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

fix: e2e playwright test #5826

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

fix: e2e playwright test #5826

wants to merge 3 commits into from

Conversation

rubentalstra
Copy link
Collaborator

@rubentalstra rubentalstra commented Feb 12, 2025

Summary

This PR updates and refactors our end-to-end testing setup and workflows. The key changes include:

  • CI Workflow Updates:

    • Removed: The outdated .github/playwright.yml file has been deleted.
    • Added: A new workflow file at .github/workflows/playwright.yml has been introduced. This updated workflow sets up the Playwright environment, installs the necessary dependencies (including browser dependencies), builds the client, and runs our Playwright tests with improved environment variable configuration and caching.
  • e2e Test Improvements:

    • Refactoring of Test Specs: Several test specs (e.g., a11y.spec.ts, keys.spec.ts, landing.spec.ts, messages.spec.ts, nav.spec.ts, popup.spec.ts, and settings.spec.ts) have been updated. Changes include:
      • Updated selectors and improved waiting logic to match the current UI and ensure test reliability.
      • Added filtering for Axe accessibility violations (to only flag “serious” or “critical” issues) in the accessibility tests.
      • Enhanced simulation of user interactions (e.g., clicking buttons, filling inputs, handling modals) to better mimic real user workflows.
    • Utility Function: A new utility, acceptTermsIfPresent, has been added (in e2e/utils/acceptTermsIfPresent.ts) to consistently handle the Terms & Conditions modal across all tests.

These updates not only improve the stability and reliability of our tests on both local and CI environments but also ensure that our workflow configuration is up to date with best practices.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
    Improved test reliability by updating selectors and wait conditions to address issues with failing or flaky tests.
  • New feature (non-breaking change which adds functionality)
    Introduces an updated CI workflow for running Playwright tests and adds a new utility function to handle Terms & Conditions modals.

Testing

Screenshot 2025-02-12 at 17 59 22

To verify these changes locally and in CI:

  1. Local Testing:
    • Run npm ci to install dependencies.
    • Build the client using npm run frontend.
    • Execute the end-to-end tests with npm run e2e:ci.
  2. CI Verification:
    • Open a pull request or push to one of the monitored branches (e.g., main, release/*).
    • The new GitHub Actions workflow will trigger automatically, running the updated Playwright tests.
  3. Important Environment Variables:
    Make sure that the following secrets are set in your CI environment:
    • MONGO_URI
    • OPENAI_API_KEY
    • E2E_USER_EMAIL
    • E2E_USER_PASSWORD
    • JWT_SECRET
    • JWT_REFRESH_SECRET
    • CREDS_KEY
    • CREDS_IV
    • DOMAIN_CLIENT
    • DOMAIN_SERVER

These variables are used to configure the test environment and ensure that all test steps (including API interactions) run correctly.

Checklist

  • My code adheres to this project's style guidelines.
  • I have performed a self-review of my own code.
  • I have commented in any complex areas of my code.
  • I have made pertinent documentation changes (if needed).
  • My changes do not introduce new warnings.
  • I have written tests demonstrating that my changes are effective.
  • Local unit tests and end-to-end tests pass with my changes.
  • Any changes dependent on mine have been merged and published in downstream modules.
  • A pull request for updating the documentation has been submitted (if applicable).

@rubentalstra rubentalstra self-assigned this Feb 12, 2025
@rubentalstra rubentalstra added ♿ a11y Accessibility 🔧 fix Bug fixes and code patches 🤖 ci/cd Pipeline and automation tweaks labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♿ a11y Accessibility 🤖 ci/cd Pipeline and automation tweaks 🔧 fix Bug fixes and code patches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant