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

Chore/implement playwright axe and axe core #838

Conversation

aasimsyed
Copy link
Contributor

Contributor checklist


Description

This PR removes Cypress and adds Playwright in its place as well as updates the GitHub Actions workfile pr_ci_frontend.yaml for CI testing.

  • This assumes that secrets are set up in the project under the dev environment for it to work.

Changes in this PR:

  • implemented Playwright with basic tests for Landing Page
    -- uses a Page Object Model design pattern
    -- uses scripts to run set in frontend/package.json
    -- to run against local (assuming server is running): yarn test:local
    -- to run against prod: yarn test:prod
    -- to run either using Playwright UI, append --ui on either command
  • updated pr_ci_frontend.yaml to include server start/stop and run playwright tests
  • updated docker-compose.yml to include health check
  • tested Playwright tests using yarn test:local, yarn test:prod, and yarn playwright test and
  • tested GitHub Actions for frontend on branch

Related issue

…ents

- Updated .gitignore to exclude Playwright generated directories and cache for cleaner commits.
- Modified package.json to include new scripts for running Playwright tests in local and production environments and added necessary dependencies for testing.
- Revised the Playwright configuration in playwright.config.ts to define environment-specific base URLs and expanded browser coverage to include Edge, mobile browsers, and iPad.
- Added TypeScript configuration in tsconfig.json to recognize Playwright types.
- Established new directories for component objects and fixtures to better organize test components and utilities.
- Introduced abstract base classes for page objects and component objects to standardize interaction with Playwright's Page object.
- Created specific test cases in landing-page.spec.ts to validate functionality of the landing page, ensuring visibility of essential elements and correct page responses.
- Overall enhancements to the testing infrastructure to support a more robust and scalable testing framework.
…istency

- Update Playwright config to explicitly set mobile devices in the testing environment to improve clarity and ensure mobile-specific behaviors are accurately tested.
- Modify the LandingPage class to use a centralized locators object, streamlining the management of page element selectors and facilitating future updates.
- Introduce an accessibility test using AxeBuilder to ensure the landing page adheres to specified WCAG standards, though this test is initially skipped to allow for further adjustments.
- Enhance the landing page test suite to include a new test verifying the visibility of all critical links, ensuring key page elements are functional and correctly displayed.
- Adjust import statements in test specs to align with the updated structure and improve test setup clarity.

These changes aim to make the test suite more maintainable and robust, particularly regarding accessibility standards and mobile responsiveness.
…st Access URL, added id locators on LandingSplash.vue
… separate 'pr_ci_playwright_e2e.yaml' WIP workflow for Playwright E2E tests only
@aasimsyed
Copy link
Contributor Author

aasimsyed commented May 2, 2024

@andrewtavis please take a new look at this. I have addressed your comments and restored the pr_ci_frontend.yaml from upstream/main, creating a separate pr_ci_playwright_e2e.yaml for Playwright E2E that is not automatically triggered (while it's a WIP). I made the Playwright one with the below trigger, which I think adds a button to manually run on GitHub if it's on the default branch:

  workflow_dispatch:

I also added a couple of ids on LandingSplash.vue for easier locators, if that is OK.

@andrewtavis
Copy link
Member

Thanks, @aasimsyed!

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

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

All's looking great, @aasimsyed! And thanks so much for handling the merge conflicts yourself 😊 Note on this, @to-sta and @wkyoshida:

  • We discussed on Thursday and we're thinking that although expansive, this is the best way to do things at this point as we don't have access to a staging environment to run the tests on
  • We need to trigger this workflow as it's set with workflow_dispatch
    • I've already added a check for the maintainer workflow that this and the new OWASP Zap workflow should be ran on PRs :)
  • Especially for the situation where we're running on Netlify, it's a bit difficult to link the deployment previews
  • Once we do switch away from Netlify, a more expansive system like this will be necessary, so it's best to keep it for now rather than rewrite it later

@andrewtavis andrewtavis merged commit 9218de3 into activist-org:main May 4, 2024
6 checks passed
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.

None yet

2 participants