From e4f5af1dc7b23a4c57d7c1b7dd7ec4fc6054581c Mon Sep 17 00:00:00 2001 From: uo289267 Date: Sat, 27 Apr 2024 14:20:32 +0200 Subject: [PATCH] Added more e2e gameMenu --- webapp/e2e/features/gameMenu.feature | 12 ++++++++-- webapp/e2e/steps/gameMenu.steps.js | 24 +++++++++++++++++++ webapp/e2e/steps/questionGame.steps.js | 2 +- webapp/src/components/GameMenu/GameMenu.js | 4 ++-- .../HistoricalData/ButtonHistoricalData.js | 2 +- 5 files changed, 38 insertions(+), 6 deletions(-) diff --git a/webapp/e2e/features/gameMenu.feature b/webapp/e2e/features/gameMenu.feature index a156fbbc..7006928d 100644 --- a/webapp/e2e/features/gameMenu.feature +++ b/webapp/e2e/features/gameMenu.feature @@ -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 \ No newline at end of file diff --git a/webapp/e2e/steps/gameMenu.steps.js b/webapp/e2e/steps/gameMenu.steps.js index 9d00a32d..a54bfff1 100644 --- a/webapp/e2e/steps/gameMenu.steps.js +++ b/webapp/e2e/steps/gameMenu.steps.js @@ -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'); + }); + }); }); diff --git a/webapp/e2e/steps/questionGame.steps.js b/webapp/e2e/steps/questionGame.steps.js index 9630561c..ffb5cbe2 100644 --- a/webapp/e2e/steps/questionGame.steps.js +++ b/webapp/e2e/steps/questionGame.steps.js @@ -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'] diff --git a/webapp/src/components/GameMenu/GameMenu.js b/webapp/src/components/GameMenu/GameMenu.js index 70ef4d0e..6cd6305f 100644 --- a/webapp/src/components/GameMenu/GameMenu.js +++ b/webapp/src/components/GameMenu/GameMenu.js @@ -22,7 +22,7 @@ export default function GameMenu() { function ButtonNewGame({ t }) { return ( - +

{t("gameMenu.new_game_button")}

); @@ -30,7 +30,7 @@ export default function GameMenu() { function ButtonRanking({ t }) { return ( - +

{t("gameMenu.view_ranking")}

diff --git a/webapp/src/components/HistoricalData/ButtonHistoricalData.js b/webapp/src/components/HistoricalData/ButtonHistoricalData.js index 3567146e..303d0e6f 100644 --- a/webapp/src/components/HistoricalData/ButtonHistoricalData.js +++ b/webapp/src/components/HistoricalData/ButtonHistoricalData.js @@ -1,7 +1,7 @@ import { Link } from "react-router-dom"; export default function ButtonHistoricalData({ t }) { return ( - +

{t("gameMenu.history_button")}

);