From 0d0801ff39d414850fc0aaaca9d67707679ee7ac Mon Sep 17 00:00:00 2001 From: William Huster Date: Wed, 28 Aug 2024 10:56:10 -0400 Subject: [PATCH] Playwright E2E tests clean-up. Remove all references to Cypress. (#346) Following up on #335 and issue #330 - this removes all references to Cypress. Apps incorporating these changes will need to update their environment variables and repository secrets accordingly. --- .github/workflows/e2e.yml | 2 +- .../.github/workflows/playwright.yml | 4 ++-- {{cookiecutter.project_slug}}/app.json | 2 +- .../clients/web/react/tests/e2e/specs/login.spec.ts | 4 ++-- .../clients/web/vue3/tests/e2e/specs/login.spec.ts | 4 ++-- {{cookiecutter.project_slug}}/package.json | 2 +- .../core/management/commands/create_test_data.py | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 07d5a363d..434e57afe 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -50,7 +50,7 @@ jobs: env: NPM_CONFIG_PRODUCTION: false PLAYWRIGHT_TEST_BASE_URL: ${{ github.event.deployment_status.environment_url }} - CYPRESS_TEST_USER_PASS: ${{ secrets.CYPRESS_TEST_USER_PASS }} + PLAYWRIGHT_TEST_USER_PASS: ${{ secrets.PLAYWRIGHT_TEST_USER_PASS }} - uses: actions/upload-artifact@v4 if: always() with: diff --git a/{{cookiecutter.project_slug}}/.github/workflows/playwright.yml b/{{cookiecutter.project_slug}}/.github/workflows/playwright.yml index d5d94976a..6c5479b32 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/playwright.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/playwright.yml @@ -20,5 +20,5 @@ jobs: env: PLAYWRIGHT_TEST_BASE_URL: {{ "${{ github.event.deployment_status.environment_url }}" }} - CYPRESS_TEST_USER_PASS: - {{ "${{ secrets.CYPRESS_TEST_USER_PASS }}" }} + PLAYWRIGHT_TEST_USER_PASS: + {{ "${{ secrets.PLAYWRIGHT_TEST_USER_PASS }}" }} diff --git a/{{cookiecutter.project_slug}}/app.json b/{{cookiecutter.project_slug}}/app.json index 85e1b66b8..c055e0924 100644 --- a/{{cookiecutter.project_slug}}/app.json +++ b/{{cookiecutter.project_slug}}/app.json @@ -22,7 +22,7 @@ "DJANGO_SUPERUSER_PASSWORD": { "value": "!!!DJANGO_SECRET_KEY!!!" }, - "CYPRESS_TEST_USER_PASS": { + "PLAYWRIGHT_TEST_USER_PASS": { "value": "!!!DJANGO_SECRET_KEY!!!" }, "SECRET_KEY": { diff --git a/{{cookiecutter.project_slug}}/clients/web/react/tests/e2e/specs/login.spec.ts b/{{cookiecutter.project_slug}}/clients/web/react/tests/e2e/specs/login.spec.ts index af34bae87..e118f8638 100644 --- a/{{cookiecutter.project_slug}}/clients/web/react/tests/e2e/specs/login.spec.ts +++ b/{{cookiecutter.project_slug}}/clients/web/react/tests/e2e/specs/login.spec.ts @@ -3,11 +3,11 @@ import { test, expect } from '@playwright/test' import dotenv from 'dotenv' test('Login workflow', async ({ page }) => { - expect(process.env.CYPRESS_TEST_USER_PASS).toBeTruthy() + expect(process.env.PLAYWRIGHT_TEST_USER_PASS).toBeTruthy() await page.goto('/log-in') await page.getByTestId('email').fill('playwright@thinknimble.com') - await page.getByTestId('password').fill(process.env.CYPRESS_TEST_USER_PASS ?? '') + await page.getByTestId('password').fill(process.env.PLAYWRIGHT_TEST_USER_PASS ?? '') await page.getByTestId('submit').click() await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible() diff --git a/{{cookiecutter.project_slug}}/clients/web/vue3/tests/e2e/specs/login.spec.ts b/{{cookiecutter.project_slug}}/clients/web/vue3/tests/e2e/specs/login.spec.ts index 56a73d257..a6d54d1c0 100644 --- a/{{cookiecutter.project_slug}}/clients/web/vue3/tests/e2e/specs/login.spec.ts +++ b/{{cookiecutter.project_slug}}/clients/web/vue3/tests/e2e/specs/login.spec.ts @@ -1,11 +1,11 @@ import { test, expect } from '@playwright/test' test('Login workflow', async ({ page }) => { - expect(process.env.CYPRESS_TEST_USER_PASS).toBeTruthy() + expect(process.env.PLAYWRIGHT_TEST_USER_PASS).toBeTruthy() await page.goto('/login') await page.getByPlaceholder('Enter email...').fill('playwright@thinknimble.com') - await page.getByPlaceholder('Enter password...').fill(process.env.CYPRESS_TEST_USER_PASS ?? '') + await page.getByPlaceholder('Enter password...').fill(process.env.PLAYWRIGHT_TEST_USER_PASS ?? '') await page.getByRole('button', { name: 'Log in' }).click() await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible() diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index 75f9bcedf..ded251f81 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -9,7 +9,7 @@ }, "cacheDirectories": [ "client/node_modules", - ".cache/Cypress" + ".cache/ms-playwright" ], "dependencies": {} } diff --git a/{{cookiecutter.project_slug}}/server/{{cookiecutter.project_slug}}/core/management/commands/create_test_data.py b/{{cookiecutter.project_slug}}/server/{{cookiecutter.project_slug}}/core/management/commands/create_test_data.py index 60e573de0..6bbd69c4f 100644 --- a/{{cookiecutter.project_slug}}/server/{{cookiecutter.project_slug}}/core/management/commands/create_test_data.py +++ b/{{cookiecutter.project_slug}}/server/{{cookiecutter.project_slug}}/core/management/commands/create_test_data.py @@ -13,7 +13,7 @@ class Command(BaseCommand): def handle(self, *args, **kwargs): logger.info(f"Starting management command {__name__}") superuser_password = config("DJANGO_SUPERUSER_PASSWORD") - playwright_password = config("CYPRESS_TEST_USER_PASS") + playwright_password = config("PLAYWRIGHT_TEST_USER_PASS") get_user_model().objects.create_superuser( email="admin@thinknimble.com", password=superuser_password, first_name="Admin", last_name="ThinkNimble" )