generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Arquisoft/99-e2e-testing
99 e2e testing
- Loading branch information
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/competitiveGame.feature'); | ||
|
||
const { register, login, logout } = require("../utils"); | ||
|
||
let page; | ||
let browser; | ||
|
||
const email = "[email protected]"; | ||
const username = "testUser" | ||
const password = "testUserPassword" | ||
|
||
defineFeature(feature, test => { | ||
|
||
beforeAll(async () => { | ||
browser = await puppeteer.launch({ | ||
headless: "new", | ||
slowMo: 40, | ||
defaultViewport: { width: 1920, height: 1080 }, | ||
args: ['--window-size=1920,1080'] | ||
}); | ||
|
||
page = await browser.newPage(); | ||
setDefaultOptions({ timeout: 30000 }); | ||
|
||
await register(page, email, username, password); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await logout(page); | ||
await login(page, username, password); | ||
}) | ||
|
||
test('Create Competitive 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 competitive game', async () => { | ||
await page.click('#competitive'); | ||
}); | ||
then('I am in /questions', async () => { | ||
await expect(page).toMatchElement('.questionContainer'); | ||
}); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters