-
Notifications
You must be signed in to change notification settings - Fork 53
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
cy - refactored e2e tests (fixtures) #10242
base: dev
Are you sure you want to change the base?
Conversation
const authenticatedPages = [ | ||
"/mes-tutos/enregistres", | ||
"/mes-tutos/recommandes", | ||
"/mon-compte/informations-personnelles", | ||
"/mon-compte/langue", | ||
"/mon-compte/methodes-de-connexion", | ||
"/plan-du-site", | ||
]; |
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.
Some pages are missing in this array
cy.injectAxe(); | ||
|
||
// then | ||
viewports.forEach(({ width, height }) => { | ||
cy.viewport(width, height); | ||
cy.checkA11yAndShowViolations({ skipFailures, url }); | ||
cy.checkA11yAndShowViolations({ skipFailures: false, url }); |
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.
skipFailures
was set to true
for some urls, notably /assessments/fake-assessment
Sorry for the small mistakes earlier! I’ve addressed the feedback and made the necessary updates. Everything should look good now, but please let me know if there’s anything else I need to fix or adjust. I was just aiming to do a small refactor to clean things up a bit. |
🦄 Problem
We needed to refactor the Cypress tests to improve readability and maintainability, particularly in how fixtures were loaded across the test suite. The previous approach involved loading each fixture manually within the
beforeEach
block, leading to code duplication and decreased clarity.🤖 Solution
I refactored the Cypress test suite by introducing a more concise method to handle fixture loading. Instead of calling
cy.task("db:fixture", ...)
for each fixture separately, I grouped the fixtures into an array and used a loop to load them all at once. This reduces redundancy, improves readability, and makes future modifications easier (e.g., adding new fixtures).The refactor only affects the way fixtures are loaded, without impacting the overall test functionality. This should help streamline future test maintenance and updates.
🌈 Notes
beforeEach
hook to ensure that they are loaded before each test.💯 How to test