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 #198 from Arquisoft/feat/e2e
test: initial e2e testing
- Loading branch information
Showing
10 changed files
with
69 additions
and
81 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
testMatch: ["**/steps/*.js"], | ||
testTimeout: 30000, | ||
setupFilesAfterEnv: ["expect-puppeteer"] | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
testTimeout: 30000 | ||
} |
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,60 @@ | ||
const { defineFeature, loadFeature }=require('jest-cucumber'); | ||
const puppeteer = require('puppeteer'); | ||
const setDefaultOptions = require("expect-puppeteer").setDefaultOptions; | ||
const feature = loadFeature('./features/about_features/positive_logged_user_seeing_about_screen.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 logged user wants to see the about screen of the webpage", ({given,when,and,then}) => { | ||
|
||
let username; | ||
let password; | ||
|
||
given("A logged user in the main menu", async () => { | ||
username = "[email protected]" | ||
password = "password" | ||
|
||
await expect(page).toClick("button[data-testid='Login'"); | ||
await expect(page).toFill("#user", username); | ||
await expect(page).toFill("#password", password); | ||
await expect(page).toClick("button[data-testid='Login'"); | ||
}); | ||
|
||
when("The user presses the button for deploying the lateral menu", async () => { | ||
await expect(page).toClick("#lateralMenuButton"); | ||
}); | ||
|
||
and("the user presses the button for seeing the about section (i)", async () => { | ||
await expect(page).toClick("#aboutButton"); | ||
}); | ||
|
||
then("The user is presented to the about screen", async () => { | ||
let header = await page.$eval("h2", (element) => { | ||
return element.innerHTML | ||
}) | ||
let value = header === "About" || header === "Sobre nosotros"; | ||
expect(value).toBeTruthy(); | ||
}); | ||
}); | ||
|
||
afterAll((done) => { | ||
done(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
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