Skip to content

Commit

Permalink
Merge branch 'e2e-fixes' of https://github.com/Arquisoft/wiq_es1a int…
Browse files Browse the repository at this point in the history
…o e2e-fixes
  • Loading branch information
iyanfdezz committed Apr 26, 2024
2 parents 10a995d + 9df946f commit f69599c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions webapp/e2e/steps/create-group.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

});
});
Expand Down
18 changes: 11 additions & 7 deletions webapp/e2e/steps/logout.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
7 changes: 5 additions & 2 deletions webapp/e2e/steps/play-battery.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ defineFeature(feature, (test) => {
let firstquestion;
test("The user can answer a question on Battery mode", ({ given, when, then }) => {
given("A logged-in user", async () => {
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")]');
Expand All @@ -84,8 +89,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 =>
Expand Down

0 comments on commit f69599c

Please sign in to comment.