Skip to content

Commit

Permalink
Merge pull request #128 from Arquisoft/99-e2e-testing
Browse files Browse the repository at this point in the history
fixed flaky
  • Loading branch information
Mister-Mario authored Apr 25, 2024
2 parents e3c459d + d184f34 commit 680c2d0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions webapp/e2e/features/competitiveGame.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ Feature: Game Configurator and Competitive Game functionality
Scenario: Create Competitive Game should go to /questions
Given I am on the game configurator
When I click on new competitive game
Then I am in /questions
Scenario: Create Customized Game should go to /questions
Given I am on the game configurator
When I click on new customized game
Then I am in /questions
17 changes: 15 additions & 2 deletions webapp/e2e/steps/competitiveGame.steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const { register, login, logout } = require("../utils");
let page;
let browser;

const email = "testUser@example.com";
const username = "testUser"
const email = "testUser1@example.com";
const username = "testUser1"
const password = "testUserPassword"

defineFeature(feature, test => {
Expand Down Expand Up @@ -46,5 +46,18 @@ defineFeature(feature, test => {
await expect(page).toMatchElement('.questionContainer');
});
});

test('Create Customized Game should go to /questions', ({ given,when, then }) => {
given('I am on the game configurator', async () => {
await page.goto('http://localhost:3000/configurator');
await page.waitForSelector('.GameConfiguratorDiv');
});
when('I click on new customized game', async () => {
await page.click('.linkButton');
});
then('I am in /questions', async () => {
await expect(page).toMatchElement('.questionContainer');
});
});

});
2 changes: 1 addition & 1 deletion webapp/src/components/GameConfigurator/GameConfigurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function ButtonRandomizeCustom({t,handleClick}){

function ButtonCustomized({t,handleClick}) {
return (
<button className="linkButton" onClick={handleClick}>{t("gameConfigurator.play_custom")}</button>
<button className="linkButton" id="customized" onClick={handleClick}>{t("gameConfigurator.play_custom")}</button>
);
}

Expand Down

0 comments on commit 680c2d0

Please sign in to comment.