Skip to content

Commit

Permalink
Ya va el e2e de classic
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 24, 2024
1 parent 3a28848 commit 1650f67
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 103 deletions.
6 changes: 0 additions & 6 deletions webapp/e2e/features/ranking-sorting.feature

This file was deleted.

6 changes: 0 additions & 6 deletions webapp/e2e/features/ranking.feature

This file was deleted.

6 changes: 0 additions & 6 deletions webapp/e2e/features/stats.feature

This file was deleted.

6 changes: 0 additions & 6 deletions webapp/e2e/features/users-addfriend.feature

This file was deleted.

71 changes: 0 additions & 71 deletions webapp/e2e/steps/creategroup.steps.js

This file was deleted.

1 change: 1 addition & 0 deletions webapp/e2e/steps/logout.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ defineFeature(feature, (test) => {
});

when("I click on the Logout link", async () => {
await page.waitForTimeout(1000);
await page.waitForSelector('[data-testid="logout-link"]');
await page.click('[data-testid="logout-link"]');
await page.waitForNavigation({ waitUntil: "networkidle0" });
Expand Down
16 changes: 12 additions & 4 deletions webapp/e2e/steps/play-calculator.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,20 @@ defineFeature(feature, (test) => {
await page.waitForSelector("#login-password");
await page.type("#login-password", password);
await page.click("button", { text: "Login" });
await page.waitForNavigation({ waitUntil: "networkidle0" });

//await page.waitForNavigation({ waitUntil: "networkidle0" });
});

when("I play on Human Calculator mode and answer incorrectly", async () => {
await page.click('[data-testid="calculator"]');
await page.waitForNavigation({ waitUntil: "networkidle0" });
await page.waitForTimeout(1000);
await page.waitForXPath('//button[contains(text(), "Calculadora humana")]');
const button = await page.$x('//button[contains(text(), "Calculadora humana")]');
await button[0].click();
//await page.waitForNavigation({ waitUntil: "networkidle0" });

await page.waitForXPath('//section[contains(@class, "chakra-modal__content")]//button[contains(text(), "Jugar")]');
const jugarButton = await page.$x('//section[contains(@class, "chakra-modal__content")]//button[contains(text(), "Jugar")]');
await jugarButton[0].click();
await page.waitForSelector('[data-testid="operation"]');

const operation = await page.evaluate(() => {
Expand All @@ -55,7 +62,8 @@ defineFeature(feature, (test) => {
await page.waitForSelector('[data-testid="game-over"]');

const gameOverMessage = await page.evaluate(() => {
return document.querySelector('[data-testid="game-over"]').textContent;
return document.querySelector('h2:contains("¡Juego terminado!")');

});

expect(gameOverMessage).toContain("¡Juego terminado!");
Expand Down
15 changes: 11 additions & 4 deletions webapp/e2e/steps/play-classic.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ defineFeature(feature, (test) => {
await page.waitForSelector("#login-password");
await page.type("#login-password", password);
await page.click("button", { text: "Login" });
await page.waitForNavigation({ waitUntil: "networkidle0" });
//await page.waitForNavigation({ waitUntil: "networkidle0" });
});

when("I play on Classic mode and click on an answer", async () => {
await page.click('[data-testid="classic"]');
await page.waitForNavigation({ waitUntil: "networkidle0" });
await page.waitForTimeout(1000);
await page.waitForXPath('//button[contains(text(), "Clásico")]');
const classicButton = await page.$x('//button[contains(text(), "Clásico")]');
await classicButton[0].click();
//await page.waitForNavigation({ waitUntil: "networkidle0" });

await page.waitForXPath('//section[contains(@class, "chakra-modal__content")]//button[contains(text(), "Jugar")]');
const jugarButton = await page.$x('//section[contains(@class, "chakra-modal__content")]//button[contains(text(), "Jugar")]');
await jugarButton[0].click();

await page.waitForSelector('[data-testid="question"]');

Expand All @@ -53,7 +60,7 @@ defineFeature(feature, (test) => {
const buttonColor = await button.evaluate((el) => {
return window.getComputedStyle(el).getPropertyValue("background-color");
});
if (buttonColor === "rgb(16, 255, 0)") {
if (buttonColor.includes("rgb(44, 122, 123)")) {
isGreen = true;
break;
}
Expand Down

0 comments on commit 1650f67

Please sign in to comment.