diff --git a/CLAUDE.md b/CLAUDE.md index 58729c782..879ecb07c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -52,11 +52,9 @@ npm run test:file - Unit tests: `npm test` - Uses Jasmine/Karma, tests are co-located with source files (`.spec.ts`) - E2E tests: `npm run e2e` - Uses Nightwatch, located in `/e2e/src/` - Playwright E2E tests: Located in `/e2e-playwright/` - - `npm run e2e:playwright` - Run all Playwright tests - - `npm run e2e:playwright:quick` - Run tests with minimal output (faster debugging) - - `npm run e2e:playwright:summary` - Show concise test summary after run - - `npm run e2e:playwright:failures` - Show only failing tests - - `npm run e2e:playwright:file ` - Run a single test file (e.g., `npm run e2e:playwright:file tests/work-view/work-view.spec.ts`) + - `npm run e2e:playwright` - Run all tests with minimal output (shows failures clearly) + - `npm run e2e:playwright:file ` - Run a single test file with detailed output + - Example: `npm run e2e:playwright:file tests/work-view/work-view.spec.ts` - Linting: `npm run lint` - ESLint for TypeScript, Stylelint for SCSS ## Architecture Overview diff --git a/e2e-playwright/playwright.config.minimal.ts b/e2e-playwright/playwright.config.minimal.ts deleted file mode 100644 index 08d460e4c..000000000 --- a/e2e-playwright/playwright.config.minimal.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { defineConfig } from '@playwright/test'; -import baseConfig from './playwright.config'; - -/** - * Minimal config for quick test runs with minimal output - */ -export default defineConfig({ - ...baseConfig, - - // Faster timeout for quicker failures - timeout: 10 * 1000, - - // Minimal reporter - only show failures - reporter: [['line']], - - // No retries for faster results - retries: 0, - - // Disable videos and traces for speed - use: { - ...baseConfig.use, - trace: 'off', - screenshot: 'only-on-failure', - video: 'off', - }, - - // Disable parallel execution for cleaner output - workers: 1, -}); diff --git a/e2e-playwright/playwright.config.ts b/e2e-playwright/playwright.config.ts index 85622f53b..69ac7a499 100644 --- a/e2e-playwright/playwright.config.ts +++ b/e2e-playwright/playwright.config.ts @@ -24,10 +24,7 @@ export default defineConfig({ ], ['junit', { outputFile: '../.tmp/e2e-test-results/results.xml' }], ] - : [ - ['list', { printSteps: false }], - ['json', { outputFile: 'test-results.json' }], - ], + : 'line', /* 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('/')`. */ diff --git a/package.json b/package.json index f7bfcc600..79b9f969e 100644 --- a/package.json +++ b/package.json @@ -56,15 +56,12 @@ "e2e": "cross-env WEBDAV_DATA_DIR=./e2e-webdav-data docker compose up -d webdav && TZ='Europe/Berlin' DETECT_CHROMEDRIVER_VERSION=true SKIP_POST_INSTALL=true npm i -D chromedriver --legacy-peer-deps && tsc --project e2e/tsconfig.e2e.json && start-server-and-test 'ng serve --no-live-reload' http://localhost:4200 'nightwatch -c ./e2e/nightwatch.conf.js --suiteRetries 1 --retries 1'", "e2e:tag": "killall chromedriver; rm -R ./.tmp/out-tsc; tsc --project e2e/tsconfig.e2e.json && nightwatch -c ./e2e/nightwatch.conf.js --suiteRetries 0 --retries 0 --tag ", "e2e:webdav": "WEBDAV_DATA_DIR=./e2e-webdav-data docker compose up -d webdav && sleep 5 && npm run e2e:tag webdav; docker compose down", - "e2e:playwright": "cd e2e-playwright && npx playwright test", + "e2e:playwright": "cd e2e-playwright && npx playwright test --reporter=line", "e2e:playwright:ui": "cd e2e-playwright && npx playwright test --ui", + "e2e:playwright:file": "cd e2e-playwright && npx playwright test --reporter=list", "e2e:playwright:debug": "cd e2e-playwright && npx playwright test --debug", "e2e:playwright:headed": "cd e2e-playwright && npx playwright test --headed", "e2e:playwright:report": "cd e2e-playwright && npx playwright show-report", - "e2e:playwright:failures": "cd e2e-playwright && npx playwright test --reporter=list --grep-invert @skip || true", - "e2e:playwright:summary": "cd e2e-playwright && node ../tools/test-summary.js", - "e2e:playwright:quick": "cd e2e-playwright && npx playwright test --config=playwright.config.minimal.ts", - "e2e:playwright:file": "cd e2e-playwright && npx playwright test", "electron": "NODE_ENV=PROD electron .", "electron:build": "tsc -p electron/tsconfig.electron.json", "electron:watch": "tsc -p electron/tsconfig.electron.json --watch", diff --git a/tools/test-summary.js b/tools/test-summary.js deleted file mode 100755 index 64c6e13dc..000000000 --- a/tools/test-summary.js +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs'); -const path = require('path'); - -const TEST_RESULTS_FILE = path.join(__dirname, '../e2e-playwright/test-results.json'); - -function summarizeResults() { - // Check if results file exists - if (!fs.existsSync(TEST_RESULTS_FILE)) { - console.log('āŒ No test results found. Run tests first with: npm run e2e:playwright'); - return; - } - - try { - const results = JSON.parse(fs.readFileSync(TEST_RESULTS_FILE, 'utf8')); - - const stats = results.stats || {}; - const suites = results.suites || []; - - // Calculate statistics - const total = stats.expected || 0; - const passed = (stats.expected || 0) - (stats.unexpected || 0) - (stats.skipped || 0); - const failed = stats.unexpected || 0; - const skipped = stats.skipped || 0; - const duration = stats.duration || 0; - - // Print summary header - console.log('\nšŸ“Š Playwright Test Summary'); - console.log('=========================\n'); - - // Print statistics - console.log(`Total Tests: ${total}`); - console.log(`āœ… Passed: ${passed}`); - console.log(`āŒ Failed: ${failed}`); - console.log(`ā­ļø Skipped: ${skipped}`); - console.log(`ā±ļø Duration: ${(duration / 1000).toFixed(2)}s\n`); - - // Print failed tests if any - if (failed > 0) { - console.log('Failed Tests:'); - console.log('-------------'); - - const failedTests = []; - - // Recursively find failed tests - function findFailedTests(suites) { - for (const suite of suites) { - if (suite.suites) { - findFailedTests(suite.suites); - } - if (suite.specs) { - for (const spec of suite.specs) { - if (spec.tests) { - for (const test of spec.tests) { - if (test.status === 'unexpected' || test.status === 'failed') { - failedTests.push({ - file: spec.file || suite.file, - title: spec.title || test.title, - error: test.results?.[0]?.error?.message || 'Unknown error', - }); - } - } - } - } - } - } - } - - findFailedTests(suites); - - failedTests.forEach((test, index) => { - console.log(`\n${index + 1}. ${test.file}`); - console.log(` ${test.title}`); - if (test.error) { - console.log(` Error: ${test.error.split('\n')[0]}`); - } - }); - } - - // Print success message if all passed - if (failed === 0 && passed > 0) { - console.log('šŸŽ‰ All tests passed!'); - } - } catch (error) { - console.error('āŒ Error reading test results:', error.message); - console.log('\nMake sure to run tests with: npm run e2e:playwright'); - } -} - -// Run the summary -summarizeResults();