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 branch 'develop' into Valentin_Interfaz2
- Loading branch information
Showing
26 changed files
with
970 additions
and
185 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,14 @@ | ||
Feature: Login a user on the web page | ||
|
||
Scenario: The user log in | ||
Given Email and password of a user | ||
When I click in Iniciar Sesión | ||
Then I should be redirected to the catalog | ||
Scenario: User log in blank email | ||
Given Blank Email and password of a user | ||
When I click in Iniciar Sesión | ||
Then Warning message below Email | ||
Scenario: User log in blank password | ||
Given Email and blank password of a user | ||
When I click in Iniciar Sesión | ||
Then Warning message below Password |
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 |
---|---|---|
@@ -0,0 +1,96 @@ | ||
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("User Login", ({given,when,then}) => { | ||
let email:string | ||
let password:string | ||
|
||
given("Email and password of a user", () => { | ||
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' }); | ||
}); | ||
|
||
then("I should be redirected to the catalog", async () => { | ||
await page.waitForNavigation() | ||
await page.waitForTimeout(2000); | ||
await expect(page).toMatch("Yeso"); | ||
}); | ||
}); | ||
|
||
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"); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.