mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
refactor(e2e): simplify Playwright commands to essentials
- Keep only the most useful commands: - e2e:playwright - run all tests with minimal output - e2e:playwright:file - run single file with detailed output - e2e:playwright:ui/debug/headed/report - existing useful commands - Remove complexity: test-summary.js, minimal config, redundant commands - Use line reporter by default for cleaner output - Update CLAUDE.md documentation BREAKING CHANGE: Removed e2e:playwright:quick, e2e:playwright:failures, and e2e:playwright:summary commands
This commit is contained in:
parent
fadff3bc19
commit
41b287fd9d
5 changed files with 6 additions and 135 deletions
|
|
@ -52,11 +52,9 @@ npm run test:file <filepath>
|
|||
- 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 <path>` - 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 <path>` - 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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
@ -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('/')`. */
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
Loading…
Add table
Add a link
Reference in a new issue