Skip to content

Commit

Permalink
Added gameMenu tests to e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
uo289267 committed Apr 18, 2024
1 parent 50b0781 commit 8c0b47f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webapp/e2e/features/gameMenu.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
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
36 changes: 36 additions & 0 deletions webapp/e2e/steps/gameMenu.steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const puppeteer = require('puppeteer');
const { defineFeature, loadFeature } = require('jest-cucumber');
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions;

const feature = loadFeature('./features/gameMenu.feature');

let page;
let browser;

defineFeature(feature, test => {

beforeAll(async () => {
browser = await puppeteer.launch({
slowMo: 20,
defaultViewport: { width: 1920, height: 1080 },
args: ['--window-size=1920,1080']
});

page = await browser.newPage();
setDefaultOptions({ timeout: 10000 });
});

test('There should be visible three links', ({ given, then }) => {
given('I am on the the game menu', async () => {
await page.goto('http://localhost:3000/menu');
await page.waitForSelector('.divMenu');
});

then('Then three buttons should be visible', async () => {
//await expect(page).toMatchElement('.linkButton');
const elements = await page.$$('.linkButton');
expect(elements.length).toBeGreaterThan(0); // At least one element with class 'linkButton'
});
});

});

0 comments on commit 8c0b47f

Please sign in to comment.