From 80ee7b1e2b5783d3b77d3502f99eceffc1696df4 Mon Sep 17 00:00:00 2001 From: Artem Sorokin <38620398+seemewalkin@users.noreply.github.com> Date: Thu, 18 Dec 2025 18:51:51 +0100 Subject: [PATCH] test: Rename Playwright project names from ui to e2e (#23423) --- .github/workflows/playwright-test-ci.yml | 10 ++++----- packages/testing/playwright/CONTRIBUTING.md | 14 ++++++------ packages/testing/playwright/README.md | 6 ++--- packages/testing/playwright/package.json | 22 +++++++++---------- .../testing/playwright/playwright-projects.ts | 10 ++++----- .../playwright/scripts/coverage-workflow.md | 14 ++++++------ .../scripts/generate-coverage-report.js | 18 +++++++-------- 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/.github/workflows/playwright-test-ci.yml b/.github/workflows/playwright-test-ci.yml index 33b5b4129b1..eee7a936066 100644 --- a/.github/workflows/playwright-test-ci.yml +++ b/.github/workflows/playwright-test-ci.yml @@ -13,14 +13,14 @@ jobs: # Multi-main: postgres + redis + caddy + 2 mains + 1 worker # Only runs for internal PRs (not community/fork PRs) # Builds Docker images locally per shard for faster parallel execution - multi-main-ui: - name: 'Multi-Main: UI' + multi-main-e2e: + name: 'Multi-Main: E2E' if: ${{ !github.event.pull_request.head.repo.fork }} uses: ./.github/workflows/playwright-test-reusable.yml with: branch: ${{ inputs.branch }} test-mode: docker-build - test-command: pnpm --filter=n8n-playwright test:container:multi-main:ui + test-command: pnpm --filter=n8n-playwright test:container:multi-main:e2e shards: '[1, 2, 3, 4, 5, 6, 7, 8]' runner: blacksmith-4vcpu-ubuntu-2204 workers: '1' @@ -41,8 +41,8 @@ jobs: # Community PR tests: Local mode with SQLite (no container building, no secrets required) # Runs on GitHub-hosted runners without Currents reporting - community-ui: - name: 'Community: UI' + community-e2e: + name: 'Community: E2E' if: ${{ github.event.pull_request.head.repo.fork }} uses: ./.github/workflows/playwright-test-reusable.yml with: diff --git a/packages/testing/playwright/CONTRIBUTING.md b/packages/testing/playwright/CONTRIBUTING.md index 2ce83b75738..475a5d37116 100644 --- a/packages/testing/playwright/CONTRIBUTING.md +++ b/packages/testing/playwright/CONTRIBUTING.md @@ -227,7 +227,7 @@ tests/ |------|---------|---------| | **Page Objects** | `{PageName}Page.ts` | `CredentialsPage.ts` | | **Composables** | `{Domain}Composer.ts` | `WorkflowComposer.ts` | -| **Test Files** | `{number}-{feature}.spec.ts` | `1-workflows.spec.ts` | +| **Test Files** | `{feature}.spec.ts` | `workflows.spec.ts` | | **Test IDs** | `kebab-case` | `data-test-id="save-button"` | --- @@ -302,9 +302,9 @@ export class ProjectComposer { ### When Writing Tests -#### UI Tests +#### E2E Tests ```typescript -// ✅ GOOD: From 1-workflows.spec.ts +// ✅ GOOD: From workflows/list/workflows.spec.ts test('should create a new workflow using add workflow button', async ({ n8n }) => { await n8n.workflows.clickAddWorklowButton(); @@ -317,7 +317,7 @@ test('should create a new workflow using add workflow button', async ({ n8n }) = ).toBeVisible(); }); -// ✅ GOOD: From 28-debug.spec.ts - Using helper functions +// ✅ GOOD: From workflows/editor/execution/debug.spec.ts - Using helper functions async function createBasicWorkflow(n8n, url = URLS.FAILING) { await n8n.workflows.clickAddWorklowButton(); await n8n.canvas.addNode('Manual Trigger'); @@ -411,7 +411,7 @@ export const CODE_NODE_NAME = 'Code'; export const SET_NODE_NAME = 'Set'; export const HTTP_REQUEST_NODE_NAME = 'HTTP Request'; -// From 28-debug.spec.ts +// From workflows/editor/execution/debug.spec.ts const NOTIFICATIONS = { WORKFLOW_CREATED: 'Workflow successfully created', EXECUTION_IMPORTED: 'Execution data imported', @@ -477,7 +477,7 @@ async clickArchiveMenuItem() { ### ❌ Don't Use Raw Selectors in Tests ```typescript -// BAD: From 1-workflows.spec.ts +// BAD: From workflows/list/workflows.spec.ts await expect(n8n.page.getByText('No workflows found')).toBeVisible(); // GOOD: Add getter to page object @@ -552,7 +552,7 @@ export class ProjectComposer { } } -// 3. Test (39-projects.spec.ts) +// 3. Test (projects/projects.spec.ts) test('should filter credentials by project ID', async ({ n8n, api }) => { const { projectName, projectId } = await n8n.projectComposer.createProject(); await n8n.projectComposer.addCredentialToProject( diff --git a/packages/testing/playwright/README.md b/packages/testing/playwright/README.md index 12c0c2b95e4..55b8b24b0a4 100644 --- a/packages/testing/playwright/README.md +++ b/packages/testing/playwright/README.md @@ -9,8 +9,8 @@ pnpm build:docker # from root first to test against local changes ## Quick Start ```bash pnpm test:all # Run all tests (fresh containers, pnpm build:docker from root first to ensure local containers) -pnpm test:local # Starts a local server and runs the UI tests -N8N_BASE_URL=localhost:5068 pnpm test:local # Runs the UI tests against the instance running +pnpm test:local # Starts a local server and runs the E2E tests +N8N_BASE_URL=localhost:5068 pnpm test:local # Runs the E2E tests against the instance running ``` ## Separate Backend and Frontend URLs @@ -43,7 +43,7 @@ pnpm test:chaos # Runs the chaos tests # Development -pnpm test:all --grep "workflow" # Pattern match, can run across all test types UI/cli-workflow/performance +pnpm test:all --grep "workflow" # Pattern match, can run across all test types E2E/cli-workflow/performance pnpm test:local --ui # To enable UI debugging and test running mode ``` diff --git a/packages/testing/playwright/package.json b/packages/testing/playwright/package.json index 4fafd7aa435..cb4986b3d29 100644 --- a/packages/testing/playwright/package.json +++ b/packages/testing/playwright/package.json @@ -2,24 +2,24 @@ "name": "n8n-playwright", "private": true, "scripts": { - "dev": "N8N_BASE_URL=http://localhost:5678 N8N_EDITOR_URL=http://localhost:8080 RESET_E2E_DB=true playwright test --project=ui --project=ui:isolated", + "dev": "N8N_BASE_URL=http://localhost:5678 N8N_EDITOR_URL=http://localhost:8080 RESET_E2E_DB=true playwright test --project=e2e --project=e2e:isolated", "test:all": "playwright test", - "test:local": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=ui --project=ui:isolated", - "test:local:ui-only": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=ui", - "test:local:isolated": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=ui:isolated", - "test:ui": "playwright test --project=*ui*", + "test:local": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=e2e --project=e2e:isolated", + "test:local:e2e-only": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=e2e", + "test:local:isolated": "N8N_BASE_URL=http://localhost:5680 RESET_E2E_DB=true playwright test --project=e2e:isolated", + "test:e2e": "playwright test --project=*e2e*", "test:performance": "playwright test --project=performance", "test:chaos": "playwright test --project='*:chaos'", "test:container:standard": "playwright test --project='standard:*'", - "test:container:standard:ui": "playwright test --project='standard:ui'", - "test:container:standard:isolated": "playwright test --project='standard:ui:isolated'", + "test:container:standard:e2e": "playwright test --project='standard:e2e'", + "test:container:standard:isolated": "playwright test --project='standard:e2e:isolated'", "test:container:postgres": "playwright test --project='postgres:*'", "test:container:queue": "playwright test --project='queue:*'", - "test:container:queue:ui-only": "playwright test --project='queue:ui'", - "test:container:queue:isolated": "playwright test --project='queue:ui:isolated'", + "test:container:queue:e2e-only": "playwright test --project='queue:e2e'", + "test:container:queue:isolated": "playwright test --project='queue:e2e:isolated'", "test:container:multi-main": "playwright test --project='multi-main:*'", - "test:container:multi-main:ui": "playwright test --project='multi-main:ui'", - "test:container:multi-main:isolated": "playwright test --project='multi-main:ui:isolated'", + "test:container:multi-main:e2e": "playwright test --project='multi-main:e2e'", + "test:container:multi-main:isolated": "playwright test --project='multi-main:e2e:isolated'", "test:container:trial": "playwright test --project='trial:*'", "test:workflows:setup": "tsx ./tests/cli-workflows/setup-workflow-tests.ts", "test:workflows": "playwright test --project=cli-workflows", diff --git a/packages/testing/playwright/playwright-projects.ts b/packages/testing/playwright/playwright-projects.ts index c4df768a2ea..de0216f41c0 100644 --- a/packages/testing/playwright/playwright-projects.ts +++ b/packages/testing/playwright/playwright-projects.ts @@ -18,7 +18,7 @@ const CONTAINER_ONLY_TAGS = [ const CONTAINER_ONLY = new RegExp(`@capability:(${CONTAINER_ONLY_TAGS.join('|')})`); // Tags that need serial execution -// These tests will be run AFTER the first run of the UI tests +// These tests will be run AFTER the first run of the E2E tests // In local run they are a "dependency" which means they will be skipped if earlier tests fail, not ideal but needed for isolation const SERIAL_EXECUTION = /@db:reset/; @@ -40,7 +40,7 @@ export function getProjects(): Project[] { if (isLocal) { projects.push( { - name: 'ui', + name: 'e2e', testDir: './tests/e2e', grepInvert: new RegExp( [CONTAINER_ONLY.source, SERIAL_EXECUTION.source, ISOLATED_ONLY.source].join('|'), @@ -49,7 +49,7 @@ export function getProjects(): Project[] { use: { baseURL: getFrontendUrl() }, }, { - name: 'ui:isolated', + name: 'e2e:isolated', testDir: './tests/e2e', grep: new RegExp([SERIAL_EXECUTION.source, ISOLATED_ONLY.source].join('|')), workers: 1, @@ -61,7 +61,7 @@ export function getProjects(): Project[] { const grepInvertPatterns = [SERIAL_EXECUTION.source, ISOLATED_ONLY.source]; projects.push( { - name: `${name}:ui`, + name: `${name}:e2e`, testDir: './tests/e2e', grepInvert: new RegExp(grepInvertPatterns.join('|')), timeout: name === 'standard' ? 60000 : 180000, // 60 seconds for standard container test, 180 for containers to allow startup etc @@ -69,7 +69,7 @@ export function getProjects(): Project[] { use: { containerConfig: config }, }, { - name: `${name}:ui:isolated`, + name: `${name}:e2e:isolated`, testDir: './tests/e2e', grep: new RegExp([SERIAL_EXECUTION.source, ISOLATED_ONLY.source].join('|')), workers: 1, diff --git a/packages/testing/playwright/scripts/coverage-workflow.md b/packages/testing/playwright/scripts/coverage-workflow.md index b6ffc75a98d..7a15e22fb89 100644 --- a/packages/testing/playwright/scripts/coverage-workflow.md +++ b/packages/testing/playwright/scripts/coverage-workflow.md @@ -34,8 +34,8 @@ Run your Playwright tests with coverage collection enabled: # From the playwright package directory cd packages/testing/playwright -# Run UI tests -pnpm test:ui +# Run E2E tests +pnpm test:e2e ``` @@ -89,8 +89,8 @@ If you see "No coverage files found": 1. Build with coverage: `BUILD_WITH_COVERAGE=true pnpm build` or `pnpm build:docker:coverage` 2. Run tests with coverage enabled: `BUILD_WITH_COVERAGE=true pnpm test:container:standard` 3. Check that coverage files exist in `.nyc_output/{projectName}/` directories - - For local mode: `.nyc_output/ui/` - - For container mode: `.nyc_output/standard:ui/`, `.nyc_output/standard:ui:isolated/`, etc. + - For local mode: `.nyc_output/e2e/` + - For container mode: `.nyc_output/standard:e2e/`, `.nyc_output/standard:e2e:isolated/`, etc. ### Low Coverage Percentage @@ -160,9 +160,9 @@ packages/testing/playwright/ │ ├── base.css # Report styling │ └── ... # Individual file reports ├── .nyc_output/ # Raw coverage data (per project) -│ ├── ui/ # Local mode coverage -│ ├── standard:ui/ # Container mode coverage -│ ├── standard:ui:isolated/ +│ ├── e2e/ # Local mode coverage +│ ├── standard:e2e/ # Container mode coverage +│ ├── standard:e2e:isolated/ │ └── out.json # Merged coverage data ├── nyc.config.ts # NYC configuration └── scripts/ diff --git a/packages/testing/playwright/scripts/generate-coverage-report.js b/packages/testing/playwright/scripts/generate-coverage-report.js index 8b993a1915e..6e00e5b2575 100755 --- a/packages/testing/playwright/scripts/generate-coverage-report.js +++ b/packages/testing/playwright/scripts/generate-coverage-report.js @@ -15,15 +15,15 @@ const NYC_CONFIG = path.join(__dirname, '..', 'nyc.config.ts'); // Coverage directories to look for - Currents writes to .nyc_output/{projectName}/ // Project names come from playwright-projects.ts const COVERAGE_PROJECT_PATTERNS = [ - 'ui', // Local mode project - 'standard:ui', // Container mode projects - 'standard:ui:isolated', - 'postgres:ui', - 'postgres:ui:isolated', - 'queue:ui', - 'queue:ui:isolated', - 'multi-main:ui', - 'multi-main:ui:isolated', + 'e2e', // Local mode project + 'standard:e2e', // Container mode projects + 'standard:e2e:isolated', + 'postgres:e2e', + 'postgres:e2e:isolated', + 'queue:e2e', + 'queue:e2e:isolated', + 'multi-main:e2e', + 'multi-main:e2e:isolated', ]; /**