Skip to content

Commit

Permalink
Ya va el e2e de calculadora
Browse files Browse the repository at this point in the history
  • Loading branch information
iyanfdezz committed Apr 24, 2024
1 parent 1650f67 commit c89893c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions webapp/e2e/steps/play-calculator.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ defineFeature(feature, (test) => {
await jugarButton[0].click();
await page.waitForSelector('[data-testid="operation"]');

const operation = await page.evaluate(() => {
return document.querySelector('[data-testid="operation"]').textContent;
});

const answer = -1;

await page.type('[data-testid="answer-input"]', answer.toString());
Expand All @@ -59,14 +55,14 @@ defineFeature(feature, (test) => {
});

then("The game ends", async () => {
await page.waitForSelector('[data-testid="game-over"]');
await page.waitForSelector('[data-testid="play-again-button"]');

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

});

expect(gameOverMessage).toContain("¡Juego terminado!");
expect(gameOverMessage).toContain("Jugar de nuevo");
});
});

Expand Down

0 comments on commit c89893c

Please sign in to comment.