forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #195 from Arquisoft/monitor
Endpoint_usage, e2e tests and i18n files updated
- Loading branch information
Showing
21 changed files
with
1,082 additions
and
42 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
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
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,10 @@ | ||
Feature: Add friend | ||
|
||
Scenario: The user is going to add a friend | ||
Given An unregistered user | ||
When I fill the data in the form, press submit, press Friends and adds a friend | ||
Then The friend will be added | ||
Scenario: The user is going to remove a friend | ||
Given A registered user with one friend | ||
When I am in Friends page and select the friend to remove | ||
Then The friend will be removed from the user's friend list |
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: Login | ||
|
||
Scenario: Login | ||
Given A registered user | ||
When I fill the data in the form, press submit | ||
Then The user must be logged |
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: Play Classic Mode | ||
|
||
Scenario: The user is going to play classic mode | ||
Given An unregistered user | ||
When I fill the data in the form, press submit, press Classic Mode button and play game | ||
Then A Game Over message should be shown in the screen |
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,87 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature }=require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions | ||
const feature = loadFeature('./features/friends.feature'); | ||
|
||
let page; | ||
let browser; | ||
|
||
defineFeature(feature, test => { | ||
|
||
beforeAll(async () => { | ||
browser = process.env.GITHUB_ACTIONS | ||
? await puppeteer.launch() | ||
: await puppeteer.launch({ headless: false, slowMo: 50 }); | ||
page = await browser.newPage(); | ||
//Way of setting up the timeout | ||
setDefaultOptions({ timeout: 10000 }) | ||
await page.setViewport({ width: 1080, height: 980 }); | ||
|
||
await page | ||
.goto("http://localhost:3000", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
|
||
}); | ||
|
||
test('The user is going to add a friend', ({given,when,then}) => { | ||
|
||
let username; | ||
let password; | ||
|
||
given('An unregistered user', async () => { | ||
username = "add-friend-user" | ||
password = "defaultpassword" | ||
await expect(page).toClick("button", { text: "Don't have an account? Register here." }); | ||
}); | ||
|
||
when('I fill the data in the form, press submit, press Friends and adds a friend', async () => { | ||
await page.waitForSelector('input[name="username"]'); | ||
await expect(page).toFill('input[name="username"]', username); | ||
|
||
await page.waitForSelector('input[name="password"]'); | ||
await expect(page).toFill('input[name="password"]', password); | ||
|
||
await page.waitForSelector('input[name="confirmPassword"]'); | ||
await expect(page).toFill('input[name="confirmPassword"]', password); | ||
|
||
await page.waitForSelector('button.btn'); | ||
await expect(page).toClick('button.btn', { text: '' }); | ||
|
||
await page.waitForSelector('div a'); | ||
await expect(page).toClick('div a', { text: 'Friends' }); | ||
|
||
await page.waitForSelector('.searchForm input'); | ||
await expect(page).toFill('.searchForm input', 'defaultuser'); | ||
|
||
await page.waitForSelector('button.btn'); | ||
await expect(page).toClick('button.btn', { text: '' }); | ||
|
||
}); | ||
|
||
then('The friend will be added', async () => { | ||
await expect(page).toMatchElement('.tableFriends', { text: 'defaultuser' }); | ||
}); | ||
}) | ||
test('The user is going to remove a friend', ({given,when,then}) => { | ||
|
||
given('A registered user with one friend', async () => { | ||
}); | ||
|
||
when('I am in Friends page and select the friend to remove', async () => { | ||
await page.waitForSelector('.tableFriends button.btn'); | ||
await expect(page).toClick('.tableFriends button.btn', { text: 'Delete friend' }); | ||
|
||
}); | ||
|
||
then("The friend will be removed from the user's friend list", async () => { | ||
await expect(page).not.toMatchElement('.tableFriends', { text: 'defaultuser' }); | ||
}); | ||
}) | ||
|
||
afterAll(async ()=>{ | ||
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
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,58 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature }=require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions | ||
const feature = loadFeature('./features/login.feature'); | ||
|
||
let page; | ||
let browser; | ||
|
||
defineFeature(feature, test => { | ||
|
||
beforeAll(async () => { | ||
browser = process.env.GITHUB_ACTIONS | ||
? await puppeteer.launch() | ||
: await puppeteer.launch({ headless: false, slowMo: 50 }); | ||
page = await browser.newPage(); | ||
//Way of setting up the timeout | ||
setDefaultOptions({ timeout: 10000 }) | ||
|
||
await page | ||
.goto("http://localhost:3000", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
|
||
|
||
}); | ||
|
||
test('Login', ({given,when,then}) => { | ||
|
||
let username; | ||
let password; | ||
|
||
given('A registered user', async () => { | ||
username = "defaultuser" | ||
password = "defaultpassword" | ||
}); | ||
|
||
when('I fill the data in the form, press submit', async () => { | ||
await expect(page).toFill('input[name="username"]', username); | ||
await expect(page).toFill('input[name="password"]', password); | ||
expect(page).toClick('button.btn', { text: '' }) | ||
|
||
|
||
|
||
}); | ||
then('The user must be logged', async () => { | ||
await page.waitForFunction(() => localStorage.getItem('sessionData') !== null); | ||
const sessionData = await page.evaluate(() => localStorage.getItem('sessionData')); | ||
expect(sessionData).toContain('token'); | ||
|
||
}) | ||
}); | ||
|
||
afterAll(async ()=>{ | ||
browser.close() | ||
}) | ||
|
||
}); |
Oops, something went wrong.