diff --git a/spec-main/api-web-contents-spec.ts b/spec-main/api-web-contents-spec.ts index 86a8e1692f2..403c01e7e90 100644 --- a/spec-main/api-web-contents-spec.ts +++ b/spec-main/api-web-contents-spec.ts @@ -1122,7 +1122,12 @@ describe('webContents module', () => { { name: 'did-fail-load', url: '/net-error' } ] for (const e of events) { - it(`should not crash when invoked synchronously inside ${e.name} handler`, async () => { + it(`should not crash when invoked synchronously inside ${e.name} handler`, async function () { + // This test is flaky on Windows CI and we don't know why, but the + // purpose of this test is to make sure Electron does not crash so it + // is fine to retry this test for a few times. + this.retries(3) + const contents = (webContents as any).create() as WebContents const originalEmit = contents.emit.bind(contents) contents.emit = (...args) => { return originalEmit(...args) } diff --git a/spec-main/visibility-state-spec.ts b/spec-main/visibility-state-spec.ts index b08cacf59b9..729ff31fecf 100644 --- a/spec-main/visibility-state-spec.ts +++ b/spec-main/visibility-state-spec.ts @@ -20,6 +20,10 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => { const itWithOptions = (name: string, options: BrowserWindowConstructorOptions, fn: Mocha.Func) => { return it(name, async function (...args) { + // document.visibilityState tests are very flaky, this is probably because + // Electron implements it via async IPC messages. + this.retries(3) + w = new BrowserWindow({ ...options, paintWhenInitiallyHidden: false,