-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[React - Vue] - Migrate E2E Tests from Cypress to Playwright (#335)
- Loading branch information
1 parent
96b4115
commit e145468
Showing
47 changed files
with
366 additions
and
428 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,59 @@ | ||
name: E2E Tests | ||
on: [deployment_status] | ||
|
||
jobs: | ||
Setup: | ||
if: github.event.deployment_status.state == 'success' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: pipx install pipenv | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
# Can't use cache because of https://github.com/actions/cache/issues/319 | ||
# cache: 'pipenv' | ||
- name: Install bootstrapper dependencies | ||
run: pipenv install --dev --deploy | ||
- run: | | ||
config_file=$(./scripts/vue_or_react.sh) | ||
pipenv run cookiecutter . --config-file $config_file --no-input -f | ||
cat $config_file | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: my_project | ||
path: my_project/ | ||
retention-days: 1 | ||
Playwright: | ||
needs: Setup | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
if: github.event.deployment_status.state == 'success' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: my_project | ||
path: my_project/ | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
- name: 📦 Install frontend dependencies | ||
working-directory: ./my_project/client | ||
run: npm install | ||
- name: 🎭 Install Playwright | ||
working-directory: ./my_project/client | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests against ${{ github.event.deployment_status.environment_url }} | ||
working-directory: ./my_project/client | ||
run: npx playwright test --reporter=html | ||
env: | ||
NPM_CONFIG_PRODUCTION: false | ||
PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }} | ||
CYPRESS_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }} | ||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: my_project/client/playwright-report/ | ||
retention-days: 30 |
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 |
---|---|---|
|
@@ -22,4 +22,4 @@ Add user steps to achieve desired functionality for this feature. | |
| user | password | has admin | notes | | ||
| --- | --- | --- | --- | | ||
| `[email protected]` | !!!DJANGO_SECRET_KEY!!! | :white_check_mark: | | | ||
| `cypress@example.com` | !!!DJANGO_SECRET_KEY!!! | :x: | Only use for automated E2E testing | | ||
| `playwright@thinknimble.com` | !!!DJANGO_SECRET_KEY!!! | :x: | Only use for automated E2E testing | |
43 changes: 0 additions & 43 deletions
43
{{cookiecutter.project_slug}}/.github/workflows/cypress.yml
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
{{cookiecutter.project_slug}}/.github/workflows/playwright.yml
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,24 @@ | ||
name: Playwright Tests | ||
on: | ||
deployment_status: | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
if: github.event.deployment_status.state == 'success' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm --prefix ./client i | ||
- name: Install Playwright | ||
run: npx --prefix ./client playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx --prefix ./client playwright test --reporter=html | ||
env: | ||
PLAYWRIGHT_TEST_BASE_URL: | ||
{{ "${{ github.event.deployment_status.environment_url }}" }} | ||
CYPRESS_TEST_USER_PASS: | ||
{{ "${{ secrets.CYPRESS_TEST_USER_PASS }}" }} |
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 |
---|---|---|
|
@@ -5,34 +5,38 @@ | |
## Setup | ||
|
||
### Docker | ||
|
||
If this is your first time... | ||
|
||
1. [Install Docker](https://www.docker.com/) | ||
1. Run `pipenv lock` to generate a Pipfile.lock | ||
1. Run `cd client && npm install` so you have node_modules available outside of Docker | ||
1. Back in the root directory, run `make build` | ||
1. `make run` to start the app | ||
1. If the DB is new, run `make create-test-data` | ||
1. SuperUser `[email protected]` with credentials from your `.env` | ||
1. User `cypress@thinknimble.com` with credentials from your `.env` is used by the Cypress | ||
tests | ||
1. SuperUser `[email protected]` with credentials from your `.env` | ||
1. User `playwright@thinknimble.com` with credentials from your `.env` is used by the Playwright | ||
tests | ||
1. View other available scripts/commands with `make commands` | ||
1. `localhost:8080` to view the app. | ||
1. `localhost:8000/staff/` to log into the Django admin | ||
1. `localhost:8000/api/docs/` to view backend API endpoints available for frontend development | ||
|
||
|
||
### Backend | ||
|
||
If not using Docker... | ||
See the [backend README](server/README.md) | ||
|
||
### Frontend | ||
|
||
If not using Docker... | ||
See the [frontend README](client/README.md) | ||
|
||
|
||
## Testing & Linting Locally | ||
|
||
1. `pipenv install --dev` | ||
1. `pipenv run pytest server` | ||
1. `pipenv run black server` | ||
1. `pipenv run isort server --diff` (shows you what isort is expecting) | ||
1. `npm run cypress` | ||
1. `npx playwright test` | ||
1. `npx playwright codegen localhost:8080` (generate your tests through manual testing) |
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
11 changes: 0 additions & 11 deletions
11
{{cookiecutter.project_slug}}/clients/web/react/cypress.config.ts
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
{{cookiecutter.project_slug}}/clients/web/react/cypress.example.env.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.