Skip to content

Commit

Permalink
chore: run launcher test for chrome fallback only in regular install …
Browse files Browse the repository at this point in the history
…mode.
  • Loading branch information
whimboo committed Oct 13, 2021
1 parent d063d2c commit df5a414
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions test/launcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,19 +509,22 @@ describe('Launcher specs', function () {
expect(userAgent).toContain('Chrome');
});

it('falls back to launching chrome if there is an unknown product but logs a warning', async () => {
const { puppeteer } = getTestState();
const consoleStub = sinon.stub(console, 'warn');
// @ts-expect-error purposeful bad input
const browser = await puppeteer.launch({ product: 'SO_NOT_A_PRODUCT' });
const userAgent = await browser.userAgent();
await browser.close();
expect(userAgent).toContain('Chrome');
expect(consoleStub.callCount).toEqual(1);
expect(consoleStub.firstCall.args).toEqual([
'Warning: unknown product name SO_NOT_A_PRODUCT. Falling back to chrome.',
]);
});
itOnlyRegularInstall(
'falls back to launching chrome if there is an unknown product but logs a warning',
async () => {
const { puppeteer } = getTestState();
const consoleStub = sinon.stub(console, 'warn');
// @ts-expect-error purposeful bad input
const browser = await puppeteer.launch({ product: 'SO_NOT_A_PRODUCT'});
const userAgent = await browser.userAgent();
await browser.close();
expect(userAgent).toContain('Chrome');
expect(consoleStub.callCount).toEqual(1);
expect(consoleStub.firstCall.args).toEqual([
'Warning: unknown product name SO_NOT_A_PRODUCT. Falling back to chrome.',
]);
}
);

itOnlyRegularInstall(
'should be able to launch Firefox',
Expand Down

0 comments on commit df5a414

Please sign in to comment.