Skip to content

Commit

Permalink
ci: deflake WOA tests (electron#23769)
Browse files Browse the repository at this point in the history
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
  • Loading branch information
trop[bot] and John Kleinschmidt committed May 26, 2020
1 parent 471f805 commit 0962c1b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
1 change: 0 additions & 1 deletion azure-pipelines-woa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ steps:
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: 'mocha-junit-reporter, tap'
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_TIMEOUT: 120000

- task: PublishTestResults@2
displayName: 'Publish Test Results'
Expand Down
12 changes: 8 additions & 4 deletions spec-main/api-menu-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { closeWindow } from './window-helpers';
const fixturesPath = path.resolve(__dirname, 'fixtures');

describe('Menu module', function () {
this.timeout(5000);
describe('Menu.buildFromTemplate', () => {
it('should be able to attach extra fields', () => {
const menu = Menu.buildFromTemplate([
Expand Down Expand Up @@ -885,9 +884,14 @@ describe('Menu module', function () {
const appProcess = cp.spawn(process.execPath, [appPath]);

let output = '';
appProcess.stdout.on('data', data => { output += data; });

await emittedOnce(appProcess, 'exit');
await new Promise((resolve) => {
appProcess.stdout.on('data', data => {
output += data;
if (data.indexOf('Window has') > -1) {
resolve();
}
});
});
expect(output).to.include('Window has no menu');
});

Expand Down
10 changes: 8 additions & 2 deletions spec-main/chromium-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1233,15 +1233,21 @@ describe('chromium features', () => {
w.loadURL(pdfSource);
const [, contents] = await emittedOnce(app, 'web-contents-created');
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 () => {
const w = new BrowserWindow({ show: false });
w.loadFile(path.join(__dirname, 'fixtures', 'pages', 'pdf-in-iframe.html'));
const [, contents] = await emittedOnce(app, 'web-contents-created');
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);
});
});
});

Expand Down
3 changes: 2 additions & 1 deletion spec-main/extensions-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,12 @@ describe('chrome extensions', () => {
it('loads a devtools extension', async () => {
const customSession = session.fromPartition(`persist:${require('uuid').v4()}`);
customSession.loadExtension(path.join(fixtures, 'extensions', 'devtools-extension'));
const winningMessage = emittedOnce(ipcMain, 'winning');
const w = new BrowserWindow({ show: true, webPreferences: { session: customSession, nodeIntegration: true } });
await w.loadURL(url);
w.webContents.openDevTools();
showLastDevToolsPanel(w);
await emittedOnce(ipcMain, 'winning');
await winningMessage;
});
});

Expand Down

0 comments on commit 0962c1b

Please sign in to comment.