-
Notifications
You must be signed in to change notification settings - Fork 0
Integrates playwright in cucumber e2e tests #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
edouard-gv
wants to merge
8
commits into
main
Choose a base branch
from
behavior
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
72b9f0b
First playwright BDD scenario
edouard-gv dbbc79d
Better configs alternative
edouard-gv 998de21
document test:cucumber filtering @OK scenarios
edouard-gv 9de3456
playwright & cucumber installation details
edouard-gv ce95173
Lint and format
magopian 52a4876
Scenario template for multiple loggin.
edouard-gv 1943d5e
Suppression de la page d'information FC
edouard-gv c7186a4
On ne test plus tous les comptes de test FC.
edouard-gv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
53 changes: 42 additions & 11 deletions
53
public/mobile-app/tests/features/step_definitions/default-steps.cjs
This file contains hidden or 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,23 +1,54 @@ | ||
| const { Given, | ||
| Then, | ||
| // When | ||
| } = require('@cucumber/cucumber'); | ||
| const { Given, When, Then, Before, After, setDefaultTimeout, context } = require("@cucumber/cucumber"); | ||
|
|
||
| const { chromium, expect, defineConfig } = require("@playwright/test"); | ||
|
|
||
| const { Page } = require("playwright"); | ||
|
|
||
| setDefaultTimeout(60 * 1000); | ||
|
|
||
| let page, browserContext, browser; | ||
|
|
||
| Before(async function () { | ||
| browser = await chromium.launch( | ||
| //uncomment this line to see the tests in live | ||
| //{ headless: false, slowMo: 1500} | ||
| ); | ||
| browserContext = await browser.newContext( | ||
| //{baseURL: "https://localhost:4173/", ignoreHTTPSErrors: true} | ||
| {baseURL: "https://ami-back-staging.osc-fr1.scalingo.io/"} | ||
| ); | ||
| page = await browserContext.newPage(); | ||
| }); | ||
|
|
||
| After(async function () { | ||
| await browserContext.close(); | ||
| await browser.close(); | ||
| }) | ||
|
|
||
| Given( | ||
| "l'usager se connecte sur AMI via France Connect en tant que {string} et suit le process de france connexion", | ||
| function (s) { | ||
| // Write code here that turns the phrase above into concrete actions | ||
| async (s) => { | ||
| await page.locator('#fr-connect-button').click() | ||
| await page.getByTestId('idp-e1e90d50-cca0-4a85-9db3-0bcc190ee6f7').click() | ||
| await page.getByLabel('Identifiant').fill(s) | ||
| await page.getByLabel('Mot de passe').fill('123') | ||
| await page.getByRole('button', {name: 'Valider'}).click() | ||
| // await page.getByRole('button', {name: 'Continuer sur AMI'}).click() | ||
| } | ||
| ); | ||
|
|
||
| Given("l'usager est sur la home page non connectée de l'application AMI", function () { | ||
| // Write code here that turns the phrase above into concrete actions | ||
| Given("l'usager est sur la home page non connectée de l'application AMI", async () => { | ||
| await page.goto("/") | ||
| }); | ||
|
|
||
| Then("l'usager devrait arriver sur la home page connectée de l'application AMI", async () => { | ||
| await expect(page.locator('.user-profile')).toBeVisible() | ||
| }); | ||
|
|
||
| Then("l'usager devrait arriver sur la home page connectée de l'application AMI", function () { | ||
| // Write code here that turns the phrase above into concrete actions | ||
| Then("les données de l'usager {string} récupérées depuis l'API Particulier devraient être affichées", function (s) { | ||
| //console.log(s); | ||
| }); | ||
|
|
||
| Then("l'usager {string} devrait être enregistré(e)", function (s) { | ||
| console.log(s); | ||
| //console.log(s); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: do we need to keep this comment?