test: introduce options (#3525)
This commit is contained in:
Родитель
63a2c673b5
Коммит
8989d66bda
|
@ -35,7 +35,7 @@ it('should work', async function({page}) {
|
|||
// autofocus happens after a delay in chrome these days
|
||||
await page.waitForFunction(() => document.activeElement.hasAttribute('autofocus'));
|
||||
|
||||
const golden = FFOX ? {
|
||||
const golden = options.FFOX ? {
|
||||
role: 'document',
|
||||
name: 'Accessibility Test',
|
||||
children: [
|
||||
|
@ -48,7 +48,7 @@ it('should work', async function({page}) {
|
|||
{role: 'textbox', name: '', value: 'and a value'}, // firefox doesn't use aria-placeholder for the name
|
||||
{role: 'textbox', name: '', value: 'and a value', description: 'This is a description!'}, // and here
|
||||
]
|
||||
} : CHROMIUM ? {
|
||||
} : options.CHROMIUM ? {
|
||||
role: 'WebArea',
|
||||
name: 'Accessibility Test',
|
||||
children: [
|
||||
|
@ -82,7 +82,7 @@ it('should work with regular text', async({page}) => {
|
|||
await page.setContent(`<div>Hello World</div>`);
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
expect(snapshot.children[0]).toEqual({
|
||||
role: FFOX ? 'text leaf' : 'text',
|
||||
role: options.FFOX ? 'text leaf' : 'text',
|
||||
name: 'Hello World',
|
||||
});
|
||||
});
|
||||
|
@ -124,7 +124,7 @@ it('should not report text nodes inside controls', async function({page}) {
|
|||
<div role="tab">Tab2</div>
|
||||
</div>`);
|
||||
const golden = {
|
||||
role: FFOX ? 'document' : 'WebArea',
|
||||
role: options.FFOX ? 'document' : 'WebArea',
|
||||
name: '',
|
||||
children: [{
|
||||
role: 'tab',
|
||||
|
@ -139,12 +139,12 @@ it('should not report text nodes inside controls', async function({page}) {
|
|||
});
|
||||
|
||||
// WebKit rich text accessibility is iffy
|
||||
it.skip(WEBKIT)('rich text editable fields should have children', async function({page}) {
|
||||
it.skip(options.WEBKIT)('rich text editable fields should have children', async function({page}) {
|
||||
await page.setContent(`
|
||||
<div contenteditable="true">
|
||||
Edit this image: <img src="fakeimage.png" alt="my fake image">
|
||||
</div>`);
|
||||
const golden = FFOX ? {
|
||||
const golden = options.FFOX ? {
|
||||
role: 'section',
|
||||
name: '',
|
||||
children: [{
|
||||
|
@ -170,12 +170,12 @@ it.skip(WEBKIT)('rich text editable fields should have children', async function
|
|||
expect(snapshot.children[0]).toEqual(golden);
|
||||
});
|
||||
// WebKit rich text accessibility is iffy
|
||||
it.skip(WEBKIT)('rich text editable fields with role should have children', async function({page}) {
|
||||
it.skip(options.WEBKIT)('rich text editable fields with role should have children', async function({page}) {
|
||||
await page.setContent(`
|
||||
<div contenteditable="true" role='textbox'>
|
||||
Edit this image: <img src="fakeimage.png" alt="my fake image">
|
||||
</div>`);
|
||||
const golden = FFOX ? {
|
||||
const golden = options.FFOX ? {
|
||||
role: 'textbox',
|
||||
name: '',
|
||||
value: 'Edit this image: my fake image',
|
||||
|
@ -199,7 +199,7 @@ it.skip(WEBKIT)('rich text editable fields with role should have children', asyn
|
|||
expect(snapshot.children[0]).toEqual(golden);
|
||||
});
|
||||
|
||||
it.skip(FFOX || WEBKIT)('plain text field with role should not have children', async function({page}) {
|
||||
it.skip(options.FFOX || options.WEBKIT)('plain text field with role should not have children', async function({page}) {
|
||||
// Firefox does not support contenteditable="plaintext-only".
|
||||
// WebKit rich text accessibility is iffy
|
||||
await page.setContent(`
|
||||
|
@ -212,7 +212,7 @@ it.skip(FFOX || WEBKIT)('plain text field with role should not have children', a
|
|||
});
|
||||
});
|
||||
|
||||
it.skip(FFOX || WEBKIT)('plain text field without role should not have content', async function({page}) {
|
||||
it.skip(options.FFOX || options.WEBKIT)('plain text field without role should not have content', async function({page}) {
|
||||
await page.setContent(`
|
||||
<div contenteditable="plaintext-only">Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
|
@ -222,7 +222,7 @@ it.skip(FFOX || WEBKIT)('plain text field without role should not have content',
|
|||
});
|
||||
});
|
||||
|
||||
it.skip(FFOX || WEBKIT)('plain text field with tabindex and without role should not have content', async function({page}) {
|
||||
it.skip(options.FFOX || options.WEBKIT)('plain text field with tabindex and without role should not have content', async function({page}) {
|
||||
await page.setContent(`
|
||||
<div contenteditable="plaintext-only" tabIndex=0>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
|
@ -238,11 +238,11 @@ it('non editable textbox with role and tabIndex and label should not have childr
|
|||
this is the inner content
|
||||
<img alt="yo" src="fakeimg.png">
|
||||
</div>`);
|
||||
const golden = FFOX ? {
|
||||
const golden = options.FFOX ? {
|
||||
role: 'textbox',
|
||||
name: 'my favorite textbox',
|
||||
value: 'this is the inner content yo'
|
||||
} : CHROMIUM ? {
|
||||
} : options.CHROMIUM ? {
|
||||
role: 'textbox',
|
||||
name: 'my favorite textbox',
|
||||
value: 'this is the inner content '
|
||||
|
@ -276,7 +276,7 @@ it('checkbox without label should not have children', async function({page}) {
|
|||
this is the inner content
|
||||
<img alt="yo" src="fakeimg.png">
|
||||
</div>`);
|
||||
const golden = FFOX ? {
|
||||
const golden = options.FFOX ? {
|
||||
role: 'checkbox',
|
||||
name: 'this is the inner content yo',
|
||||
checked: true
|
||||
|
@ -327,7 +327,7 @@ it('should work on a menu', async({page}) => {
|
|||
[ { role: 'menuitem', name: 'First Item' },
|
||||
{ role: 'menuitem', name: 'Second Item' },
|
||||
{ role: 'menuitem', name: 'Third Item' } ],
|
||||
orientation: WEBKIT ? 'vertical' : undefined
|
||||
orientation: options.WEBKIT ? 'vertical' : undefined
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import { Transport } from '../lib/rpc/transport';
|
|||
import { setUnderTest } from '../lib/helper';
|
||||
import { installCoverageHooks } from './runner/coverage';
|
||||
import { valueFromEnv } from './runner/utils';
|
||||
import { registerFixture, registerWorkerFixture, registerWorkerGenerator } from './runner/fixtures';
|
||||
import { registerFixture, registerWorkerFixture, registerOption } from './runner/fixtures';
|
||||
import './runner/builtin.fixtures';
|
||||
|
||||
import {mkdtempAsync, removeFolderAsync} from './utils';
|
||||
|
@ -55,16 +55,17 @@ declare global {
|
|||
httpsServer: TestServer;
|
||||
browserServer: BrowserServer;
|
||||
}
|
||||
interface Options {
|
||||
browserName: string;
|
||||
CHROMIUM: boolean;
|
||||
FFOX: boolean;
|
||||
WEBKIT: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
const browserName = process.env.BROWSER;
|
||||
|
||||
(global as any).MAC = platform === 'darwin';
|
||||
(global as any).LINUX = platform === 'linux';
|
||||
(global as any).WIN = platform === 'win32';
|
||||
(global as any).CHROMIUM = browserName === 'chromium';
|
||||
(global as any).FFOX = browserName === 'firefox';
|
||||
(global as any).WEBKIT = browserName === 'webkit';
|
||||
|
||||
registerWorkerFixture('httpService', async ({parallelIndex}, test) => {
|
||||
const assetsPath = path.join(__dirname, 'assets');
|
||||
|
@ -184,22 +185,20 @@ registerFixture('server', async ({httpService}, test) => {
|
|||
await test(httpService.server);
|
||||
});
|
||||
|
||||
registerWorkerGenerator('browserName', () => {
|
||||
if (process.env.BROWSER)
|
||||
return [process.env.BROWSER];
|
||||
return ['chromium', 'webkit', 'firefox'];
|
||||
registerWorkerFixture('browserName', async ({}, test) => {
|
||||
await test(options.browserName);
|
||||
});
|
||||
|
||||
registerWorkerFixture('isChromium', async ({browserName}, test) => {
|
||||
await test(browserName === 'chromium');
|
||||
registerWorkerFixture('isChromium', async ({}, test) => {
|
||||
await test(options.browserName === 'chromium');
|
||||
});
|
||||
|
||||
registerWorkerFixture('isFirefox', async ({browserName}, test) => {
|
||||
await test(browserName === 'firefox');
|
||||
registerWorkerFixture('isFirefox', async ({}, test) => {
|
||||
await test(options.browserName === 'firefox');
|
||||
});
|
||||
|
||||
registerWorkerFixture('isWebKit', async ({browserName}, test) => {
|
||||
await test(browserName === 'webkit');
|
||||
registerWorkerFixture('isWebKit', async ({}, test) => {
|
||||
await test(options.browserName === 'webkit');
|
||||
});
|
||||
|
||||
registerFixture('httpsServer', async ({httpService}, test) => {
|
||||
|
@ -220,3 +219,12 @@ registerWorkerFixture('asset', async ({}, test) => {
|
|||
registerWorkerFixture('golden', async ({browserName}, test) => {
|
||||
await test(p => path.join(browserName, p));
|
||||
});
|
||||
|
||||
registerOption('browserName', () => {
|
||||
if (process.env.BROWSER)
|
||||
return [process.env.BROWSER];
|
||||
return ['chromium', 'webkit', 'firefox'];
|
||||
});
|
||||
registerOption('CHROMIUM', ({browserName}) => browserName === 'chromium');
|
||||
registerOption('FFOX', ({browserName}) => browserName === 'firefox');
|
||||
registerOption('WEBKIT', ({browserName}) => browserName === 'webkit');
|
||||
|
|
|
@ -325,7 +325,7 @@ it('should(not) block third party cookies', async({context, page, server}) => {
|
|||
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||
await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);
|
||||
await page.waitForTimeout(2000);
|
||||
const allowsThirdParty = CHROMIUM || FFOX;
|
||||
const allowsThirdParty = options.CHROMIUM || options.FFOX;
|
||||
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||
if (allowsThirdParty) {
|
||||
expect(cookies).toEqual([
|
||||
|
|
|
@ -72,7 +72,7 @@ it('should properly report httpOnly cookie', async({context, page, server}) => {
|
|||
expect(cookies[0].httpOnly).toBe(true);
|
||||
});
|
||||
|
||||
it.fail(WEBKIT && WIN)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {
|
||||
it.fail(options.WEBKIT && WIN)('should properly report "Strict" sameSite cookie', async({context, page, server}) => {
|
||||
server.setRoute('/empty.html', (req, res) => {
|
||||
res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');
|
||||
res.end();
|
||||
|
@ -83,7 +83,7 @@ it.fail(WEBKIT && WIN)('should properly report "Strict" sameSite cookie', async(
|
|||
expect(cookies[0].sameSite).toBe('Strict');
|
||||
});
|
||||
|
||||
it.fail(WEBKIT && WIN)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {
|
||||
it.fail(options.WEBKIT && WIN)('should properly report "Lax" sameSite cookie', async({context, page, server}) => {
|
||||
server.setRoute('/empty.html', (req, res) => {
|
||||
res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');
|
||||
res.end();
|
||||
|
|
|
@ -18,7 +18,7 @@ import './base.fixture';
|
|||
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should fail without credentials', async({browser, server}) => {
|
||||
it.fail(options.CHROMIUM && !HEADLESS)('should fail without credentials', async({browser, server}) => {
|
||||
server.setAuth('/empty.html', 'user', 'pass');
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
@ -27,7 +27,7 @@ it.fail(CHROMIUM && !HEADLESS)('should fail without credentials', async({browser
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should work with setHTTPCredentials', async({browser, server}) => {
|
||||
it.fail(options.CHROMIUM && !HEADLESS)('should work with setHTTPCredentials', async({browser, server}) => {
|
||||
server.setAuth('/empty.html', 'user', 'pass');
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
@ -50,7 +50,7 @@ it('should work with correct credentials', async({browser, server}) => {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should fail with wrong credentials', async({browser, server}) => {
|
||||
it.fail(options.CHROMIUM && !HEADLESS)('should fail with wrong credentials', async({browser, server}) => {
|
||||
server.setAuth('/empty.html', 'user', 'pass');
|
||||
const context = await browser.newContext({
|
||||
httpCredentials: { username: 'foo', password: 'bar' }
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
it.skip(FFOX)('should work', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should work', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
const page = await context.newPage();
|
||||
|
@ -26,7 +26,7 @@ it.skip(FFOX)('should work', async({playwright, browser, server}) => {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should support clicking', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should support clicking', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
const page = await context.newPage();
|
||||
|
@ -38,7 +38,7 @@ it.skip(FFOX)('should support clicking', async({playwright, browser, server}) =>
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should scroll to click', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('should scroll to click', async({browser, server}) => {
|
||||
const context = await browser.newContext({
|
||||
viewport: {
|
||||
width: 400,
|
||||
|
|
|
@ -137,7 +137,7 @@ it('should be isolated between contexts', async({browser, server}) => {
|
|||
]);
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should not change default locale in another context', async({browser, server}) => {
|
||||
it.fail(options.FFOX)('should not change default locale in another context', async({browser, server}) => {
|
||||
async function getContextLocale(context) {
|
||||
const page = await context.newPage();
|
||||
return await page.evaluate(() => (new Intl.NumberFormat()).resolvedOptions().locale);
|
||||
|
|
|
@ -156,7 +156,7 @@ it('should fire page lifecycle events', async function({browser, server}) {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
||||
it.fail(options.WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
||||
// WebKit: Shift+Click does not open a new window.
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
@ -170,7 +170,7 @@ it.fail(WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.fail(WEBKIT || FFOX)('should work with Ctrl-clicking', async({browser, server}) => {
|
||||
it.fail(options.WEBKIT || options.FFOX)('should work with Ctrl-clicking', async({browser, server}) => {
|
||||
// Firefox: reports an opener in this case.
|
||||
// WebKit: Ctrl+Click does not open a new tab.
|
||||
const context = await browser.newContext();
|
||||
|
|
|
@ -69,7 +69,7 @@ it('should work for multiple pages sharing same process', async({browser, server
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should not change default timezone in another context', async({browser, server}) => {
|
||||
it.fail(options.FFOX)('should not change default timezone in another context', async({browser, server}) => {
|
||||
async function getContextTimezone(context) {
|
||||
const page = await context.newPage();
|
||||
return await page.evaluate(() => Intl.DateTimeFormat().resolvedOptions().timeZone);
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import './base.fixture';
|
||||
|
||||
it.skip(FFOX)('should support mobile emulation', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should support mobile emulation', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
const page = await context.newPage();
|
||||
|
@ -27,7 +28,7 @@ it.skip(FFOX)('should support mobile emulation', async({playwright, browser, ser
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should support touch emulation', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should support touch emulation', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
const page = await context.newPage();
|
||||
|
@ -50,7 +51,7 @@ it.skip(FFOX)('should support touch emulation', async({playwright, browser, serv
|
|||
}
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should be detectable by Modernizr', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should be detectable by Modernizr', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
const page = await context.newPage();
|
||||
|
@ -59,7 +60,7 @@ it.skip(FFOX)('should be detectable by Modernizr', async({playwright, browser, s
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should detect touch when applying viewport with touches', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('should detect touch when applying viewport with touches', async({browser, server}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 800, height: 600 }, hasTouch: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -68,7 +69,7 @@ it.skip(FFOX)('should detect touch when applying viewport with touches', async({
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should support landscape emulation', async({playwright, browser, server}) => {
|
||||
it.skip(options.FFOX)('should support landscape emulation', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const iPhoneLandscape = playwright.devices['iPhone 6 landscape'];
|
||||
const context1 = await browser.newContext({ ...iPhone });
|
||||
|
@ -82,7 +83,7 @@ it.skip(FFOX)('should support landscape emulation', async({playwright, browser,
|
|||
await context2.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should support window.orientation emulation', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('should support window.orientation emulation', async({browser, server}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/mobile.html');
|
||||
|
@ -92,7 +93,7 @@ it.skip(FFOX)('should support window.orientation emulation', async({browser, ser
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should fire orientationchange event', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('should fire orientationchange event', async({browser, server}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 300, height: 400 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/mobile.html');
|
||||
|
@ -111,7 +112,7 @@ it.skip(FFOX)('should fire orientationchange event', async({browser, server}) =>
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('default mobile viewports to 980 width', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('default mobile viewports to 980 width', async({browser, server}) => {
|
||||
const context = await browser.newContext({ viewport: {width: 320, height: 480 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/empty.html');
|
||||
|
@ -119,7 +120,7 @@ it.skip(FFOX)('default mobile viewports to 980 width', async({browser, server})
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('respect meta viewport tag', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('respect meta viewport tag', async({browser, server}) => {
|
||||
const context = await browser.newContext({ viewport: {width: 320, height: 480 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/mobile.html');
|
||||
|
|
|
@ -37,7 +37,7 @@ it.skip(WIRE).slow()('should be able to reconnect to a browser', async({browserT
|
|||
await browserServer.close();
|
||||
});
|
||||
|
||||
it.skip(WIRE).fail(CHROMIUM && WIN).slow()('should handle exceptions during connect', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(WIRE).fail(options.CHROMIUM && WIN).slow()('should handle exceptions during connect', async({browserType, defaultBrowserOptions}) => {
|
||||
const browserServer = await browserType.launchServer(defaultBrowserOptions);
|
||||
const __testHookBeforeCreateBrowser = () => { throw new Error('Dummy') };
|
||||
const error = await browserType.connect({ wsEndpoint: browserServer.wsEndpoint(), __testHookBeforeCreateBrowser } as any).catch(e => e);
|
||||
|
|
|
@ -38,7 +38,7 @@ it('should throw if userDataDir option is passed', async({browserType, defaultBr
|
|||
expect(waitError.message).toContain('launchPersistentContext');
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should throw if page argument is passed', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(options.FFOX)('should throw if page argument is passed', async({browserType, defaultBrowserOptions}) => {
|
||||
let waitError = null;
|
||||
const options = Object.assign({}, defaultBrowserOptions, { args: ['http://example.com'] });
|
||||
await browserType.launch(options).catch(e => waitError = e);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import url from 'url';
|
||||
import './base.fixture';
|
||||
|
||||
it.fail(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {
|
||||
it.fail(options.WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {
|
||||
await page.goto(server.PREFIX + '/wasm/table2.html');
|
||||
expect(await page.evaluate('loadTable()')).toBe('42, 83');
|
||||
});
|
||||
|
@ -48,13 +48,13 @@ it('should respect CSP', async({page, server}) => {
|
|||
expect(await page.evaluate(() => window['testStatus'])).toBe('SUCCESS');
|
||||
});
|
||||
|
||||
it.fail(WEBKIT && (WIN || LINUX))('should play video', async({page, asset}) => {
|
||||
it.fail(options.WEBKIT && (WIN || LINUX))('should play video', async({page, asset}) => {
|
||||
// TODO: the test passes on Windows locally but fails on GitHub Action bot,
|
||||
// apparently due to a Media Pack issue in the Windows Server.
|
||||
// Also the test is very flaky on Linux WebKit.
|
||||
//
|
||||
// Safari only plays mp4 so we test WebKit with an .mp4 clip.
|
||||
const fileName = WEBKIT ? 'video_mp4.html' : 'video.html';
|
||||
const fileName = options.WEBKIT ? 'video_mp4.html' : 'video.html';
|
||||
const absolutePath = asset(fileName);
|
||||
// Our test server doesn't support range requests required to play on Mac,
|
||||
// so we load the page using a file url.
|
||||
|
|
|
@ -65,7 +65,7 @@ it('should scope context handles', async({browserType, browser, server}) => {
|
|||
await expectScopeState(browser, GOLDEN_PRECONDITION);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should scope CDPSession handles', async({browserType, browser, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should scope CDPSession handles', async({browserType, browser, server}) => {
|
||||
const GOLDEN_PRECONDITION = {
|
||||
_guid: '',
|
||||
objects: [
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({browserType, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should work', async function({browserType, page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/simple.html');
|
||||
const coverage = await page.coverage.stopCSSCoverage();
|
||||
|
@ -28,7 +28,7 @@ it.skip(!CHROMIUM)('should work', async function({browserType, page, server}) {
|
|||
expect(coverage[0].text.substring(range.start, range.end)).toBe('div { color: green; }');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/sourceurl.html');
|
||||
const coverage = await page.coverage.stopCSSCoverage();
|
||||
|
@ -36,7 +36,7 @@ it.skip(!CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
|||
expect(coverage[0].url).toBe('nicename.css');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report multiple stylesheets', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report multiple stylesheets', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/multiple.html');
|
||||
const coverage = await page.coverage.stopCSSCoverage();
|
||||
|
@ -46,7 +46,7 @@ it.skip(!CHROMIUM)('should report multiple stylesheets', async function({page, s
|
|||
expect(coverage[1].url).toContain('/csscoverage/stylesheet2.css');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report stylesheets that have no coverage', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report stylesheets that have no coverage', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/unused.html');
|
||||
const coverage = await page.coverage.stopCSSCoverage();
|
||||
|
@ -55,7 +55,7 @@ it.skip(!CHROMIUM)('should report stylesheets that have no coverage', async func
|
|||
expect(coverage[0].ranges.length).toBe(0);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work with media queries', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should work with media queries', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/media.html');
|
||||
const coverage = await page.coverage.stopCSSCoverage();
|
||||
|
@ -66,7 +66,7 @@ it.skip(!CHROMIUM)('should work with media queries', async function({page, serve
|
|||
]);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work with complicated usecases', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should work with complicated usecases', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/involved.html');
|
||||
const coverage: any = await page.coverage.stopCSSCoverage();
|
||||
|
@ -90,7 +90,7 @@ it.skip(!CHROMIUM)('should work with complicated usecases', async function({page
|
|||
);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should ignore injected stylesheets', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should ignore injected stylesheets', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.addStyleTag({content: 'body { margin: 10px;}'});
|
||||
// trigger style recalc
|
||||
|
@ -100,7 +100,7 @@ it.skip(!CHROMIUM)('should ignore injected stylesheets', async function({page, s
|
|||
expect(coverage.length).toBe(0);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report stylesheets across navigations', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report stylesheets across navigations', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage({resetOnNavigation: false});
|
||||
await page.goto(server.PREFIX + '/csscoverage/multiple.html');
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -108,7 +108,7 @@ it.skip(!CHROMIUM)('should report stylesheets across navigations', async functio
|
|||
expect(coverage.length).toBe(2);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should NOT report scripts across navigations', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should NOT report scripts across navigations', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage(); // Enabled by default.
|
||||
await page.goto(server.PREFIX + '/csscoverage/multiple.html');
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -116,7 +116,7 @@ it.skip(!CHROMIUM)('should NOT report scripts across navigations', async functio
|
|||
expect(coverage.length).toBe(0);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work with a recently loaded stylesheet', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should work with a recently loaded stylesheet', async function({page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.evaluate(async url => {
|
||||
document.body.textContent = 'hello, world';
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
it.skip(CHROMIUM)('should be missing', async function({page, server}) {
|
||||
it.skip(options.CHROMIUM)('should be missing', async function({page, server}) {
|
||||
expect(page.coverage).toBe(null);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({browserType, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should work', async function({browserType, page, server}) {
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.PREFIX + '/jscoverage/simple.html', { waitUntil: 'load' });
|
||||
const coverage = await page.coverage.stopJSCoverage();
|
||||
|
@ -28,7 +28,7 @@ it.skip(!CHROMIUM)('should work', async function({browserType, page, server}) {
|
|||
expect(coverage[0].functions.find(f => f.functionName === 'foo').ranges[0].count).toEqual(1);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.PREFIX + '/jscoverage/sourceurl.html');
|
||||
const coverage = await page.coverage.stopJSCoverage();
|
||||
|
@ -36,14 +36,14 @@ it.skip(!CHROMIUM)('should report sourceURLs', async function({page, server}) {
|
|||
expect(coverage[0].url).toBe('nicename.js');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should ignore eval() scripts by default', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should ignore eval() scripts by default', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.PREFIX + '/jscoverage/eval.html');
|
||||
const coverage = await page.coverage.stopJSCoverage();
|
||||
expect(coverage.length).toBe(1);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('shouldn\'t ignore eval() scripts if reportAnonymousScripts is true', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('shouldn\'t ignore eval() scripts if reportAnonymousScripts is true', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage({reportAnonymousScripts: true});
|
||||
await page.goto(server.PREFIX + '/jscoverage/eval.html');
|
||||
const coverage = await page.coverage.stopJSCoverage();
|
||||
|
@ -51,7 +51,7 @@ it.skip(!CHROMIUM)('shouldn\'t ignore eval() scripts if reportAnonymousScripts i
|
|||
expect(coverage.length).toBe(2);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should ignore playwright internal scripts if reportAnonymousScripts is true', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should ignore playwright internal scripts if reportAnonymousScripts is true', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage({reportAnonymousScripts: true});
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.evaluate('console.log("foo")');
|
||||
|
@ -60,7 +60,7 @@ it.skip(!CHROMIUM)('should ignore playwright internal scripts if reportAnonymous
|
|||
expect(coverage.length).toBe(0);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report multiple scripts', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report multiple scripts', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.PREFIX + '/jscoverage/multiple.html');
|
||||
const coverage = await page.coverage.stopJSCoverage();
|
||||
|
@ -70,7 +70,7 @@ it.skip(!CHROMIUM)('should report multiple scripts', async function({page, serve
|
|||
expect(coverage[1].url).toContain('/jscoverage/script2.js');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report scripts across navigations when disabled', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report scripts across navigations when disabled', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage({resetOnNavigation: false});
|
||||
await page.goto(server.PREFIX + '/jscoverage/multiple.html');
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -78,7 +78,7 @@ it.skip(!CHROMIUM)('should report scripts across navigations when disabled', asy
|
|||
expect(coverage.length).toBe(2);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should NOT report scripts across navigations when enabled', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should NOT report scripts across navigations when enabled', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage(); // Enabled by default.
|
||||
await page.goto(server.PREFIX + '/jscoverage/multiple.html');
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -86,7 +86,7 @@ it.skip(!CHROMIUM)('should NOT report scripts across navigations when enabled',
|
|||
expect(coverage.length).toBe(0);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should not hang when there is a debugger statement', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should not hang when there is a debugger statement', async function({page, server}) {
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.evaluate(() => {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import '../base.fixture';
|
||||
import { ChromiumBrowserContext } from '../..';
|
||||
|
||||
it.skip(!CHROMIUM)('should create a worker from a service worker', async({page, server, context}) => {
|
||||
it.skip(!options.CHROMIUM)('should create a worker from a service worker', async({page, server, context}) => {
|
||||
const [worker] = await Promise.all([
|
||||
(context as ChromiumBrowserContext).waitForEvent('serviceworker'),
|
||||
page.goto(server.PREFIX + '/serviceworkers/empty/sw.html')
|
||||
|
@ -24,7 +24,7 @@ it.skip(!CHROMIUM)('should create a worker from a service worker', async({page,
|
|||
expect(await worker.evaluate(() => self.toString())).toBe('[object ServiceWorkerGlobalScope]');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('serviceWorkers() should return current workers', async({page, server, context}) => {
|
||||
it.skip(!options.CHROMIUM)('serviceWorkers() should return current workers', async({page, server, context}) => {
|
||||
const [worker1] = await Promise.all([
|
||||
(context as ChromiumBrowserContext).waitForEvent('serviceworker'),
|
||||
page.goto(server.PREFIX + '/serviceworkers/empty/sw.html')
|
||||
|
@ -42,7 +42,7 @@ it.skip(!CHROMIUM)('serviceWorkers() should return current workers', async({page
|
|||
expect(workers).toContain(worker2);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should not create a worker from a shared worker', async({page, server, context}) => {
|
||||
it.skip(!options.CHROMIUM)('should not create a worker from a shared worker', async({page, server, context}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
let serviceWorkerCreated;
|
||||
(context as ChromiumBrowserContext).once('serviceworker', () => serviceWorkerCreated = true);
|
||||
|
@ -52,7 +52,7 @@ it.skip(!CHROMIUM)('should not create a worker from a shared worker', async({pag
|
|||
expect(serviceWorkerCreated).not.toBeTruthy();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should close service worker together with the context', async({browser, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should close service worker together with the context', async({browser, server}) => {
|
||||
const context = await browser.newContext() as ChromiumBrowserContext;
|
||||
const page = await context.newPage();
|
||||
const [worker] = await Promise.all([
|
||||
|
@ -66,7 +66,7 @@ it.skip(!CHROMIUM)('should close service worker together with the context', asyn
|
|||
expect(messages.join('|')).toBe('worker|context');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('Page.route should work with intervention headers', async({server, page}) => {
|
||||
it.skip(!options.CHROMIUM)('Page.route should work with intervention headers', async({server, page}) => {
|
||||
server.setRoute('/intervention', (req, res) => res.end(`
|
||||
<script>
|
||||
document.write('<script src="${server.CROSS_PROCESS_PREFIX}/intervention.js">' + '</scr' + 'ipt>');
|
||||
|
|
|
@ -21,21 +21,21 @@ import { ChromiumBrowser, ChromiumBrowserContext } from '../..';
|
|||
const { makeUserDataDir, removeUserDataDir } = utils;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE || !CHROMIUM)('should throw with remote-debugging-pipe argument', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(WIRE || !options.CHROMIUM)('should throw with remote-debugging-pipe argument', async({browserType, defaultBrowserOptions}) => {
|
||||
const options = Object.assign({}, defaultBrowserOptions);
|
||||
options.args = ['--remote-debugging-pipe'].concat(options.args || []);
|
||||
const error = await browserType.launchServer(options).catch(e => e);
|
||||
expect(error.message).toContain('Playwright manages remote debugging connection itself');
|
||||
});
|
||||
|
||||
it.skip(WIRE || !CHROMIUM)('should not throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(WIRE || !options.CHROMIUM)('should not throw with remote-debugging-port argument', async({browserType, defaultBrowserOptions}) => {
|
||||
const options = Object.assign({}, defaultBrowserOptions);
|
||||
options.args = ['--remote-debugging-port=0'].concat(options.args || []);
|
||||
const browser = await browserType.launchServer(options);
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM || WIRE || WIN)('should open devtools when "devtools: true" option is given', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(!options.CHROMIUM || WIRE || WIN)('should open devtools when "devtools: true" option is given', async({browserType, defaultBrowserOptions}) => {
|
||||
let devtoolsCallback;
|
||||
const devtoolsPromise = new Promise(f => devtoolsCallback = f);
|
||||
const __testHookForDevTools = devtools => devtools.__testHookOnBinding = parsed => {
|
||||
|
@ -51,7 +51,7 @@ it.skip(!CHROMIUM || WIRE || WIN)('should open devtools when "devtools: true" op
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should return background pages', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(!options.CHROMIUM)('should return background pages', async({browserType, defaultBrowserOptions}) => {
|
||||
const userDataDir = await makeUserDataDir();
|
||||
const extensionPath = path.join(__dirname, '..', 'assets', 'simple-extension');
|
||||
const extensionOptions = {...defaultBrowserOptions,
|
||||
|
@ -73,7 +73,7 @@ it.skip(!CHROMIUM)('should return background pages', async({browserType, default
|
|||
await removeUserDataDir(userDataDir);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should not create pages automatically', async ({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(!options.CHROMIUM)('should not create pages automatically', async ({browserType, defaultBrowserOptions}) => {
|
||||
const browser = await browserType.launch(defaultBrowserOptions);
|
||||
const browserSession = await (browser as ChromiumBrowser).newBrowserCDPSession();
|
||||
const targets = [];
|
||||
|
|
|
@ -26,14 +26,14 @@ registerWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, te
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report oopif frames', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report oopif frames', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await page.frames()[1].evaluate(() => '' + location.href)).toBe(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should handle oopif detach', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should handle oopif detach', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
expect(page.frames().length).toBe(2);
|
||||
|
@ -46,7 +46,7 @@ it.skip(!CHROMIUM)('should handle oopif detach', async function({browser, page,
|
|||
expect(detachedFrame).toBe(frame);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should handle remote -> local -> remote transitions', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should handle remote -> local -> remote transitions', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
|
@ -84,7 +84,7 @@ it.fail(true)('should get the proper viewport', async({browser, page, server}) =
|
|||
expect(await oopif.evaluate(() => 'ontouchstart' in window)).toBe(false);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should expose function', async({browser, page, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should expose function', async({browser, page, server}) => {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
|
@ -96,7 +96,7 @@ it.skip(!CHROMIUM)('should expose function', async({browser, page, server}) => {
|
|||
expect(result).toBe(36);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should emulate media', async({browser, page, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should emulate media', async({browser, page, server}) => {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
|
@ -106,7 +106,7 @@ it.skip(!CHROMIUM)('should emulate media', async({browser, page, server}) => {
|
|||
expect(await oopif.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should emulate offline', async({browser, page, context, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should emulate offline', async({browser, page, context, server}) => {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
|
@ -116,7 +116,7 @@ it.skip(!CHROMIUM)('should emulate offline', async({browser, page, context, serv
|
|||
expect(await oopif.evaluate(() => navigator.onLine)).toBe(false);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should support context options', async({browser, server, playwright}) => {
|
||||
it.skip(!options.CHROMIUM)('should support context options', async({browser, server, playwright}) => {
|
||||
const iPhone = playwright.devices['iPhone 6']
|
||||
const context = await browser.newContext({ ...iPhone, timezoneId: 'America/Jamaica', locale: 'fr-CH', userAgent: 'UA' });
|
||||
const page = await context.newPage();
|
||||
|
@ -138,7 +138,7 @@ it.skip(!CHROMIUM)('should support context options', async({browser, server, pla
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should respect route', async({browser, page, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should respect route', async({browser, page, server}) => {
|
||||
let intercepted = false;
|
||||
await page.route('**/digits/0.png', route => {
|
||||
intercepted = true;
|
||||
|
@ -150,7 +150,7 @@ it.skip(!CHROMIUM)('should respect route', async({browser, page, server}) => {
|
|||
expect(intercepted).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should take screenshot', async({browser, page, server, golden}) => {
|
||||
it.skip(!options.CHROMIUM)('should take screenshot', async({browser, page, server, golden}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(page.frames().length).toBe(2);
|
||||
|
@ -158,13 +158,13 @@ it.skip(!CHROMIUM)('should take screenshot', async({browser, page, server, golde
|
|||
expect(await page.screenshot()).toMatchImage(golden('screenshot-oopif.png'), { threshold: 0.3 });
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should load oopif iframes with subresources and request interception', async function({browser, page, server, context}) {
|
||||
it.skip(!options.CHROMIUM)('should load oopif iframes with subresources and request interception', async function({browser, page, server, context}) {
|
||||
await page.route('**/*', route => route.continue());
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report main requests', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should report main requests', async function({browser, page, server}) {
|
||||
const requestFrames = [];
|
||||
page.on('request', r => requestFrames.push(r.frame()));
|
||||
const finishedFrames = [];
|
||||
|
@ -202,7 +202,7 @@ it.skip(!CHROMIUM)('should report main requests', async function({browser, page,
|
|||
expect(finishedFrames[2]).toBe(grandChild);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should support exposeFunction', async function({browser, context, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should support exposeFunction', async function({browser, context, page, server}) {
|
||||
await context.exposeFunction('dec', a => a - 1);
|
||||
await page.exposeFunction('inc', a => a + 1);
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
|
@ -214,7 +214,7 @@ it.skip(!CHROMIUM)('should support exposeFunction', async function({browser, con
|
|||
expect(await page.frames()[1].evaluate(() => window['dec'](4))).toBe(3);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should support addInitScript', async function({browser, context, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should support addInitScript', async function({browser, context, page, server}) {
|
||||
await context.addInitScript(() => window['bar'] = 17);
|
||||
await page.addInitScript(() => window['foo'] = 42);
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
|
@ -226,14 +226,14 @@ it.skip(!CHROMIUM)('should support addInitScript', async function({browser, cont
|
|||
expect(await page.frames()[1].evaluate(() => window['bar'])).toBe(17);
|
||||
});
|
||||
// @see https://github.com/microsoft/playwright/issues/1240
|
||||
it.skip(!CHROMIUM)('should click a button when it overlays oopif', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should click a button when it overlays oopif', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/button-overlay-oopif.html');
|
||||
expect(await countOOPIFs(browser)).toBe(1);
|
||||
await page.click('button');
|
||||
expect(await page.evaluate(() => window['BUTTON_CLICKED'])).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should report google.com frame with headful', async({browserType, defaultBrowserOptions, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should report google.com frame with headful', async({browserType, defaultBrowserOptions, server}) => {
|
||||
// @see https://github.com/GoogleChrome/puppeteer/issues/2548
|
||||
// https://google.com is isolated by default in Chromium embedder.
|
||||
const browser = await browserType.launch({...defaultBrowserOptions, headless: false});
|
||||
|
@ -258,7 +258,7 @@ it.skip(!CHROMIUM)('should report google.com frame with headful', async({browser
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('ElementHandle.boundingBox() should work', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('ElementHandle.boundingBox() should work', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
await page.$eval('iframe', iframe => {
|
||||
iframe.style.width = '500px';
|
||||
|
@ -281,7 +281,7 @@ it.skip(!CHROMIUM)('ElementHandle.boundingBox() should work', async function({br
|
|||
expect(await handle2.boundingBox()).toEqual({ x: 100 + 42, y: 50 + 17, width: 50, height: 50 });
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should click', async function({browser, page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should click', async function({browser, page, server}) {
|
||||
await page.goto(server.PREFIX + '/dynamic-oopif.html');
|
||||
await page.$eval('iframe', iframe => {
|
||||
iframe.style.width = '500px';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
import '../base.fixture';
|
||||
import { ChromiumBrowserContext, ChromiumBrowser } from "../../types/types";
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({page}) {
|
||||
it.skip(!options.CHROMIUM)('should work', async function({page}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
|
||||
await Promise.all([
|
||||
|
@ -27,7 +27,7 @@ it.skip(!CHROMIUM)('should work', async function({page}) {
|
|||
expect(foo).toBe('bar');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should send events', async function({page, server}) {
|
||||
it.skip(!options.CHROMIUM)('should send events', async function({page, server}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
await client.send('Network.enable');
|
||||
const events = [];
|
||||
|
@ -36,12 +36,12 @@ it.skip(!CHROMIUM)('should send events', async function({page, server}) {
|
|||
expect(events.length).toBe(1);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should only accept a page', async function({page}) {
|
||||
it.skip(!options.CHROMIUM)('should only accept a page', async function({page}) {
|
||||
const error = await (page.context() as ChromiumBrowserContext).newCDPSession(page.context() as any).catch(e => e);
|
||||
expect(error.message).toContain('page: expected Page');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should enable and disable domains independently', async function({page}) {
|
||||
it.skip(!options.CHROMIUM)('should enable and disable domains independently', async function({page}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
await client.send('Runtime.enable');
|
||||
await client.send('Debugger.enable');
|
||||
|
@ -59,7 +59,7 @@ it.skip(!CHROMIUM)('should enable and disable domains independently', async func
|
|||
]);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should be able to detach session', async function({page}) {
|
||||
it.skip(!options.CHROMIUM)('should be able to detach session', async function({page}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
await client.send('Runtime.enable');
|
||||
const evalResponse = await client.send('Runtime.evaluate', {expression: '1 + 2', returnByValue: true});
|
||||
|
@ -74,7 +74,7 @@ it.skip(!CHROMIUM)('should be able to detach session', async function({page}) {
|
|||
expect(error.message).toContain('Target browser or context has been closed');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should throw nice errors', async function({page}) {
|
||||
it.skip(!options.CHROMIUM)('should throw nice errors', async function({page}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
const error = await theSourceOfTheProblems().catch(error => error);
|
||||
expect(error.stack).toContain('theSourceOfTheProblems');
|
||||
|
@ -85,7 +85,7 @@ it.skip(!CHROMIUM)('should throw nice errors', async function({page}) {
|
|||
}
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should not break page.close()', async function({browser}) {
|
||||
it.skip(!options.CHROMIUM)('should not break page.close()', async function({browser}) {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
const session = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
|
@ -94,7 +94,7 @@ it.skip(!CHROMIUM)('should not break page.close()', async function({browser}) {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should detach when page closes', async function({browser}) {
|
||||
it.skip(!options.CHROMIUM)('should detach when page closes', async function({browser}) {
|
||||
const context = await browser.newContext() as ChromiumBrowserContext;
|
||||
const page = await context.newPage();
|
||||
const session = await context.newCDPSession(page);
|
||||
|
@ -105,7 +105,7 @@ it.skip(!CHROMIUM)('should detach when page closes', async function({browser}) {
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({browser}) {
|
||||
it.skip(!options.CHROMIUM)('should work', async function({browser}) {
|
||||
const session = await (browser as ChromiumBrowser).newBrowserCDPSession();
|
||||
|
||||
const version = await session.send('Browser.getVersion');
|
||||
|
|
|
@ -35,14 +35,14 @@ registerFixture('outputFile', async ({tmpDir}, test) => {
|
|||
fs.unlinkSync(outputFile);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should output a trace', async({browser, page, server, outputFile}) => {
|
||||
it.skip(!options.CHROMIUM)('should output a trace', async({browser, page, server, outputFile}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page, {screenshots: true, path: outputFile});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
await (browser as ChromiumBrowser).stopTracing();
|
||||
expect(fs.existsSync(outputFile)).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should create directories as needed', async({browser, page, server, tmpDir}) => {
|
||||
it.skip(!options.CHROMIUM)('should create directories as needed', async({browser, page, server, tmpDir}) => {
|
||||
const filePath = path.join(tmpDir, 'these', 'are', 'directories');
|
||||
await (browser as ChromiumBrowser).startTracing(page, {screenshots: true, path: filePath});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
@ -50,7 +50,7 @@ it.skip(!CHROMIUM)('should create directories as needed', async({browser, page,
|
|||
expect(fs.existsSync(filePath)).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should run with custom categories if provided', async({browser, page, outputFile}) => {
|
||||
it.skip(!options.CHROMIUM)('should run with custom categories if provided', async({browser, page, outputFile}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page, {path: outputFile, categories: ['disabled-by-default-v8.cpu_profiler.hires']});
|
||||
await (browser as ChromiumBrowser).stopTracing();
|
||||
|
||||
|
@ -58,7 +58,7 @@ it.skip(!CHROMIUM)('should run with custom categories if provided', async({brows
|
|||
expect(traceJson.metadata['trace-config']).toContain('disabled-by-default-v8.cpu_profiler.hires');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should throw if tracing on two pages', async({browser, page, outputFile}) => {
|
||||
it.skip(!options.CHROMIUM)('should throw if tracing on two pages', async({browser, page, outputFile}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page, {path: outputFile});
|
||||
const newPage = await browser.newPage();
|
||||
let error = null;
|
||||
|
@ -68,7 +68,7 @@ it.skip(!CHROMIUM)('should throw if tracing on two pages', async({browser, page,
|
|||
await (browser as ChromiumBrowser).stopTracing();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should return a buffer', async({browser, page, server, outputFile}) => {
|
||||
it.skip(!options.CHROMIUM)('should return a buffer', async({browser, page, server, outputFile}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page, {screenshots: true, path: outputFile});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const trace = await (browser as ChromiumBrowser).stopTracing();
|
||||
|
@ -76,14 +76,14 @@ it.skip(!CHROMIUM)('should return a buffer', async({browser, page, server, outpu
|
|||
expect(trace.toString()).toEqual(buf.toString());
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should work without options', async({browser, page, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should work without options', async({browser, page, server}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page);
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const trace = await (browser as ChromiumBrowser).stopTracing();
|
||||
expect(trace).toBeTruthy();
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should support a buffer without a path', async({browser, page, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should support a buffer without a path', async({browser, page, server}) => {
|
||||
await (browser as ChromiumBrowser).startTracing(page, {screenshots: true});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const trace = await (browser as ChromiumBrowser).stopTracing();
|
||||
|
|
|
@ -317,7 +317,7 @@ it('should click the button inside an iframe', async({page, server}) => {
|
|||
expect(await frame.evaluate(() => window['result'])).toBe('Clicked');
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM || WEBKIT)('should click the button with fixed position inside an iframe', async({page, server}) => {
|
||||
it.fail(options.CHROMIUM || options.WEBKIT)('should click the button with fixed position inside an iframe', async({page, server}) => {
|
||||
// @see https://github.com/GoogleChrome/puppeteer/issues/4110
|
||||
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=986390
|
||||
// @see https://chromium-review.googlesource.com/c/chromium/src/+/1742784
|
||||
|
@ -396,7 +396,7 @@ it('should click a button in scrolling container with offset', async({page, serv
|
|||
expect(await page.evaluate('offsetY')).toBe(isWebKit ? 1910 + 8 : 1910);
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should click the button with offset with page scale', async({browser, server, isChromium, isWebKit}) => {
|
||||
it.skip(options.FFOX)('should click the button with offset with page scale', async({browser, server, isChromium, isWebKit}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
|
|
|
@ -121,7 +121,7 @@ it('should(not) block third party cookies', async ({server, launchPersistent}) =
|
|||
return document.cookie;
|
||||
});
|
||||
await page.waitForTimeout(2000);
|
||||
const allowsThirdParty = CHROMIUM || FFOX;
|
||||
const allowsThirdParty = options.CHROMIUM || options.FFOX;
|
||||
expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
|
||||
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||
if (allowsThirdParty) {
|
||||
|
@ -219,7 +219,7 @@ it('should support hasTouch option', async ({server, launchPersistent}) => {
|
|||
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work in persistent context', async ({server, launchPersistent}) => {
|
||||
it.skip(options.FFOX)('should work in persistent context', async ({server, launchPersistent}) => {
|
||||
// Firefox does not support mobile.
|
||||
const {page, context} = await launchPersistent({viewport: {width: 320, height: 480}, isMobile: true});
|
||||
await page.goto(server.PREFIX + '/empty.html');
|
||||
|
@ -304,7 +304,7 @@ it.slow()('should restore state from userDataDir', async({browserType, defaultBr
|
|||
await removeUserDataDir(userDataDir2);
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM && (WIN || MAC)).slow()('should restore cookies from userDataDir', async({browserType, defaultBrowserOptions, server, launchPersistent}) => {
|
||||
it.fail(options.CHROMIUM && (WIN || MAC)).slow()('should restore cookies from userDataDir', async({browserType, defaultBrowserOptions, server, launchPersistent}) => {
|
||||
const userDataDir = await makeUserDataDir();
|
||||
const browserContext = await browserType.launchPersistentContext(userDataDir, defaultBrowserOptions);
|
||||
const page = await browserContext.newPage();
|
||||
|
@ -340,7 +340,7 @@ it('should have default URL when launching browser', async ({launchPersistent})
|
|||
expect(urls).toEqual(['about:blank']);
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should throw if page argument is passed', async ({browserType, defaultBrowserOptions, server, tmpDir}) => {
|
||||
it.skip(options.FFOX)('should throw if page argument is passed', async ({browserType, defaultBrowserOptions, server, tmpDir}) => {
|
||||
const options = {...defaultBrowserOptions, args: [server.EMPTY_PAGE] };
|
||||
const error = await browserType.launchPersistentContext(tmpDir, options).catch(e => e);
|
||||
expect(error.message).toContain('can not specify page');
|
||||
|
@ -383,7 +383,7 @@ it('should fire close event for a persistent context', async({launchPersistent})
|
|||
expect(closed).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('coverage should work', async ({server, launchPersistent}) => {
|
||||
it.skip(!options.CHROMIUM)('coverage should work', async ({server, launchPersistent}) => {
|
||||
const {page, context} = await launchPersistent();
|
||||
await page.coverage.startJSCoverage();
|
||||
await page.goto(server.PREFIX + '/jscoverage/simple.html', { waitUntil: 'load' });
|
||||
|
@ -393,7 +393,7 @@ it.skip(!CHROMIUM)('coverage should work', async ({server, launchPersistent}) =>
|
|||
expect(coverage[0].functions.find(f => f.functionName === 'foo').ranges[0].count).toEqual(1);
|
||||
});
|
||||
|
||||
it.skip(CHROMIUM)('coverage should be missing', async ({launchPersistent}) => {
|
||||
it.skip(options.CHROMIUM)('coverage should be missing', async ({launchPersistent}) => {
|
||||
const {page, context} = await launchPersistent();
|
||||
expect(page.coverage).toBe(null);
|
||||
});
|
||||
|
|
|
@ -61,7 +61,7 @@ it('should dismiss the confirm prompt', async({page}) => {
|
|||
expect(result).toBe(false);
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should be able to close context with open alert', async({browser}) => {
|
||||
it.fail(options.WEBKIT)('should be able to close context with open alert', async({browser}) => {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
const alertPromise = page.waitForEvent('dialog');
|
||||
|
|
|
@ -126,7 +126,7 @@ it('should be atomic', async({playwright, page}) => {
|
|||
expect(await page.evaluate(() => window['_clicked'])).toBe(true);
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should dispatch drag drop events', async({page, server}) => {
|
||||
it.fail(options.WEBKIT)('should dispatch drag drop events', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/drag-n-drop.html');
|
||||
const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
|
||||
await page.dispatchEvent('#source', 'dragstart', { dataTransfer });
|
||||
|
@ -138,7 +138,7 @@ it.fail(WEBKIT)('should dispatch drag drop events', async({page, server}) => {
|
|||
}, {source, target})).toBeTruthy();
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should dispatch drag drop events', async({page, server}) => {
|
||||
it.fail(options.WEBKIT)('should dispatch drag drop events', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/drag-n-drop.html');
|
||||
const dataTransfer = await page.evaluateHandle(() => new DataTransfer());
|
||||
const source = await page.$('#source');
|
||||
|
|
|
@ -219,7 +219,7 @@ it(`should report download path within page.on('download', …) handler for Blob
|
|||
expect(fs.readFileSync(path).toString()).toBe('Hello world');
|
||||
await page.close();
|
||||
})
|
||||
it.fail(FFOX || WEBKIT)('should report alt-click downloads', async({browser, server}) => {
|
||||
it.fail(options.FFOX || options.WEBKIT)('should report alt-click downloads', async({browser, server}) => {
|
||||
// Firefox does not download on alt-click by default.
|
||||
// Our WebKit embedder does not download on alt-click, although Safari does.
|
||||
server.setRoute('/download', (req, res) => {
|
||||
|
@ -240,7 +240,7 @@ it.fail(FFOX || WEBKIT)('should report alt-click downloads', async({browser, ser
|
|||
await page.close();
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should report new window downloads', async({browser, server}) => {
|
||||
it.fail(options.CHROMIUM && !HEADLESS)('should report new window downloads', async({browser, server}) => {
|
||||
// TODO: - the test fails in headful Chromium as the popup page gets closed along
|
||||
// with the session before download completed event arrives.
|
||||
// - WebKit doesn't close the popup page
|
||||
|
|
|
@ -19,7 +19,7 @@ import path from 'path';
|
|||
const electronName = process.platform === 'win32' ? 'electron.cmd' : 'electron';
|
||||
|
||||
|
||||
it.skip(!CHROMIUM)('should fire close event', async ({ playwright }) => {
|
||||
it.skip(!options.CHROMIUM)('should fire close event', async ({ playwright }) => {
|
||||
const electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', electronName);
|
||||
const application = await playwright.electron.launch(electronPath, {
|
||||
args: [path.join(__dirname, 'testApp.js')],
|
||||
|
@ -34,12 +34,12 @@ it.skip(!CHROMIUM)('should fire close event', async ({ playwright }) => {
|
|||
expect(events.join('|')).toBe('context|application');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should script application', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should script application', async ({ application }) => {
|
||||
const appPath = await application.evaluate(async ({ app }) => app.getAppPath());
|
||||
expect(appPath).toContain('electron');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should create window', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should create window', async ({ application }) => {
|
||||
const [ page ] = await Promise.all([
|
||||
application.waitForEvent('window'),
|
||||
application.evaluate(({ BrowserWindow }) => {
|
||||
|
@ -51,13 +51,13 @@ it.skip(!CHROMIUM)('should create window', async ({ application }) => {
|
|||
expect(await page.title()).toBe('Hello World 1');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should create window 2', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should create window 2', async ({ application }) => {
|
||||
const page = await application.newBrowserWindow({ width: 800, height: 600 });
|
||||
await page.goto('data:text/html,<title>Hello World 2</title>');
|
||||
expect(await page.title()).toBe('Hello World 2');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should create multiple windows', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should create multiple windows', async ({ application }) => {
|
||||
const createPage = async ordinal => {
|
||||
const page = await application.newBrowserWindow({ width: 800, height: 600 });
|
||||
await Promise.all([
|
||||
|
@ -78,7 +78,7 @@ it.skip(!CHROMIUM)('should create multiple windows', async ({ application }) =>
|
|||
expect(titles).toEqual(['Hello World 2', 'Hello World 3', 'Hello World 4']);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should route network', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should route network', async ({ application }) => {
|
||||
await application.context().route('**/empty.html', (route, request) => {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
|
@ -91,14 +91,14 @@ it.skip(!CHROMIUM)('should route network', async ({ application }) => {
|
|||
expect(await page.title()).toBe('Hello World');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should support init script', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should support init script', async ({ application }) => {
|
||||
await application.context().addInitScript('window.magic = 42;')
|
||||
const page = await application.newBrowserWindow({ width: 800, height: 600 });
|
||||
await page.goto('data:text/html,<script>window.copy = magic</script>');
|
||||
expect(await page.evaluate(() => window['copy'])).toBe(42);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should expose function', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should expose function', async ({ application }) => {
|
||||
const t = Date.now();
|
||||
await application.context().exposeFunction('add', (a, b) => a + b);
|
||||
const page = await application.newBrowserWindow({ width: 800, height: 600 });
|
||||
|
@ -106,7 +106,7 @@ it.skip(!CHROMIUM)('should expose function', async ({ application }) => {
|
|||
expect(await page.evaluate(() => window['result'])).toBe(42);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should wait for first window', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should wait for first window', async ({ application }) => {
|
||||
application.evaluate(({ BrowserWindow }) => {
|
||||
const window = new BrowserWindow({ width: 800, height: 600 });
|
||||
window.loadURL('data:text/html,<title>Hello World!</title>');
|
||||
|
@ -115,7 +115,7 @@ it.skip(!CHROMIUM)('should wait for first window', async ({ application }) => {
|
|||
expect(await window.title()).toBe('Hello World!');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should have a clipboard instance', async ({ application }) => {
|
||||
it.skip(!options.CHROMIUM)('should have a clipboard instance', async ({ application }) => {
|
||||
const clipboardContentToWrite = 'Hello from Playwright';
|
||||
await application.evaluate(async ({clipboard}, text) => clipboard.writeText(text), clipboardContentToWrite);
|
||||
const clipboardContentRead = await application.evaluate(async ({clipboard}) => clipboard.readText());
|
||||
|
|
|
@ -15,25 +15,25 @@
|
|||
*/
|
||||
import './electron.fixture';
|
||||
|
||||
it.skip(!CHROMIUM)('should click the button', async({window, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should click the button', async({window, server}) => {
|
||||
await window.goto(server.PREFIX + '/input/button.html');
|
||||
await window.click('button');
|
||||
expect(await window.evaluate('result')).toBe('Clicked');
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should check the box', async({window}) => {
|
||||
it.skip(!options.CHROMIUM)('should check the box', async({window}) => {
|
||||
await window.setContent(`<input id='checkbox' type='checkbox'></input>`);
|
||||
await window.check('input');
|
||||
expect(await window.evaluate('checkbox.checked')).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should not check the checked box', async({window}) => {
|
||||
it.skip(!options.CHROMIUM)('should not check the checked box', async({window}) => {
|
||||
await window.setContent(`<input id='checkbox' type='checkbox' checked></input>`);
|
||||
await window.check('input');
|
||||
expect(await window.evaluate('checkbox.checked')).toBe(true);
|
||||
});
|
||||
|
||||
it.skip(!CHROMIUM)('should type into a textarea', async({window, server}) => {
|
||||
it.skip(!options.CHROMIUM)('should type into a textarea', async({window, server}) => {
|
||||
await window.evaluate(() => {
|
||||
const textarea = document.createElement('textarea');
|
||||
document.body.appendChild(textarea);
|
||||
|
|
|
@ -18,7 +18,7 @@ import './base.fixture';
|
|||
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
it.fail(FFOX && !HEADLESS)('should work', async ({ page, server }) => {
|
||||
it.fail(options.FFOX && !HEADLESS)('should work', async ({ page, server }) => {
|
||||
await page.setViewportSize({ width: 500, height: 500 });
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
const elementHandle = await page.$('.box:nth-of-type(13)');
|
||||
|
@ -65,7 +65,7 @@ it('should work with SVG nodes', async ({ page, server }) => {
|
|||
expect(pwBoundingBox).toEqual(webBoundingBox);
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with page scale', async ({ browser, server }) => {
|
||||
it.skip(options.FFOX)('should work with page scale', async ({ browser, server }) => {
|
||||
const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
|
|
|
@ -23,7 +23,7 @@ import path from 'path';
|
|||
import fs from 'fs';
|
||||
|
||||
// Firefox headful produces a different image.
|
||||
const ffheadful = FFOX && !HEADLESS;
|
||||
const ffheadful = options.FFOX && !HEADLESS;
|
||||
|
||||
it.skip(ffheadful)('should work', async({page, server, golden}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
|
@ -211,7 +211,7 @@ it.skip(ffheadful)('should work for an element with fractional dimensions', asyn
|
|||
expect(screenshot).toMatchImage(golden('screenshot-element-fractional.png'));
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with a mobile viewport', async({browser, server, golden}) => {
|
||||
it.skip(options.FFOX)('should work with a mobile viewport', async({browser, server, golden}) => {
|
||||
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
@ -222,7 +222,7 @@ it.skip(FFOX)('should work with a mobile viewport', async({browser, server, gold
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with device scale factor', async({browser, server, golden}) => {
|
||||
it.skip(options.FFOX)('should work with device scale factor', async({browser, server, golden}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
|
@ -102,7 +103,7 @@ it('should change document.activeElement', async({page, server}) => {
|
|||
expect(active).toEqual(['INPUT', 'TEXTAREA']);
|
||||
});
|
||||
|
||||
it.skip(FFOX && !HEADLESS)('should not affect screenshots', async({page, server, golden}) => {
|
||||
it.skip(options.FFOX && !HEADLESS)('should not affect screenshots', async({page, server, golden}) => {
|
||||
// Firefox headful produces a different image.
|
||||
const page2 = await page.context().newPage();
|
||||
await Promise.all([
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
import '../base.fixture';
|
||||
|
||||
it.skip(!FFOX)('should pass firefox user preferences', async({browserType, defaultBrowserOptions}) => {
|
||||
it.skip(!options.FFOX)('should pass firefox user preferences', async({browserType, defaultBrowserOptions}) => {
|
||||
const browser = await browserType.launch({
|
||||
...defaultBrowserOptions,
|
||||
firefoxUserPrefs: {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
it('should work', async function({page, server}) {
|
||||
it.skip(options.FFOX)('should work', async function({page, server}) {
|
||||
await page.setContent(`<div id=d1 tabIndex=0></div>`);
|
||||
expect(await page.evaluate(() => document.activeElement.nodeName)).toBe('BODY');
|
||||
await page.focus('#d1');
|
||||
|
@ -77,7 +77,7 @@ it('should traverse focus in all directions', async function({page}) {
|
|||
|
||||
// Chromium and WebKit both have settings for tab traversing all links, but
|
||||
// it is only on by default in WebKit.
|
||||
it.skip(!MAC || !WEBKIT)('should traverse only form elements', async function({page}) {
|
||||
it.skip(!MAC || !options.WEBKIT)('should traverse only form elements', async function({page}) {
|
||||
await page.setContent(`
|
||||
<input id="input-1">
|
||||
<button id="button">buttton</button>
|
||||
|
|
|
@ -127,7 +127,7 @@ it('should be isolated between frames', async({page, server}) => {
|
|||
expect(a2).toBe(2);
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM || FFOX)('should work in iframes that failed initial navigation', async({page, server}) => {
|
||||
it.fail(options.CHROMIUM || options.FFOX)('should work in iframes that failed initial navigation', async({page, server}) => {
|
||||
// - Firefox does not report domcontentloaded for the iframe.
|
||||
// - Chromium and Firefox report empty url.
|
||||
// - Chromium does not report main/utility worlds for the iframe.
|
||||
|
@ -148,7 +148,7 @@ it.fail(CHROMIUM || FFOX)('should work in iframes that failed initial navigation
|
|||
expect(await page.frames()[1].$('div')).toBeTruthy();
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM)('should work in iframes that interrupted initial javascript url navigation', async({page, server}) => {
|
||||
it.fail(options.CHROMIUM)('should work in iframes that interrupted initial javascript url navigation', async({page, server}) => {
|
||||
// Chromium does not report isolated world for the iframe.
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.evaluate(() => {
|
||||
|
|
|
@ -172,7 +172,7 @@ it('should report different frame instance when frame re-attaches', async({page,
|
|||
expect(frame1).not.toBe(frame2);
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should refuse to display x-frame-options:deny iframe', async({page, server}) => {
|
||||
it.fail(options.FFOX)('should refuse to display x-frame-options:deny iframe', async({page, server}) => {
|
||||
server.setRoute('/x-frame-options-deny.html', async (req, res) => {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.setHeader('X-Frame-Options', 'DENY');
|
||||
|
|
|
@ -27,7 +27,7 @@ it('should have default url when launching browser', async ({browserType, defaul
|
|||
await browserContext.close();
|
||||
});
|
||||
|
||||
it.fail(WIN && CHROMIUM).slow()('headless should be able to read cookies written by headful', async({browserType, defaultBrowserOptions, server}) => {
|
||||
it.fail(WIN && options.CHROMIUM).slow()('headless should be able to read cookies written by headful', async({browserType, defaultBrowserOptions, server}) => {
|
||||
// see https://github.com/microsoft/playwright/issues/717
|
||||
const userDataDir = await makeUserDataDir();
|
||||
// Write a cookie in headful chrome
|
||||
|
@ -107,7 +107,7 @@ it('should(not) block third party cookies', async({browserType, defaultBrowserOp
|
|||
return document.cookie;
|
||||
});
|
||||
await page.waitForTimeout(2000);
|
||||
const allowsThirdParty = CHROMIUM || FFOX;
|
||||
const allowsThirdParty = options.CHROMIUM || options.FFOX;
|
||||
expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
|
||||
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||
if (allowsThirdParty) {
|
||||
|
@ -129,7 +129,7 @@ it('should(not) block third party cookies', async({browserType, defaultBrowserOp
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should not override viewport size when passed null', async function({browserType, defaultBrowserOptions, server}) {
|
||||
it.fail(options.WEBKIT)('should not override viewport size when passed null', async function({browserType, defaultBrowserOptions, server}) {
|
||||
// Our WebKit embedder does not respect window features.
|
||||
const browser = await browserType.launch({...defaultBrowserOptions, headless: false });
|
||||
const context = await browser.newContext({ viewport: null });
|
||||
|
|
|
@ -53,6 +53,6 @@ it('should work with different subtypes', async({page}) => {
|
|||
expect((await page.evaluateHandle('new WeakSet()')).toString()).toBe('JSHandle@weakset');
|
||||
expect((await page.evaluateHandle('new Error()')).toString()).toBe('JSHandle@error');
|
||||
// TODO(yurys): change subtype from array to typedarray in WebKit.
|
||||
expect((await page.evaluateHandle('new Int32Array()')).toString()).toBe(WEBKIT ? 'JSHandle@array' : 'JSHandle@typedarray');
|
||||
expect((await page.evaluateHandle('new Int32Array()')).toString()).toBe(options.WEBKIT ? 'JSHandle@array' : 'JSHandle@typedarray');
|
||||
expect((await page.evaluateHandle('new Proxy({}, {})')).toString()).toBe('JSHandle@proxy');
|
||||
});
|
||||
|
|
|
@ -83,7 +83,7 @@ it('insertText should only emit input event', async ({page, server}) => {
|
|||
expect(await events.jsonValue()).toEqual(['input']);
|
||||
});
|
||||
|
||||
it.fail(FFOX && MAC)('should report shiftKey', async ({page, server}) => {
|
||||
it.fail(options.FFOX && MAC)('should report shiftKey', async ({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/keyboard.html');
|
||||
const keyboard = page.keyboard;
|
||||
const codeForKey = {'Shift': 16, 'Alt': 18, 'Control': 17};
|
||||
|
@ -380,7 +380,7 @@ it('should work after a cross origin navigation', async ({page, server}) => {
|
|||
});
|
||||
|
||||
// event.keyIdentifier has been removed from all browsers except WebKit
|
||||
it.skip(!WEBKIT)('should expose keyIdentifier in webkit', async ({page, server}) => {
|
||||
it.skip(!options.WEBKIT)('should expose keyIdentifier in webkit', async ({page, server}) => {
|
||||
const lastEvent = await captureLastKeydown(page);
|
||||
const keyMap = {
|
||||
'ArrowUp': 'Up',
|
||||
|
|
|
@ -26,8 +26,8 @@ function dimensions() {
|
|||
};
|
||||
}
|
||||
|
||||
it.fail(FFOX && WIN)('should click the document', async({page, server}) => {
|
||||
// Occasionally times out on FFOX on Windows: https://github.com/microsoft/playwright/pull/1911/checks?check_run_id=607149016
|
||||
it.fail(options.FFOX && WIN)('should click the document', async({page, server}) => {
|
||||
// Occasionally times out on options.FFOX on Windows: https://github.com/microsoft/playwright/pull/1911/checks?check_run_id=607149016
|
||||
await page.evaluate(() => {
|
||||
window["clickPromise"] = new Promise(resolve => {
|
||||
document.addEventListener('click', event => {
|
||||
|
@ -163,7 +163,7 @@ it('should tween mouse movement', async({page, isWebKit}) => {
|
|||
]);
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with mobile viewports and cross process navigations', async({browser, server}) => {
|
||||
it.skip(options.FFOX)('should work with mobile viewports and cross process navigations', async({browser, server}) => {
|
||||
// @see https://crbug.com/929806
|
||||
const context = await browser.newContext({ viewport: {width: 360, height: 640}, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
|
|
|
@ -55,7 +55,7 @@ it('should return headers', async({page, server, isChromium, isFirefox, isWebKit
|
|||
expect(response.request().headers()['user-agent']).toContain('WebKit');
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM||WEBKIT)('should get the same headers as the server', async({page, server}) => {
|
||||
it.fail(options.CHROMIUM||options.WEBKIT)('should get the same headers as the server', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/empty.html');
|
||||
let serverRequest;
|
||||
server.setRoute('/something', (request, response) => {
|
||||
|
|
|
@ -74,7 +74,7 @@ it('should work with a path', async({page, server}) => {
|
|||
expect(await page.evaluate(() => window['__injected'])).toBe(42);
|
||||
});
|
||||
|
||||
it.skip(WEBKIT)('should include sourceURL when path is provided', async({page, server}) => {
|
||||
it.skip(options.WEBKIT)('should include sourceURL when path is provided', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.addScriptTag({ path: path.join(__dirname, 'assets/injectedfile.js') });
|
||||
const result = await page.evaluate(() => window['__injectedError'].stack);
|
||||
|
@ -88,7 +88,7 @@ it('should work with content', async({page, server}) => {
|
|||
expect(await page.evaluate(() => window['__injected'])).toBe(35);
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should throw when added with content to the CSP page', async({page, server}) => {
|
||||
it.fail(options.FFOX)('should throw when added with content to the CSP page', async({page, server}) => {
|
||||
// Firefox fires onload for blocked script before it issues the CSP console error.
|
||||
await page.goto(server.PREFIX + '/csp.html');
|
||||
let error = null;
|
||||
|
|
|
@ -218,7 +218,7 @@ it('should have sane user agent', async ({page, isChromium, isFirefox}) => {
|
|||
expect(part5).toBe(undefined);
|
||||
return;
|
||||
}
|
||||
// For both CHROMIUM and WEBKIT, third part is the AppleWebKit version.
|
||||
// For both options.CHROMIUM and options.WEBKIT, third part is the AppleWebKit version.
|
||||
expect(part3.startsWith('AppleWebKit/')).toBe(true);
|
||||
expect(part4).toBe('KHTML, like Gecko');
|
||||
// 5th part encodes real browser name and engine version.
|
||||
|
@ -243,7 +243,7 @@ it('frame.press should work', async({page, server}) => {
|
|||
expect(await frame.evaluate(() => document.querySelector('textarea').value)).toBe('a');
|
||||
});
|
||||
|
||||
it.fail(FFOX)('frame.focus should work multiple times', async ({ context, server }) => {
|
||||
it.fail(options.FFOX)('frame.focus should work multiple times', async ({ context, server }) => {
|
||||
const page1 = await context.newPage()
|
||||
const page2 = await context.newPage()
|
||||
for (const page of [page1, page2]) {
|
||||
|
|
|
@ -114,7 +114,7 @@ it('should work in cross-process iframe', async({browser, server}) => {
|
|||
await page.close();
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should change the actual colors in css', async({page}) => {
|
||||
it.fail(options.FFOX)('should change the actual colors in css', async({page}) => {
|
||||
await page.setContent(`
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
|
|
|
@ -415,7 +415,7 @@ it('should not throw an error when evaluation does a navigation', async ({ page,
|
|||
expect(result).toEqual([42]);
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should not throw an error when evaluation does a synchronous navigation and returns an object', async ({ page, server }) => {
|
||||
it.fail(options.WEBKIT)('should not throw an error when evaluation does a synchronous navigation and returns an object', async ({ page, server }) => {
|
||||
// It is imporant to be on about:blank for sync reload.
|
||||
const result = await page.evaluate(() => {
|
||||
window.location.reload();
|
||||
|
@ -453,7 +453,7 @@ it('should work even when JSON is set to null', async ({ page }) => {
|
|||
expect(result).toEqual({ abc: 123 });
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should await promise from popup', async ({ page, server }) => {
|
||||
it.fail(options.FFOX)('should await promise from popup', async ({ page, server }) => {
|
||||
// Something is wrong about the way Firefox waits for the chained promise
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
const result = await page.evaluate(() => {
|
||||
|
|
|
@ -18,7 +18,7 @@ import './base.fixture';
|
|||
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
const CRASH_FAIL = (FFOX && WIN) || WIRE;
|
||||
const CRASH_FAIL = (options.FFOX && WIN) || WIRE;
|
||||
// Firefox Win: it just doesn't crash sometimes.
|
||||
function crash(pageImpl, browserName) {
|
||||
if (browserName === 'chromium')
|
||||
|
|
|
@ -30,7 +30,7 @@ it('should fire', async({page, server, isWebKit}) => {
|
|||
expect(error.stack).toBe(stack);
|
||||
});
|
||||
|
||||
it.fail(WEBKIT)('should contain sourceURL', async({page, server}) => {
|
||||
it.fail(options.WEBKIT)('should contain sourceURL', async({page, server}) => {
|
||||
const [error] = await Promise.all([
|
||||
page.waitForEvent('pageerror'),
|
||||
page.goto(server.PREFIX + '/error.html'),
|
||||
|
@ -50,24 +50,24 @@ it('should handle odd values', async ({page}) => {
|
|||
page.waitForEvent('pageerror'),
|
||||
page.evaluate(value => setTimeout(() => { throw value; }, 0), value),
|
||||
]);
|
||||
expect(error.message).toBe(FFOX ? 'uncaught exception: ' + message : message);
|
||||
expect(error.message).toBe(options.FFOX ? 'uncaught exception: ' + message : message);
|
||||
}
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should handle object', async ({page}) => {
|
||||
it.fail(options.FFOX)('should handle object', async ({page}) => {
|
||||
// Firefox just does not report this error.
|
||||
const [error] = await Promise.all([
|
||||
page.waitForEvent('pageerror'),
|
||||
page.evaluate(() => setTimeout(() => { throw {}; }, 0)),
|
||||
]);
|
||||
expect(error.message).toBe(CHROMIUM ? 'Object' : '[object Object]');
|
||||
expect(error.message).toBe(options.CHROMIUM ? 'Object' : '[object Object]');
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should handle window', async ({page}) => {
|
||||
it.fail(options.FFOX)('should handle window', async ({page}) => {
|
||||
// Firefox just does not report this error.
|
||||
const [error] = await Promise.all([
|
||||
page.waitForEvent('pageerror'),
|
||||
page.evaluate(() => setTimeout(() => { throw window; }, 0)),
|
||||
]);
|
||||
expect(error.message).toBe(CHROMIUM ? 'Window' : '[object Window]');
|
||||
expect(error.message).toBe(options.CHROMIUM ? 'Window' : '[object Window]');
|
||||
});
|
||||
|
|
|
@ -59,7 +59,7 @@ it('should fill date input after clicking', async({page, server}) => {
|
|||
expect(await page.$eval('input', input => input.value)).toBe('2020-03-02');
|
||||
});
|
||||
|
||||
it.skip(WEBKIT)('should throw on incorrect date', async({page, server}) => {
|
||||
it.skip(options.WEBKIT)('should throw on incorrect date', async({page, server}) => {
|
||||
await page.setContent('<input type=date>');
|
||||
const error = await page.fill('input', '2020-13-05').catch(e => e);
|
||||
expect(error.message).toContain('Malformed value');
|
||||
|
@ -71,7 +71,7 @@ it('should fill time input', async({page, server}) => {
|
|||
expect(await page.$eval('input', input => input.value)).toBe('13:15');
|
||||
});
|
||||
|
||||
it.skip(WEBKIT)('should throw on incorrect time', async({page, server}) => {
|
||||
it.skip(options.WEBKIT)('should throw on incorrect time', async({page, server}) => {
|
||||
await page.setContent('<input type=time>');
|
||||
const error = await page.fill('input', '25:05').catch(e => e);
|
||||
expect(error.message).toContain('Malformed value');
|
||||
|
@ -83,7 +83,7 @@ it('should fill datetime-local input', async({page, server}) => {
|
|||
expect(await page.$eval('input', input => input.value)).toBe('2020-03-02T05:15');
|
||||
});
|
||||
|
||||
it.skip(WEBKIT || FFOX)('should throw on incorrect datetime-local', async({page, server}) => {
|
||||
it.skip(options.WEBKIT || options.FFOX)('should throw on incorrect datetime-local', async({page, server}) => {
|
||||
await page.setContent('<input type=datetime-local>');
|
||||
const error = await page.fill('input', 'abc').catch(e => e);
|
||||
expect(error.message).toContain('Malformed value');
|
||||
|
|
|
@ -52,7 +52,7 @@ it('page.goBack should work with HistoryAPI', async({page, server}) => {
|
|||
expect(page.url()).toBe(server.PREFIX + '/first.html');
|
||||
});
|
||||
|
||||
it.fail(WEBKIT && MAC)('page.goBack should work for file urls', async ({page, server, asset}) => {
|
||||
it.fail(options.WEBKIT && MAC)('page.goBack should work for file urls', async ({page, server, asset}) => {
|
||||
// WebKit embedder fails to go back/forward to the file url.
|
||||
const url1 = url.pathToFileURL(asset('empty.html')).href;
|
||||
const url2 = server.EMPTY_PAGE;
|
||||
|
|
|
@ -22,7 +22,7 @@ import fs from 'fs';
|
|||
const { HEADLESS } = testOptions;
|
||||
|
||||
// Firefox headful produces a different image.
|
||||
const ffheadful = FFOX && !HEADLESS;
|
||||
const ffheadful = options.FFOX && !HEADLESS;
|
||||
|
||||
it.skip(ffheadful)('should work', async({page, server, golden}) => {
|
||||
await page.setViewportSize({width: 500, height: 500});
|
||||
|
@ -140,7 +140,7 @@ it.skip(ffheadful)('should run in parallel in multiple pages', async({server, co
|
|||
await Promise.all(pages.map(page => page.close()));
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should allow transparency', async({page, golden}) => {
|
||||
it.fail(options.FFOX)('should allow transparency', async({page, golden}) => {
|
||||
await page.setViewportSize({ width: 50, height: 150 });
|
||||
await page.setContent(`
|
||||
<style>
|
||||
|
@ -174,7 +174,7 @@ it.skip(ffheadful)('should work with odd clip size on Retina displays', async({p
|
|||
expect(screenshot).toMatchImage(golden('screenshot-clip-odd-size.png'));
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with a mobile viewport', async({browser, server, golden}) => {
|
||||
it.skip(options.FFOX)('should work with a mobile viewport', async({browser, server, golden}) => {
|
||||
const context = await browser.newContext({ viewport: { width: 320, height: 480 }, isMobile: true });
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow.html');
|
||||
|
@ -183,7 +183,7 @@ it.skip(FFOX)('should work with a mobile viewport', async({browser, server, gold
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with a mobile viewport and clip', async({browser, server, golden}) => {
|
||||
it.skip(options.FFOX)('should work with a mobile viewport and clip', async({browser, server, golden}) => {
|
||||
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow.html');
|
||||
|
@ -192,7 +192,7 @@ it.skip(FFOX)('should work with a mobile viewport and clip', async({browser, ser
|
|||
await context.close();
|
||||
});
|
||||
|
||||
it.skip(FFOX)('should work with a mobile viewport and fullPage', async({browser, server, golden}) => {
|
||||
it.skip(options.FFOX)('should work with a mobile viewport and fullPage', async({browser, server, golden}) => {
|
||||
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/overflow-large.html');
|
||||
|
@ -215,7 +215,7 @@ it.skip(ffheadful)('should work for translateZ', async({page, server, golden}) =
|
|||
expect(screenshot).toMatchImage(golden('screenshot-translateZ.png'));
|
||||
});
|
||||
|
||||
it.fail(FFOX || WEBKIT)('should work for webgl', async({page, server, golden}) => {
|
||||
it.fail(options.FFOX || options.WEBKIT)('should work for webgl', async({page, server, golden}) => {
|
||||
await page.setViewportSize({width: 640, height: 480});
|
||||
await page.goto(server.PREFIX + '/screenshots/webgl.html');
|
||||
const screenshot = await page.screenshot();
|
||||
|
|
|
@ -77,8 +77,8 @@ it('should wait for load state of empty url popup', async({browser, page}) => {
|
|||
}),
|
||||
]);
|
||||
await popup.waitForLoadState();
|
||||
expect(readyState).toBe(FFOX ? 'uninitialized' : 'complete');
|
||||
expect(await popup.evaluate(() => document.readyState)).toBe(FFOX ? 'uninitialized' : 'complete');
|
||||
expect(readyState).toBe(options.FFOX ? 'uninitialized' : 'complete');
|
||||
expect(await popup.evaluate(() => document.readyState)).toBe(options.FFOX ? 'uninitialized' : 'complete');
|
||||
});
|
||||
|
||||
it('should wait for load state of about:blank popup ', async({browser, page}) => {
|
||||
|
|
|
@ -140,7 +140,7 @@ it('should work with DOM history.back()/history.forward()', async({page, server}
|
|||
expect(page.url()).toBe(server.PREFIX + '/second.html');
|
||||
});
|
||||
|
||||
it.fail(FFOX)('should work when subframe issues window.stop()', async({page, server}) => {
|
||||
it.fail(options.FFOX)('should work when subframe issues window.stop()', async({page, server}) => {
|
||||
server.setRoute('/frames/style.css', (req, res) => {});
|
||||
const navigationPromise = page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
const frame = await new Promise<Frame>(f => page.once('frameattached', f));
|
||||
|
|
|
@ -23,13 +23,13 @@ import path from 'path'
|
|||
const { HEADLESS } = testOptions;
|
||||
|
||||
// Printing to pdf is currently only supported in headless chromium.
|
||||
it.skip(!(HEADLESS && CHROMIUM))('should be able to save file', async({page, tmpDir}) => {
|
||||
it.skip(!(HEADLESS && options.CHROMIUM))('should be able to save file', async({page, tmpDir}) => {
|
||||
const outputFile = path.join(tmpDir, 'output.pdf');
|
||||
await page.pdf({path: outputFile});
|
||||
expect(fs.readFileSync(outputFile).byteLength).toBeGreaterThan(0);
|
||||
fs.unlinkSync(outputFile);
|
||||
});
|
||||
|
||||
it.skip(CHROMIUM)('should be able to save file', async({page}) => {
|
||||
it.skip(options.CHROMIUM)('should be able to save file', async({page}) => {
|
||||
expect(page.pdf).toBe(undefined);
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@ function getPermission(page, name) {
|
|||
return page.evaluate(name => navigator.permissions.query({name}).then(result => result.state), name);
|
||||
}
|
||||
|
||||
describe.skip(WEBKIT)('permissions', () => {
|
||||
describe.skip(options.WEBKIT)('permissions', () => {
|
||||
it('should be prompt by default', async({page, server, context}) => {
|
||||
// Permissions API is not implemented in WebKit (see https://developer.mozilla.org/en-US/docs/Web/API/Permissions_API)
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
@ -92,7 +92,7 @@ describe.skip(WEBKIT)('permissions', () => {
|
|||
expect(await getPermission(page, 'geolocation')).toBe('prompt');
|
||||
});
|
||||
|
||||
it.fail(WEBKIT || FFOX || (CHROMIUM && !HEADLESS))('should trigger permission onchange', async({page, server, context}) => {
|
||||
it.fail(options.WEBKIT || options.FFOX || (options.CHROMIUM && !HEADLESS))('should trigger permission onchange', async({page, server, context}) => {
|
||||
//TODO: flaky
|
||||
// - Linux: https://github.com/microsoft/playwright/pull/1790/checks?check_run_id=587327883
|
||||
// - Win: https://ci.appveyor.com/project/aslushnikov/playwright/builds/32402536
|
||||
|
@ -134,7 +134,7 @@ describe.skip(WEBKIT)('permissions', () => {
|
|||
await otherContext.close();
|
||||
});
|
||||
|
||||
it.fail(WEBKIT || FFOX || (CHROMIUM && !HEADLESS))('should support clipboard read', async({page, server, context, browser}) => {
|
||||
it.fail(options.WEBKIT || options.FFOX || (options.CHROMIUM && !HEADLESS))('should support clipboard read', async({page, server, context, browser}) => {
|
||||
// No such permissions (requires flag) in Firefox
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(await getPermission(page, 'clipboard-read')).toBe('prompt');
|
||||
|
|
|
@ -57,7 +57,7 @@ it('should authenticate', async ({browserType, defaultBrowserOptions, server}) =
|
|||
await browser.close();
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should exclude patterns', async ({browserType, defaultBrowserOptions, server}) => {
|
||||
it.fail(options.CHROMIUM && !HEADLESS)('should exclude patterns', async ({browserType, defaultBrowserOptions, server}) => {
|
||||
// Chromium headful crashes with CHECK(!in_frame_tree_) in RenderFrameImpl::OnDeleteFrame.
|
||||
server.setRoute('/target.html', async (req, res) => {
|
||||
res.end('<html><title>Served by the proxy</title></html>');
|
||||
|
|
|
@ -51,7 +51,7 @@ it('should work with status code 422', async({page, server}) => {
|
|||
expect(await page.evaluate(() => document.body.textContent)).toBe('Yo, page!');
|
||||
});
|
||||
|
||||
it.skip(FFOX && !HEADLESS)('should allow mocking binary responses', async({page, server, golden}) => {
|
||||
it.skip(options.FFOX && !HEADLESS)('should allow mocking binary responses', async({page, server, golden}) => {
|
||||
// Firefox headful produces a different image.
|
||||
await page.route('**/*', route => {
|
||||
const imageBuffer = fs.readFileSync(path.join(__dirname, 'assets', 'pptr.png'));
|
||||
|
@ -70,7 +70,7 @@ it.skip(FFOX && !HEADLESS)('should allow mocking binary responses', async({page,
|
|||
expect(await img.screenshot()).toMatchImage(golden('mock-binary-response.png'));
|
||||
});
|
||||
|
||||
it.skip(FFOX && !HEADLESS)('should allow mocking svg with charset', async({page, server, golden}) => {
|
||||
it.skip(options.FFOX && !HEADLESS)('should allow mocking svg with charset', async({page, server, golden}) => {
|
||||
// Firefox headful produces a different image.
|
||||
await page.route('**/*', route => {
|
||||
route.fulfill({
|
||||
|
|
|
@ -19,7 +19,29 @@ const debug = require('debug');
|
|||
|
||||
const registrations = new Map();
|
||||
const registrationsByFile = new Map();
|
||||
const generatorRegistrations = new Map();
|
||||
const optionRegistrations = new Map();
|
||||
const optionsImpl = new Map();
|
||||
const options = new Proxy({}, {
|
||||
get: (obj, prop) => {
|
||||
if (optionsImpl.has(prop))
|
||||
return optionsImpl.get(prop);
|
||||
const fn = optionRegistrations.get(prop);
|
||||
if (!fn)
|
||||
return obj[prop];
|
||||
const names = optionParameterNames(fn);
|
||||
const param = {};
|
||||
names.forEach(name => param[name] = options[name]);
|
||||
const result = fn.call(null, param);
|
||||
optionsImpl.set(prop, result);
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
function setOptions(map) {
|
||||
optionsImpl.clear();
|
||||
for (const [name, value] of map)
|
||||
optionsImpl.set(name, value);
|
||||
}
|
||||
|
||||
class Fixture {
|
||||
constructor(pool, name, scope, fn) {
|
||||
|
@ -29,7 +51,7 @@ class Fixture {
|
|||
this.fn = fn;
|
||||
this.deps = fixtureParameterNames(this.fn);
|
||||
this.usages = new Set();
|
||||
this.generatorValue = this.pool.generators.get(name);
|
||||
this.generatorValue = optionsImpl.get(name);
|
||||
this.value = this.generatorValue || null;
|
||||
}
|
||||
|
||||
|
@ -82,7 +104,6 @@ class Fixture {
|
|||
class FixturePool {
|
||||
constructor() {
|
||||
this.instances = new Map();
|
||||
this.generators = new Map();
|
||||
}
|
||||
|
||||
async setupFixture(name) {
|
||||
|
@ -155,6 +176,15 @@ function fixtureParameterNames(fn) {
|
|||
return signature.split(',').map(t => t.trim());
|
||||
}
|
||||
|
||||
function optionParameterNames(fn) {
|
||||
const text = fn.toString();
|
||||
const match = text.match(/(?:\s+function)?\s*\(\s*{\s*([^}]*)\s*}/);
|
||||
if (!match || !match[1].trim())
|
||||
return [];
|
||||
let signature = match[1];
|
||||
return signature.split(',').map(t => t.trim());
|
||||
}
|
||||
|
||||
function innerRegisterFixture(name, scope, fn) {
|
||||
const stackFrame = new Error().stack.split('\n').slice(1).filter(line => !line.includes(__filename))[0];
|
||||
const location = stackFrame.replace(/.*at Object.<anonymous> \((.*)\)/, '$1');
|
||||
|
@ -174,9 +204,8 @@ function registerWorkerFixture(name, fn) {
|
|||
innerRegisterFixture(name, 'worker', fn);
|
||||
};
|
||||
|
||||
function registerWorkerGenerator(name, fn) {
|
||||
innerRegisterFixture(name, 'worker', () => {});
|
||||
generatorRegistrations.set(name, fn);
|
||||
function registerOption(name, fn) {
|
||||
optionRegistrations.set(name, fn);
|
||||
}
|
||||
|
||||
function collectRequires(file, result) {
|
||||
|
@ -184,6 +213,8 @@ function collectRequires(file, result) {
|
|||
return;
|
||||
result.add(file);
|
||||
const cache = require.cache[file];
|
||||
if (!cache)
|
||||
return;
|
||||
const deps = cache.children.map(m => m.id).slice().reverse();
|
||||
for (const dep of deps)
|
||||
collectRequires(dep, result);
|
||||
|
@ -225,4 +256,4 @@ function computeWorkerHash(file) {
|
|||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
module.exports = { FixturePool, registerFixture, registerWorkerFixture, computeWorkerHash, rerunRegistrations, lookupRegistrations, fixturesForCallback, registerWorkerGenerator, generatorRegistrations };
|
||||
module.exports = { FixturePool, registerFixture, registerWorkerFixture, computeWorkerHash, rerunRegistrations, lookupRegistrations, fixturesForCallback, registerOption, setOptions, optionRegistrations, options };
|
||||
|
|
|
@ -14,16 +14,17 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const { registerFixture, registerWorkerFixture, registerWorkerGenerator } = require('./fixtures');
|
||||
const { registerFixture, registerWorkerFixture, registerOption, options } = require('./fixtures');
|
||||
const { Test, Suite } = require('mocha');
|
||||
const { installTransform } = require('./transform');
|
||||
const commonSuite = require('mocha/lib/interfaces/common');
|
||||
|
||||
Error.stackTraceLimit = 15;
|
||||
global.options = options;
|
||||
global.testOptions = require('./testOptions');
|
||||
global.registerFixture = registerFixture;
|
||||
global.registerWorkerFixture = registerWorkerFixture;
|
||||
global.registerWorkerGenerator = registerWorkerGenerator;
|
||||
global.registerOption = registerOption;
|
||||
|
||||
let revertBabelRequire;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
const path = require('path');
|
||||
const Mocha = require('mocha');
|
||||
const { fixturesForCallback, generatorRegistrations } = require('./fixtures');
|
||||
const { fixturesForCallback, optionRegistrations } = require('./fixtures');
|
||||
const { fixturesUI } = require('./fixturesUI');
|
||||
|
||||
global.testOptions = require('./testOptions');
|
||||
|
@ -71,9 +71,9 @@ class TestCollector {
|
|||
// to build different workers for them.
|
||||
const generatorConfigurations = [];
|
||||
for (const name of fixtures) {
|
||||
if (!generatorRegistrations.has(name))
|
||||
if (!optionRegistrations.has(name))
|
||||
continue;
|
||||
const values = generatorRegistrations.get(name)();
|
||||
const values = optionRegistrations.get(name)();
|
||||
let state = generatorConfigurations.length ? generatorConfigurations.slice() : [[]];
|
||||
generatorConfigurations.length = 0;
|
||||
for (const gen of state) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
const path = require('path');
|
||||
const Mocha = require('mocha');
|
||||
const { FixturePool, rerunRegistrations, fixturesForCallback } = require('./fixtures');
|
||||
const { FixturePool, rerunRegistrations, setOptions } = require('./fixtures');
|
||||
const { fixturesUI } = require('./fixturesUI');
|
||||
const { EventEmitter } = require('events');
|
||||
|
||||
|
@ -56,16 +56,14 @@ class TestRunner extends EventEmitter {
|
|||
this._parsedGeneratorConfiguration.set(name, value);
|
||||
this._relativeTestFile = path.relative(options.testDir, this._file);
|
||||
this.mocha.addFile(this._file);
|
||||
this.mocha.loadFiles();
|
||||
this.suite = this.mocha.suite;
|
||||
}
|
||||
|
||||
async run() {
|
||||
let callback;
|
||||
const result = new Promise(f => callback = f);
|
||||
setOptions(this._parsedGeneratorConfiguration);
|
||||
this.mocha.loadFiles();
|
||||
rerunRegistrations(this._file, 'test');
|
||||
for (const [name, value] of this._parsedGeneratorConfiguration)
|
||||
fixturePool.generators.set(name, value);
|
||||
const runner = this.mocha.run(callback);
|
||||
|
||||
const constants = Mocha.Runner.constants;
|
||||
|
|
|
@ -33,7 +33,7 @@ declare global {
|
|||
|
||||
registerFixture('videoPlayer', async ({playwright, context}, test) => {
|
||||
let firefox;
|
||||
if (WEBKIT && !LINUX) {
|
||||
if (options.WEBKIT && !LINUX) {
|
||||
// WebKit on Mac & Windows cannot replay webm/vp8 video, so we launch Firefox.
|
||||
firefox = await playwright.firefox.launch();
|
||||
context = await firefox.newContext();
|
||||
|
@ -174,7 +174,7 @@ class VideoPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
it.fail(CHROMIUM)('should capture static page', async({page, tmpDir, videoPlayer, toImpl}) => {
|
||||
it.fail(options.CHROMIUM)('should capture static page', async({page, tmpDir, videoPlayer, toImpl}) => {
|
||||
if (!toImpl)
|
||||
return;
|
||||
const videoFile = path.join(tmpDir, 'v.webm');
|
||||
|
@ -182,7 +182,7 @@ it.fail(CHROMIUM)('should capture static page', async({page, tmpDir, videoPlayer
|
|||
await toImpl(page)._delegate.startVideoRecording({outputFile: videoFile, width: 640, height: 480});
|
||||
// TODO: in WebKit figure out why video size is not reported correctly for
|
||||
// static pictures.
|
||||
if (HEADLESS && WEBKIT)
|
||||
if (HEADLESS && options.WEBKIT)
|
||||
await page.setViewportSize({width: 1270, height: 950});
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
await toImpl(page)._delegate.stopVideoRecording();
|
||||
|
@ -200,7 +200,7 @@ it.fail(CHROMIUM)('should capture static page', async({page, tmpDir, videoPlayer
|
|||
expectAll(pixels, almostRed);
|
||||
});
|
||||
|
||||
it.fail(CHROMIUM)('should capture navigation', async({page, tmpDir, server, videoPlayer, toImpl}) => {
|
||||
it.fail(options.CHROMIUM)('should capture navigation', async({page, tmpDir, server, videoPlayer, toImpl}) => {
|
||||
if (!toImpl)
|
||||
return;
|
||||
const videoFile = path.join(tmpDir, 'v.webm');
|
||||
|
@ -208,7 +208,7 @@ it.fail(CHROMIUM)('should capture navigation', async({page, tmpDir, server, vide
|
|||
await toImpl(page)._delegate.startVideoRecording({outputFile: videoFile, width: 640, height: 480});
|
||||
// TODO: in WebKit figure out why video size is not reported correctly for
|
||||
// static pictures.
|
||||
if (HEADLESS && WEBKIT)
|
||||
if (HEADLESS && options.WEBKIT)
|
||||
await page.setViewportSize({width: 1270, height: 950});
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
await page.goto(server.CROSS_PROCESS_PREFIX + '/background-color.html#rgb(100,100,100)');
|
||||
|
@ -234,7 +234,7 @@ it.fail(CHROMIUM)('should capture navigation', async({page, tmpDir, server, vide
|
|||
});
|
||||
|
||||
// Accelerated compositing is disabled in WebKit on Windows.
|
||||
it.fail(CHROMIUM || (WEBKIT && WIN))('should capture css transformation', async({page, tmpDir, server, videoPlayer, toImpl}) => {
|
||||
it.fail(options.CHROMIUM || (options.WEBKIT && WIN))('should capture css transformation', async({page, tmpDir, server, videoPlayer, toImpl}) => {
|
||||
if (!toImpl)
|
||||
return;
|
||||
const videoFile = path.join(tmpDir, 'v.webm');
|
||||
|
@ -242,7 +242,7 @@ it.fail(CHROMIUM || (WEBKIT && WIN))('should capture css transformation', async(
|
|||
await toImpl(page)._delegate.startVideoRecording({outputFile: videoFile, width: 640, height: 480});
|
||||
// TODO: in WebKit figure out why video size is not reported correctly for
|
||||
// static pictures.
|
||||
if (HEADLESS && WEBKIT)
|
||||
if (HEADLESS && options.WEBKIT)
|
||||
await page.setViewportSize({width: 1270, height: 950});
|
||||
await new Promise(r => setTimeout(r, 300));
|
||||
await toImpl(page)._delegate.stopVideoRecording();
|
||||
|
|
|
@ -58,9 +58,9 @@ it('query', async ({page}) => {
|
|||
expect(await page.$eval(`"x"`, e => e.outerHTML)).toBe('<div>x</div>');
|
||||
expect(await page.$eval(`'x'`, e => e.outerHTML)).toBe('<div>x</div>');
|
||||
let error = await page.$(`"`).catch(e => e);
|
||||
expect(error.message).toContain(WEBKIT ? 'SyntaxError' : 'querySelector');
|
||||
expect(error.message).toContain(options.WEBKIT ? 'SyntaxError' : 'querySelector');
|
||||
error = await page.$(`'`).catch(e => e);
|
||||
expect(error.message).toContain(WEBKIT ? 'SyntaxError' : 'querySelector');
|
||||
expect(error.message).toContain(options.WEBKIT ? 'SyntaxError' : 'querySelector');
|
||||
|
||||
await page.setContent(`<div> ' </div><div> " </div>`);
|
||||
expect(await page.$eval(`text="`, e => e.outerHTML)).toBe('<div> " </div>');
|
||||
|
|
|
@ -39,6 +39,9 @@ interface WorkerState {
|
|||
interface FixtureState {
|
||||
}
|
||||
|
||||
interface Options {
|
||||
}
|
||||
|
||||
declare module '' {
|
||||
module 'expect/build/types' {
|
||||
interface Matchers<R> {
|
||||
|
@ -49,6 +52,7 @@ declare module '' {
|
|||
|
||||
declare const expect: typeof import('expect');
|
||||
|
||||
declare const options: Options;
|
||||
declare const describe: DescribeFunction;
|
||||
declare const fdescribe: DescribeFunction;
|
||||
declare const xdescribe: DescribeFunction;
|
||||
|
@ -73,9 +77,6 @@ declare const testOptions: {
|
|||
declare var MAC: boolean;
|
||||
declare var LINUX: boolean;
|
||||
declare var WIN: boolean;
|
||||
declare var CHROMIUM: boolean;
|
||||
declare var FFOX: boolean;
|
||||
declare var WEBKIT: boolean;
|
||||
|
||||
// keyboard.html
|
||||
declare function getResult(): string;
|
||||
|
|
Загрузка…
Ссылка в новой задаче