test: use delay() helper (#24321)

This commit is contained in:
Milan Burda 2020-06-26 22:59:54 +02:00 committed by GitHub
parent 8eb198bab4
commit 1c49e4e376
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 36 deletions

View file

@ -8,7 +8,7 @@ import { BrowserWindow, ipcMain, webContents, session, WebContents, app } from '
import { clipboard } from 'electron/common';
import { emittedOnce } from './events-helpers';
import { closeAllWindows } from './window-helpers';
import { ifdescribe, ifit } from './spec-helpers';
import { ifdescribe, ifit, delay } from './spec-helpers';
const pdfjs = require('pdfjs-dist');
const fixturesPath = path.resolve(__dirname, '..', 'spec', 'fixtures');
@ -406,7 +406,7 @@ describe('webContents module', () => {
expect(() => { webContents.getFocusedWebContents(); }).to.not.throw();
// Work around https://github.com/electron/electron/issues/19985
await new Promise(resolve => setTimeout(resolve, 0));
await delay();
const devToolsClosed = emittedOnce(w.webContents, 'devtools-closed');
w.webContents.closeDevTools();
@ -490,7 +490,7 @@ describe('webContents module', () => {
emittedOnce(w.webContents, 'devtools-opened'),
emittedOnce(w.webContents, 'devtools-focused')
]);
await new Promise(resolve => setTimeout(resolve, 0));
await delay();
expect(w.isFocused()).to.be.false();
});