generated 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 #86 from Arquisoft/LaraFMz
Lara f mz
- Loading branch information
Showing
8 changed files
with
9,574 additions
and
668 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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: Access the app | ||
|
||
Scenario: A registered user enters the app | ||
Given A user that is logged in the application | ||
When I navigate to the Home page | ||
Then I should be able to interact with the app |
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: Logging in as a user | ||
|
||
Scenario: Logging in with valid credentials | ||
Given A user that is logged in the application | ||
When I enter valid username and password | ||
Then A confirmation 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const puppeteer = require('puppeteer'); | ||
const { defineFeature, loadFeature }=require('jest-cucumber'); | ||
const setDefaultOptions = require('expect-puppeteer').setDefaultOptions | ||
const feature = loadFeature('../features/home.feature'); | ||
|
||
let page; | ||
let browser; | ||
|
||
defineFeature(feature, test => { | ||
|
||
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('A registered user enters the app', ({given,when,then}) => { | ||
|
||
let username; | ||
let password; | ||
|
||
given('A user that is logged in the application', async () => { | ||
username = "pablo" | ||
password = "pabloasw" | ||
await expect(page).toClick("button", { text: "INICIA SESIÓN" }); | ||
}); | ||
|
||
when('I navigate to the Home page', async () => { | ||
await expect(page).toFill('input[name="username"]', username); | ||
await expect(page).toFill('input[name="password"]', password); | ||
await expect(page).toClick('button', { text: 'Login' }) | ||
|
||
await expect(page).toClick('a[href="/"]', { text: 'WIQ 5A' }); | ||
await page.waitForNavigation(); | ||
|
||
}); | ||
|
||
then('I should be able to interact with the app', async () => { | ||
await expect(page).toMatchElement("button", { text: "JUGAR" }); | ||
await expect(page).toMatchElement("button", { text: "ESTADÍSTICAS" }); | ||
}); | ||
}) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
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: 100 }); | ||
page = await browser.newPage(); | ||
//Way of setting up the timeout | ||
setDefaultOptions({ timeout: 10000 }) | ||
|
||
await page | ||
.goto("http://localhost:3000", { | ||
waitUntil: "networkidle0", | ||
}) | ||
.catch(() => {}); | ||
}); | ||
|
||
test('Logging in with valid credentials', ({given,when,then}) => { | ||
|
||
let username; | ||
let password; | ||
|
||
given('A user that is logged in the application', async () => { | ||
username = "pablo" | ||
password = "pabloasw" | ||
await expect(page).toClick("button", { text: "INICIA SESIÓN" }); | ||
}); | ||
|
||
when('I enter valid username and password', async () => { | ||
await expect(page).toFill('input[name="username"]', username); | ||
await expect(page).toFill('input[name="password"]', password); | ||
await expect(page).toClick('button', { text: 'Login' }) | ||
}); | ||
|
||
then('A confirmation message should be shown in the screen', async () => { | ||
await expect(page).toMatchElement("div", { text: "Hello "+username+"!" }); | ||
}); | ||
}) | ||
|
||
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