chore: fix failing test for the chrome headless (#8364)

This commit is contained in:
Alex Rudenko 2022-05-19 09:41:29 +02:00 committed by GitHub
parent bfead976f1
commit ea47ff0766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -22,11 +22,13 @@ describe('Browser specs', function () {
describe('Browser.version', function () {
it('should return whether we are in headless', async () => {
const { browser, isHeadless } = getTestState();
const { browser, isHeadless, headless } = getTestState();
const version = await browser.version();
expect(version.length).toBeGreaterThan(0);
expect(version.startsWith('Headless')).toBe(isHeadless);
expect(version.startsWith('Headless')).toBe(
isHeadless && headless !== 'chrome'
);
});
});

View File

@ -137,6 +137,7 @@ interface PuppeteerTestState {
isFirefox: boolean;
isChrome: boolean;
isHeadless: boolean;
headless: string;
puppeteerPath: string;
}
const state: Partial<PuppeteerTestState> = {};
@ -270,6 +271,7 @@ export const mochaHooks = {
state.isFirefox = isFirefox;
state.isChrome = isChrome;
state.isHeadless = isHeadless;
state.headless = headless;
state.puppeteerPath = path.resolve(path.join(__dirname, '..'));
},
coverageHooks.beforeAll,