mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: move skipped tests to expectations (#11789)
This commit is contained in:
parent
b99d478cd4
commit
422b5a5b03
@ -689,18 +689,6 @@
|
|||||||
"parameters": ["firefox"],
|
"parameters": ["firefox"],
|
||||||
"expectations": ["SKIP"]
|
"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",
|
"testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch should work with no default arguments",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1111,6 +1099,18 @@
|
|||||||
"parameters": ["firefox"],
|
"parameters": ["firefox"],
|
||||||
"expectations": ["PASS"]
|
"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",
|
"testIdPattern": "[screenshot.spec] Screenshots Page.screenshot should get screenshot bigger than the viewport",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -2245,6 +2245,18 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL", "PASS"]
|
"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",
|
"testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch tmp profile should be cleaned up",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -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 {rmSync} from 'puppeteer-core/internal/node/util/fs.js';
|
||||||
import sinon from 'sinon';
|
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';
|
import {dumpFrames, waitEvent} from './utils.js';
|
||||||
|
|
||||||
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
@ -408,21 +408,18 @@ describe('Launcher specs', function () {
|
|||||||
expect(puppeteer.product).toBe('firefox');
|
expect(puppeteer.product).toBe('firefox');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
(!isHeadless ? it : it.skip)(
|
it('should work with no default arguments', async () => {
|
||||||
'should work with no default arguments',
|
const {context, close} = await launch({
|
||||||
async () => {
|
ignoreDefaultArgs: true,
|
||||||
const {context, close} = await launch({
|
});
|
||||||
ignoreDefaultArgs: true,
|
try {
|
||||||
});
|
const page = await context.newPage();
|
||||||
try {
|
expect(await page.evaluate('11 * 11')).toBe(121);
|
||||||
const page = await context.newPage();
|
await page.close();
|
||||||
expect(await page.evaluate('11 * 11')).toBe(121);
|
} finally {
|
||||||
await page.close();
|
await close();
|
||||||
} finally {
|
|
||||||
await close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
it('should filter out ignored default arguments in Chrome', async () => {
|
it('should filter out ignored default arguments in Chrome', async () => {
|
||||||
const {defaultBrowserOptions, puppeteer} = await getTestState({
|
const {defaultBrowserOptions, puppeteer} = await getTestState({
|
||||||
skipLaunch: true,
|
skipLaunch: true,
|
||||||
@ -590,31 +587,28 @@ describe('Launcher specs', function () {
|
|||||||
});
|
});
|
||||||
expect(error.message).toContain('either pipe or debugging port');
|
expect(error.message).toContain('either pipe or debugging port');
|
||||||
});
|
});
|
||||||
(!isHeadless ? it : it.skip)(
|
it('should launch Chrome properly with --no-startup-window and waitForInitialPage=false', async () => {
|
||||||
'should launch Chrome properly with --no-startup-window and waitForInitialPage=false',
|
const {defaultBrowserOptions} = await getTestState({
|
||||||
async () => {
|
skipLaunch: true,
|
||||||
const {defaultBrowserOptions} = await getTestState({
|
});
|
||||||
skipLaunch: true,
|
const options = {
|
||||||
});
|
waitForInitialPage: false,
|
||||||
const options = {
|
// This is needed to prevent Puppeteer from adding an initial blank page.
|
||||||
waitForInitialPage: false,
|
// See also https://github.com/puppeteer/puppeteer/blob/ad6b736039436fcc5c0a262e5b575aa041427be3/src/node/Launcher.ts#L200
|
||||||
// This is needed to prevent Puppeteer from adding an initial blank page.
|
ignoreDefaultArgs: true,
|
||||||
// See also https://github.com/puppeteer/puppeteer/blob/ad6b736039436fcc5c0a262e5b575aa041427be3/src/node/Launcher.ts#L200
|
...defaultBrowserOptions,
|
||||||
ignoreDefaultArgs: true,
|
args: ['--no-startup-window'],
|
||||||
...defaultBrowserOptions,
|
};
|
||||||
args: ['--no-startup-window'],
|
const {browser, close} = await launch(options, {
|
||||||
};
|
createContext: false,
|
||||||
const {browser, close} = await launch(options, {
|
});
|
||||||
createContext: false,
|
try {
|
||||||
});
|
const pages = await browser.pages();
|
||||||
try {
|
expect(pages).toHaveLength(0);
|
||||||
const pages = await browser.pages();
|
} finally {
|
||||||
expect(pages).toHaveLength(0);
|
await close();
|
||||||
} finally {
|
|
||||||
await close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Puppeteer.launch', function () {
|
describe('Puppeteer.launch', function () {
|
||||||
|
@ -8,12 +8,7 @@ import assert from 'assert';
|
|||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {
|
import {getTestState, launch, setupTestBrowserHooks} from './mocha-utils.js';
|
||||||
getTestState,
|
|
||||||
isHeadless,
|
|
||||||
launch,
|
|
||||||
setupTestBrowserHooks,
|
|
||||||
} from './mocha-utils.js';
|
|
||||||
|
|
||||||
describe('Screenshots', function () {
|
describe('Screenshots', function () {
|
||||||
setupTestBrowserHooks();
|
setupTestBrowserHooks();
|
||||||
@ -436,18 +431,15 @@ describe('Screenshots', function () {
|
|||||||
});
|
});
|
||||||
expect(screenshot).toBeGolden('white.jpg');
|
expect(screenshot).toBeGolden('white.jpg');
|
||||||
});
|
});
|
||||||
(!isHeadless ? it : it.skip)(
|
it('should work in "fromSurface: false" mode', async () => {
|
||||||
'should work in "fromSurface: false" mode',
|
const {page, server} = await getTestState();
|
||||||
async () => {
|
|
||||||
const {page, server} = await getTestState();
|
|
||||||
|
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
fromSurface: false,
|
fromSurface: false,
|
||||||
});
|
});
|
||||||
expect(screenshot).toBeDefined(); // toBeGolden('screenshot-fromsurface-false.png');
|
expect(screenshot).toBeDefined();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user