test(e2e): fix trace file dump

pull/8386/head
Junyi Du 2023-01-13 02:01:24 +08:00 committed by Andelf
parent 5dcbe6cdf5
commit 95724dd8af
1 changed files with 25 additions and 8 deletions

View File

@ -55,6 +55,7 @@ base.beforeAll(async () => {
})
context = electronApp.context()
await context.tracing.start({ screenshots: true, snapshots: true });
await context.tracing.startChunk();
// NOTE: The following ensures App first start with the correct path.
const info = await electronApp.evaluate(async ({ app }) => {
@ -133,14 +134,6 @@ base.beforeEach(async () => {
}
})
base.afterAll(async () => {
// if (electronApp) {
// await electronApp.close()
//}
// use .dump as extension to avoid unfolded when zip by github
await context.tracing.stop({ path: `e2e-dump/trace-${Date.now()}.zip.dump` });
})
// hijack electron app into the test context
// FIXME: add type to `block`
export const test = base.extend<LogseqFixtures>({
@ -283,3 +276,27 @@ export const test = base.extend<LogseqFixtures>({
await use(graphDir);
},
});
let getTracingFilePath = function(): string {
return `e2e-dump/trace-${Date.now()}.zip.dump`
}
test.afterAll(async () => {
await context.tracing.stopChunk({ path: getTracingFilePath() });
})
/**
* Trace all tests in a file
*/
export let traceAll = function(){
test.beforeAll(async () => {
await context.tracing.startChunk();
})
test.afterAll(async () => {
await context.tracing.stopChunk({ path: getTracingFilePath() });
})
}