Skip to content

Commit

Permalink
refactor: simplify e2e tests
Browse files Browse the repository at this point in the history
- Run Drupal and Decap tests in one go
- Make the test package depend on relevant apps (instead of previous turborepo setup)
  • Loading branch information
Leksat committed Dec 16, 2024
1 parent 5c44485 commit b5f42a4
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 97 deletions.
7 changes: 0 additions & 7 deletions apps/cms/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@
"!web/themes/custom/**",
"!web/sites/default/files/**"
]
},
"test:integration": {
"dependsOn": [
"prep",
"@custom-tests/e2e#test:integration:drupal",
"@custom-tests/schema#test:integration"
]
}
}
}
3 changes: 0 additions & 3 deletions apps/decap/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
},
"prep": {
"dependsOn": ["prep:vite", "prep:scripts"]
},
"test:integration": {
"dependsOn": ["@custom-tests/e2e#test:integration:decap"]
}
}
}
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions tests/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"name": "@custom-tests/e2e",
"version": "1.0.0",
"description": "",
"keywords": [],
"author": "",
"license": "ISC",
"type": "module",
"scripts": {
"test:static": "tsc --noEmit && eslint . --quiet",
"test:integration:drupal": "playwright install chromium && playwright test --config playwright.config.drupal.ts",
"test:integration:decap": "playwright install chromium && playwright test --config playwright.config.decap.ts",
"test:headed:drupal": "playwright install chromium && playwright test --headed --config playwright.config.drupal.ts",
"test:headed:decap": "playwright install chromium && playwright test --headed --config playwright.config.decap.ts",
"dev:decap": "playwright install chromium && playwright test --ui --config playwright.config.decap.ts",
"dev:drupal": "playwright install chromium && playwright test --ui --config playwright.config.drupal.ts"
"test:integration": "playwright install chromium && playwright test",
"test:headed": "playwright install chromium && playwright test --headed",
"dev": "playwright install chromium && playwright test --ui"
},
"devDependencies": {
"@custom/cms": "workspace:*",
"@custom/decap": "workspace:*",
"@custom/eslint-config": "workspace:*",
"@custom/preview": "workspace:*",
"@custom/website": "workspace:*",
"@playwright/test": "^1.44.1",
"@types/node": "^18",
"typescript": "^5.3.3"
Expand Down
28 changes: 0 additions & 28 deletions tests/e2e/playwright.config.decap.ts

This file was deleted.

12 changes: 0 additions & 12 deletions tests/e2e/playwright.config.default.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { defineConfig, devices } from '@playwright/test';

import defaults from './playwright.config.default';

export default defineConfig({
...defaults,
testDir: './specs/drupal',
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: 'html',
use: {
trace: process.env.CI ? 'retain-on-failure' : 'on',
actionTimeout: 10_000,
},
testDir: './specs',
webServer: [
{
command: 'pnpm run --filter "@custom/cms" start >> /tmp/cms.log 2>&1',
Expand All @@ -27,7 +32,7 @@ export default defineConfig({
projects: [
{
name: 'setup',
testMatch: /drupal\/setup\.ts/,
testMatch: /setup\.ts/,
},
{
name: 'chromium',
Expand Down
12 changes: 0 additions & 12 deletions tests/e2e/specs/decap/setup.ts

This file was deleted.

4 changes: 2 additions & 2 deletions tests/e2e/specs/drupal/setup.ts → tests/e2e/specs/setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { expect, test as setup } from '@playwright/test';

import { cmsUrl } from '../../helpers/url';
import { cmsUrl } from '../helpers/url';
import {
netlifyBootTimeout,
waitForNetlifyBoot,
} from '../../helpers/wait-for-netlify-boot';
} from '../helpers/wait-for-netlify-boot';

setup.setTimeout(netlifyBootTimeout + 30_000);

Expand Down
19 changes: 2 additions & 17 deletions tests/e2e/turbo.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
{
"extends": ["//"],
"tasks": {
"test:integration:decap": {
"dependsOn": ["@custom/website#build"],
"env": ["PLAYWRIGHT_WEBSITE_URL"],
"inputs": [
"helpers/**",
"specs/decap/**",
"playwright.config.decap.ts",
"playwright.config.default.ts"
]
},
"test:integration:drupal": {
"test:integration": {
"dependsOn": ["@custom/website#build"],
"env": ["PLAYWRIGHT_WEBSITE_URL", "PLAYWRIGHT_CMS_URL"],
"inputs": [
"helpers/**",
"specs/drupal/**",
"playwright.config.drupal.ts",
"playwright.config.default.ts"
]
"inputs": ["helpers/**", "specs/**", "playwright.config.ts"]
}
}
}

0 comments on commit b5f42a4

Please sign in to comment.