nocobase/scripts/codegen.setup.ts
2023-09-09 08:14:28 +08:00

19 lines
568 B
TypeScript

import { execSync } from 'node:child_process';
import { PORT, commonConfig, deleteNocoBase, runNocoBase } from './utils';
runNocoBase();
try {
execSync(
`npx playwright codegen --load-storage=./.auth/codegen.auth.json http://localhost:${PORT} --save-storage=./.auth/codegen.auth.json`,
commonConfig,
);
} catch (err) {
if (err.message.includes('auth.json')) {
execSync(`npx playwright codegen http://localhost:${PORT} --save-storage=./.auth/codegen.auth.json`, commonConfig);
} else {
console.error(err);
}
} finally {
deleteNocoBase();
}