test: retry for a few flaky tests (#21658)
This commit is contained in:
parent
cfae97a64c
commit
8a92b65fd3
2 changed files with 10 additions and 1 deletions
|
@ -1122,7 +1122,12 @@ describe('webContents module', () => {
|
||||||
{ name: 'did-fail-load', url: '/net-error' }
|
{ name: 'did-fail-load', url: '/net-error' }
|
||||||
]
|
]
|
||||||
for (const e of events) {
|
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 contents = (webContents as any).create() as WebContents
|
||||||
const originalEmit = contents.emit.bind(contents)
|
const originalEmit = contents.emit.bind(contents)
|
||||||
contents.emit = (...args) => { return originalEmit(...args) }
|
contents.emit = (...args) => { return originalEmit(...args) }
|
||||||
|
|
|
@ -20,6 +20,10 @@ ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
|
||||||
|
|
||||||
const itWithOptions = (name: string, options: BrowserWindowConstructorOptions, fn: Mocha.Func) => {
|
const itWithOptions = (name: string, options: BrowserWindowConstructorOptions, fn: Mocha.Func) => {
|
||||||
return it(name, async function (...args) {
|
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({
|
w = new BrowserWindow({
|
||||||
...options,
|
...options,
|
||||||
paintWhenInitiallyHidden: false,
|
paintWhenInitiallyHidden: false,
|
||||||
|
|
Loading…
Reference in a new issue