ci: deflake WOA tests (#23707)

This commit is contained in:
John Kleinschmidt 2020-05-26 10:25:57 -04:00 committed by GitHub
parent 08f288faf1
commit db5cf816b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 8 deletions

View file

@ -71,7 +71,6 @@ steps:
ELECTRON_TEST_RESULTS_DIR: junit ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap' MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters MOCHA_REPORTER: mocha-multi-reporters
MOCHA_TIMEOUT: 120000
- task: PublishTestResults@2 - task: PublishTestResults@2
displayName: 'Publish Test Results' displayName: 'Publish Test Results'

View file

@ -10,7 +10,6 @@ import { closeWindow } from './window-helpers';
const fixturesPath = path.resolve(__dirname, 'fixtures'); const fixturesPath = path.resolve(__dirname, 'fixtures');
describe('Menu module', function () { describe('Menu module', function () {
this.timeout(5000);
describe('Menu.buildFromTemplate', () => { describe('Menu.buildFromTemplate', () => {
it('should be able to attach extra fields', () => { it('should be able to attach extra fields', () => {
const menu = Menu.buildFromTemplate([ const menu = Menu.buildFromTemplate([
@ -885,9 +884,14 @@ describe('Menu module', function () {
const appProcess = cp.spawn(process.execPath, [appPath]); const appProcess = cp.spawn(process.execPath, [appPath]);
let output = ''; let output = '';
appProcess.stdout.on('data', data => { output += data; }); await new Promise((resolve) => {
appProcess.stdout.on('data', data => {
await emittedOnce(appProcess, 'exit'); output += data;
if (data.indexOf('Window has') > -1) {
resolve();
}
});
});
expect(output).to.include('Window has no menu'); expect(output).to.include('Window has no menu');
}); });

View file

@ -1233,7 +1233,10 @@ describe('chromium features', () => {
w.loadURL(pdfSource); w.loadURL(pdfSource);
const [, contents] = await emittedOnce(app, 'web-contents-created'); const [, contents] = await emittedOnce(app, 'web-contents-created');
expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'); expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html');
await emittedOnce(contents, 'did-finish-load'); await new Promise((resolve) => {
contents.on('did-finish-load', resolve);
contents.on('did-frame-finish-load', resolve);
});
}); });
it('opens when loading a pdf resource in a iframe', async () => { it('opens when loading a pdf resource in a iframe', async () => {
@ -1241,7 +1244,10 @@ describe('chromium features', () => {
w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'pdf-in-iframe.html')); w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'pdf-in-iframe.html'));
const [, contents] = await emittedOnce(app, 'web-contents-created'); const [, contents] = await emittedOnce(app, 'web-contents-created');
expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html'); expect(contents.getURL()).to.equal('chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html');
await emittedOnce(contents, 'did-finish-load'); await new Promise((resolve) => {
contents.on('did-finish-load', resolve);
contents.on('did-frame-finish-load', resolve);
});
}); });
}); });

View file

@ -294,11 +294,12 @@ describe('chrome extensions', () => {
it('loads a devtools extension', async () => { it('loads a devtools extension', async () => {
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`); const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
customSession.loadExtension(path.join(fixtures, 'extensions', 'devtools-extension')); customSession.loadExtension(path.join(fixtures, 'extensions', 'devtools-extension'));
const winningMessage = emittedOnce(ipcMain, 'winning');
const w = new BrowserWindow({ show: true, webPreferences: { session: customSession, nodeIntegration: true } }); const w = new BrowserWindow({ show: true, webPreferences: { session: customSession, nodeIntegration: true } });
await w.loadURL(url); await w.loadURL(url);
w.webContents.openDevTools(); w.webContents.openDevTools();
showLastDevToolsPanel(w); showLastDevToolsPanel(w);
await emittedOnce(ipcMain, 'winning'); await winningMessage;
}); });
}); });