nocobase/scripts/codegen.setup.ts

19 lines
568 B
TypeScript
Raw Normal View History

2023-09-09 00:14:28 +00:00
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();
}