Skip to content
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

[POC]Integrate a11y scan into E2E tests #2096

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

Conversation

alexvuong
Copy link
Collaborator

@alexvuong alexvuong commented Oct 23, 2024

Description

This PR added E2E tests for a11y by using snapshot method provided by playwright. The reason we are using snapshots instead of excluding/ixcluding a11y rules are because current storefront still have known a11y errors which may be addressed in the future.
With snapshot method, we are capturing the current stage of a11y on each page on the E2E that we have in the project

Why

We want to make sure we are not introduce any a11y bugs into current existing code. Although we have fixed most of our a11y in GUS, but we still have some minor errors that have no plan to get fixed.
Using snapshot, we are capturing the current state of a11y on the storefront

Pros

  • We don't have to disable/ignore any a11y rules when we run the a11y scan on E2E
  • Any new a11y error will get noticed since it will cause nightly run to fail

Cons

  • We will need to update snapshots if there is an acceptable change to current a11y state. Say, you fixed an a11y or you may have introduce a new a11y, but it is acceptable for now to move forwards.
  • The snapshots file will need to be committed in the codebase
  • This will not run on PR checked on every commit, but will run on E2E tests. We may have discovered if we violate any a11y at least one nightly run

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • Check out code
  • Change you config to match E2E instance
// template-retail-app/default.js
parameters: {
               clientId: '987fc116-d30c-4537-93cb-c2bd433c3b5a',
               organizationId: 'f_ecom_zzrf_002',
               shortCode: '8o7m175y',
               siteId: 'RefArch'
}
  • Change your DEFAULT_SEARCH_PARAM in constant.js
export const DEFAULT_SEARCH_PARAMS = {limit: 3, offset: 0, sort: 'best-matches', refine: []}

  • Run RETAIL_APP_HOME=http://localhost:3000 test:e2e and make sure no tests are failing.
  • Now change something in your code that can cause a11y.
  • Re run the tests, you will notice the e2e tests will fail and complain the snapshot for a11y is no longer matched.

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@alexvuong alexvuong requested a review from a team as a code owner October 23, 2024 00:21
@alexvuong alexvuong changed the title Add a11y E2E tests Integrate a11y scan into E2E tests Oct 23, 2024
@alexvuong alexvuong changed the title Integrate a11y scan into E2E tests [POC]Integrate a11y scan into E2E tests Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant