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

@ -4,7 +4,7 @@ import { expect } from 'chai';
import * as path from 'path';
import { closeWindow } from './window-helpers';
import { emittedOnce } from './events-helpers';
import { ifit, ifdescribe } from './spec-helpers';
import { ifit, ifdescribe, delay } from './spec-helpers';
const features = process._linkedBinding('electron_common_features');
@ -33,7 +33,7 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => {
await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()');
const contextMenuPromise = emittedOnce(w.webContents, 'context-menu');
// Wait for spellchecker to load
await new Promise(resolve => setTimeout(resolve, 500));
await delay(500);
w.webContents.sendInputEvent({
type: 'mouseDown',
button: 'right',
@ -50,7 +50,7 @@ ifdescribe(features.isBuiltinSpellCheckerEnabled())('spellchecker', () => {
await w.webContents.executeJavaScript('document.body.querySelector("textarea").focus()');
const contextMenuPromise = emittedOnce(w.webContents, 'context-menu');
// Wait for spellchecker to load
await new Promise(resolve => setTimeout(resolve, 500));
await delay(500);
w.webContents.sendInputEvent({
type: 'mouseDown',
button: 'right',