diff --git a/webapp/e2e/steps/create-group.steps.js b/webapp/e2e/steps/create-group.steps.js index 341c8754..e7159b7d 100644 --- a/webapp/e2e/steps/create-group.steps.js +++ b/webapp/e2e/steps/create-group.steps.js @@ -92,8 +92,8 @@ defineFeature(feature, (test) => { const alertElement = document.querySelector('div[role="alert"]'); return alertElement.innerText.trim(); }); - const rightMessage=alertText === "Group created successfully"; - expect(rightMessage).toBe(true); + const rightMessage = "Group created successfully"; + expect(rightMessage).toBe(alertText); }); }); diff --git a/webapp/e2e/steps/logout.steps.js b/webapp/e2e/steps/logout.steps.js index 14f90762..90ec4c45 100644 --- a/webapp/e2e/steps/logout.steps.js +++ b/webapp/e2e/steps/logout.steps.js @@ -75,13 +75,17 @@ defineFeature(feature, (test) => { test("The user can logout", ({ given, when, then }) => { given("A logged-in user", async () => { - username = "testuser"; - password = "Testpassword1"; - await page.waitForSelector("#login-username"); - await page.type("#login-username", username); - await page.waitForSelector("#login-password"); - await page.type("#login-password", password); - await page.click("button", { text: "Login" }); + await page.evaluate(() => { + localStorage.clear(); + localStorage.setItem("username","testuser"); + localStorage.setItem("token","abcdefg"); + }); + + await page + .goto("http://localhost:3000/home", { + waitUntil: "networkidle0", + }) + .catch(() => {}); }); when("I click on the Logout link", async () => { diff --git a/webapp/e2e/steps/play-battery.steps.js b/webapp/e2e/steps/play-battery.steps.js index 40cbb338..cbf86306 100644 --- a/webapp/e2e/steps/play-battery.steps.js +++ b/webapp/e2e/steps/play-battery.steps.js @@ -59,9 +59,12 @@ defineFeature(feature, (test) => { let firstquestion; test("The user can answer a question on Battery mode", ({ given, when, then }) => { given("A logged-in user", async () => { - localStorage.setItem("username","testuser"); - localStorage.setItem("token","abcdefg"); - + await page.evaluate(() => { + localStorage.clear(); + localStorage.setItem("username","testuser"); + localStorage.setItem("token","abcdefg"); + }); + await page.waitForTimeout(1000); await page.waitForXPath('//button[contains(text(), "BaterĂ­a de sabios")]'); const button = await page.$x('//button[contains(text(), "BaterĂ­a de sabios")]'); @@ -76,8 +79,6 @@ defineFeature(feature, (test) => { }); when("I play on Battery mode and click on an answer", async () => { - - await page.waitForSelector('[data-testid="question"]'); firstquestion = await page.evaluate(element =>