Use url contains on E2E

This commit is contained in:
Aarni Halinen
2021-01-15 19:11:51 +02:00
parent 060aebab68
commit 1517f29392
4 changed files with 7 additions and 11 deletions
+2 -3
View File
@@ -20,12 +20,11 @@ test("Logged in user can create event", async t => {
const loginForm = Selector("form.admin-login-form");
await t.expect(loginForm.exists).ok();
await doLogin(t);
await t.expect(await getPageUrl() === "/admin/events").ok();
await t.expect(await getPageUrl()).contains("/admin/events");
const newButton = Selector("[data-e2e=\"create-event\"]");
await t.click(newButton);
// await t.expect(await getPageUrl() === "/admin/events/create").ok();
console.log(await getPageUrl());
await t.expect(await getPageUrl()).contains("/admin/events/create");
const titleFi = Selector("#rjsf_title_fi");
const titleEn = Selector("#rjsf_title_en");
+2 -3
View File
@@ -14,12 +14,11 @@ test("Logged in user can create signup", async t => {
const loginForm = Selector("form.admin-login-form");
await t.expect(loginForm.exists).ok();
await doLogin(t);
await t.expect(await getPageUrl() === "/admin/signups").ok();
await t.expect(await getPageUrl()).contains("/admin/signups");
const newButton = Selector("[data-e2e=\"create-signup\"]");
await t.click(newButton);
// await t.expect(await getPageUrl() === "/admin/signups/create").ok();
console.log(await getPageUrl());
await t.expect(await getPageUrl()).contains("/admin/signups/create");
const titleFi = Selector("#rjsf_title_fi");
const titleEn = Selector("#rjsf_title_en");
+1 -1
View File
@@ -27,7 +27,7 @@ test("User can log out and is redirected to login", async t => {
*/
await t.click(Selector("#login-submit"));
const logout = Selector(`[data-e2e="admin-sidebar-logout"]`);
const logout = Selector("[data-e2e=\"admin-sidebar-logout\"]");
await t.click(logout);
const loginForm = Selector("form.admin-login-form");
+2 -4
View File
@@ -21,15 +21,13 @@ test("User signups to event from front page", async t => {
await t
.click(CardSelector.child("a"));
let url = await getPageUrl();
await t.expect(url).match(/\/events\/\d{1,4}/, "URL isn't /events/<id>");
await t.expect(await getPageUrl()).match(/\/events\/\d{1,4}/, "URL isn't /events/<id>");
const SignupButton = Selector("button");
await t
.click(SignupButton);
url = await getPageUrl();
await t.expect(url).match(/\/signup\/\d{1,4}/, "URL isn't /signup/<id>");
await t.expect(await getPageUrl()).match(/\/signup\/\d{1,4}/, "URL isn't /signup/<id>");
const nameField = Selector("input").nth(0);
const emailField = Selector("input").nth(1);