generated from Arquisoft/dede_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 branch 'develop' into Despliegue
- Loading branch information
Showing
36 changed files
with
1,282 additions
and
440 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
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 |
---|---|---|
|
@@ -55,11 +55,8 @@ afterAll(async () => { | |
|
||
describe('user ', () => { | ||
it("Se puede añadir un usuario", async() =>{ | ||
var dni:String = "7178958B"; | ||
var nombre:String = "nombrePrueba"; | ||
var apellidos:String = "apellidosPrueba"; | ||
var email:String = "[email protected]"; | ||
const response:Response = await request(app).post('/usuario').send({dni:dni,nombre:nombre,apellidos:apellidos,email:email}); | ||
const response:Response = await request(app).post('/usuario').send({email:email}); | ||
expect(response.statusCode).toBe(200); | ||
expect(response.text).toEqual("Usuario añadido correctamente"); | ||
}) | ||
|
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: Seeing my orders history | ||
Scenario: The orders history has orders | ||
Given A user with some orders | ||
When I click the orders history button | ||
Then Orders must be seen |
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,74 @@ | ||
import { defineFeature, loadFeature } from 'jest-cucumber'; | ||
import puppeteer from "puppeteer"; | ||
|
||
const feature = loadFeature('./features/orders-history.feature'); | ||
|
||
let page: puppeteer.Page; | ||
let browser: puppeteer.Browser; | ||
|
||
defineFeature(feature, test => { | ||
|
||
jest.setTimeout(100000); | ||
beforeAll(async () => { | ||
|
||
browser = process.env.GITHUB_ACTIONS | ||
? await puppeteer.launch() | ||
: await puppeteer.launch({ headless: false, slowMo: 50 }); | ||
//: await puppeteer.launch({ headless: true }); | ||
page = await browser.newPage(); | ||
|
||
await page | ||
.goto("http://localhost:3000/productos", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => { }); | ||
}); | ||
test('The orders history has orders', ({ given, when, then }) => { | ||
let email: string; | ||
let password: string; | ||
|
||
given('A user with some orders', async () => { | ||
email = "[email protected]"; | ||
password = "Prueba1!"; | ||
//Iniciamos en sesión auth0 | ||
const registerButton = await page.$('button#registerButton'); | ||
await registerButton!.evaluate(a => { | ||
if (a instanceof HTMLElement) { | ||
a.click(); | ||
} | ||
}); | ||
await page.waitForNavigation(); | ||
|
||
await expect(page).toClick("a"); | ||
|
||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toClick("button[name='submit']"); | ||
await page.waitForNavigation(); | ||
|
||
}); | ||
|
||
when('I click the orders history button', async () => { | ||
|
||
await delay(1500); | ||
//Nos desplazamos a pedidos | ||
await expect(page).toClick("a[href='pedidos']"); | ||
await page.waitForNavigation(); | ||
}); | ||
|
||
then('Orders must be seen', async () => { | ||
await delay(1500); | ||
//En consecuencia, debería aparecer la palabra bakugan, ya que este usuario de prueba tenia un pedido con bakugans | ||
await expect(page).toMatch('Bakugan', {timeout:6000}) | ||
}); | ||
}) | ||
|
||
afterAll(async () => { | ||
browser.close() | ||
}) | ||
|
||
}); | ||
|
||
function delay(ms:number){ | ||
return new Promise( resolve => setTimeout(resolve, ms)); | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.