test: make sure tests fail properly instead of timing out (#24316)

This commit is contained in:
Milan Burda 2020-07-01 00:10:36 +02:00 committed by GitHub
commit c6db47182a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 1484 additions and 1367 deletions

View file

@ -233,17 +233,16 @@ describe('BrowserView module', () => {
});
describe('window.open()', () => {
it('works in BrowserView', (done) => {
it('works in BrowserView', async () => {
view = new BrowserView();
w.setBrowserView(view);
view.webContents.once('new-window', (e, url, frameName, disposition, options, additionalFeatures) => {
e.preventDefault();
expect(url).to.equal('http://host/');
expect(frameName).to.equal('host');
expect(additionalFeatures[0]).to.equal('this-is-not-a-standard-feature');
done();
});
const newWindow = emittedOnce(view.webContents, 'new-window');
view.webContents.once('new-window', event => event.preventDefault());
view.webContents.loadFile(path.join(fixtures, 'pages', 'window-open.html'));
const [, url, frameName,,, additionalFeatures] = await newWindow;
expect(url).to.equal('http://host/');
expect(frameName).to.equal('host');
expect(additionalFeatures[0]).to.equal('this-is-not-a-standard-feature');
});
});
});