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

Issue 923 accessibility testing #1014

Conversation

marikadeveloper
Copy link
Contributor

The Pull Request is ready

Overview

Add cypress tests to each of the page inside the constants file. The tests produce json files in the cypress/accessibility folder using node filesystem.

Documentation-Website

  • mobile view is usable
  • desktop view is usable
  • no a-tags are used directly (NavLink, MailLink, ExternalLink instead)
  • all new texts are added to the translation files (at least the english one)
  • tests have been added (if required)
  • shared code has been extracted in a different file

Notes

As mentioned in our chat, I don't think this is 100% useful

@github-actions github-actions bot added the component: documentation-website related to the project's website, not the framework label May 6, 2024
Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

CodeRabbit has integrated enhancements into the documentation website's accessibility. The updates encompass ignoring specific directories, refining Cypress configurations for accessibility testing, and introducing new constants and dependencies to facilitate this functionality. The primary emphasis is on automated accessibility testing across various UI modes.

Changes

Files Changes
.gitignore Added /documentation-website/cypress/accessibility to the .gitignore file.
cypress.config.ts, cypress/e2e/accessibility.cy.ts, cypress/fixtures/constants.ts Enhanced with new constants, imports, and tasks for accessibility testing.
package.json Added dependencies for @napi-rs/image, @types/node, axe-core, and cypress-axe.

Assessment against linked issues

Objective Addressed Explanation
Find A11Y issues on the docs site (#923) The code changes establish infrastructure for automated accessibility testing, but it is uncertain if specific A11Y issues have been pinpointed or resolved.

🌟 A Poem of Code and Accessibility 🌟

In the realm of code, where logic reigns,
A quest for access, through digital plains.
With tools in hand, and tests in place,
We strive to make, a more inclusive space.
Let Cypress guide, through light and dark,
Unveil the issues, where contrasts stark.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@marikadeveloper
Copy link
Contributor Author

This is paused.

Copy link

sonarcloud bot commented May 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between cfe0f82 and 3a180c0.
Files ignored due to path filters (1)
  • documentation-website/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (5)
  • .gitignore (1 hunks)
  • documentation-website/cypress.config.ts (1 hunks)
  • documentation-website/cypress/e2e/accessibility.cy.ts (1 hunks)
  • documentation-website/cypress/fixtures/constants.ts (1 hunks)
  • documentation-website/package.json (2 hunks)
Files skipped from review due to trivial changes (2)
  • .gitignore
  • documentation-website/cypress/fixtures/constants.ts
Additional Context Used
Path-based Instructions (2)
documentation-website/cypress.config.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

documentation-website/cypress/e2e/accessibility.cy.ts (1)

Pattern **/*.ts: Review the code for conformity with the .eslintrc files in / and /*/.

Additional comments not posted (11)
documentation-website/cypress.config.ts (3)

7-11: Imports from 'fs' module are added to handle file operations.


13-14: Constant ACCESSIBILITY_FILES_DIR is correctly imported from constants file.


28-39: New task writeFile is added to handle writing of accessibility test results. Ensure directory exists before writing to prevent errors.

Verification successful

The task writeFile has been verified within the documentation-website/cypress.config.ts file. The implementation checks for the existence of the directory before performing file write operations, aligning with the intended functionality to prevent errors due to non-existent directories.

  • documentation-website/cypress.config.ts: Proper directory check and file writing operations are implemented.
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the directory creation and file writing operations are handled correctly.

# Test: Search for usage of `writeFile` task. Expect: Proper checks before file operations.
rg --type typescript $'writeFile'

Length of output: 67



Script:

#!/bin/bash
# Description: Verify that the directory creation and file writing operations are handled correctly.

# Test: Search for usage of `writeFile` task in TypeScript files. Expect: Proper checks before file operations.
rg 'writeFile' --glob '*.ts'

Length of output: 767

documentation-website/cypress/e2e/accessibility.cy.ts (4)

1-8: Imports for cypress-axe and constants are correctly added.


10-28: Function setMode is added to adjust UI mode based on input. Ensure it handles all possible UI modes correctly.


30-72: Function testPageAccessibility is added to perform accessibility tests and log violations. Ensure it correctly logs and handles violations.

Verification successful

Function testPageAccessibility is confirmed to log and handle accessibility violations as expected. The function is used within the same file where it is defined, and the implementation matches the provided code snippet.

  • File: documentation-website/cypress/e2e/accessibility.cy.ts
    • Lines where function is defined and used: 1, 3, 4
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that accessibility violations are logged and handled correctly.

# Test: Search for usage of `testPageAccessibility`. Expect: Proper logging and handling of violations.
rg --type typescript $'testPageAccessibility'

Length of output: 79



Script:

#!/bin/bash
# Description: Verify that accessibility violations are logged and handled correctly.

# Test: Search for usage of `testPageAccessibility`. Expect: Proper logging and handling of violations.
rg 'testPageAccessibility'

Length of output: 293


74-112: Test suite runs accessibility tests in both dark and light modes for each page route. Ensure all routes are covered and tests are correctly isolated.

Verification successful

CodeRabbit has assimilated the output from the executed script. The script was designed to verify that all routes are covered by accessibility tests in the codebase. The output indicates that various routes are indeed referenced in the Cypress end-to-end tests, including specific tests for accessibility.

The output lists numerous instances where different page routes are used in Cypress tests across various files, suggesting comprehensive coverage of routes for accessibility testing. Each route appears to be tested in both dark and light modes as per the original code snippet provided.

Based on the evidence provided by the script output, CodeRabbit concludes that the accessibility tests cover all the routes as expected. The initial review comment is consistent with the findings in the codebase.

Conclusion: All routes are covered by accessibility tests as required.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that all routes are covered by accessibility tests.

# Test: Search for usage of page routes in tests. Expect: Coverage of all routes.
rg --type typescript $'page'

Length of output: 62



Script:

#!/bin/bash
# Description: Verify that all routes are covered by accessibility tests.

# Test: Search for usage of page routes in tests. Expect: Coverage of all routes.
rg --type ts $'page'

Length of output: 12000

documentation-website/package.json (4)

58-58: Dependency @napi-rs/image is added for enhanced Node.js functionality.


61-61: Dependency @types/node is updated to support new Node.js features used in the tests.


67-67: Dependencies axe-core and cypress-axe are added for conducting accessibility tests.


73-73: Dependency cypress-axe is added to enhance Cypress testing with accessibility checks.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 3a180c0 and 8341ebf.
Files ignored due to path filters (1)
  • documentation-website/package-lock.json is excluded by !**/package-lock.json
Files selected for processing (1)
  • documentation-website/package.json (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • documentation-website/package.json

@Idrinth Idrinth closed this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: documentation-website related to the project's website, not the framework
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Find A11Y issues on the docs site
2 participants