test: slowly removing testOptions (#3464)
This commit is contained in:
parent
036cd5ca41
commit
2f5a0a6c07
|
|
@ -34,6 +34,7 @@ beforeEach(async () => {
|
|||
afterEach(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should work', async () => {
|
||||
await page.goto('https://www.example.com/');
|
||||
expect(await page.title()).toBe('Example Domain');
|
||||
|
|
@ -90,6 +91,7 @@ beforeEach(async() => {
|
|||
afterEach(async () => {
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should work', async () => {
|
||||
await page.goto('https://www.example.com/');
|
||||
assert.equal(await page.title(), 'Example Domain');
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async function({page}) {
|
||||
await page.setContent(`
|
||||
<head>
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
|
||||
const {WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it('should await navigation when clicking anchor', async({page, server}) => {
|
||||
const messages = [];
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
|
||||
it('clicking on links which do not commit navigation', async({page, server, httpsServer}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`<a href='${httpsServer.EMPTY_PAGE}'>foobar</a>`);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import {mkdtempAsync, removeFolderAsync} from './utils';
|
|||
setUnderTest(); // Note: we must call setUnderTest before requiring Playwright
|
||||
|
||||
const browserName = process.env.BROWSER || 'chromium';
|
||||
const platform = os.platform();
|
||||
|
||||
declare global {
|
||||
interface WorkerState {
|
||||
|
|
@ -54,6 +55,13 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
(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('parallelIndex', async ({}, test) => {
|
||||
await test(parseInt(process.env.JEST_WORKER_ID, 10) - 1);
|
||||
});
|
||||
|
|
@ -180,7 +188,7 @@ registerFixture('httpsServer', async ({httpService}, test) => {
|
|||
registerFixture('tmpDir', async ({}, test) => {
|
||||
const tmpDir = await mkdtempAsync(path.join(os.tmpdir(), 'playwright-test-'));
|
||||
await test(tmpDir);
|
||||
await removeFolderAsync(tmpDir);
|
||||
await removeFolderAsync(tmpDir).catch(e => {});
|
||||
});
|
||||
|
||||
registerWorkerFixture('asset', async ({}, test) => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM} = testOptions;
|
||||
|
||||
it('should create new page', async function({browser}) {
|
||||
const page1 = await browser.newPage();
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM} = testOptions;
|
||||
|
||||
it('should work', async({context, page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await context.addCookies([{
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ import './base.fixture';
|
|||
|
||||
import utils from './utils';
|
||||
|
||||
const {WEBKIT} = testOptions;
|
||||
|
||||
it('should create new context', async function({browser}) {
|
||||
expect(browser.contexts().length).toBe(0);
|
||||
const context = await browser.newContext();
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, WEBKIT, WIN} = testOptions;
|
||||
|
||||
it('should return no cookies in pristine browser context', async({context, page, server}) => {
|
||||
expect(await context.cookies()).toEqual([]);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, HEADLESS} = testOptions;
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
it.fail(CHROMIUM && !HEADLESS)('should fail without credentials', async({browser, server}) => {
|
||||
server.setAuth('/empty.html', 'user', 'pass');
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX} = testOptions;
|
||||
|
||||
it.skip(FFOX)('should work', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, HEADLESS} = testOptions;
|
||||
const {devices} = require('..');
|
||||
|
||||
it('expose binding should work', async({browser}) => {
|
||||
const context = await browser.newContext();
|
||||
let bindingSource;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
|
||||
it('should affect accept-language header', async({browser, server}) => {
|
||||
const context = await browser.newContext({ locale: 'fr-CH' });
|
||||
const page = await context.newPage();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, HEADLESS} = testOptions;
|
||||
const {devices} = require('..');
|
||||
|
||||
it('should have url', async({browser, server}) => {
|
||||
const context = await browser.newContext();
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, HEADLESS} = testOptions;
|
||||
const {devices} = require('..');
|
||||
|
||||
it('should intercept', async({browser, server}) => {
|
||||
const context = await browser.newContext();
|
||||
let intercepted = false;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
|
||||
it('should work', async ({ browser }) => {
|
||||
const func = () => new Date(1479579154987).toString();
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, HEADLESS} = testOptions;
|
||||
const {devices} = require('..');
|
||||
|
||||
it('should work', async({browser, server}) => {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
|
||||
it.skip(FFOX)('should support mobile emulation', async({playwright, browser, server}) => {
|
||||
const iPhone = playwright.devices['iPhone 6'];
|
||||
const context = await browser.newContext({ ...iPhone });
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
|
||||
it('should get the proper default viewport size', async({page, server}) => {
|
||||
await utils.verifyViewport(page, 1280, 720);
|
||||
|
|
|
|||
|
|
@ -14,12 +14,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
import './base.fixture';
|
||||
|
||||
it('browserType.executablePath should work', async({browserType}) => {
|
||||
const executablePath = browserType.executablePath();
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE).slow()('should be able to reconnect to a browser', async({browserType, defaultBrowserOptions, server}) => {
|
||||
const browserServer = await browserType.launchServer(defaultBrowserOptions);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE)('should work', async({browserType, defaultBrowserOptions}) => {
|
||||
const browserServer = await browserType.launchServer(defaultBrowserOptions);
|
||||
|
|
|
|||
|
|
@ -14,12 +14,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
import './base.fixture';
|
||||
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it('should reject all promises when browser is closed', async({browserType, defaultBrowserOptions}) => {
|
||||
const browser = await browserType.launch(defaultBrowserOptions);
|
||||
|
|
|
|||
|
|
@ -13,12 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, LINUX} = testOptions;
|
||||
import './base.fixture';
|
||||
|
||||
it.fail(WEBKIT && WIN)('Web Assembly should work', async function({page, server}) {
|
||||
await page.goto(server.PREFIX + '/wasm/table2.html');
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
import { ChromiumBrowser } from '..';
|
||||
const { FFOX, CHROMIUM, WEBKIT, WIN } = testOptions;
|
||||
|
||||
it('should work', async({browser}) => {
|
||||
expect(!!browser['_connection']).toBeTruthy();
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({browserType, page, server}) {
|
||||
await page.coverage.startCSSCoverage();
|
||||
await page.goto(server.PREFIX + '/csscoverage/simple.html');
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it.skip(CHROMIUM)('should be missing', async function({page, server}) {
|
||||
expect(page.coverage).toBe(null);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
import '../base.fixture';
|
||||
import { ChromiumBrowserContext } from '../..';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it.skip(!CHROMIUM)('should create a worker from a service worker', async({page, server, context}) => {
|
||||
const [worker] = await Promise.all([
|
||||
(context as ChromiumBrowserContext).waitForEvent('serviceworker'),
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import '../base.fixture';
|
|||
import path from 'path';
|
||||
import utils from '../utils';
|
||||
import { ChromiumBrowser, ChromiumBrowserContext } from '../..';
|
||||
const {makeUserDataDir, removeUserDataDir} = utils;
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
const { makeUserDataDir, removeUserDataDir } = utils;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE || !CHROMIUM)('should throw with remote-debugging-pipe argument', async({browserType, defaultBrowserOptions}) => {
|
||||
const options = Object.assign({}, defaultBrowserOptions);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
import '../base.fixture';
|
||||
import { registerWorkerFixture } from '../runner/fixtures';
|
||||
|
||||
const {CHROMIUM} = testOptions;
|
||||
|
||||
registerWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, test) => {
|
||||
const browser = await browserType.launch({
|
||||
...defaultBrowserOptions,
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
import '../base.fixture';
|
||||
import { ChromiumBrowserContext, ChromiumBrowser } from "../../types/types";
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
|
||||
it.skip(!CHROMIUM)('should work', async function({page}) {
|
||||
const client = await (page.context() as ChromiumBrowserContext).newCDPSession(page);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@ import { registerFixture } from '../runner/fixtures';
|
|||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { ChromiumBrowser } from '../..';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
declare global {
|
||||
interface FixtureState {
|
||||
outputFile: string;
|
||||
}
|
||||
}
|
||||
|
||||
registerFixture('outputFile', async ({tmpDir}, test) => {
|
||||
const outputFile = path.join(tmpDir, `trace.json`);
|
||||
await test(outputFile);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
import utils from './utils';
|
||||
|
||||
declare const renderComponent;
|
||||
declare const e;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE)('should avoid side effects after timeout', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {WIRE} = testOptions;
|
||||
|
||||
it('should timeout waiting for display:none to be gone', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
await page.$eval('button', b => b.style.display = 'none');
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE)('should fail when element jumps during hit testing', async({page, server}) => {
|
||||
await page.setContent('<button>Click me</button>');
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
import utils from './utils';
|
||||
|
||||
it('should timeout waiting for stable position', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, HEADLESS, WIRE} = testOptions;
|
||||
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
async function giveItAChanceToClick(page) {
|
||||
for (let i = 0; i < 5; i++)
|
||||
|
|
|
|||
|
|
@ -16,33 +16,24 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
import { registerFixture } from './runner/fixtures';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
import os from 'os';
|
||||
import { BrowserType, Browser, BrowserContext, Page } from '..';
|
||||
const {removeFolderAsync, mkdtempAsync, removeUserDataDir, makeUserDataDir} = utils;
|
||||
const {FFOX, MAC, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
const { removeUserDataDir, makeUserDataDir } = utils;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
declare global {
|
||||
interface FixtureState {
|
||||
userDataDir: string;
|
||||
launchPersistent: (options?: Parameters<BrowserType<Browser>['launchPersistentContext']>[1]) => Promise<{context: BrowserContext, page: Page}>;
|
||||
}
|
||||
}
|
||||
registerFixture('userDataDir', async ({}, test) => {
|
||||
const userDataDir = await mkdtempAsync(path.join(os.tmpdir(), 'playwright_dev_profile-'));
|
||||
await test(userDataDir);
|
||||
removeFolderAsync(userDataDir).catch(e => {});
|
||||
});
|
||||
|
||||
registerFixture('launchPersistent', async ({userDataDir, defaultBrowserOptions, browserType}, test) => {
|
||||
registerFixture('launchPersistent', async ({tmpDir, defaultBrowserOptions, browserType}, test) => {
|
||||
let context;
|
||||
async function launchPersistent(options) {
|
||||
if (context)
|
||||
throw new Error('can only launch one persitent context');
|
||||
context = await browserType.launchPersistentContext(userDataDir, {...defaultBrowserOptions, ...options});
|
||||
context = await browserType.launchPersistentContext(tmpDir, {...defaultBrowserOptions, ...options});
|
||||
const page = context.pages()[0];
|
||||
return {context, page};
|
||||
}
|
||||
|
|
@ -275,14 +266,14 @@ it('should support extraHTTPHeaders option', async ({server, launchPersistent})
|
|||
expect(request.headers['foo']).toBe('bar');
|
||||
});
|
||||
|
||||
it('should accept userDataDir', async ({launchPersistent, userDataDir}) => {
|
||||
it('should accept userDataDir', async ({launchPersistent, tmpDir}) => {
|
||||
const {page, context} = await launchPersistent();
|
||||
// Note: we need an open page to make sure its functional.
|
||||
expect(fs.readdirSync(userDataDir).length).toBeGreaterThan(0);
|
||||
expect(fs.readdirSync(tmpDir).length).toBeGreaterThan(0);
|
||||
await context.close();
|
||||
expect(fs.readdirSync(userDataDir).length).toBeGreaterThan(0);
|
||||
expect(fs.readdirSync(tmpDir).length).toBeGreaterThan(0);
|
||||
// This might throw. See https://github.com/GoogleChrome/puppeteer/issues/2778
|
||||
await removeUserDataDir(userDataDir);
|
||||
await removeUserDataDir(tmpDir);
|
||||
});
|
||||
|
||||
it.slow()('should restore state from userDataDir', async({browserType, defaultBrowserOptions, server, launchPersistent}) => {
|
||||
|
|
@ -347,20 +338,20 @@ 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, userDataDir}) => {
|
||||
it.skip(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(userDataDir, options).catch(e => e);
|
||||
const error = await browserType.launchPersistentContext(tmpDir, options).catch(e => e);
|
||||
expect(error.message).toContain('can not specify page');
|
||||
});
|
||||
|
||||
it.skip(WIRE)('should have passed URL when launching with ignoreDefaultArgs: true', async ({browserType, defaultBrowserOptions, server, userDataDir, toImpl}) => {
|
||||
const args = toImpl(browserType)._defaultArgs(defaultBrowserOptions, 'persistent', userDataDir, 0).filter(a => a !== 'about:blank');
|
||||
it.skip(WIRE)('should have passed URL when launching with ignoreDefaultArgs: true', async ({browserType, defaultBrowserOptions, server, tmpDir, toImpl}) => {
|
||||
const args = toImpl(browserType)._defaultArgs(defaultBrowserOptions, 'persistent', tmpDir, 0).filter(a => a !== 'about:blank');
|
||||
const options = {
|
||||
...defaultBrowserOptions,
|
||||
args: [...args, server.EMPTY_PAGE],
|
||||
ignoreDefaultArgs: true,
|
||||
};
|
||||
const browserContext = await browserType.launchPersistentContext(userDataDir, options);
|
||||
const browserContext = await browserType.launchPersistentContext(tmpDir, options);
|
||||
if (!browserContext.pages().length)
|
||||
await browserContext.waitForEvent('page');
|
||||
await browserContext.pages()[0].waitForLoadState();
|
||||
|
|
@ -369,16 +360,16 @@ it.skip(WIRE)('should have passed URL when launching with ignoreDefaultArgs: tru
|
|||
await browserContext.close();
|
||||
});
|
||||
|
||||
it.skip(WIRE)('should handle timeout', async({browserType, defaultBrowserOptions, userDataDir}) => {
|
||||
it.skip(WIRE)('should handle timeout', async({browserType, defaultBrowserOptions, tmpDir}) => {
|
||||
const options = { ...defaultBrowserOptions, timeout: 5000, __testHookBeforeCreateBrowser: () => new Promise(f => setTimeout(f, 6000)) };
|
||||
const error = await browserType.launchPersistentContext(userDataDir, options).catch(e => e);
|
||||
const error = await browserType.launchPersistentContext(tmpDir, options).catch(e => e);
|
||||
expect(error.message).toContain(`browserType.launchPersistentContext: Timeout 5000ms exceeded.`);
|
||||
});
|
||||
|
||||
it.skip(WIRE)('should handle exception', async({browserType, defaultBrowserOptions, userDataDir}) => {
|
||||
it.skip(WIRE)('should handle exception', async({browserType, defaultBrowserOptions, tmpDir}) => {
|
||||
const e = new Error('Dummy');
|
||||
const options = { ...defaultBrowserOptions, __testHookBeforeCreateBrowser: () => { throw e; } };
|
||||
const error = await browserType.launchPersistentContext(userDataDir, options).catch(e => e);
|
||||
const error = await browserType.launchPersistentContext(tmpDir, options).catch(e => e);
|
||||
expect(error.message).toContain('Dummy');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should fire', async({page, server}) => {
|
||||
page.on('dialog', dialog => {
|
||||
expect(dialog.type()).toBe('alert');
|
||||
|
|
@ -28,7 +26,7 @@ it('should fire', async({page, server}) => {
|
|||
await page.evaluate(() => alert('yo'));
|
||||
});
|
||||
|
||||
it('should allow accepting prompts', async({page, server}) => {
|
||||
it('should allow accepting prompts', async({page}) => {
|
||||
page.on('dialog', dialog => {
|
||||
expect(dialog.type()).toBe('prompt');
|
||||
expect(dialog.defaultValue()).toBe('yes.');
|
||||
|
|
@ -39,7 +37,7 @@ it('should allow accepting prompts', async({page, server}) => {
|
|||
expect(result).toBe('answer!');
|
||||
});
|
||||
|
||||
it('should dismiss the prompt', async({page, server}) => {
|
||||
it('should dismiss the prompt', async({page}) => {
|
||||
page.on('dialog', dialog => {
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
|
@ -47,7 +45,7 @@ it('should dismiss the prompt', async({page, server}) => {
|
|||
expect(result).toBe(null);
|
||||
});
|
||||
|
||||
it('should accept the confirm prompt', async({page, server}) => {
|
||||
it('should accept the confirm prompt', async({page}) => {
|
||||
page.on('dialog', dialog => {
|
||||
dialog.accept();
|
||||
});
|
||||
|
|
@ -55,7 +53,7 @@ it('should accept the confirm prompt', async({page, server}) => {
|
|||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should dismiss the confirm prompt', async({page, server}) => {
|
||||
it('should dismiss the confirm prompt', async({page}) => {
|
||||
page.on('dialog', dialog => {
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should dispatch click event', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
|
|
@ -32,7 +31,7 @@ it('should dispatch click event properties', async({page, server}) => {
|
|||
expect(await page.evaluate('composed')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should dispatch click svg', async({page, server}) => {
|
||||
it('should dispatch click svg', async({page}) => {
|
||||
await page.setContent(`
|
||||
<svg height="100" width="100">
|
||||
<circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import util from 'util';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, HEADLESS} = testOptions;
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
beforeEach(async ({server}) => {
|
||||
server.setRoute('/download', (req, res) => {
|
||||
|
|
|
|||
|
|
@ -24,18 +24,12 @@ import { Browser, BrowserContext } from '..';
|
|||
|
||||
declare global {
|
||||
interface FixtureState {
|
||||
downloadsPath: string;
|
||||
downloadsBrowser: Browser;
|
||||
persistentDownloadsContext: BrowserContext;
|
||||
}
|
||||
}
|
||||
registerFixture('downloadsPath', async ({}, test) => {
|
||||
const downloadsPath = await mkdtempAsync(path.join(os.tmpdir(), 'playwright-test-'));
|
||||
await test(downloadsPath);
|
||||
await removeFolderAsync(downloadsPath);
|
||||
});
|
||||
|
||||
registerFixture('downloadsBrowser', async ({server, browserType, defaultBrowserOptions, downloadsPath}, test) => {
|
||||
registerFixture('downloadsBrowser', async ({server, browserType, defaultBrowserOptions, tmpDir}, test) => {
|
||||
server.setRoute('/download', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/octet-stream');
|
||||
res.setHeader('Content-Disposition', 'attachment; filename=file.txt');
|
||||
|
|
@ -43,13 +37,13 @@ registerFixture('downloadsBrowser', async ({server, browserType, defaultBrowserO
|
|||
});
|
||||
const browser = await browserType.launch({
|
||||
...defaultBrowserOptions,
|
||||
downloadsPath: downloadsPath,
|
||||
downloadsPath: tmpDir,
|
||||
});
|
||||
await test(browser);
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
registerFixture('persistentDownloadsContext', async ({server, browserType, defaultBrowserOptions, downloadsPath}, test) => {
|
||||
registerFixture('persistentDownloadsContext', async ({server, browserType, defaultBrowserOptions, tmpDir}, test) => {
|
||||
const userDataDir = await mkdtempAsync(path.join(os.tmpdir(), 'playwright-test-'));
|
||||
server.setRoute('/download', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/octet-stream');
|
||||
|
|
@ -60,7 +54,7 @@ registerFixture('persistentDownloadsContext', async ({server, browserType, defau
|
|||
userDataDir,
|
||||
{
|
||||
...defaultBrowserOptions,
|
||||
downloadsPath,
|
||||
downloadsPath: tmpDir,
|
||||
acceptDownloads: true
|
||||
}
|
||||
);
|
||||
|
|
@ -71,7 +65,7 @@ registerFixture('persistentDownloadsContext', async ({server, browserType, defau
|
|||
await removeFolderAsync(userDataDir);
|
||||
});
|
||||
|
||||
it('should keep downloadsPath folder', async({downloadsBrowser, downloadsPath, server}) => {
|
||||
it('should keep downloadsPath folder', async({downloadsBrowser, tmpDir, server}) => {
|
||||
const page = await downloadsBrowser.newPage();
|
||||
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
|
||||
const [ download ] = await Promise.all([
|
||||
|
|
@ -83,10 +77,10 @@ it('should keep downloadsPath folder', async({downloadsBrowser, downloadsPath, s
|
|||
await download.path().catch(e => void 0);
|
||||
await page.close();
|
||||
await downloadsBrowser.close();
|
||||
expect(fs.existsSync(downloadsPath)).toBeTruthy();
|
||||
expect(fs.existsSync(tmpDir)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should delete downloads when context closes', async({downloadsBrowser, downloadsPath, server}) => {
|
||||
it('should delete downloads when context closes', async({downloadsBrowser, server}) => {
|
||||
const page = await downloadsBrowser.newPage({ acceptDownloads: true });
|
||||
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
|
||||
const [ download ] = await Promise.all([
|
||||
|
|
@ -100,7 +94,7 @@ it('should delete downloads when context closes', async({downloadsBrowser, downl
|
|||
|
||||
});
|
||||
|
||||
it('should report downloads in downloadsPath folder', async({downloadsBrowser, downloadsPath, server}) => {
|
||||
it('should report downloads in downloadsPath folder', async({downloadsBrowser, tmpDir, server}) => {
|
||||
const page = await downloadsBrowser.newPage({ acceptDownloads: true });
|
||||
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
|
||||
const [ download ] = await Promise.all([
|
||||
|
|
@ -108,11 +102,11 @@ it('should report downloads in downloadsPath folder', async({downloadsBrowser, d
|
|||
page.click('a')
|
||||
]);
|
||||
const path = await download.path();
|
||||
expect(path.startsWith(downloadsPath)).toBeTruthy();
|
||||
expect(path.startsWith(tmpDir)).toBeTruthy();
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should accept downloads', async({persistentDownloadsContext, downloadsPath, server}) => {
|
||||
it('should accept downloads', async({persistentDownloadsContext, tmpDir, server}) => {
|
||||
const page = persistentDownloadsContext.pages()[0];
|
||||
const [ download ] = await Promise.all([
|
||||
page.waitForEvent('download'),
|
||||
|
|
@ -121,7 +115,7 @@ it('should accept downloads', async({persistentDownloadsContext, downloadsPath,
|
|||
expect(download.url()).toBe(`${server.PREFIX}/download`);
|
||||
expect(download.suggestedFilename()).toBe(`file.txt`);
|
||||
const path = await download.path();
|
||||
expect(path.startsWith(downloadsPath)).toBeTruthy();
|
||||
expect(path.startsWith(tmpDir)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not delete downloads when the context closes', async({persistentDownloadsContext}) => {
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ import './electron.fixture';
|
|||
import path from 'path';
|
||||
const electronName = process.platform === 'win32' ? 'electron.cmd' : 'electron';
|
||||
|
||||
const { CHROMIUM } = testOptions;
|
||||
|
||||
|
||||
it.skip(!CHROMIUM)('should fire close event', async ({ playwright }) => {
|
||||
const electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', electronName);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
import './electron.fixture';
|
||||
|
||||
const { CHROMIUM } = testOptions;
|
||||
|
||||
it.skip(!CHROMIUM)('should click the button', async({window, server}) => {
|
||||
await window.goto(server.PREFIX + '/input/button.html');
|
||||
await window.click('button');
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
it.fail(FFOX && !HEADLESS)('should work', async ({ page, server }) => {
|
||||
await page.setViewportSize({ width: 500, height: 500 });
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page, server }) => {
|
||||
await page.goto(server.PREFIX + '/input/button.html');
|
||||
const button = await page.$('button');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page, server }) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should have a nice preview', async ({ page, server }) => {
|
||||
await page.goto(`${server.PREFIX}/dom.html`);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
|
||||
const tweet = await page.$('.tweet');
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should hover', async ({ page, server }) => {
|
||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||
const button = await page.$('#button-6');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page, server }) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page }) => {
|
||||
await page.setContent(`<input type='text' />`);
|
||||
await page.press('input', 'h');
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
|
||||
it('should query existing element', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/playground.html');
|
||||
await page.setContent('<html><body><div class="second"><div class="inner">A</div></div></body></html>');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE, HEADLESS} = testOptions;
|
||||
const {WIRE, HEADLESS} = testOptions;
|
||||
import {PNG} from 'pngjs';
|
||||
|
||||
// Firefox headful produces a different image.
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page, server }) => {
|
||||
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||
for (let i = 0; i < 11; ++i) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should select textarea', async ({ page, server }) => {
|
||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||
const textarea = await page.$('textarea');
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const { FFOX, HEADLESS } = testOptions;
|
||||
|
||||
it('should work', async ({ page }) => {
|
||||
await page.setContent(`<input type='text' />`);
|
||||
await page.type('input', 'hello');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
it('should think that it is focused by default', async({page}) => {
|
||||
expect(await page.evaluate('document.hasFocus()')).toBe(true);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
|
||||
it('should work with css selector', async({page, server}) => {
|
||||
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
||||
const divsCount = await page.$$eval('css=div', divs => divs.length);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
|
||||
it('should work with css selector', async({page, server}) => {
|
||||
await page.setContent('<section id="testAttribute">43543</section>');
|
||||
const idAttribute = await page.$eval('css=section', e => e.id);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
import '../base.fixture';
|
||||
|
||||
const { FFOX } = testOptions;
|
||||
|
||||
it.skip(!FFOX)('should pass firefox user preferences', async({browserType, defaultBrowserOptions}) => {
|
||||
const browser = await browserType.launch({
|
||||
...defaultBrowserOptions,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { registerFixture } from './runner/fixtures';
|
|||
import path from 'path';
|
||||
import {spawn, execSync} from 'child_process';
|
||||
import { BrowserType, Browser, LaunchOptions } from '..';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, LINUX, HEADLESS} = testOptions;
|
||||
const { HEADLESS } = testOptions;
|
||||
|
||||
const playwrightPath = path.join(__dirname, '..');
|
||||
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, LINUX, WEBKIT, MAC} = testOptions;
|
||||
|
||||
it('should work', async function({page, server}) {
|
||||
await page.setContent(`<div id=d1 tabIndex=0></div>`);
|
||||
expect(await page.evaluate(() => document.activeElement.nodeName)).toBe('BODY');
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
import path from 'path';
|
||||
const { FFOX, CHROMIUM, WEBKIT, WIRE } = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it('should have different execution contexts', async ({ page, server }) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('should navigate subframes', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should handle nested frames', async({page, server}) => {
|
||||
await page.goto(server.PREFIX + '/frames/nested-frames.html');
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server, context}) => {
|
||||
await context.grantPermissions(['geolocation']);
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
|
|
@ -17,15 +17,12 @@ import './base.fixture';
|
|||
|
||||
import utils from './utils';
|
||||
const { makeUserDataDir, removeUserDataDir } = utils;
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, MAC} = testOptions;
|
||||
|
||||
it('should have default url when launching browser', async ({browserType, defaultBrowserOptions}) => {
|
||||
const userDataDir = await makeUserDataDir();
|
||||
const browserContext = await browserType.launchPersistentContext(userDataDir, {...defaultBrowserOptions, headless: false });
|
||||
it('should have default url when launching browser', async ({browserType, defaultBrowserOptions, tmpDir}) => {
|
||||
const browserContext = await browserType.launchPersistentContext(tmpDir, {...defaultBrowserOptions, headless: false });
|
||||
const urls = browserContext.pages().map(page => page.url());
|
||||
expect(urls).toEqual(['about:blank']);
|
||||
await browserContext.close();
|
||||
await removeUserDataDir(userDataDir);
|
||||
});
|
||||
|
||||
it.fail(WIN && CHROMIUM).slow()('headless should be able to read cookies written by headful', async({browserType, defaultBrowserOptions, server}) => {
|
||||
|
|
@ -48,19 +45,17 @@ it.fail(WIN && CHROMIUM).slow()('headless should be able to read cookies written
|
|||
expect(cookie).toBe('foo=true');
|
||||
});
|
||||
|
||||
it.slow()('should close browser with beforeunload page', async({browserType, defaultBrowserOptions, server}) => {
|
||||
const userDataDir = await makeUserDataDir();
|
||||
const browserContext = await browserType.launchPersistentContext(userDataDir, {...defaultBrowserOptions, headless: false});
|
||||
it.slow()('should close browser with beforeunload page', async({browserType, defaultBrowserOptions, server, tmpDir}) => {
|
||||
const browserContext = await browserType.launchPersistentContext(tmpDir, {...defaultBrowserOptions, headless: false});
|
||||
const page = await browserContext.newPage();
|
||||
await page.goto(server.PREFIX + '/beforeunload.html');
|
||||
// We have to interact with a page so that 'beforeunload' handlers
|
||||
// fire.
|
||||
await page.click('body');
|
||||
await browserContext.close();
|
||||
await removeUserDataDir(userDataDir);
|
||||
});
|
||||
|
||||
it('should not crash when creating second context', async ({browserType, defaultBrowserOptions, server}) => {
|
||||
it('should not crash when creating second context', async ({browserType, defaultBrowserOptions}) => {
|
||||
const browser = await browserType.launch({...defaultBrowserOptions, headless: false });
|
||||
{
|
||||
const browserContext = await browser.newContext();
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC} = testOptions;
|
||||
|
||||
it('should work', async({browser, httpsServer}) => {
|
||||
let error = null;
|
||||
const context = await browser.newContext({ ignoreHTTPSErrors: true });
|
||||
|
|
|
|||
|
|
@ -16,11 +16,8 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { helper } from '../lib/helper';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, HEADLESS} = testOptions;
|
||||
|
||||
it('should work with navigation', async({page, server}) => {
|
||||
const requests = new Map();
|
||||
|
|
|
|||
|
|
@ -16,21 +16,19 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
it('should work', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => document.body);
|
||||
const element = aHandle.asElement();
|
||||
expect(element).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return null for non-elements', async({page, server}) => {
|
||||
it('should return null for non-elements', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => 2);
|
||||
const element = aHandle.asElement();
|
||||
expect(element).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should return ElementHandle for TextNodes', async({page, server}) => {
|
||||
it('should return ElementHandle for TextNodes', async({page}) => {
|
||||
await page.setContent('<div>ee!</div>');
|
||||
const aHandle = await page.evaluateHandle(() => document.querySelector('div').firstChild);
|
||||
const element = aHandle.asElement();
|
||||
|
|
@ -38,7 +36,7 @@ it('should return ElementHandle for TextNodes', async({page, server}) => {
|
|||
expect(await page.evaluate(e => e.nodeType === Node.TEXT_NODE, element)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should work with nullified Node', async({page, server}) => {
|
||||
it('should work with nullified Node', async({page}) => {
|
||||
await page.setContent('<section>test</section>');
|
||||
await page.evaluate('delete Node');
|
||||
const handle = await page.evaluateHandle(() => document.querySelector('section'));
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work with function', async({page, server}) => {
|
||||
it('should work with function', async({page}) => {
|
||||
const windowHandle = await page.evaluateHandle(() => {
|
||||
window['foo'] = [1, 2];
|
||||
return window;
|
||||
|
|
@ -26,7 +24,7 @@ it('should work with function', async({page, server}) => {
|
|||
expect(await windowHandle.evaluate(w => w['foo'])).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should work with expression', async({page, server}) => {
|
||||
it('should work with expression', async({page}) => {
|
||||
const windowHandle = await page.evaluateHandle(() => {
|
||||
window['foo'] = [1, 2];
|
||||
return window;
|
||||
|
|
|
|||
|
|
@ -16,21 +16,19 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
it('should work', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));
|
||||
const json = await aHandle.jsonValue();
|
||||
expect(json).toEqual({foo: 'bar'});
|
||||
});
|
||||
|
||||
it('should work with dates', async({page, server}) => {
|
||||
it('should work with dates', async({page}) => {
|
||||
const dateHandle = await page.evaluateHandle(() => new Date('2017-09-26T00:00:00.000Z'));
|
||||
const date = await dateHandle.jsonValue();
|
||||
expect(date.toJSON()).toBe('2017-09-26T00:00:00.000Z');
|
||||
});
|
||||
|
||||
it('should throw for circular objects', async({page, server}) => {
|
||||
it('should throw for circular objects', async({page}) => {
|
||||
const windowHandle = await page.evaluateHandle('window');
|
||||
let error = null;
|
||||
await windowHandle.jsonValue().catch(e => error = e);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
it('should work', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => ({
|
||||
one: 1,
|
||||
two: 2,
|
||||
|
|
@ -28,7 +26,7 @@ it('should work', async({page, server}) => {
|
|||
expect(await twoHandle.jsonValue()).toEqual(2);
|
||||
});
|
||||
|
||||
it('should work with undefined, null, and empty', async({page, server}) => {
|
||||
it('should work with undefined, null, and empty', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => ({
|
||||
undefined: undefined,
|
||||
null: null,
|
||||
|
|
@ -41,7 +39,7 @@ it('should work with undefined, null, and empty', async({page, server}) => {
|
|||
expect(String(await emptyhandle.jsonValue())).toEqual('undefined');
|
||||
});
|
||||
|
||||
it('should work with unserializable values', async({page, server}) => {
|
||||
it('should work with unserializable values', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => ({
|
||||
infinity: Infinity,
|
||||
nInfinity: -Infinity,
|
||||
|
|
@ -58,7 +56,7 @@ it('should work with unserializable values', async({page, server}) => {
|
|||
expect(await nzeroHandle.jsonValue()).toEqual(-0);
|
||||
});
|
||||
|
||||
it('getProperties should work', async({page, server}) => {
|
||||
it('getProperties should work', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => ({
|
||||
foo: 'bar'
|
||||
}));
|
||||
|
|
@ -68,13 +66,13 @@ it('getProperties should work', async({page, server}) => {
|
|||
expect(await foo.jsonValue()).toBe('bar');
|
||||
});
|
||||
|
||||
it('getProperties should return empty map for non-objects', async({page, server}) => {
|
||||
it('getProperties should return empty map for non-objects', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => 123);
|
||||
const properties = await aHandle.getProperties();
|
||||
expect(properties.size).toBe(0);
|
||||
});
|
||||
|
||||
it('getProperties should return even non-own properties', async({page, server}) => {
|
||||
it('getProperties should return even non-own properties', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => {
|
||||
class A {
|
||||
a: string;
|
||||
|
|
|
|||
|
|
@ -16,28 +16,26 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work for primitives', async({page, server}) => {
|
||||
it('should work for primitives', async({page}) => {
|
||||
const numberHandle = await page.evaluateHandle(() => 2);
|
||||
expect(numberHandle.toString()).toBe('JSHandle@2');
|
||||
const stringHandle = await page.evaluateHandle(() => 'a');
|
||||
expect(stringHandle.toString()).toBe('JSHandle@a');
|
||||
});
|
||||
|
||||
it('should work for complicated objects', async({page, server}) => {
|
||||
it('should work for complicated objects', async({page}) => {
|
||||
const aHandle = await page.evaluateHandle(() => window);
|
||||
expect(aHandle.toString()).toBe('JSHandle@object');
|
||||
});
|
||||
|
||||
it('should work for promises', async({page, server}) => {
|
||||
it('should work for promises', async({page}) => {
|
||||
// wrap the promise in an object, otherwise we will await.
|
||||
const wrapperHandle = await page.evaluateHandle(() => ({b: Promise.resolve(123)}));
|
||||
const bHandle = await wrapperHandle.getProperty('b');
|
||||
expect(bHandle.toString()).toBe('JSHandle@promise');
|
||||
});
|
||||
|
||||
it('should work with different subtypes', async({page, server}) => {
|
||||
it('should work with different subtypes', async({page}) => {
|
||||
expect((await page.evaluateHandle('(function(){})')).toString()).toBe('JSHandle@function');
|
||||
expect((await page.evaluateHandle('12')).toString()).toBe('JSHandle@12');
|
||||
expect((await page.evaluateHandle('true')).toString()).toBe('JSHandle@true');
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@ import './base.fixture';
|
|||
|
||||
import utils from './utils';
|
||||
|
||||
const {FFOX, WEBKIT, CHROMIUM, MAC} = testOptions;
|
||||
|
||||
it('should type into a textarea', async ({page, server}) => {
|
||||
it('should type into a textarea', async ({page}) => {
|
||||
await page.evaluate(() => {
|
||||
const textarea = document.createElement('textarea');
|
||||
document.body.appendChild(textarea);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,9 @@
|
|||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should require top-level Errors', async({playwright}) => {
|
||||
it('should require top-level Errors', async({}) => {
|
||||
const Errors = require(path.join(utils.projectRoot(), '/lib/errors.js'));
|
||||
expect(String(Errors.TimeoutError)).toContain('TimeoutError');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -15,10 +15,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should log', async({browserType, defaultBrowserOptions}) => {
|
||||
const log = [];
|
||||
const browser = await browserType.launch({...defaultBrowserOptions, logger: {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
function dimensions() {
|
||||
const rect = document.querySelector('textarea').getBoundingClientRect();
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it.skip(WIRE)('should work across sessions', async ({browserType, defaultBrowserOptions}) => {
|
||||
const browserServer = await browserType.launchServer(defaultBrowserOptions);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('should work for main frame navigation request', async({page, server}) => {
|
||||
const requests = [];
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ import './base.fixture';
|
|||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
server.setRoute('/empty.html', (req, res) => {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
import path from 'path';
|
||||
const { FFOX, CHROMIUM, WEBKIT, WIRE } = testOptions;
|
||||
|
||||
it('should evaluate before anything else on the page', async ({ page, server }) => {
|
||||
await page.addInitScript(function () {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should throw an error if no options are provided', async({page, server}) => {
|
||||
let error = null;
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should throw an error if no options are provided', async({page, server}) => {
|
||||
let error = null;
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should reject all promises when page is closed', async({context}) => {
|
||||
const newPage = await context.newPage();
|
||||
let error = null;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
import './base.fixture';
|
||||
|
||||
import utils from './utils';
|
||||
const {CHROMIUM, FFOX, MAC, HEADLESS} = testOptions;
|
||||
|
||||
it('should emulate type', async({page, server}) => {
|
||||
expect(await page.evaluate(() => matchMedia('screen').matches)).toBe(true);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
const windowHandle = await page.evaluateHandle(() => window);
|
||||
expect(windowHandle).toBeTruthy();
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {WEBKIT, WIRE, FFOX} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
it('should work', async ({ page, server }) => {
|
||||
const result = await page.evaluate(() => 7 * 3);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
let message = null;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
const { WIRE } = testOptions;
|
||||
|
||||
const CRASH_FAIL = (FFOX && WIN) || WIRE;
|
||||
// Firefox Win: it just doesn't crash sometimes.
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('Page.Events.Request', async({page, server}) => {
|
||||
const requests = [];
|
||||
page.on('request', request => requests.push(request));
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('should fire', async({page, server}) => {
|
||||
const [error] = await Promise.all([
|
||||
page.waitForEvent('pageerror'),
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC} = testOptions;
|
||||
|
||||
it('should work', async({browser}) => {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
|
|
|||
|
|
@ -16,10 +16,7 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import utils from './utils';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('should fire for navigation requests', async({page, server}) => {
|
||||
const requests = [];
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
it('exposeBinding should work', async({browser}) => {
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@
|
|||
*/
|
||||
import './base.fixture';
|
||||
|
||||
import path from 'path';
|
||||
import util from 'util';
|
||||
import vm from 'vm';
|
||||
const {FFOX, CHROMIUM, WEBKIT, WIN, WIRE} = testOptions;
|
||||
|
||||
async function giveItAChanceToFill(page) {
|
||||
for (let i = 0; i < 5; i++)
|
||||
await page.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import './base.fixture';
|
|||
import utils from './utils';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
const {FFOX, CHROMIUM, WEBKIT, MAC, WIN} = testOptions;
|
||||
|
||||
it('should work', async({page, server}) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue