generated from Arquisoft/dede_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 #203 from Arquisoft/Adrian-Develop
Test End2End (Registro, Login y Perfil de usuario) y Hotfixes añadidos
- Loading branch information
Showing
8 changed files
with
336 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Feature: Seeing orders history of a user | ||
|
||
Scenario: Orders of user "admin" | ||
Given Registered user admin | ||
When Log In and click on my profile | ||
Then I should see my orders |
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 |
---|---|---|
|
@@ -48,4 +48,49 @@ defineFeature(feature, test => { | |
}); | ||
}); | ||
|
||
test("User Login", ({given,when,then}) => { | ||
let email:string | ||
let password:string | ||
|
||
given("Blank Email and password of a user", () => { | ||
email = " " | ||
password = "admin" | ||
}); | ||
|
||
when("I click in Iniciar Sesion", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/login']"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toClick('button', { text: 'Iniciar Sesión' }); | ||
}); | ||
|
||
then("Warning below email", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("User Login", ({given,when,then}) => { | ||
let email:string | ||
let password:string | ||
|
||
given("Email and blank password of a user", () => { | ||
email = "[email protected]" | ||
password = " " | ||
}); | ||
|
||
when("I click in Iniciar Sesion", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/login']"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toClick('button', { text: 'Iniciar Sesión' }); | ||
}); | ||
|
||
then("Warning below password", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
|
||
}); |
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,56 @@ | ||
import { defineFeature, loadFeature } from 'jest-cucumber'; | ||
import puppeteer from "puppeteer"; | ||
|
||
const feature = loadFeature('./features/login.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: true, slowMo:100}); //false to run tests locally | ||
page = await browser.newPage(); | ||
|
||
await page | ||
.goto("http://localhost:3000", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
}); | ||
|
||
test("Orders in profile", ({given,when,then}) => { | ||
let email:string | ||
let password:string | ||
|
||
given("Admin session", () => { | ||
email = "[email protected]" | ||
password = "admin" | ||
}); | ||
|
||
when("I click in Iniciar Sesion", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/login']"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toClick('button', { text: 'Iniciar Sesión' }); | ||
await page.waitForNavigation() | ||
await page.waitForTimeout(2000); | ||
await expect(page).toMatch("Yeso"); | ||
await expect(page).toClick("a[href='/orders']"); | ||
|
||
|
||
}); | ||
|
||
then("I should see admin order's history", async () => { | ||
await page.waitForNavigation() | ||
await page.waitForTimeout(2000); | ||
await expect(page).toMatch("Cuarcita"); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -54,7 +54,199 @@ defineFeature(feature, test => { | |
then("I should be redirected to the login page", async () => { | ||
await page.waitForNavigation() | ||
await page.waitForTimeout(2000); | ||
await expect(page).toMatch("Entrar en Sesión"); | ||
await expect(page).toMatch("Iniciar Sesión"); | ||
}); | ||
}); | ||
test("User Register blank email", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Name, Dni, Password and confirmPassword of a user", () => { | ||
email = "" | ||
name = "Adri" | ||
dni = "12345678" | ||
password = "adri" | ||
confirmPassword = "adri" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below email", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("User Register blank name", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Email, Dni, Password and confirmPassword of a user", () => { | ||
email = "[email protected]" | ||
name = "" | ||
dni = "12345678" | ||
password = "adri" | ||
confirmPassword = "adri" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below name", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("User Register blank dni", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Email, Name, Password and confirmPassword of a user", () => { | ||
email = "[email protected]" | ||
name = "Adri" | ||
dni = "" | ||
password = "adri" | ||
confirmPassword = "adri" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below dni", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("User Register blank password", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Email, Name, Dni and confirmPassword of a user", () => { | ||
email = "[email protected]" | ||
name = "Adri" | ||
dni = "123456" | ||
password = "" | ||
confirmPassword = "adri" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below password", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("User Register blank confirm password", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Email, Name, Dni Password of a user", () => { | ||
email = "[email protected]" | ||
name = "Adri" | ||
dni = "123456" | ||
password = "adri" | ||
confirmPassword = "" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below confirmPassword", async () => { | ||
await expect(page).toMatch("El campo no puede estar vacio"); | ||
}); | ||
}); | ||
test("Confirm Password and Password don't match", ({given,when,then}) => { | ||
let email:string | ||
let name:string | ||
let dni:string | ||
let password:string | ||
let confirmPassword:string | ||
|
||
given("Email, Name, Dni Password of a user", () => { | ||
email = "[email protected]" | ||
name = "Adri" | ||
dni = "123456" | ||
password = "adri" | ||
confirmPassword = "manuel" | ||
}); | ||
|
||
when("I click in Regístrate", async () => { | ||
await page.setViewport({ width: 1200, height: 1300 }); | ||
await expect(page).toMatch("Sedimentarias"); | ||
await expect(page).toClick("a[href='/register']"); | ||
await expect(page).toMatch("Crear cuenta"); | ||
await expect(page).toFill("input[name='email']", email); | ||
await expect(page).toFill("input[name='name']", name); | ||
await expect(page).toFill("input[name='dni']", dni); | ||
await expect(page).toFill("input[name='password']", password); | ||
await expect(page).toFill("input[name='confirmPassword']", confirmPassword); | ||
await expect(page).toClick('button', { text: 'Regístrate' }); | ||
}); | ||
|
||
then("Warning below confirmPassword", async () => { | ||
await expect(page).toMatch("Las contraseñas no coinciden"); | ||
}); | ||
}); | ||
}); |
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