diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 5f8e028f988..f6370545fe5 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -689,18 +689,6 @@ "parameters": ["firefox"], "expectations": ["SKIP"] }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", - "platforms": ["darwin", "linux", "win32"], - "parameters": ["chrome"], - "expectations": ["SKIP"] - }, - { - "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", - "platforms": ["linux"], - "parameters": ["webDriverBiDi"], - "expectations": ["FAIL"] - }, { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", "platforms": ["darwin", "linux", "win32"], @@ -1111,6 +1099,18 @@ "parameters": ["firefox"], "expectations": ["PASS"] }, + { + "testIdPattern": "[screenshot.spec] Screenshots Cdp should work in \"fromSurface: false\" mode", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["headless"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[screenshot.spec] Screenshots Cdp should work in \"fromSurface: false\" mode", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["new-headless"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should get screenshot bigger than the viewport", "platforms": ["darwin", "linux", "win32"], @@ -2245,6 +2245,18 @@ "parameters": ["cdp", "firefox"], "expectations": ["FAIL", "PASS"] }, + { + "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "headless"], + "expectations": ["SKIP"] + }, + { + "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome", "new-headless"], + "expectations": ["SKIP"] + }, { "testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch tmp profile should be cleaned up", "platforms": ["darwin", "linux", "win32"], diff --git a/test/src/launcher.spec.ts b/test/src/launcher.spec.ts index f31b22b1e5d..fc1a9978225 100644 --- a/test/src/launcher.spec.ts +++ b/test/src/launcher.spec.ts @@ -16,7 +16,7 @@ import type {Page} from 'puppeteer-core/internal/api/Page.js'; import {rmSync} from 'puppeteer-core/internal/node/util/fs.js'; import sinon from 'sinon'; -import {getTestState, isHeadless, launch} from './mocha-utils.js'; +import {getTestState, launch} from './mocha-utils.js'; import {dumpFrames, waitEvent} from './utils.js'; const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-'); @@ -408,21 +408,18 @@ describe('Launcher specs', function () { expect(puppeteer.product).toBe('firefox'); } }); - (!isHeadless ? it : it.skip)( - 'should work with no default arguments', - async () => { - const {context, close} = await launch({ - ignoreDefaultArgs: true, - }); - try { - const page = await context.newPage(); - expect(await page.evaluate('11 * 11')).toBe(121); - await page.close(); - } finally { - await close(); - } + it('should work with no default arguments', async () => { + const {context, close} = await launch({ + ignoreDefaultArgs: true, + }); + try { + const page = await context.newPage(); + expect(await page.evaluate('11 * 11')).toBe(121); + await page.close(); + } finally { + await close(); } - ); + }); it('should filter out ignored default arguments in Chrome', async () => { const {defaultBrowserOptions, puppeteer} = await getTestState({ skipLaunch: true, @@ -590,31 +587,28 @@ describe('Launcher specs', function () { }); expect(error.message).toContain('either pipe or debugging port'); }); - (!isHeadless ? it : it.skip)( - 'should launch Chrome properly with --no-startup-window and waitForInitialPage=false', - async () => { - const {defaultBrowserOptions} = await getTestState({ - skipLaunch: true, - }); - const options = { - waitForInitialPage: false, - // This is needed to prevent Puppeteer from adding an initial blank page. - // See also https://github.com/puppeteer/puppeteer/blob/ad6b736039436fcc5c0a262e5b575aa041427be3/src/node/Launcher.ts#L200 - ignoreDefaultArgs: true, - ...defaultBrowserOptions, - args: ['--no-startup-window'], - }; - const {browser, close} = await launch(options, { - createContext: false, - }); - try { - const pages = await browser.pages(); - expect(pages).toHaveLength(0); - } finally { - await close(); - } + it('should launch Chrome properly with --no-startup-window and waitForInitialPage=false', async () => { + const {defaultBrowserOptions} = await getTestState({ + skipLaunch: true, + }); + const options = { + waitForInitialPage: false, + // This is needed to prevent Puppeteer from adding an initial blank page. + // See also https://github.com/puppeteer/puppeteer/blob/ad6b736039436fcc5c0a262e5b575aa041427be3/src/node/Launcher.ts#L200 + ignoreDefaultArgs: true, + ...defaultBrowserOptions, + args: ['--no-startup-window'], + }; + const {browser, close} = await launch(options, { + createContext: false, + }); + try { + const pages = await browser.pages(); + expect(pages).toHaveLength(0); + } finally { + await close(); } - ); + }); }); describe('Puppeteer.launch', function () { diff --git a/test/src/screenshot.spec.ts b/test/src/screenshot.spec.ts index d150e68c8f9..b67028bdd33 100644 --- a/test/src/screenshot.spec.ts +++ b/test/src/screenshot.spec.ts @@ -8,12 +8,7 @@ import assert from 'assert'; import expect from 'expect'; -import { - getTestState, - isHeadless, - launch, - setupTestBrowserHooks, -} from './mocha-utils.js'; +import {getTestState, launch, setupTestBrowserHooks} from './mocha-utils.js'; describe('Screenshots', function () { setupTestBrowserHooks(); @@ -436,18 +431,15 @@ describe('Screenshots', function () { }); expect(screenshot).toBeGolden('white.jpg'); }); - (!isHeadless ? it : it.skip)( - 'should work in "fromSurface: false" mode', - async () => { - const {page, server} = await getTestState(); + it('should work in "fromSurface: false" mode', async () => { + const {page, server} = await getTestState(); - await page.setViewport({width: 500, height: 500}); - await page.goto(server.PREFIX + '/grid.html'); - const screenshot = await page.screenshot({ - fromSurface: false, - }); - expect(screenshot).toBeDefined(); // toBeGolden('screenshot-fromsurface-false.png'); - } - ); + await page.setViewport({width: 500, height: 500}); + await page.goto(server.PREFIX + '/grid.html'); + const screenshot = await page.screenshot({ + fromSurface: false, + }); + expect(screenshot).toBeDefined(); + }); }); });