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

feat: adds E2E tests for the frontend static site and runs them as part of CI #1392

Merged
merged 25 commits into from
Mar 13, 2024
Merged

feat: adds E2E tests for the frontend static site and runs them as part of CI #1392

merged 25 commits into from
Mar 13, 2024

Conversation

kniedermaier
Copy link
Contributor

Summary

(To add ticket)

Time to review: 20 mins

Changes proposed

  1. Adds @playwright/test as a dev dependency
  2. Includes an E2E test for each page on the static site
  3. Adds helper aliases to run the E2E tests via the command line
  4. Adds a step in the CI workflow to run these tests

Context for reviewers

The playwright config added in this PR is largely based on the default provided by running npm init playwright@latest. The options run the gambit for customizing the configuration. For instance, it's possible to add tracing artifacts (e.g. screenshots or videos) when tests fail during CI.

To run via command line: npm run test:e2e
Instructions on using the VS Code extension: https://playwright.dev/docs/getting-started-vscode

Additional information

Running npm run test:e2e:ui will result in opening up the Playwright UI, which looks like this:
Screenshot 2024-03-01 at 4 50 56 PM

@github-actions github-actions bot added documentation Improvements or additions to documentation api storybook and removed documentation Improvements or additions to documentation api storybook labels Mar 4, 2024
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 4, 2024
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

2. Follow the [instructions](https://playwright.dev/docs/getting-started-vscode#running-tests) Playwright provides

In CI, the "Front-end Checks" workflow (`.github/workflows/ci-frontend.yml`) summary will include an "Artifacts" section where there is an attached "playwright-report". [Playwright docs](https://playwright.dev/docs/ci-intro#html-report) describe how to view HTML Report in more detail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to document what we're trying to test here - the entire flow with mock db data? How does it differ from the jest unit tests we write?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How it's set up now is a proof-of-concept with tests for published pages that mirror the jest ones. Once more features like /search are built out, I would argue that another workflow specifically for E2E tests is going to be necessary because "Front-end Checks" workflow isn't currently spinning up the rest of the application.

I'm happy to take that on as part of this PR if that corresponds to how others are reasoning about the purpose of this test suite.

Copy link
Collaborator

@acouch acouch left a comment

Choose a reason for hiding this comment

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

Looks great! Amazing work, thank you. Let's create a ticket for the sendy mock issue.

@acouch acouch merged commit cddd9c4 into HHS:main Mar 13, 2024
15 checks passed
@kniedermaier kniedermaier deleted the kniedermaier/adds-e2e-integration branch March 13, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd documentation Improvements or additions to documentation frontend javascript typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants