Skip to content

Commit

Permalink
Added more e2e gameMenu
Browse files Browse the repository at this point in the history
  • Loading branch information
uo289267 committed Apr 27, 2024
1 parent 47ef32e commit e4f5af1
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
12 changes: 10 additions & 2 deletions webapp/e2e/features/gameMenu.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Feature: Game Menu page functionality
Scenario: There should be visible three links
Given I am on the game menu
Then three buttons should be visible
Given I am on the game menu
Then three buttons should be visible
Scenario: New Game should go to game configurator
Given I am on the game menu
When I click on New Game
Then I should be in the game configurator
Scenario: Ranking should go to ranking view
Given I am on the game menu
When I click on Ranking
Then I should be in the ranking
Scenario: View Historical Data should go to historical data
Given I am on the game menu
When I click on View Historical Data
Then I should be in the historical data
24 changes: 24 additions & 0 deletions webapp/e2e/steps/gameMenu.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,29 @@ defineFeature(feature, test => {
await expect(page).toMatchElement('.GameConfiguratorDiv');
});
});
test('Ranking should go to ranking view', ({ given, when, then }) => {
given('I am on the game menu', async () => {
await page.goto('http://localhost:3000/menu');
await page.waitForSelector('.divMenu');
});
when('I click on Ranking', async () => {
await page.click('#ranking');
});
then('I should be in the ranking', async () => {
await expect(page).toMatchElement('.table');
});
});
test('View Historical Data should go to historical data', ({ given, when, then }) => {
given('I am on the game menu', async () => {
await page.goto('http://localhost:3000/menu');
await page.waitForSelector('.divMenu');
});
when('I click on View Historical Data', async () => {
await page.click('#historical');
});
then('I should be in the historical data', async () => {
await expect(page).toMatchElement('.globalHistoricalView');
});
});

});
2 changes: 1 addition & 1 deletion webapp/e2e/steps/questionGame.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defineFeature(feature, test => {

beforeAll(async () => {
browser = await puppeteer.launch({
headless: false,
headless: "new",
slowMo: 20,
defaultViewport: { width: 1920, height: 1080 },
args: ['--window-size=1920,1080']
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/components/GameMenu/GameMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export default function GameMenu() {

function ButtonNewGame({ t }) {
return (
<Link className="linkButton" to="/configurator">
<Link className="linkButton" to="/configurator">
<h3>{t("gameMenu.new_game_button")}</h3>
</Link>
);
}

function ButtonRanking({ t }) {
return (
<Link className="linkButton" to="/ranking">
<Link className="linkButton" id="ranking" to="/ranking">
<h3>{t("gameMenu.view_ranking")}</h3>

</Link>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from "react-router-dom";
export default function ButtonHistoricalData({ t }) {
return (
<Link className="linkButton" to="/historical">
<Link className="linkButton" id="historical" to="/historical">
<h3>{t("gameMenu.history_button")}</h3>
</Link>
);
Expand Down

0 comments on commit e4f5af1

Please sign in to comment.