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 #112 from Arquisoft/e2e_laura
e2e tests
- Loading branch information
Showing
16 changed files
with
422 additions
and
82 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,6 @@ | ||
Feature: Register page functionality | ||
|
||
Scenario: Register | ||
Given I register a user | ||
Then I am in /menu | ||
|
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: 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 |
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,9 @@ | ||
Feature: Instructions page functionality | ||
|
||
Scenario: Instructions view is well rendered | ||
Given I am on the instructions page | ||
Then The instructions title is rendered | ||
Then The instructions content is rendered | ||
|
||
|
||
|
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,10 @@ | ||
Feature: Login page functionality | ||
|
||
Scenario: Login | ||
Given I login a user | ||
Then I am in /menu | ||
Scenario: Failed login | ||
Given I am on the login page | ||
When I try to login | ||
Then I am in /login | ||
|
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,13 @@ | ||
Feature: NavBar functionality | ||
|
||
Scenario: Displaying navbar elements correctly | ||
Given I am on the home page | ||
Then The navbar elements are visible | ||
|
||
Scenario: Changing language | ||
Given I am on the home page | ||
When I click on the language button | ||
Then The language options menu should be visible | ||
Then I choose Spanish | ||
Then The navbar should be in Spanish | ||
|
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,44 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/addUser.feature'); | ||
|
||
const { register, login, logout } = require("../utils"); | ||
|
||
let page; | ||
let browser; | ||
|
||
const email = "[email protected]"; | ||
const username = "testUserAddUser" | ||
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 }); | ||
|
||
}, 60000); | ||
|
||
|
||
test('Register', ({ given,when, then }) => { | ||
given('I register a user', async () => { | ||
await register(page, email, username, password); | ||
}); | ||
|
||
then('I am in /menu', async () => { | ||
await expect(page).toMatchElement('.divMenu'); | ||
}); | ||
}, 60000); | ||
|
||
|
||
|
||
}); |
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,63 @@ | ||
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 = "testUserCompetitiveGame" | ||
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'); | ||
}); | ||
}); | ||
|
||
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'); | ||
}); | ||
}); | ||
|
||
}); |
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,42 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/instructions.feature'); | ||
|
||
let page; | ||
let browser; | ||
|
||
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: 10000 }); | ||
}); | ||
|
||
test('Instructions view is well rendered', ({ given, then }) => { | ||
given('I am on the instructions page', async () => { | ||
await page.goto('http://localhost:3000/instructions'); | ||
await page.waitForSelector('.instructions_title'); | ||
}); | ||
|
||
then('The instructions title is rendered', async () => { | ||
await expect(page).toMatchElement('.instructions_title'); | ||
}); | ||
|
||
then('The instructions content is rendered', async () => { | ||
await expect(page).toMatchElement('.ins_ul'); | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser.close(); | ||
}); | ||
}); |
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,63 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature } = require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions; | ||
|
||
const feature = loadFeature('./features/login.feature'); | ||
|
||
const { register, login, logout } = require("../utils"); | ||
|
||
let page; | ||
let browser; | ||
|
||
const email = "[email protected]"; | ||
const username = "testUserLogin" | ||
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: 10000 }); | ||
await register(page, email, username, password); | ||
await logout(page); | ||
},60000); | ||
|
||
|
||
test('Login', ({ given, then }) => { | ||
given('I login a user', async () => { | ||
await login(page, username, password); | ||
|
||
}); | ||
then('I am in /menu', async () => { | ||
await expect(page).toMatchElement('.divMenu'); | ||
await logout(page); | ||
}); | ||
}, 60000); | ||
|
||
test('Failed login', ({ given,when, then }) => { | ||
given('I am on the login page', async () => { | ||
await page.goto('http://localhost:3000/login'); | ||
}); | ||
when('I try to login', async () => { | ||
await page.goto('http://localhost:3000/login'); | ||
await page.waitForSelector('.general'); | ||
|
||
await page.type('input[type="text"]', 'lau'); | ||
await page.type('input[type="password"]', '123'); | ||
await page.click('button[type="submit"]'); | ||
}); | ||
then('I am in /login', async () => { | ||
await expect(page).toMatchElement('.title-login'); | ||
}, 60000); | ||
}); | ||
|
||
|
||
|
||
}); |
Oops, something went wrong.