From dc1250063b79bbb780da8062ce6a9bb84ebeb0d3 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 17:40:37 -0800 Subject: [PATCH 01/24] initial commit --- .github/workflows/e2e-checks.yml | 36 ++++++++++++++++++++++++++++++++ e2e/.prettierrc | 5 +++++ e2e/package-lock.json | 18 +++++++++++++++- e2e/package.json | 23 ++++++++++---------- 4 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/e2e-checks.yml create mode 100644 e2e/.prettierrc diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml new file mode 100644 index 000000000..a9069d523 --- /dev/null +++ b/.github/workflows/e2e-checks.yml @@ -0,0 +1,36 @@ +name: E2E Code Quality Checks +run-name: E2E Code Quality Checks + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + +jobs: + quality: + name: Code Quality + 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: lts/* + + - name: Cache Node.js dependencies + id: cache-node + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + + - name: Install dependencies + if: steps.cache-node.outputs.cache-hit != 'true' + run: npm ci + + - name: Check formatting + run: npm run format:check diff --git a/e2e/.prettierrc b/e2e/.prettierrc new file mode 100644 index 000000000..c351c0a2c --- /dev/null +++ b/e2e/.prettierrc @@ -0,0 +1,5 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 2 + } diff --git a/e2e/package-lock.json b/e2e/package-lock.json index bbc1c3cac..57314de39 100644 --- a/e2e/package-lock.json +++ b/e2e/package-lock.json @@ -14,7 +14,8 @@ }, "devDependencies": { "@playwright/test": "^1.49.0", - "@types/node": "^22.10.1" + "@types/node": "^22.10.1", + "prettier": "^3.5.1" } }, "node_modules/@axe-core/playwright": { @@ -112,6 +113,21 @@ "node": ">=18" } }, + "node_modules/prettier": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.1.tgz", + "integrity": "sha512-hPpFQvHwL3Qv5AdRvBFMhnKo4tYxp0ReXiPn2bxkiohEX6mBeBwEpBSQTkD458RaaDKQMYSp4hX4UtfUTA5wDw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/undici-types": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", diff --git a/e2e/package.json b/e2e/package.json index 2e2b270b9..87f2525a3 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -2,19 +2,20 @@ "name": "e2e", "version": "1.0.0", "scripts": { - "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", - "e2e-setup": "npx playwright install --with-deps", - "e2e-show-report": "npx playwright show-report", - "e2e-test": "./run-e2e-test", - "e2e-test:ui": "./run-e2e-test --ui" + "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", + "e2e-setup": "npx playwright install --with-deps", + "e2e-show-report": "npx playwright show-report", + "e2e-test": "./run-e2e-test", + "e2e-test:ui": "./run-e2e-test --ui" }, "devDependencies": { - "@playwright/test": "^1.49.0", - "@types/node": "^22.10.1" + "@playwright/test": "^1.49.0", + "@types/node": "^22.10.1", + "prettier": "^3.5.1" }, "dependencies": { - "@axe-core/playwright": "^4.10.1", - "dotenv": "^16.4.7", - "playwright": "^1.49.0" + "@axe-core/playwright": "^4.10.1", + "dotenv": "^16.4.7", + "playwright": "^1.49.0" } - } +} From 322d594115fa3bd6fc98741c2554797862a77719 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 17:43:22 -0800 Subject: [PATCH 02/24] only for e2e changes --- .github/workflows/e2e-checks.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index a9069d523..036fbf175 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -4,8 +4,12 @@ run-name: E2E Code Quality Checks on: pull_request: branches: [ main ] + paths: + - 'e2e/**' push: branches: [ main ] + paths: + - 'e2e/**' jobs: quality: From c46d0b99be9269a2d5c87f5b49f5f7535cc4a686 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 17:45:20 -0800 Subject: [PATCH 03/24] use npm script --- .github/workflows/e2e-checks.yml | 2 +- e2e/package.json | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 036fbf175..cc7aa47dd 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -37,4 +37,4 @@ jobs: run: npm ci - name: Check formatting - run: npm run format:check + run: npm run e2e-format:check diff --git a/e2e/package.json b/e2e/package.json index 87f2525a3..bb82ee75b 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -6,7 +6,9 @@ "e2e-setup": "npx playwright install --with-deps", "e2e-show-report": "npx playwright show-report", "e2e-test": "./run-e2e-test", - "e2e-test:ui": "./run-e2e-test --ui" + "e2e-test:ui": "./run-e2e-test --ui", + "e2e-format": "prettier --write .", + "e2e-format:check": "prettier --check ." }, "devDependencies": { "@playwright/test": "^1.49.0", From a015322c28cf97f5119cee099960c1c468b475d9 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 17:47:59 -0800 Subject: [PATCH 04/24] add prettierignore --- e2e/.prettierignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 e2e/.prettierignore diff --git a/e2e/.prettierignore b/e2e/.prettierignore new file mode 100644 index 000000000..4e9d39031 --- /dev/null +++ b/e2e/.prettierignore @@ -0,0 +1 @@ +*-lock.json From d71e97f114e5b51e6120b6895de2decaedd572f1 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 17:48:07 -0800 Subject: [PATCH 05/24] format prettierrc --- e2e/.prettierrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/.prettierrc b/e2e/.prettierrc index c351c0a2c..1d296fb67 100644 --- a/e2e/.prettierrc +++ b/e2e/.prettierrc @@ -1,5 +1,5 @@ { - "semi": true, - "singleQuote": true, - "tabWidth": 2 - } + "semi": true, + "singleQuote": true, + "tabWidth": 2 +} From 6dabf01500d74ee95199b95cb9e49c9c13684161 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:16:21 -0800 Subject: [PATCH 06/24] add npm format scripts at top --- e2e/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index bb82ee75b..fd5c086dd 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -2,13 +2,13 @@ "name": "e2e", "version": "1.0.0", "scripts": { + "e2e-format": "prettier --write .", + "e2e-format:check": "prettier --check .", "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", "e2e-setup": "npx playwright install --with-deps", "e2e-show-report": "npx playwright show-report", "e2e-test": "./run-e2e-test", - "e2e-test:ui": "./run-e2e-test --ui", - "e2e-format": "prettier --write .", - "e2e-format:check": "prettier --check ." + "e2e-test:ui": "./run-e2e-test --ui" }, "devDependencies": { "@playwright/test": "^1.49.0", From 7d6ac45335b3550a1bdc21bde8b1395112580e7c Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:20:47 -0800 Subject: [PATCH 07/24] add e2e-install-ci-native make target --- .github/workflows/e2e-checks.yml | 2 +- Makefile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index cc7aa47dd..5b15a43e4 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -34,7 +34,7 @@ jobs: - name: Install dependencies if: steps.cache-node.outputs.cache-hit != 'true' - run: npm ci + run: make e2e-install-ci - name: Check formatting run: npm run e2e-format:check diff --git a/Makefile b/Makefile index 87e6cccfb..f87334a54 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,9 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/blob-report rm -rf ./e2e/test-results +e2e-install-ci-native: ## Install depencies natively + cd e2e && npm ci + e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report cd e2e && npm run e2e-merge-reports From a400cd08d6168cf37e1978e6b466e40ab4570caa Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:22:38 -0800 Subject: [PATCH 08/24] fix make target in workflow --- .github/workflows/e2e-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 5b15a43e4..2291d2e87 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -34,7 +34,7 @@ jobs: - name: Install dependencies if: steps.cache-node.outputs.cache-hit != 'true' - run: make e2e-install-ci + run: make e2e-install-ci-native - name: Check formatting run: npm run e2e-format:check From 334f1c1830172b60add6aaee861f9bd688025177 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:24:00 -0800 Subject: [PATCH 09/24] fix spacing in make command --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f87334a54..b2c498d64 100644 --- a/Makefile +++ b/Makefile @@ -95,8 +95,8 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/blob-report rm -rf ./e2e/test-results -e2e-install-ci-native: ## Install depencies natively - cd e2e && npm ci +e2e-install-ci-native: ## Install dependencies natively + cd e2e && npm ci e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report cd e2e && npm run e2e-merge-reports From 71fb9c5305c5773b6a3bc05bd6aeaeb9689a9599 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:26:28 -0800 Subject: [PATCH 10/24] use make cmd to cd into e2e --- .github/workflows/e2e-checks.yml | 2 +- Makefile | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 2291d2e87..4cc598acf 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -37,4 +37,4 @@ jobs: run: make e2e-install-ci-native - name: Check formatting - run: npm run e2e-format:check + run: make e2e-format-check-native diff --git a/Makefile b/Makefile index b2c498d64..b930dd247 100644 --- a/Makefile +++ b/Makefile @@ -95,6 +95,9 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/blob-report rm -rf ./e2e/test-results +e2e-format-check-native: ## Check formatting natively + cd e2e && npm run format:check + e2e-install-ci-native: ## Install dependencies natively cd e2e && npm ci From 5383fa8feacf677aa06630987d4baed40060865d Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:27:36 -0800 Subject: [PATCH 11/24] typo --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b930dd247..afa652065 100644 --- a/Makefile +++ b/Makefile @@ -96,7 +96,7 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/test-results e2e-format-check-native: ## Check formatting natively - cd e2e && npm run format:check + cd e2e && npm run e2e-format:check e2e-install-ci-native: ## Install dependencies natively cd e2e && npm ci From 50d85712e545b648dea49e74f79cedf691977d1a Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:30:50 -0800 Subject: [PATCH 12/24] prettier write --- e2e/package.json | 42 ++++++++++++++-------------- e2e/playwright.config.js | 27 +++++++++--------- e2e/util.js | 20 ++++++------- e2e/{{app_name}}/tests/index.spec.js | 5 ++-- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/e2e/package.json b/e2e/package.json index fd5c086dd..b4aa51f52 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -1,23 +1,23 @@ { - "name": "e2e", - "version": "1.0.0", - "scripts": { - "e2e-format": "prettier --write .", - "e2e-format:check": "prettier --check .", - "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", - "e2e-setup": "npx playwright install --with-deps", - "e2e-show-report": "npx playwright show-report", - "e2e-test": "./run-e2e-test", - "e2e-test:ui": "./run-e2e-test --ui" - }, - "devDependencies": { - "@playwright/test": "^1.49.0", - "@types/node": "^22.10.1", - "prettier": "^3.5.1" - }, - "dependencies": { - "@axe-core/playwright": "^4.10.1", - "dotenv": "^16.4.7", - "playwright": "^1.49.0" - } + "name": "e2e", + "version": "1.0.0", + "scripts": { + "e2e-format": "prettier --write .", + "e2e-format:check": "prettier --check .", + "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", + "e2e-setup": "npx playwright install --with-deps", + "e2e-show-report": "npx playwright show-report", + "e2e-test": "./run-e2e-test", + "e2e-test:ui": "./run-e2e-test --ui" + }, + "devDependencies": { + "@playwright/test": "^1.49.0", + "@types/node": "^22.10.1", + "prettier": "^3.5.1" + }, + "dependencies": { + "@axe-core/playwright": "^4.10.1", + "dotenv": "^16.4.7", + "playwright": "^1.49.0" + } } diff --git a/e2e/playwright.config.js b/e2e/playwright.config.js index aa0f3d02c..a691b85ad 100644 --- a/e2e/playwright.config.js +++ b/e2e/playwright.config.js @@ -1,7 +1,7 @@ // Load environment variables from .env file if it exists import * as dotenv from 'dotenv'; -import { defineConfig, devices } from "@playwright/test"; +import { defineConfig, devices } from '@playwright/test'; dotenv.config(); @@ -11,7 +11,7 @@ dotenv.config(); export default defineConfig({ // Timeout for each test in milliseconds timeout: 20000, - testDir: "./tests", // Ensure this points to the correct test directory + testDir: './tests', // Ensure this points to the correct test directory // Run tests in files in parallel fullyParallel: true, // Fail the build on CI if you accidentally left test.only in the source code. @@ -22,19 +22,19 @@ export default defineConfig({ workers: process.env.CI ? 1 : undefined, // Use 'blob' for CI to allow merging of reports. See https://playwright.dev/docs/test-reporters reporter: process.env.CI - ? [['blob']] : - // Don't open the HTML report since it hangs when running inside a container. - // Use make e2e-show-report for opening the HTML report - [['html', { open: 'never' }]], + ? [['blob']] + : // Don't open the HTML report since it hangs when running inside a container. + // Use make e2e-show-report for opening the HTML report + [['html', { open: 'never' }]], // Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. use: { // Base URL to use in actions like `await page.goto('/')`. baseURL: process.env.BASE_URL, // Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer - trace: "on-first-retry", - screenshot: "on", - video: "on-first-retry", + trace: 'on-first-retry', + screenshot: 'on', + video: 'on-first-retry', }, // Splits tests into chunks for distributed parallel execution shard: { @@ -48,15 +48,14 @@ export default defineConfig({ // Supported browsers: https://playwright.dev/docs/browsers#:~:text=Configure%20Browsers%E2%80%8B,Google%20Chrome%20and%20Microsoft%20Edge. projects: [ { - name: "chromium", - use: { ...devices["Desktop Chrome"] }, + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, }, // Test against mobile viewports. { - name: "Mobile Chrome", - use: { ...devices["Pixel 7"] }, + name: 'Mobile Chrome', + use: { ...devices['Pixel 7'] }, }, ], - }); diff --git a/e2e/util.js b/e2e/util.js index c1d2e62af..46079570d 100644 --- a/e2e/util.js +++ b/e2e/util.js @@ -1,16 +1,16 @@ // Merge a base and derived config export function deepMerge(obj1, obj2) { - const result = { ...obj1 }; + const result = { ...obj1 }; - for (let key in obj2) { - if (obj2.hasOwnProperty(key)) { - if (obj2[key] instanceof Object && obj1[key] instanceof Object) { - result[key] = deepMerge(obj1[key], obj2[key]); - } else { - result[key] = obj2[key]; - } + for (let key in obj2) { + if (obj2.hasOwnProperty(key)) { + if (obj2[key] instanceof Object && obj1[key] instanceof Object) { + result[key] = deepMerge(obj1[key], obj2[key]); + } else { + result[key] = obj2[key]; } } - - return result; } + + return result; +} diff --git a/e2e/{{app_name}}/tests/index.spec.js b/e2e/{{app_name}}/tests/index.spec.js index 51c07df4f..7bb6d74b7 100644 --- a/e2e/{{app_name}}/tests/index.spec.js +++ b/e2e/{{app_name}}/tests/index.spec.js @@ -15,7 +15,9 @@ test.describe('Generic Webpage Tests', () => { }); // https://playwright.dev/docs/accessibility-testing - test('should not have any automatically detectable accessibility issues', async ({ page }) => { + test('should not have any automatically detectable accessibility issues', async ({ + page, + }) => { await page.goto('/'); const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); expect(accessibilityScanResults.violations).toEqual([]); @@ -27,5 +29,4 @@ test.describe('Generic Webpage Tests', () => { // const element = page.locator('h1'); // await expect(element).toBeVisible(); // }); - }); From 915cb31bf94609d33d3c1dd36be3a8373f136191 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:32:36 -0800 Subject: [PATCH 13/24] add 4 format make commands --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index afa652065..6f078eda0 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,16 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/blob-report rm -rf ./e2e/test-results -e2e-format-check-native: ## Check formatting natively +e2e-format: ## Format code with autofix inside Docker + docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format" + +e2e-format-native: ## Format code with autofix natively + cd e2e && npm run e2e-format + +e2e-format-check: ## Format check without autofix inside Docker + docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format:check" + +e2e-format-check-native: ## Format check without autofix natively cd e2e && npm run e2e-format:check e2e-install-ci-native: ## Install dependencies natively From db5d0b987f31e506863caf0c044ead1154b41013 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:39:28 -0800 Subject: [PATCH 14/24] alphabetize make targets --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6f078eda0..1560379b9 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,11 @@ __check_defined = \ e2e-clean \ e2e-clean-image \ e2e-clean-report \ + e2e-format \ + e2e-format-check \ + e2e-format-check-native \ + e2e-format-native \ + e2e-install-ci-native \ e2e-merge-reports \ e2e-setup-ci \ e2e-setup-native \ @@ -98,15 +103,15 @@ e2e-clean-report: ## Remove the local e2e report folders and content e2e-format: ## Format code with autofix inside Docker docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format" -e2e-format-native: ## Format code with autofix natively - cd e2e && npm run e2e-format - e2e-format-check: ## Format check without autofix inside Docker docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format:check" e2e-format-check-native: ## Format check without autofix natively cd e2e && npm run e2e-format:check +e2e-format-native: ## Format code with autofix natively + cd e2e && npm run e2e-format + e2e-install-ci-native: ## Install dependencies natively cd e2e && npm ci From 8903de16ed5c34adedaec1b68048105cff221599 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:42:18 -0800 Subject: [PATCH 15/24] add variable for node image --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1560379b9..7100a95ee 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,9 @@ __check_defined = \ # The e2e test image includes the test suite for all apps and therefore isn't specific to each app. E2E_IMAGE_NAME := $(PROJECT_ROOT)-e2e +# Define Node.js Docker image to use for e2e commands +E2E_NODE_IMAGE := node:22-alpine + e2e-build: ## Build the e2e Docker image, if not already built, using ./e2e/Dockerfile docker build -t $(E2E_IMAGE_NAME) -f ./e2e/Dockerfile . @@ -101,10 +104,10 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/test-results e2e-format: ## Format code with autofix inside Docker - docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format" + docker run --rm -v $(PWD)/e2e:/e2e $(E2E_NODE_IMAGE) sh -c "cd /e2e && npm run e2e-format" e2e-format-check: ## Format check without autofix inside Docker - docker run --rm -v $(PWD)/e2e:/e2e node:22-alpine sh -c "cd /e2e && npm run e2e-format:check" + docker run --rm -v $(PWD)/e2e:/e2e $(E2E_NODE_IMAGE) sh -c "cd /e2e && npm run e2e-format:check" e2e-format-check-native: ## Format check without autofix natively cd e2e && npm run e2e-format:check From 87643fc82aaa2e80d75cbabacf630900cc2386de Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:50:27 -0800 Subject: [PATCH 16/24] use prettier cache --- e2e/.gitignore | 1 + e2e/package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e/.gitignore b/e2e/.gitignore index 68f91e367..1ed6dbac6 100644 --- a/e2e/.gitignore +++ b/e2e/.gitignore @@ -4,3 +4,4 @@ node_modules/ /blob-report/ /playwright/.cache/ *.png* +.prettier-cache diff --git a/e2e/package.json b/e2e/package.json index b4aa51f52..25d5e2c70 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -2,8 +2,8 @@ "name": "e2e", "version": "1.0.0", "scripts": { - "e2e-format": "prettier --write .", - "e2e-format:check": "prettier --check .", + "e2e-format": "prettier --cache --cache-location='./.prettier-cache' --write '**/*.{js,json,md,mdx,ts,tsx,scss,yaml,yml}'", + "e2e-format:check": "prettier --cache --cache-location='./.prettier-cache' --check '**/*.{js,json,md,mdx,ts,tsx,scss,yaml,yml}'", "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", "e2e-setup": "npx playwright install --with-deps", "e2e-show-report": "npx playwright show-report", From 3bbc77825a319ba1555df690e5a1c55f938be7d7 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:50:34 -0800 Subject: [PATCH 17/24] update name --- .github/workflows/e2e-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 4cc598acf..9eda9b952 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -13,7 +13,7 @@ on: jobs: quality: - name: Code Quality + name: E2E Code Quality runs-on: ubuntu-latest steps: From 8ae2d1391b06c190f5040497c6580c2e2a9c58f1 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 18:58:32 -0800 Subject: [PATCH 18/24] rename make target --- .github/workflows/e2e-checks.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 9eda9b952..5767a0b3f 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -34,7 +34,7 @@ jobs: - name: Install dependencies if: steps.cache-node.outputs.cache-hit != 'true' - run: make e2e-install-ci-native + run: make e2e-install-ci - name: Check formatting run: make e2e-format-check-native diff --git a/Makefile b/Makefile index 7100a95ee..df4c5e979 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ e2e-format-check-native: ## Format check without autofix natively e2e-format-native: ## Format code with autofix natively cd e2e && npm run e2e-format -e2e-install-ci-native: ## Install dependencies natively +e2e-install-ci ## CI install dependencies cd e2e && npm ci e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report From a8fe9e88ab7ef76297992a91a583f7e24ef58fd9 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 19:00:37 -0800 Subject: [PATCH 19/24] fix colon typo on make target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index df4c5e979..83228aa11 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ e2e-format-check-native: ## Format check without autofix natively e2e-format-native: ## Format code with autofix natively cd e2e && npm run e2e-format -e2e-install-ci ## CI install dependencies +e2e-install-ci: ## CI install dependencies cd e2e && npm ci e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report From c2c13ddeab095dfaba71135ececfe1f65e6fb72d Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 19:06:03 -0800 Subject: [PATCH 20/24] fix workflow path --- .github/workflows/e2e-checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e-checks.yml b/.github/workflows/e2e-checks.yml index 5767a0b3f..0163a1610 100644 --- a/.github/workflows/e2e-checks.yml +++ b/.github/workflows/e2e-checks.yml @@ -29,7 +29,7 @@ jobs: id: cache-node uses: actions/cache@v4 with: - path: node_modules + path: e2e/node_modules key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - name: Install dependencies From ff13ffcd9639202633b882b7eaa997cf6ea0ebcd Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Thu, 13 Feb 2025 19:07:14 -0800 Subject: [PATCH 21/24] use standard prettier config --- e2e/.prettierrc | 4 +++- e2e/{{app_name}}/tests/index.spec.js | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/.prettierrc b/e2e/.prettierrc index 1d296fb67..1f4c4bbc4 100644 --- a/e2e/.prettierrc +++ b/e2e/.prettierrc @@ -1,5 +1,7 @@ { "semi": true, "singleQuote": true, - "tabWidth": 2 + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 100 } diff --git a/e2e/{{app_name}}/tests/index.spec.js b/e2e/{{app_name}}/tests/index.spec.js index 7bb6d74b7..f0e43064e 100644 --- a/e2e/{{app_name}}/tests/index.spec.js +++ b/e2e/{{app_name}}/tests/index.spec.js @@ -15,9 +15,7 @@ test.describe('Generic Webpage Tests', () => { }); // https://playwright.dev/docs/accessibility-testing - test('should not have any automatically detectable accessibility issues', async ({ - page, - }) => { + test('should not have any automatically detectable accessibility issues', async ({ page }) => { await page.goto('/'); const accessibilityScanResults = await new AxeBuilder({ page }).analyze(); expect(accessibilityScanResults.violations).toEqual([]); From 64a1ed74f781d443ff859641667e4d3247f5240c Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Mon, 24 Feb 2025 15:37:03 -0800 Subject: [PATCH 22/24] update prettier config with override filetypes --- e2e/.prettierrc | 28 +++++++++++++++++++++++----- e2e/package.json | 4 ++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/e2e/.prettierrc b/e2e/.prettierrc index 1f4c4bbc4..4e1593a58 100644 --- a/e2e/.prettierrc +++ b/e2e/.prettierrc @@ -1,7 +1,25 @@ { - "semi": true, - "singleQuote": true, - "tabWidth": 2, - "trailingComma": "es5", - "printWidth": 100 + "overrides": [ + { + "files": [ + "*.js", + "*.jsx", + "*.ts", + "*.tsx", + "*.json", + "*.md", + "*.mdx", + "*.scss", + "*.yaml", + "*.yml" + ], + "options": { + "semi": true, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "printWidth": 100 + } + } + ] } diff --git a/e2e/package.json b/e2e/package.json index 25d5e2c70..e3e8e0080 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -2,8 +2,8 @@ "name": "e2e", "version": "1.0.0", "scripts": { - "e2e-format": "prettier --cache --cache-location='./.prettier-cache' --write '**/*.{js,json,md,mdx,ts,tsx,scss,yaml,yml}'", - "e2e-format:check": "prettier --cache --cache-location='./.prettier-cache' --check '**/*.{js,json,md,mdx,ts,tsx,scss,yaml,yml}'", + "e2e-format": "prettier --cache --cache-location='./.prettier-cache' --write .", + "e2e-format:check": "prettier --cache --cache-location='./.prettier-cache' --check .", "e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report", "e2e-setup": "npx playwright install --with-deps", "e2e-show-report": "npx playwright show-report", From 4a17dd90eacc6eff3c0dda900fff5326892bab7b Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Mon, 24 Feb 2025 16:22:33 -0800 Subject: [PATCH 23/24] remove entrypoint and use CMD --- e2e/Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/e2e/Dockerfile b/e2e/Dockerfile index 6c96f2bc8..6b2cd9668 100644 --- a/e2e/Dockerfile +++ b/e2e/Dockerfile @@ -17,7 +17,4 @@ RUN npm run e2e-setup # Copy entire e2e folder over COPY e2e /e2e -ENTRYPOINT ["npm", "run", "e2e-test", "--"] - -# Optional additional args -CMD [""] +CMD ["npm", "run", "e2e-test"] From 4ea9cf7690a5d50cb7fa9ccdf8005b5a030900c8 Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Mon, 24 Feb 2025 16:26:50 -0800 Subject: [PATCH 24/24] remove E2E_NODE_IMAGE --- Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 83228aa11..0a891afc9 100644 --- a/Makefile +++ b/Makefile @@ -86,9 +86,6 @@ __check_defined = \ # The e2e test image includes the test suite for all apps and therefore isn't specific to each app. E2E_IMAGE_NAME := $(PROJECT_ROOT)-e2e -# Define Node.js Docker image to use for e2e commands -E2E_NODE_IMAGE := node:22-alpine - e2e-build: ## Build the e2e Docker image, if not already built, using ./e2e/Dockerfile docker build -t $(E2E_IMAGE_NAME) -f ./e2e/Dockerfile . @@ -103,8 +100,8 @@ e2e-clean-report: ## Remove the local e2e report folders and content rm -rf ./e2e/blob-report rm -rf ./e2e/test-results -e2e-format: ## Format code with autofix inside Docker - docker run --rm -v $(PWD)/e2e:/e2e $(E2E_NODE_IMAGE) sh -c "cd /e2e && npm run e2e-format" +e2e-format: e2e-build ## Format code with autofix inside Docker + docker run --rm -v e2e:/e2e $(E2E_IMAGE_NAME) npm run e2e-format e2e-format-check: ## Format check without autofix inside Docker docker run --rm -v $(PWD)/e2e:/e2e $(E2E_NODE_IMAGE) sh -c "cd /e2e && npm run e2e-format:check" @@ -142,10 +139,10 @@ e2e-test: e2e-build -e CURRENT_SHARD=$(CURRENT_SHARD) \ -e TOTAL_SHARDS=$(TOTAL_SHARDS) \ -e CI=$(CI) \ - -v $(PWD)/e2e/playwright-report:/e2e/playwright-report \ - -v $(PWD)/e2e/blob-report:/e2e/blob-report \ + -v e2e/playwright-report:/e2e/playwright-report \ + -v e2e/blob-report:/e2e/blob-report \ $(E2E_IMAGE_NAME) \ - $(E2E_ARGS) + npm run e2e-test -- $(E2E_ARGS) @echo "Run 'make e2e-show-report' to view the test report" e2e-test-native: ## Run end-to-end tests natively