-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08591cb
commit 63cbd50
Showing
8 changed files
with
160 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: E2E Tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
service_endpoint: | ||
required: true | ||
type: string | ||
app_name: | ||
required: false | ||
type: string | ||
|
||
jobs: | ||
e2e: | ||
name: " " # GitHub UI is noisy when calling reusable workflows, so use whitespace for name to reduce noise | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install Playwright browsers | ||
run: make e2e-setup-ci | ||
|
||
- name: Run e2e tests | ||
run: make e2e-test APP_NAME=${{ inputs.app_name }} BASE_URL=${{ inputs.service_endpoint }} | ||
|
||
- name: Upload Playwright report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: playwright-report | ||
path: ./e2e/playwright-report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
7fcff11e1ebcddaeaa3c73a5f273acb4bd551106 | ||
48c76567034b229c738730972ad35a467aa1e9f8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# End-to-End (E2E) Tests | ||
|
||
## Overview | ||
|
||
This repository uses [Playwright](https://playwright.dev/) to perform end-to-end (E2E) tests. The tests can be run locally, but also run on [Pull Request preview environments](../infra/pull-request-environments.md). This ensures that any new code changes are validated through E2E tests before being merged. | ||
|
||
## Folder Structure | ||
In order to support e2e for multiple apps, the folder structure will include a base playwright config (`./e2e/playwright.config.js`), and app-specific derived playwright config that override the base config. See the example folder structure below: | ||
``` | ||
- e2e | ||
- playwright.config.js | ||
- app/ | ||
- playwright.config.js | ||
- tests/ | ||
- index.spec.js | ||
- app2/ | ||
- playwright.config.js | ||
- tests/ | ||
- index.spec.js | ||
``` | ||
|
||
Some highlights: | ||
- By default, the base config is defined to run on a minimal browser-set (desktop and mobile chrome). Browsers can be added in the app-specific playwright config. | ||
- Snapshots will be output locally or in the artifacts of the CI job | ||
- HTML reports are output to the `playwright-report` folder | ||
- Parallelism limited on CI to ensure stable execution | ||
- Accessibility testing can be performed using the `@axe-core/playwright` package (https://playwright.dev/docs/accessibility-testing) | ||
|
||
|
||
## Running Locally | ||
|
||
### Running Locally From the Root Directory | ||
|
||
Make targets are setup to easily pass in a particular app name and URL to run tests against | ||
|
||
```bash | ||
make e2e-setup # install playwright deps | ||
make e2e-test APP_NAME=app BASE_URL=http://localhost:3000 # run tests on a particular app | ||
``` | ||
|
||
### Running Locally From the `./e2e` Directory | ||
|
||
If you prefer to run package.json run scripts, you can do so from the e2e folder: | ||
|
||
``` | ||
cd e2e | ||
npm install | ||
APP_NAME=app npm run e2e-test | ||
``` | ||
|
||
### PR Environments | ||
|
||
The E2E tests are triggered in PR preview environments on each PR update. For more information on how PR environments work, please refer to [PR Environments Documentation](../infra/pull-request-environments.md). | ||
|
||
### Workflows | ||
|
||
The following workflows trigger E2E tests: | ||
- [PR Environment Update](../../.github/workflows/pr-environment-checks.yml) | ||
- [E2E Tests Workflow](../../.github/workflows/e2e-tests.yml) | ||
|
||
The [E2E Tests Workflow](../../.github/workflows/e2e-tests.yml) takes a `service_endpoint` URL and an `app_name` to run the tests against specific configurations for your app. | ||
|
||
## Configuration | ||
|
||
The E2E tests are configured using the following files: | ||
- [Base Configuration](../../e2e/playwright.config.js) | ||
- [App-specific Configuration](../../e2e/app/playwright.config.js) | ||
|
||
The app-specific configuration files extend the common base configuration. | ||
|
||
By default when running `make e2e-test APP_NAME=app BASE_URL=http://localhost:3000 ` - you don't necessarily need to pass an `BASE_URL` since the default is defined in the app-specific playwright config (`./e2e/app/playwright.config.js`). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters