Skip to content

Commit

Permalink
chore: fix failing test for the chrome headless (#8364)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed May 19, 2022
1 parent bfead97 commit ea47ff0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/browser.spec.ts
Expand Up @@ -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'
);
});
});

Expand Down
2 changes: 2 additions & 0 deletions test/mocha-utils.ts
Expand Up @@ -137,6 +137,7 @@ interface PuppeteerTestState {
isFirefox: boolean;
isChrome: boolean;
isHeadless: boolean;
headless: string;
puppeteerPath: string;
}
const state: Partial<PuppeteerTestState> = {};
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ea47ff0

Please sign in to comment.