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 #135 from Arquisoft/99-e2e-testing
99 e2e testing
- Loading branch information
Showing
11 changed files
with
350 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -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 |
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,29 @@ | ||
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 | ||
Scenario: Create Customized Game of Capital questions | ||
Given I am on the game configurator | ||
When I click select Capital and I create a new customized game | ||
Then I get Capital questions | ||
Scenario: Create Customized Game of Language questions | ||
Given I am on the game configurator | ||
When I click select Language and I create a new customized game | ||
Then I get Language questions | ||
Scenario: Create Customized Game of Population questions | ||
Given I am on the game configurator | ||
When I click select Population and I create a new customized game | ||
Then I get Population questions | ||
Scenario: Create Customized Game of Size questions | ||
Given I am on the game configurator | ||
When I click select Size and I create a new customized game | ||
Then I get Size questions | ||
Scenario: Create Customized Game of Head of Goverment questions | ||
Given I am on the game configurator | ||
When I click select Head of Goverment and I create a new customized game | ||
Then I get Head of Goverment 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,9 @@ | ||
Feature: Question View answers | ||
Scenario: Create Competitive Game and reveal correct answer color | ||
Given I am on the game configurator and create a competitive game | ||
When I let the counter end | ||
Then Correct Color appears | ||
Scenario: Create Competitive Game and reveal wrong answer colors | ||
Given I am on the game configurator and create a competitive game | ||
When I let the counter end | ||
Then Incorrect Color appears |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/questionGame.feature'); | ||
|
||
const { register, login, logout } = require("../utils"); | ||
|
||
let page; | ||
let browser; | ||
|
||
const email = "[email protected]"; | ||
const username = "testUser1" | ||
const password = "testUserPassword" | ||
|
||
defineFeature(feature, test => { | ||
|
||
beforeAll(async () => { | ||
browser = await puppeteer.launch({ | ||
headless: "new", | ||
slowMo: 20, | ||
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'); | ||
}); | ||
}); | ||
|
||
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'); | ||
}); | ||
}); | ||
|
||
test('Create Customized Game of Capital 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 select Capital and I create a new customized game', async () => { | ||
await page.select('#select', 'CAPITAL'); | ||
await page.click('.linkButton');//click on capital | ||
}); | ||
then('I get Capital questions', async () => { | ||
//await expect(page).toMatchElement('.topPanel'); | ||
const questionContainer = await page.$('.topPanel'); | ||
const questionText = await page.evaluate(questionContainer => questionContainer.textContent, questionContainer); | ||
const containsCapital = /Capital/i.test(questionText); | ||
expect(containsCapital).toBe(true); | ||
}); | ||
}); | ||
|
||
test('Create Customized Game of Language 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 select Language and I create a new customized game', async () => { | ||
await page.select('#select', 'LANGUAGE'); | ||
await page.click('.linkButton'); | ||
}); | ||
then('I get Language questions', async () => { | ||
//await expect(page).toMatchElement('.topPanel'); | ||
const questionContainer = await page.$('.topPanel'); | ||
const questionText = await page.evaluate(questionContainer => questionContainer.textContent, questionContainer); | ||
const containsCapital = /Language/i.test(questionText); | ||
expect(containsCapital).toBe(true); | ||
}); | ||
}); | ||
test('Create Customized Game of Population 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 select Population and I create a new customized game', async () => { | ||
await page.select('#select', 'POPULATION'); | ||
await page.click('.linkButton'); | ||
}); | ||
then('I get Population questions', async () => { | ||
//await expect(page).toMatchElement('.topPanel'); | ||
const questionContainer = await page.$('.topPanel'); | ||
const questionText = await page.evaluate(questionContainer => questionContainer.textContent, questionContainer); | ||
const containsCapital = /Population/i.test(questionText); | ||
expect(containsCapital).toBe(true); | ||
}); | ||
}); | ||
test('Create Customized Game of Size 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 select Size and I create a new customized game', async () => { | ||
await page.select('#select', 'SIZE'); | ||
await page.click('.linkButton'); | ||
}); | ||
then('I get Size questions', async () => { | ||
//await expect(page).toMatchElement('.topPanel'); | ||
const questionContainer = await page.$('.topPanel'); | ||
const questionText = await page.evaluate(questionContainer => questionContainer.textContent, questionContainer); | ||
const containsCapital = /Size/i.test(questionText); | ||
expect(containsCapital).toBe(true); | ||
}); | ||
}); | ||
test('Create Customized Game of Head of Goverment 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 select Head of Goverment and I create a new customized game', async () => { | ||
await page.select('#select', 'HEAD_OF_GOVERMENT'); | ||
await page.click('.linkButton'); | ||
}); | ||
then('I get Head of Goverment questions', async () => { | ||
//await expect(page).toMatchElement('.topPanel'); | ||
const questionContainer = await page.$('.topPanel'); | ||
const questionText = await page.evaluate(questionContainer => questionContainer.textContent, questionContainer); | ||
const containsCapital = /Head of Goverment/i.test(questionText); | ||
expect(containsCapital).toBe(true); | ||
}); | ||
}); | ||
|
||
}); |
Oops, something went wrong.