test: don't ignore random arguments (#726)

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.
This commit is contained in:
Joel Einbinder 2020-01-28 15:03:10 -08:00 committed by GitHub
parent 4c25180912
commit 5e5d1933b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
});
});