Skip to content

Chore: Update the Cypress JS example with custom threshold validation…#587

Draft
ash007ok wants to merge 1 commit intoGovTechSG:masterfrom
ash007ok:chore/update_cypress_js_example_with_threshold_sc
Draft

Chore: Update the Cypress JS example with custom threshold validation…#587
ash007ok wants to merge 1 commit intoGovTechSG:masterfrom
ash007ok:chore/update_cypress_js_example_with_threshold_sc

Conversation

@ash007ok
Copy link

… at the test level and capture a screenshot in Cypress to handle the session with a red highlighter

This PR adds...

  • I've kept this PR as small as possible (~500 lines) by splitting it into PRs with manageable chunks of code
  • I've requested reviews from 1 reviewer
  • I've tested existing features (website scan, sitemap, custom flow) in both node index and cli
  • I've synced this fork with GovTechSG repo
  • I've added/updated unit tests
  • I've added/updated any necessary dependencies in package[-lock].json npm audit, portable installation on GitHub Actions

… at the test level and capture a screenshot in Cypress to handle the session with a red highlighter
Copy link
Collaborator

@younglim younglim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As appended


Cypress.Commands.add("runOobeeA11yScan", (items = {}) => {
cy.window().then(async (win) => {
Cypress.Commands.add('runOobeeA11yScan', (items = {}, threshold = {}) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ash007ok with your Cypress experience, do you think it is possible to make Oobee functions like these exposed as cypress keywords instead?

E.g. Can we have an equivalent of or extendnpmIndex for Cypress? Then users don't have to copy/paste the examples.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add on, the screenshots keywords can be for Playwright too

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@younglim That would be great! We can create a Cypress plugin like cypress-oobee to eliminate the copy/paste setup.

Guide to create plugins: https://docs.cypress.io/guides/tooling/plugins-guide
Plugin examples: https://docs.cypress.io/app/plugins/plugins-list

@younglim younglim marked this pull request as ready for review October 31, 2025 05:23
@younglim younglim marked this pull request as draft October 31, 2025 05:23
@younglim
Copy link
Collaborator

younglim commented Feb 3, 2026

Implemented Cypress native screenshots function here
#629

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.

2 participants