Skip to content

Commit

Permalink
test: don't ignore random arguments (#726)
Browse files Browse the repository at this point in the history
This test was ignoring some very important arguments depending on the browser! The comment about `--enable-automation` was a lie. I changed it to ignore the userDataDir argument, which should be safe.
  • Loading branch information
JoelEinbinder authored Jan 28, 2020
1 parent 4c25180 commit 5e5d193
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ module.exports.describe = function({testRunner, expect, defaultBrowserOptions, p
expect(playwright.defaultArgs({userDataDir: 'foo'})).toContain(FFOX ? 'foo' : '--user-data-dir=foo');
});
it('should filter out ignored default arguments', async() => {
// Make sure we launch with `--enable-automation` by default.
const defaultArgs = playwright.defaultArgs(defaultBrowserOptions);
const defaultArgsWithoutUserDataDir = playwright.defaultArgs(defaultBrowserOptions);
const defaultArgsWithUserDataDir = playwright.defaultArgs({...defaultBrowserOptions, userDataDir: 'fake-profile'});
const browserApp = await playwright.launchBrowserApp(Object.assign({}, defaultBrowserOptions, {
// Ignore second default argument.
ignoreDefaultArgs: [ defaultArgs[1] ],
userDataDir: 'fake-profile',
// Filter out any of the args added by the fake profile
ignoreDefaultArgs: defaultArgsWithUserDataDir.filter(x => !defaultArgsWithoutUserDataDir.includes(x))
}));
const spawnargs = browserApp.process().spawnargs;
expect(spawnargs.indexOf(defaultArgs[0])).not.toBe(-1);
expect(spawnargs.indexOf(defaultArgs[1])).toBe(-1);
expect(spawnargs.some(x => x.includes('fake-profile'))).toBe(false);
await browserApp.close();
});
});
Expand Down

0 comments on commit 5e5d193

Please sign in to comment.