forked from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
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/pablo
Documentacion pruebas de carga
- Loading branch information
Showing
12 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
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,11 @@ | ||
Feature: Visible user logged history | ||
|
||
Scenario: The user is not loged in the site | ||
Given A not loged user | ||
When Press history | ||
Then Redirected to login | ||
|
||
Scenario: The user register in the site so he can see history | ||
Given A unregistered user, fill the register | ||
When I press history | ||
Then I see my history |
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,85 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature }=require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions | ||
const feature = loadFeature('./features/historial-form.feature'); | ||
|
||
let page; | ||
let browser; | ||
|
||
defineFeature(feature, test => { | ||
|
||
let username = ""; | ||
let password = ""; | ||
|
||
beforeAll(async () => { | ||
browser = process.env.GITHUB_ACTIONS | ||
? await puppeteer.launch() | ||
: await puppeteer.launch({ headless: false, slowMo: 100 }); | ||
page = await browser.newPage(); | ||
//Way of setting up the timeout | ||
setDefaultOptions({ timeout: 10000 }) | ||
|
||
await page | ||
.goto("http://localhost:3000/", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
}); | ||
|
||
test('The user is not logged in the site', ({given,when,then}) => { | ||
|
||
given('A not logged user', async () => { | ||
username = "pablo"; | ||
password = "12345"; | ||
}); | ||
|
||
when('Press history', async () => { | ||
await page.goto("http://localhost:3000/getgamehistory", { | ||
waitUntil: "networkidle0", | ||
}).catch(() => {}); | ||
}); | ||
|
||
then('Redirected to login', async () => { | ||
await expect(page).toMatchElement('button[title="entrar"]'); | ||
}); | ||
},300000); | ||
|
||
|
||
test('The user is not registered in the site', ({given,when,then}) => { | ||
|
||
|
||
given('A unregistered user, fill the register', async () => { | ||
await page.goto("http://localhost:3000/sign-up", { | ||
waitUntil: "networkidle0", | ||
}).catch(() => {}); | ||
//Registrar al user | ||
await expect(page).toFill('input[name="username"]', username); | ||
await expect(page).toFill('input[name="password"]', password); | ||
await expect(page).toClick('button[name="registrarsePage"]'); | ||
await page.waitForNavigation({ | ||
waitUntil: 'networkidle0' | ||
}); | ||
}); | ||
|
||
when('I fill the data in the form and press submit', async () => { | ||
await page.waitForSelector('[data-testid="historial-user"]', { | ||
visible: true, | ||
}); | ||
await page.click('[data-testid="historial-user"]'); | ||
}); | ||
|
||
then('I see my history', async () => { | ||
await expect(page).toMatchElement('th', { text: 'Fecha'}); | ||
await expect(page).toMatchElement('th', { text: 'Tiempo de partida'}); | ||
await expect(page).toMatchElement('th', { text: 'Porcentaje de aciertos'}); | ||
await expect(page).toMatchElement('th', { text: 'Número de preguntas'}); | ||
await expect(page).toMatchElement('th', { text: 'Número de aciertos'}); | ||
await expect(page).toMatchElement('th', { text: 'Número de fallos'}); | ||
}); | ||
},300000); | ||
|
||
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