Skip to content

Commit

Permalink
Añadido evaluate
Browse files Browse the repository at this point in the history
  • Loading branch information
CANCI0 committed Apr 26, 2024
1 parent dcfcd88 commit baf6174
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 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
11 changes: 6 additions & 5 deletions webapp/e2e/steps/play-battery.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")]');
Expand All @@ -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 =>
Expand Down

0 comments on commit baf6174

Please sign in to comment.