From 504232b43559917d8e2d40a4bfe11b3c8427cd6a Mon Sep 17 00:00:00 2001 From: uo289267 Date: Sat, 20 Apr 2024 19:18:02 +0200 Subject: [PATCH] Added e2e test --- webapp/e2e/features/gameMenu.feature | 4 ++++ webapp/e2e/steps/gameMenu.steps.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/webapp/e2e/features/gameMenu.feature b/webapp/e2e/features/gameMenu.feature index 3953d899..a156fbbc 100644 --- a/webapp/e2e/features/gameMenu.feature +++ b/webapp/e2e/features/gameMenu.feature @@ -2,3 +2,7 @@ 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 + 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 diff --git a/webapp/e2e/steps/gameMenu.steps.js b/webapp/e2e/steps/gameMenu.steps.js index 2f66b817..cc4230c2 100644 --- a/webapp/e2e/steps/gameMenu.steps.js +++ b/webapp/e2e/steps/gameMenu.steps.js @@ -32,5 +32,17 @@ defineFeature(feature, test => { expect(elements.length).toBeGreaterThan(0); // At least one element with class 'linkButton' }); }); + test('New Game should go to game configurator', ({ 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 New Game', async () => { + await page.click('.linkButton:first-child'); + }); + then('I should be in the game configurator', async () => { + await expect(page).toMatchElement('.GameConfiguratorDiv'); + }); + }); });