mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* test(e2e): gate beta mac packaged runtime * test(e2e): separate ui automation layout * test(e2e): move localized content coverage * chore(release): prepare packaged 0.4.1 beta validation * test(e2e): keep ui lane playwright-only * fix(web): keep chat recoverable after conversation load failure * fix(desktop): honor native mac quit
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { mkdir, rm } from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
const e2eDir = path.resolve(scriptDir, '..');
|
|
const uiDir = path.join(e2eDir, 'ui');
|
|
|
|
type Command = () => Promise<void>;
|
|
|
|
const commands: Record<string, Command> = {
|
|
clean: cleanArtifacts,
|
|
help: async () => printUsage(),
|
|
};
|
|
|
|
const commandName = process.argv[2] ?? 'help';
|
|
const command = commands[commandName];
|
|
|
|
if (command == null) {
|
|
console.error(`Unknown e2e Playwright helper command: ${commandName}`);
|
|
printUsage();
|
|
process.exitCode = 1;
|
|
} else {
|
|
await command();
|
|
}
|
|
|
|
async function cleanArtifacts(): Promise<void> {
|
|
const targets = [
|
|
path.join(uiDir, '.od-data'),
|
|
path.join(uiDir, 'test-results'),
|
|
path.join(uiDir, 'reports', 'test-results'),
|
|
path.join(uiDir, 'reports', 'html'),
|
|
path.join(uiDir, 'reports', 'playwright-html-report'),
|
|
path.join(uiDir, 'reports', 'results.json'),
|
|
path.join(uiDir, 'reports', 'junit.xml'),
|
|
path.join(uiDir, '.DS_Store'),
|
|
];
|
|
|
|
await Promise.all(targets.map((target) => rm(target, { recursive: true, force: true })));
|
|
await mkdir(path.join(uiDir, 'reports', 'test-results'), { recursive: true });
|
|
await mkdir(path.join(uiDir, '.od-data'), { recursive: true });
|
|
|
|
console.log('Cleaned e2e UI Playwright artifacts.');
|
|
}
|
|
|
|
function printUsage(): void {
|
|
console.log(`Usage: tsx scripts/playwright.ts <command>
|
|
|
|
Commands:
|
|
clean Remove e2e UI Playwright runtime data and reports
|
|
help Show this help
|
|
`);
|
|
}
|