parent
0b1777e73c
commit
0b1a9ceee2
@ -22,15 +22,6 @@ task:
|
|||||||
test_doclint_script: npm run test-doclint
|
test_doclint_script: npm run test-doclint
|
||||||
test_types_script: npm run test-types
|
test_types_script: npm run test-types
|
||||||
|
|
||||||
task:
|
|
||||||
matrix:
|
|
||||||
- name: Firefox Juggler (node8 + linux)
|
|
||||||
container:
|
|
||||||
dockerfile: .ci/node8/Dockerfile.linux
|
|
||||||
xvfb_start_background_script: Xvfb :99 -ac -screen 0 1024x768x24
|
|
||||||
install_script: npm install --unsafe-perm && cd experimental/puppeteer-firefox && npm install --unsafe-perm
|
|
||||||
test_script: npm run fjunit
|
|
||||||
|
|
||||||
task:
|
task:
|
||||||
osx_instance:
|
osx_instance:
|
||||||
image: high-sierra-base
|
image: high-sierra-base
|
||||||
|
@ -15,11 +15,13 @@ before_install:
|
|||||||
- "sysctl kernel.unprivileged_userns_clone=1"
|
- "sysctl kernel.unprivileged_userns_clone=1"
|
||||||
- "export DISPLAY=:99.0"
|
- "export DISPLAY=:99.0"
|
||||||
- "sh -e /etc/init.d/xvfb start"
|
- "sh -e /etc/init.d/xvfb start"
|
||||||
|
- 'if [ "$FIREFOX" = "true" ]; then pyenv shell 3.6; pip3 install --user mozdownload; fi'
|
||||||
|
- 'if [ "$FIREFOX" = "true" ]; then rm -rf $FIREFOX_HOME; mozdownload -t daily -d $FIREFOX_HOME/latest.tar.bz --log-level DEBUG; fi'
|
||||||
|
- 'if [ "$FIREFOX" = "true" ]; then cd $FIREFOX_HOME; tar -xvf latest.tar.bz; cd -; ls $FIREFOX_HOME/firefox/firefox; fi'
|
||||||
script:
|
script:
|
||||||
- 'if [ "$NODE8" = "true" ]; then npm run lint; fi'
|
- 'if [ "$NODE8" = "true" ]; then npm run lint; fi'
|
||||||
- 'if [ "$NODE8" = "true" ]; then npm run coverage; fi'
|
- 'if [ "$NODE8" = "true" ]; then npm run coverage; fi'
|
||||||
- 'if [ "$FIREFOX" = "true" ]; then cd experimental/puppeteer-firefox && npm i && cd ../..; fi'
|
- 'if [ "$FIREFOX" = "true" ]; then BINARY=$FIREFOX_HOME/firefox/firefox npm run funit; fi'
|
||||||
- 'if [ "$FIREFOX" = "true" ]; then npm run fjunit; fi'
|
|
||||||
- 'if [ "$NODE8" = "true" ]; then npm run test-doclint; fi'
|
- 'if [ "$NODE8" = "true" ]; then npm run test-doclint; fi'
|
||||||
- 'if [ "$NODE8" = "true" ]; then npm run test-types; fi'
|
- 'if [ "$NODE8" = "true" ]; then npm run test-types; fi'
|
||||||
- 'if [ "$NODE8" = "true" ]; then npm run bundle; fi'
|
- 'if [ "$NODE8" = "true" ]; then npm run bundle; fi'
|
||||||
@ -34,8 +36,9 @@ jobs:
|
|||||||
- node_js: "8.16.0"
|
- node_js: "8.16.0"
|
||||||
env:
|
env:
|
||||||
- FIREFOX=true
|
- FIREFOX=true
|
||||||
- FLAKINESS_DASHBOARD_NAME="Travis Firefox (node8 + linux)"
|
- FLAKINESS_DASHBOARD_NAME="Travis Firefox Nightly (node8 + linux)"
|
||||||
- FLAKINESS_DASHBOARD_BUILD_URL="${TRAVIS_JOB_WEB_URL}"
|
- FLAKINESS_DASHBOARD_BUILD_URL="${TRAVIS_JOB_WEB_URL}"
|
||||||
|
- FIREFOX_HOME=$TRAVIS_HOME/firefox-latest
|
||||||
before_deploy: "npm run apply-next-version"
|
before_deploy: "npm run apply-next-version"
|
||||||
deploy:
|
deploy:
|
||||||
provider: npm
|
provider: npm
|
||||||
|
@ -398,6 +398,9 @@ class FirefoxLauncher {
|
|||||||
else
|
else
|
||||||
firefoxArguments.push(...args);
|
firefoxArguments.push(...args);
|
||||||
|
|
||||||
|
if (!firefoxArguments.some(argument => argument.startsWith('--remote-debugging-')))
|
||||||
|
firefoxArguments.push('--remote-debugging-port=0');
|
||||||
|
|
||||||
let temporaryUserDataDir = null;
|
let temporaryUserDataDir = null;
|
||||||
|
|
||||||
if (!firefoxArguments.includes('-profile') && !firefoxArguments.includes('--profile')) {
|
if (!firefoxArguments.includes('-profile') && !firefoxArguments.includes('--profile')) {
|
||||||
@ -484,7 +487,6 @@ class FirefoxLauncher {
|
|||||||
*/
|
*/
|
||||||
defaultArgs(options = {}) {
|
defaultArgs(options = {}) {
|
||||||
const firefoxArguments = [
|
const firefoxArguments = [
|
||||||
'--remote-debugging-port=0',
|
|
||||||
'--no-remote',
|
'--no-remote',
|
||||||
'--foreground',
|
'--foreground',
|
||||||
];
|
];
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"unit": "node test/test.js",
|
"unit": "node test/test.js",
|
||||||
"fjunit": "PUPPETEER_PRODUCT=juggler node test/test.js",
|
|
||||||
"funit": "PUPPETEER_PRODUCT=firefox node test/test.js",
|
"funit": "PUPPETEER_PRODUCT=firefox node test/test.js",
|
||||||
"debug-unit": "node --inspect-brk test/test.js",
|
"debug-unit": "node --inspect-brk test/test.js",
|
||||||
"test-doclint": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js",
|
"test-doclint": "node utils/doclint/check_public_api/test/test.js && node utils/doclint/preprocessor/test.js",
|
||||||
|
@ -19,7 +19,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Accessibility', function() {
|
describe_fails_ffox('Accessibility', function() {
|
||||||
it('should work', async function({page}) {
|
it('should work', async function({page}) {
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
<head>
|
<head>
|
||||||
@ -310,7 +310,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
expect(snapshot.children[0]).toEqual(golden);
|
expect(snapshot.children[0]).toEqual(golden);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe_fails_ffox('root option', function() {
|
describe('root option', function() {
|
||||||
it('should work a button', async({page}) => {
|
it('should work a button', async({page}) => {
|
||||||
await page.setContent(`<button>My Button</button>`);
|
await page.setContent(`<button>My Button</button>`);
|
||||||
|
|
||||||
|
@ -23,10 +23,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
it('should return whether we are in headless', async({browser}) => {
|
it('should return whether we are in headless', async({browser}) => {
|
||||||
const version = await browser.version();
|
const version = await browser.version();
|
||||||
expect(version.length).toBeGreaterThan(0);
|
expect(version.length).toBeGreaterThan(0);
|
||||||
if (CHROME)
|
expect(version.startsWith('Headless')).toBe(headless);
|
||||||
expect(version.startsWith('Headless')).toBe(headless);
|
|
||||||
else
|
|
||||||
expect(version.startsWith('Firefox/')).toBe(true);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,11 +18,11 @@ const utils = require('./utils');
|
|||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('BrowserContext', function() {
|
describe('BrowserContext', function() {
|
||||||
it('should have default context', async function({browser, server}) {
|
it_fails_ffox('should have default context', async function({browser, server}) {
|
||||||
expect(browser.browserContexts().length).toBe(1);
|
expect(browser.browserContexts().length).toBe(1);
|
||||||
const defaultContext = browser.browserContexts()[0];
|
const defaultContext = browser.browserContexts()[0];
|
||||||
expect(defaultContext.isIncognito()).toBe(false);
|
expect(defaultContext.isIncognito()).toBe(false);
|
||||||
@ -31,7 +31,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(browser.defaultBrowserContext()).toBe(defaultContext);
|
expect(browser.defaultBrowserContext()).toBe(defaultContext);
|
||||||
expect(error.message).toContain('cannot be closed');
|
expect(error.message).toContain('cannot be closed');
|
||||||
});
|
});
|
||||||
it('should create new incognito context', async function({browser, server}) {
|
it_fails_ffox('should create new incognito context', async function({browser, server}) {
|
||||||
expect(browser.browserContexts().length).toBe(1);
|
expect(browser.browserContexts().length).toBe(1);
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
expect(context.isIncognito()).toBe(true);
|
expect(context.isIncognito()).toBe(true);
|
||||||
@ -40,7 +40,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await context.close();
|
await context.close();
|
||||||
expect(browser.browserContexts().length).toBe(1);
|
expect(browser.browserContexts().length).toBe(1);
|
||||||
});
|
});
|
||||||
it('should close all belonging targets once closing context', async function({browser, server}) {
|
it_fails_ffox('should close all belonging targets once closing context', async function({browser, server}) {
|
||||||
expect((await browser.pages()).length).toBe(1);
|
expect((await browser.pages()).length).toBe(1);
|
||||||
|
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
@ -51,7 +51,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await context.close();
|
await context.close();
|
||||||
expect((await browser.pages()).length).toBe(1);
|
expect((await browser.pages()).length).toBe(1);
|
||||||
});
|
});
|
||||||
it('window.open should use parent tab context', async function({browser, server}) {
|
it_fails_ffox('window.open should use parent tab context', async function({browser, server}) {
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -62,7 +62,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(popupTarget.browserContext()).toBe(context);
|
expect(popupTarget.browserContext()).toBe(context);
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
it('should fire target events', async function({browser, server}) {
|
it_fails_ffox('should fire target events', async function({browser, server}) {
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
const events = [];
|
const events = [];
|
||||||
context.on('targetcreated', target => events.push('CREATED: ' + target.url()));
|
context.on('targetcreated', target => events.push('CREATED: ' + target.url()));
|
||||||
@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
]);
|
]);
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
it('should wait for a target', async function({browser, server}) {
|
it_fails_ffox('should wait for a target', async function({browser, server}) {
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
let resolved = false;
|
let resolved = false;
|
||||||
const targetPromise = context.waitForTarget(target => target.url() === server.EMPTY_PAGE);
|
const targetPromise = context.waitForTarget(target => target.url() === server.EMPTY_PAGE);
|
||||||
@ -96,7 +96,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
||||||
await context.close();
|
await context.close();
|
||||||
});
|
});
|
||||||
it('should isolate localStorage and cookies', async function({browser, server}) {
|
it_fails_ffox('should isolate localStorage and cookies', async function({browser, server}) {
|
||||||
// Create two incognito contexts.
|
// Create two incognito contexts.
|
||||||
const context1 = await browser.createIncognitoBrowserContext();
|
const context1 = await browser.createIncognitoBrowserContext();
|
||||||
const context2 = await browser.createIncognitoBrowserContext();
|
const context2 = await browser.createIncognitoBrowserContext();
|
||||||
@ -140,7 +140,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
]);
|
]);
|
||||||
expect(browser.browserContexts().length).toBe(1);
|
expect(browser.browserContexts().length).toBe(1);
|
||||||
});
|
});
|
||||||
it('should work across sessions', async function({browser, server}) {
|
it_fails_ffox('should work across sessions', async function({browser, server}) {
|
||||||
expect(browser.browserContexts().length).toBe(1);
|
expect(browser.browserContexts().length).toBe(1);
|
||||||
const context = await browser.createIncognitoBrowserContext();
|
const context = await browser.createIncognitoBrowserContext();
|
||||||
expect(browser.browserContexts().length).toBe(2);
|
expect(browser.browserContexts().length).toBe(2);
|
||||||
|
@ -27,7 +27,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await page.click('button');
|
await page.click('button');
|
||||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||||
});
|
});
|
||||||
it('should click svg', async({page, server}) => {
|
it_fails_ffox('should click svg', async({page, server}) => {
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
<svg height="100" width="100">
|
<svg height="100" width="100">
|
||||||
<circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
<circle onclick="javascript:window.__CLICKED=42" cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
||||||
@ -43,7 +43,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(await page.evaluate(() => result)).toBe('Clicked');
|
expect(await page.evaluate(() => result)).toBe('Clicked');
|
||||||
});
|
});
|
||||||
// @see https://github.com/puppeteer/puppeteer/issues/4281
|
// @see https://github.com/puppeteer/puppeteer/issues/4281
|
||||||
it('should click on a span with an inline element inside', async({page, server}) => {
|
it_fails_ffox('should click on a span with an inline element inside', async({page, server}) => {
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
<style>
|
<style>
|
||||||
span::before {
|
span::before {
|
||||||
@ -104,7 +104,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
|
return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
|
||||||
})).toBe(text);
|
})).toBe(text);
|
||||||
});
|
});
|
||||||
it('should click offscreen buttons', async({page, server}) => {
|
it_fails_ffox('should click offscreen buttons', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
await page.goto(server.PREFIX + '/offscreenbuttons.html');
|
||||||
const messages = [];
|
const messages = [];
|
||||||
page.on('console', msg => messages.push(msg.text()));
|
page.on('console', msg => messages.push(msg.text()));
|
||||||
@ -153,7 +153,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(await page.evaluate(() => result.check)).toBe(false);
|
expect(await page.evaluate(() => result.check)).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on checkbox label and toggle', async({page, server}) => {
|
it_fails_ffox('should click on checkbox label and toggle', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/checkbox.html');
|
await page.goto(server.PREFIX + '/input/checkbox.html');
|
||||||
expect(await page.evaluate(() => result.check)).toBe(null);
|
expect(await page.evaluate(() => result.check)).toBe(null);
|
||||||
await page.click('label[for="agree"]');
|
await page.click('label[for="agree"]');
|
||||||
@ -187,7 +187,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await page.click('#button-80');
|
await page.click('#button-80');
|
||||||
expect(await page.evaluate(() => document.querySelector('#button-80').textContent)).toBe('clicked');
|
expect(await page.evaluate(() => document.querySelector('#button-80').textContent)).toBe('clicked');
|
||||||
});
|
});
|
||||||
it('should double click the button', async({page, server}) => {
|
it_fails_ffox('should double click the button', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.double = false;
|
window.double = false;
|
||||||
@ -223,12 +223,12 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(await page.evaluate(() => document.querySelector('#button-8').textContent)).toBe('context menu');
|
expect(await page.evaluate(() => document.querySelector('#button-8').textContent)).toBe('context menu');
|
||||||
});
|
});
|
||||||
// @see https://github.com/puppeteer/puppeteer/issues/206
|
// @see https://github.com/puppeteer/puppeteer/issues/206
|
||||||
it('should click links which cause navigation', async({page, server}) => {
|
it_fails_ffox('should click links which cause navigation', async({page, server}) => {
|
||||||
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
|
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
|
||||||
// This await should not hang.
|
// This await should not hang.
|
||||||
await page.click('a');
|
await page.click('a');
|
||||||
});
|
});
|
||||||
it('should click the button inside an iframe', async({page, server}) => {
|
it_fails_ffox('should click the button inside an iframe', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setContent('<div style="width:100px;height:100px">spacer</div>');
|
await page.setContent('<div style="width:100px;height:100px">spacer</div>');
|
||||||
await utils.attachFrame(page, 'button-test', server.PREFIX + '/input/button.html');
|
await utils.attachFrame(page, 'button-test', server.PREFIX + '/input/button.html');
|
||||||
@ -248,7 +248,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await frame.click('button');
|
await frame.click('button');
|
||||||
expect(await frame.evaluate(() => window.result)).toBe('Clicked');
|
expect(await frame.evaluate(() => window.result)).toBe('Clicked');
|
||||||
});
|
});
|
||||||
it('should click the button with deviceScaleFactor set', async({page, server}) => {
|
it_fails_ffox('should click the button with deviceScaleFactor set', async({page, server}) => {
|
||||||
await page.setViewport({width: 400, height: 400, deviceScaleFactor: 5});
|
await page.setViewport({width: 400, height: 400, deviceScaleFactor: 5});
|
||||||
expect(await page.evaluate(() => window.devicePixelRatio)).toBe(5);
|
expect(await page.evaluate(() => window.devicePixelRatio)).toBe(5);
|
||||||
await page.setContent('<div style="width:100px;height:100px">spacer</div>');
|
await page.setContent('<div style="width:100px;height:100px">spacer</div>');
|
||||||
|
@ -51,7 +51,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(cookies.length).toBe(1);
|
expect(cookies.length).toBe(1);
|
||||||
expect(cookies[0].httpOnly).toBe(true);
|
expect(cookies[0].httpOnly).toBe(true);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should properly report "Strict" sameSite cookie', async({page, server}) => {
|
it('should properly report "Strict" sameSite cookie', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('Set-Cookie', ';SameSite=Strict');
|
res.setHeader('Set-Cookie', ';SameSite=Strict');
|
||||||
res.end();
|
res.end();
|
||||||
@ -61,7 +61,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(cookies.length).toBe(1);
|
expect(cookies.length).toBe(1);
|
||||||
expect(cookies[0].sameSite).toBe('Strict');
|
expect(cookies[0].sameSite).toBe('Strict');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should properly report "Lax" sameSite cookie', async({page, server}) => {
|
it('should properly report "Lax" sameSite cookie', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('Set-Cookie', ';SameSite=Lax');
|
res.setHeader('Set-Cookie', ';SameSite=Lax');
|
||||||
res.end();
|
res.end();
|
||||||
@ -104,7 +104,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should get cookies from multiple urls', async({page, server}) => {
|
it_fails_ffox('should get cookies from multiple urls', async({page, server}) => {
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
url: 'https://foo.com',
|
url: 'https://foo.com',
|
||||||
name: 'doggo',
|
name: 'doggo',
|
||||||
@ -145,7 +145,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setCookie', function() {
|
describe('Page.setCookie', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'password',
|
name: 'password',
|
||||||
@ -153,7 +153,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
expect(await page.evaluate(() => document.cookie)).toEqual('password=123456');
|
expect(await page.evaluate(() => document.cookie)).toEqual('password=123456');
|
||||||
});
|
});
|
||||||
it('should isolate cookies in browser contexts', async({page, server, browser}) => {
|
it_fails_ffox('should isolate cookies in browser contexts', async({page, server, browser}) => {
|
||||||
const anotherContext = await browser.createIncognitoBrowserContext();
|
const anotherContext = await browser.createIncognitoBrowserContext();
|
||||||
const anotherPage = await anotherContext.newPage();
|
const anotherPage = await anotherContext.newPage();
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(cookies2[0].value).toBe('page2value');
|
expect(cookies2[0].value).toBe('page2value');
|
||||||
await anotherContext.close();
|
await anotherContext.close();
|
||||||
});
|
});
|
||||||
it('should set multiple cookies', async({page, server}) => {
|
it_fails_ffox('should set multiple cookies', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'password',
|
name: 'password',
|
||||||
@ -190,7 +190,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
'password=123456',
|
'password=123456',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should have |expires| set to |-1| for session cookies', async({page, server}) => {
|
it_fails_ffox('should have |expires| set to |-1| for session cookies', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'password',
|
name: 'password',
|
||||||
@ -200,7 +200,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(cookies[0].session).toBe(true);
|
expect(cookies[0].session).toBe(true);
|
||||||
expect(cookies[0].expires).toBe(-1);
|
expect(cookies[0].expires).toBe(-1);
|
||||||
});
|
});
|
||||||
it('should set cookie with reasonable defaults', async({page, server}) => {
|
it_fails_ffox('should set cookie with reasonable defaults', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'password',
|
name: 'password',
|
||||||
@ -219,7 +219,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
session: true
|
session: true
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
it('should set a cookie with a path', async({page, server}) => {
|
it_fails_ffox('should set a cookie with a path', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'gridcookie',
|
name: 'gridcookie',
|
||||||
@ -279,7 +279,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
}
|
}
|
||||||
expect(error.message).toContain('At least one of the url and domain needs to be specified');
|
expect(error.message).toContain('At least one of the url and domain needs to be specified');
|
||||||
});
|
});
|
||||||
it('should default to setting secure cookie for HTTPS websites', async({page, server}) => {
|
it_fails_ffox('should default to setting secure cookie for HTTPS websites', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const SECURE_URL = 'https://example.com';
|
const SECURE_URL = 'https://example.com';
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
@ -290,7 +290,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const [cookie] = await page.cookies(SECURE_URL);
|
const [cookie] = await page.cookies(SECURE_URL);
|
||||||
expect(cookie.secure).toBe(true);
|
expect(cookie.secure).toBe(true);
|
||||||
});
|
});
|
||||||
it('should be able to set unsecure cookie for HTTP website', async({page, server}) => {
|
it_fails_ffox('should be able to set unsecure cookie for HTTP website', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const HTTP_URL = 'http://example.com';
|
const HTTP_URL = 'http://example.com';
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
@ -301,7 +301,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const [cookie] = await page.cookies(HTTP_URL);
|
const [cookie] = await page.cookies(HTTP_URL);
|
||||||
expect(cookie.secure).toBe(false);
|
expect(cookie.secure).toBe(false);
|
||||||
});
|
});
|
||||||
it('should set a cookie on a different domain', async({page, server}) => {
|
it_fails_ffox('should set a cookie on a different domain', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
url: 'https://www.example.com',
|
url: 'https://www.example.com',
|
||||||
@ -322,7 +322,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
session: true
|
session: true
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
it('should set cookies from a frame', async({page, server}) => {
|
it_fails_ffox('should set cookies from a frame', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
await page.setCookie({name: 'localhost-cookie', value: 'best'});
|
await page.setCookie({name: 'localhost-cookie', value: 'best'});
|
||||||
await page.evaluate(src => {
|
await page.evaluate(src => {
|
||||||
@ -365,7 +365,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.deleteCookie', function() {
|
describe('Page.deleteCookie', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'cookie1',
|
name: 'cookie1',
|
||||||
|
@ -19,7 +19,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe_fails_ffox('DefaultBrowserContext', function() {
|
describe('DefaultBrowserContext', function() {
|
||||||
beforeEach(async state => {
|
beforeEach(async state => {
|
||||||
state.browser = await puppeteer.launch(defaultBrowserOptions);
|
state.browser = await puppeteer.launch(defaultBrowserOptions);
|
||||||
state.page = await state.browser.newPage();
|
state.page = await state.browser.newPage();
|
||||||
@ -46,7 +46,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
session: true
|
session: true
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
it('page.setCookie() should work', async({page, server}) => {
|
it_fails_ffox('page.setCookie() should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'username',
|
name: 'username',
|
||||||
@ -65,7 +65,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
session: true
|
session: true
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
it('page.deleteCookie() should work', async({page, server}) => {
|
it_fails_ffox('page.deleteCookie() should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setCookie({
|
await page.setCookie({
|
||||||
name: 'cookie1',
|
name: 'cookie1',
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect}) {
|
module.exports.addTests = function({testRunner, expect}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.Events.Dialog', function() {
|
describe('Page.Events.Dialog', function() {
|
||||||
@ -29,7 +29,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
await page.evaluate(() => alert('yo'));
|
await page.evaluate(() => alert('yo'));
|
||||||
});
|
});
|
||||||
it('should allow accepting prompts', async({page, server}) => {
|
it_fails_ffox('should allow accepting prompts', async({page, server}) => {
|
||||||
page.on('dialog', dialog => {
|
page.on('dialog', dialog => {
|
||||||
expect(dialog.type()).toBe('prompt');
|
expect(dialog.type()).toBe('prompt');
|
||||||
expect(dialog.defaultValue()).toBe('yes.');
|
expect(dialog.defaultValue()).toBe('yes.');
|
||||||
|
@ -21,7 +21,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('ElementHandle.boundingBox', function() {
|
describe_fails_ffox('ElementHandle.boundingBox', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
@ -133,7 +133,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('ElementHandle.contentFrame', function() {
|
describe('ElementHandle.contentFrame', function() {
|
||||||
it('should work', async({page,server}) => {
|
it_fails_ffox('should work', async({page,server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
const elementHandle = await page.$('#frame1');
|
const elementHandle = await page.$('#frame1');
|
||||||
@ -184,7 +184,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
const error = await button.click().catch(err => err);
|
const error = await button.click().catch(err => err);
|
||||||
expect(error.message).toBe('Node is either not visible or not an HTMLElement');
|
expect(error.message).toBe('Node is either not visible or not an HTMLElement');
|
||||||
});
|
});
|
||||||
it('should throw for <br> elements', async({page, server}) => {
|
it_fails_ffox('should throw for <br> elements', async({page, server}) => {
|
||||||
await page.setContent('hello<br>goodbye');
|
await page.setContent('hello<br>goodbye');
|
||||||
const br = await page.$('br');
|
const br = await page.$('br');
|
||||||
const error = await br.click().catch(err => err);
|
const error = await br.click().catch(err => err);
|
||||||
@ -193,7 +193,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('ElementHandle.hover', function() {
|
describe('ElementHandle.hover', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||||
const button = await page.$('#button-6');
|
const button = await page.$('#button-6');
|
||||||
await button.hover();
|
await button.hover();
|
||||||
|
@ -36,7 +36,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
await page.setViewport({width: 400, height: 300});
|
await page.setViewport({width: 400, height: 300});
|
||||||
expect(await page.evaluate(() => window.innerWidth)).toBe(400);
|
expect(await page.evaluate(() => window.innerWidth)).toBe(400);
|
||||||
});
|
});
|
||||||
it('should support touch emulation', async({page, server}) => {
|
it_fails_ffox('should support touch emulation', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/mobile.html');
|
await page.goto(server.PREFIX + '/mobile.html');
|
||||||
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);
|
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);
|
||||||
await page.setViewport(iPhone.viewport);
|
await page.setViewport(iPhone.viewport);
|
||||||
@ -58,14 +58,14 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('should be detectable by Modernizr', async({page, server}) => {
|
it_fails_ffox('should be detectable by Modernizr', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/detect-touch.html');
|
await page.goto(server.PREFIX + '/detect-touch.html');
|
||||||
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('NO');
|
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('NO');
|
||||||
await page.setViewport(iPhone.viewport);
|
await page.setViewport(iPhone.viewport);
|
||||||
await page.goto(server.PREFIX + '/detect-touch.html');
|
await page.goto(server.PREFIX + '/detect-touch.html');
|
||||||
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('YES');
|
expect(await page.evaluate(() => document.body.textContent.trim())).toBe('YES');
|
||||||
});
|
});
|
||||||
it('should detect touch when applying viewport with touches', async({page, server}) => {
|
it_fails_ffox('should detect touch when applying viewport with touches', async({page, server}) => {
|
||||||
await page.setViewport({ width: 800, height: 600, hasTouch: true });
|
await page.setViewport({ width: 800, height: 600, hasTouch: true });
|
||||||
await page.addScriptTag({url: server.PREFIX + '/modernizr.js'});
|
await page.addScriptTag({url: server.PREFIX + '/modernizr.js'});
|
||||||
expect(await page.evaluate(() => Modernizr.touchevents)).toBe(true);
|
expect(await page.evaluate(() => Modernizr.touchevents)).toBe(true);
|
||||||
@ -104,7 +104,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.emulateMediaType', function() {
|
describe('Page.emulateMediaType', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
expect(await page.evaluate(() => matchMedia('screen').matches)).toBe(true);
|
expect(await page.evaluate(() => matchMedia('screen').matches)).toBe(true);
|
||||||
expect(await page.evaluate(() => matchMedia('print').matches)).toBe(false);
|
expect(await page.evaluate(() => matchMedia('print').matches)).toBe(false);
|
||||||
await page.emulateMediaType('print');
|
await page.emulateMediaType('print');
|
||||||
@ -121,8 +121,8 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe_fails_ffox('Page.emulateMediaFeatures', function() {
|
describe('Page.emulateMediaFeatures', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.emulateMediaFeatures([
|
await page.emulateMediaFeatures([
|
||||||
{ name: 'prefers-reduced-motion', value: 'reduce' },
|
{ name: 'prefers-reduced-motion', value: 'reduce' },
|
||||||
]);
|
]);
|
||||||
|
@ -19,7 +19,7 @@ const utils = require('./utils');
|
|||||||
const bigint = typeof BigInt !== 'undefined';
|
const bigint = typeof BigInt !== 'undefined';
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect}) {
|
module.exports.addTests = function({testRunner, expect}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
@ -32,19 +32,19 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const result = await page.evaluate(a => a, BigInt(42));
|
const result = await page.evaluate(a => a, BigInt(42));
|
||||||
expect(result).toBe(BigInt(42));
|
expect(result).toBe(BigInt(42));
|
||||||
});
|
});
|
||||||
it('should transfer NaN', async({page, server}) => {
|
it_fails_ffox('should transfer NaN', async({page, server}) => {
|
||||||
const result = await page.evaluate(a => a, NaN);
|
const result = await page.evaluate(a => a, NaN);
|
||||||
expect(Object.is(result, NaN)).toBe(true);
|
expect(Object.is(result, NaN)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should transfer -0', async({page, server}) => {
|
it_fails_ffox('should transfer -0', async({page, server}) => {
|
||||||
const result = await page.evaluate(a => a, -0);
|
const result = await page.evaluate(a => a, -0);
|
||||||
expect(Object.is(result, -0)).toBe(true);
|
expect(Object.is(result, -0)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should transfer Infinity', async({page, server}) => {
|
it_fails_ffox('should transfer Infinity', async({page, server}) => {
|
||||||
const result = await page.evaluate(a => a, Infinity);
|
const result = await page.evaluate(a => a, Infinity);
|
||||||
expect(Object.is(result, Infinity)).toBe(true);
|
expect(Object.is(result, Infinity)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should transfer -Infinity', async({page, server}) => {
|
it_fails_ffox('should transfer -Infinity', async({page, server}) => {
|
||||||
const result = await page.evaluate(a => a, -Infinity);
|
const result = await page.evaluate(a => a, -Infinity);
|
||||||
expect(Object.is(result, -Infinity)).toBe(true);
|
expect(Object.is(result, -Infinity)).toBe(true);
|
||||||
});
|
});
|
||||||
@ -80,7 +80,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const result = await page.evaluate(a => a['中文字符'], {'中文字符': 42});
|
const result = await page.evaluate(a => a['中文字符'], {'中文字符': 42});
|
||||||
expect(result).toBe(42);
|
expect(result).toBe(42);
|
||||||
});
|
});
|
||||||
it('should throw when evaluation triggers reload', async({page, server}) => {
|
it_fails_ffox('should throw when evaluation triggers reload', async({page, server}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -100,7 +100,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(await frameEvaluation).toBe(42);
|
expect(await frameEvaluation).toBe(42);
|
||||||
});
|
});
|
||||||
it('should work from-inside an exposed function', async({page, server}) => {
|
it_fails_ffox('should work from-inside an exposed function', async({page, server}) => {
|
||||||
// Setup inpage callback, which calls Page.evaluate
|
// Setup inpage callback, which calls Page.evaluate
|
||||||
await page.exposeFunction('callController', async function(a, b) {
|
await page.exposeFunction('callController', async function(a, b) {
|
||||||
return await page.evaluate((a, b) => a * b, a, b);
|
return await page.evaluate((a, b) => a * b, a, b);
|
||||||
@ -138,19 +138,19 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const result = await page.evaluate(() => BigInt(42));
|
const result = await page.evaluate(() => BigInt(42));
|
||||||
expect(result).toBe(BigInt(42));
|
expect(result).toBe(BigInt(42));
|
||||||
});
|
});
|
||||||
it('should return NaN', async({page, server}) => {
|
it_fails_ffox('should return NaN', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => NaN);
|
const result = await page.evaluate(() => NaN);
|
||||||
expect(Object.is(result, NaN)).toBe(true);
|
expect(Object.is(result, NaN)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should return -0', async({page, server}) => {
|
it_fails_ffox('should return -0', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => -0);
|
const result = await page.evaluate(() => -0);
|
||||||
expect(Object.is(result, -0)).toBe(true);
|
expect(Object.is(result, -0)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should return Infinity', async({page, server}) => {
|
it_fails_ffox('should return Infinity', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => Infinity);
|
const result = await page.evaluate(() => Infinity);
|
||||||
expect(Object.is(result, Infinity)).toBe(true);
|
expect(Object.is(result, Infinity)).toBe(true);
|
||||||
});
|
});
|
||||||
it('should return -Infinity', async({page, server}) => {
|
it_fails_ffox('should return -Infinity', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => -Infinity);
|
const result = await page.evaluate(() => -Infinity);
|
||||||
expect(Object.is(result, -Infinity)).toBe(true);
|
expect(Object.is(result, -Infinity)).toBe(true);
|
||||||
});
|
});
|
||||||
@ -161,10 +161,10 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
it('should properly serialize null fields', async({page}) => {
|
it('should properly serialize null fields', async({page}) => {
|
||||||
expect(await page.evaluate(() => ({a: undefined}))).toEqual({});
|
expect(await page.evaluate(() => ({a: undefined}))).toEqual({});
|
||||||
});
|
});
|
||||||
it('should return undefined for non-serializable objects', async({page, server}) => {
|
it_fails_ffox('should return undefined for non-serializable objects', async({page, server}) => {
|
||||||
expect(await page.evaluate(() => window)).toBe(undefined);
|
expect(await page.evaluate(() => window)).toBe(undefined);
|
||||||
});
|
});
|
||||||
it('should fail for circular object', async({page, server}) => {
|
it_fails_ffox('should fail for circular object', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => {
|
const result = await page.evaluate(() => {
|
||||||
const a = {};
|
const a = {};
|
||||||
const b = {a};
|
const b = {a};
|
||||||
@ -193,13 +193,13 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const result = await page.evaluate('2 + 5;\n// do some math!');
|
const result = await page.evaluate('2 + 5;\n// do some math!');
|
||||||
expect(result).toBe(7);
|
expect(result).toBe(7);
|
||||||
});
|
});
|
||||||
it('should accept element handle as an argument', async({page, server}) => {
|
it_fails_ffox('should accept element handle as an argument', async({page, server}) => {
|
||||||
await page.setContent('<section>42</section>');
|
await page.setContent('<section>42</section>');
|
||||||
const element = await page.$('section');
|
const element = await page.$('section');
|
||||||
const text = await page.evaluate(e => e.textContent, element);
|
const text = await page.evaluate(e => e.textContent, element);
|
||||||
expect(text).toBe('42');
|
expect(text).toBe('42');
|
||||||
});
|
});
|
||||||
it('should throw if underlying element was disposed', async({page, server}) => {
|
it_fails_ffox('should throw if underlying element was disposed', async({page, server}) => {
|
||||||
await page.setContent('<section>39</section>');
|
await page.setContent('<section>39</section>');
|
||||||
const element = await page.$('section');
|
const element = await page.$('section');
|
||||||
expect(element).toBeTruthy();
|
expect(element).toBeTruthy();
|
||||||
@ -208,7 +208,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
await page.evaluate(e => e.textContent, element).catch(e => error = e);
|
await page.evaluate(e => e.textContent, element).catch(e => error = e);
|
||||||
expect(error.message).toContain('JSHandle is disposed');
|
expect(error.message).toContain('JSHandle is disposed');
|
||||||
});
|
});
|
||||||
it('should throw if elementHandles are from other frames', async({page, server}) => {
|
it_fails_ffox('should throw if elementHandles are from other frames', async({page, server}) => {
|
||||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
const bodyHandle = await page.frames()[1].$('body');
|
const bodyHandle = await page.frames()[1].$('body');
|
||||||
let error = null;
|
let error = null;
|
||||||
@ -216,7 +216,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(error).toBeTruthy();
|
expect(error).toBeTruthy();
|
||||||
expect(error.message).toContain('JSHandles can be evaluated only in the context they were created');
|
expect(error.message).toContain('JSHandles can be evaluated only in the context they were created');
|
||||||
});
|
});
|
||||||
it('should simulate a user gesture', async({page, server}) => {
|
it_fails_ffox('should simulate a user gesture', async({page, server}) => {
|
||||||
const result = await page.evaluate(() => {
|
const result = await page.evaluate(() => {
|
||||||
document.body.appendChild(document.createTextNode('test'));
|
document.body.appendChild(document.createTextNode('test'));
|
||||||
document.execCommand('selectAll');
|
document.execCommand('selectAll');
|
||||||
@ -224,7 +224,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
});
|
});
|
||||||
it('should throw a nice error after a navigation', async({page, server}) => {
|
it_fails_ffox('should throw a nice error after a navigation', async({page, server}) => {
|
||||||
const executionContext = await page.mainFrame().executionContext();
|
const executionContext = await page.mainFrame().executionContext();
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@ -255,7 +255,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.evaluateOnNewDocument', function() {
|
describe_fails_ffox('Page.evaluateOnNewDocument', function() {
|
||||||
it('should evaluate before anything else on the page', async({page, server}) => {
|
it('should evaluate before anything else on the page', async({page, server}) => {
|
||||||
await page.evaluateOnNewDocument(function(){
|
await page.evaluateOnNewDocument(function(){
|
||||||
window.injected = 123;
|
window.injected = 123;
|
||||||
@ -278,7 +278,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame.evaluate', function() {
|
describe('Frame.evaluate', function() {
|
||||||
it('should have different execution contexts', async({page, server}) => {
|
it_fails_ffox('should have different execution contexts', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
expect(page.frames().length).toBe(2);
|
expect(page.frames().length).toBe(2);
|
||||||
@ -287,7 +287,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(await page.frames()[0].evaluate(() => window.FOO)).toBe('foo');
|
expect(await page.frames()[0].evaluate(() => window.FOO)).toBe('foo');
|
||||||
expect(await page.frames()[1].evaluate(() => window.FOO)).toBe('bar');
|
expect(await page.frames()[1].evaluate(() => window.FOO)).toBe('bar');
|
||||||
});
|
});
|
||||||
it('should have correct execution contexts', async({page, server}) => {
|
it_fails_ffox('should have correct execution contexts', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
expect(page.frames().length).toBe(2);
|
expect(page.frames().length).toBe(2);
|
||||||
expect(await page.frames()[0].evaluate(() => document.body.textContent.trim())).toBe('');
|
expect(await page.frames()[0].evaluate(() => document.body.textContent.trim())).toBe('');
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, puppeteerPath, JUGGLER}) {
|
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, puppeteerPath}) {
|
||||||
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
@ -38,16 +38,9 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
const options = Object.assign({}, defaultBrowserOptions, {dumpio: true});
|
const options = Object.assign({}, defaultBrowserOptions, {dumpio: true});
|
||||||
const res = spawn('node',
|
const res = spawn('node',
|
||||||
[path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]);
|
[path.join(__dirname, 'fixtures', 'dumpio.js'), puppeteerPath, JSON.stringify(options)]);
|
||||||
if (JUGGLER)
|
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
|
||||||
res.stdout.on('data', data => dumpioData += data.toString('utf8'));
|
|
||||||
else
|
|
||||||
res.stderr.on('data', data => dumpioData += data.toString('utf8'));
|
|
||||||
await new Promise(resolve => res.on('close', resolve));
|
await new Promise(resolve => res.on('close', resolve));
|
||||||
|
expect(dumpioData).toContain('DevTools listening on ws://');
|
||||||
if (JUGGLER)
|
|
||||||
expect(dumpioData).toContain('Juggler listening on ws://');
|
|
||||||
else
|
|
||||||
expect(dumpioData).toContain('DevTools listening on ws://');
|
|
||||||
});
|
});
|
||||||
it('should close the browser when the node process closes', async({ server }) => {
|
it('should close the browser when the node process closes', async({ server }) => {
|
||||||
const {spawn, execSync} = require('child_process');
|
const {spawn, execSync} = require('child_process');
|
||||||
|
@ -22,7 +22,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Frame.executionContext', function() {
|
describe('Frame.executionContext', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
expect(page.frames().length).toBe(2);
|
expect(page.frames().length).toBe(2);
|
||||||
@ -68,7 +68,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame Management', function() {
|
describe('Frame Management', function() {
|
||||||
it('should handle nested frames', async({page, server}) => {
|
it_fails_ffox('should handle nested frames', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/frames/nested-frames.html');
|
await page.goto(server.PREFIX + '/frames/nested-frames.html');
|
||||||
expect(utils.dumpFrames(page.mainFrame())).toEqual([
|
expect(utils.dumpFrames(page.mainFrame())).toEqual([
|
||||||
'http://localhost:<PORT>/frames/nested-frames.html',
|
'http://localhost:<PORT>/frames/nested-frames.html',
|
||||||
@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
' http://localhost:<PORT>/frames/frame.html (aframe)'
|
' http://localhost:<PORT>/frames/frame.html (aframe)'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should send events when frames are manipulated dynamically', async({page, server}) => {
|
it_fails_ffox('should send events when frames are manipulated dynamically', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
// validate frameattached events
|
// validate frameattached events
|
||||||
const attachedFrames = [];
|
const attachedFrames = [];
|
||||||
@ -101,7 +101,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(detachedFrames.length).toBe(1);
|
expect(detachedFrames.length).toBe(1);
|
||||||
expect(detachedFrames[0].isDetached()).toBe(true);
|
expect(detachedFrames[0].isDetached()).toBe(true);
|
||||||
});
|
});
|
||||||
it('should send "framenavigated" when navigating on anchor URLs', async({page, server}) => {
|
it_fails_ffox('should send "framenavigated" when navigating on anchor URLs', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
page.goto(server.EMPTY_PAGE + '#foo'),
|
page.goto(server.EMPTY_PAGE + '#foo'),
|
||||||
@ -122,7 +122,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(hasEvents).toBe(false);
|
expect(hasEvents).toBe(false);
|
||||||
});
|
});
|
||||||
it('should detach child frames on navigation', async({page, server}) => {
|
it_fails_ffox('should detach child frames on navigation', async({page, server}) => {
|
||||||
let attachedFrames = [];
|
let attachedFrames = [];
|
||||||
let detachedFrames = [];
|
let detachedFrames = [];
|
||||||
let navigatedFrames = [];
|
let navigatedFrames = [];
|
||||||
@ -142,7 +142,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(detachedFrames.length).toBe(4);
|
expect(detachedFrames.length).toBe(4);
|
||||||
expect(navigatedFrames.length).toBe(1);
|
expect(navigatedFrames.length).toBe(1);
|
||||||
});
|
});
|
||||||
it('should support framesets', async({page, server}) => {
|
it_fails_ffox('should support framesets', async({page, server}) => {
|
||||||
let attachedFrames = [];
|
let attachedFrames = [];
|
||||||
let detachedFrames = [];
|
let detachedFrames = [];
|
||||||
let navigatedFrames = [];
|
let navigatedFrames = [];
|
||||||
@ -162,7 +162,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(detachedFrames.length).toBe(4);
|
expect(detachedFrames.length).toBe(4);
|
||||||
expect(navigatedFrames.length).toBe(1);
|
expect(navigatedFrames.length).toBe(1);
|
||||||
});
|
});
|
||||||
it('should report frame from-inside shadow DOM', async({page, server}) => {
|
it_fails_ffox('should report frame from-inside shadow DOM', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/shadow.html');
|
await page.goto(server.PREFIX + '/shadow.html');
|
||||||
await page.evaluate(async url => {
|
await page.evaluate(async url => {
|
||||||
const frame = document.createElement('iframe');
|
const frame = document.createElement('iframe');
|
||||||
@ -173,7 +173,7 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(page.frames().length).toBe(2);
|
expect(page.frames().length).toBe(2);
|
||||||
expect(page.frames()[1].url()).toBe(server.EMPTY_PAGE);
|
expect(page.frames()[1].url()).toBe(server.EMPTY_PAGE);
|
||||||
});
|
});
|
||||||
it('should report frame.name()', async({page, server}) => {
|
it_fails_ffox('should report frame.name()', async({page, server}) => {
|
||||||
await utils.attachFrame(page, 'theFrameId', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'theFrameId', server.EMPTY_PAGE);
|
||||||
await page.evaluate(url => {
|
await page.evaluate(url => {
|
||||||
const frame = document.createElement('iframe');
|
const frame = document.createElement('iframe');
|
||||||
@ -186,14 +186,14 @@ module.exports.addTests = function({testRunner, expect}) {
|
|||||||
expect(page.frames()[1].name()).toBe('theFrameId');
|
expect(page.frames()[1].name()).toBe('theFrameId');
|
||||||
expect(page.frames()[2].name()).toBe('theFrameName');
|
expect(page.frames()[2].name()).toBe('theFrameName');
|
||||||
});
|
});
|
||||||
it('should report frame.parent()', async({page, server}) => {
|
it_fails_ffox('should report frame.parent()', async({page, server}) => {
|
||||||
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
await utils.attachFrame(page, 'frame2', server.EMPTY_PAGE);
|
await utils.attachFrame(page, 'frame2', server.EMPTY_PAGE);
|
||||||
expect(page.frames()[0].parentFrame()).toBe(null);
|
expect(page.frames()[0].parentFrame()).toBe(null);
|
||||||
expect(page.frames()[1].parentFrame()).toBe(page.mainFrame());
|
expect(page.frames()[1].parentFrame()).toBe(page.mainFrame());
|
||||||
expect(page.frames()[2].parentFrame()).toBe(page.mainFrame());
|
expect(page.frames()[2].parentFrame()).toBe(page.mainFrame());
|
||||||
});
|
});
|
||||||
it('should report different frame instance when frame re-attaches', async({page, server}) => {
|
it_fails_ffox('should report different frame instance when frame re-attaches', async({page, server}) => {
|
||||||
const frame1 = await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
const frame1 = await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.frame = document.querySelector('#frame1');
|
window.frame = document.querySelector('#frame1');
|
||||||
|
@ -18,7 +18,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('ignoreHTTPSErrors', function() {
|
describe_fails_ffox('ignoreHTTPSErrors', function() {
|
||||||
beforeAll(async state => {
|
beforeAll(async state => {
|
||||||
const options = Object.assign({ignoreHTTPSErrors: true}, defaultBrowserOptions);
|
const options = Object.assign({ignoreHTTPSErrors: true}, defaultBrowserOptions);
|
||||||
state.browser = await puppeteer.launch(options);
|
state.browser = await puppeteer.launch(options);
|
||||||
|
@ -22,7 +22,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('input', function() {
|
describe_fails_ffox('input', function() {
|
||||||
it('should upload the file', async({page, server}) => {
|
it('should upload the file', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/fileupload.html');
|
await page.goto(server.PREFIX + '/input/fileupload.html');
|
||||||
const filePath = path.relative(process.cwd(), FILE_TO_UPLOAD);
|
const filePath = path.relative(process.cwd(), FILE_TO_UPLOAD);
|
||||||
|
@ -139,14 +139,14 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
const element = aHandle.asElement();
|
const element = aHandle.asElement();
|
||||||
expect(element).toBeFalsy();
|
expect(element).toBeFalsy();
|
||||||
});
|
});
|
||||||
it('should return ElementHandle for TextNodes', async({page, server}) => {
|
it_fails_ffox('should return ElementHandle for TextNodes', async({page, server}) => {
|
||||||
await page.setContent('<div>ee!</div>');
|
await page.setContent('<div>ee!</div>');
|
||||||
const aHandle = await page.evaluateHandle(() => document.querySelector('div').firstChild);
|
const aHandle = await page.evaluateHandle(() => document.querySelector('div').firstChild);
|
||||||
const element = aHandle.asElement();
|
const element = aHandle.asElement();
|
||||||
expect(element).toBeTruthy();
|
expect(element).toBeTruthy();
|
||||||
expect(await page.evaluate(e => e.nodeType === HTMLElement.TEXT_NODE, element));
|
expect(await page.evaluate(e => e.nodeType === HTMLElement.TEXT_NODE, element));
|
||||||
});
|
});
|
||||||
it('should work with nullified Node', async({page, server}) => {
|
it_fails_ffox('should work with nullified Node', async({page, server}) => {
|
||||||
await page.setContent('<section>test</section>');
|
await page.setContent('<section>test</section>');
|
||||||
await page.evaluate(() => delete Node);
|
await page.evaluate(() => delete Node);
|
||||||
const handle = await page.evaluateHandle(() => document.querySelector('section'));
|
const handle = await page.evaluateHandle(() => document.querySelector('section'));
|
||||||
|
@ -33,7 +33,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await page.keyboard.type(text);
|
await page.keyboard.type(text);
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe(text);
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe(text);
|
||||||
});
|
});
|
||||||
it('should press the metaKey', async({page}) => {
|
it_fails_ffox('should press the metaKey', async({page}) => {
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.keyPromise = new Promise(resolve => document.addEventListener('keydown', event => resolve(event.key)));
|
window.keyPromise = new Promise(resolve => document.addEventListener('keydown', event => resolve(event.key)));
|
||||||
});
|
});
|
||||||
@ -72,7 +72,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await textarea.press('a', {text: 'ё'});
|
await textarea.press('a', {text: 'ё'});
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('ё');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('ё');
|
||||||
});
|
});
|
||||||
it('should send a character with sendCharacter', async({page, server}) => {
|
it_fails_ffox('should send a character with sendCharacter', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.focus('textarea');
|
await page.focus('textarea');
|
||||||
await page.keyboard.sendCharacter('嗨');
|
await page.keyboard.sendCharacter('嗨');
|
||||||
@ -81,7 +81,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await page.keyboard.sendCharacter('a');
|
await page.keyboard.sendCharacter('a');
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('嗨a');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('嗨a');
|
||||||
});
|
});
|
||||||
it('should report shiftKey', async({page, server}) => {
|
it_fails_ffox('should report shiftKey', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/keyboard.html');
|
await page.goto(server.PREFIX + '/input/keyboard.html');
|
||||||
const keyboard = page.keyboard;
|
const keyboard = page.keyboard;
|
||||||
const codeForKey = {'Shift': 16, 'Alt': 18, 'Control': 17};
|
const codeForKey = {'Shift': 16, 'Alt': 18, 'Control': 17};
|
||||||
@ -158,7 +158,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await page.keyboard.type('Hello World!');
|
await page.keyboard.type('Hello World!');
|
||||||
expect(await page.evaluate(() => textarea.value)).toBe('He Wrd!');
|
expect(await page.evaluate(() => textarea.value)).toBe('He Wrd!');
|
||||||
});
|
});
|
||||||
it('should specify repeat property', async({page, server}) => {
|
it_fails_ffox('should specify repeat property', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.focus('textarea');
|
await page.focus('textarea');
|
||||||
await page.evaluate(() => document.querySelector('textarea').addEventListener('keydown', e => window.lastEvent = e, true));
|
await page.evaluate(() => document.querySelector('textarea').addEventListener('keydown', e => window.lastEvent = e, true));
|
||||||
@ -176,14 +176,14 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await page.keyboard.down('a');
|
await page.keyboard.down('a');
|
||||||
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
||||||
});
|
});
|
||||||
it('should type all kinds of characters', async({page, server}) => {
|
it_fails_ffox('should type all kinds of characters', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.focus('textarea');
|
await page.focus('textarea');
|
||||||
const text = 'This text goes onto two lines.\nThis character is 嗨.';
|
const text = 'This text goes onto two lines.\nThis character is 嗨.';
|
||||||
await page.keyboard.type(text);
|
await page.keyboard.type(text);
|
||||||
expect(await page.evaluate('result')).toBe(text);
|
expect(await page.evaluate('result')).toBe(text);
|
||||||
});
|
});
|
||||||
it('should specify location', async({page, server}) => {
|
it_fails_ffox('should specify location', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.addEventListener('keydown', event => window.keyLocation = event.location, true);
|
window.addEventListener('keydown', event => window.keyLocation = event.location, true);
|
||||||
@ -212,12 +212,12 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
error = await page.keyboard.press('😊').catch(e => e);
|
error = await page.keyboard.press('😊').catch(e => e);
|
||||||
expect(error && error.message).toBe('Unknown key: "😊"');
|
expect(error && error.message).toBe('Unknown key: "😊"');
|
||||||
});
|
});
|
||||||
it('should type emoji', async({page, server}) => {
|
it_fails_ffox('should type emoji', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.type('textarea', '👹 Tokyo street Japan 🇯🇵');
|
await page.type('textarea', '👹 Tokyo street Japan 🇯🇵');
|
||||||
expect(await page.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');
|
expect(await page.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');
|
||||||
});
|
});
|
||||||
it('should type emoji into an iframe', async({page, server}) => {
|
it_fails_ffox('should type emoji into an iframe', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await utils.attachFrame(page, 'emoji-test', server.PREFIX + '/input/textarea.html');
|
await utils.attachFrame(page, 'emoji-test', server.PREFIX + '/input/textarea.html');
|
||||||
const frame = page.frames()[1];
|
const frame = page.frames()[1];
|
||||||
@ -225,7 +225,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
await textarea.type('👹 Tokyo street Japan 🇯🇵');
|
await textarea.type('👹 Tokyo street Japan 🇯🇵');
|
||||||
expect(await frame.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');
|
expect(await frame.$eval('textarea', textarea => textarea.value)).toBe('👹 Tokyo street Japan 🇯🇵');
|
||||||
});
|
});
|
||||||
it('should press the meta key', async({page}) => {
|
it_fails_ffox('should press the meta key', async({page}) => {
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.result = null;
|
window.result = null;
|
||||||
document.addEventListener('keydown', event => {
|
document.addEventListener('keydown', event => {
|
||||||
|
@ -24,7 +24,7 @@ const statAsync = helper.promisify(fs.stat);
|
|||||||
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
|
||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, CHROME, FFOX, JUGGLER, puppeteerPath}) {
|
module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, puppeteer, CHROME, FFOX, puppeteerPath}) {
|
||||||
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
@ -192,6 +192,13 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
expect(puppeteer.defaultArgs()).toContain('--headless');
|
expect(puppeteer.defaultArgs()).toContain('--headless');
|
||||||
expect(puppeteer.defaultArgs({headless: false})).not.toContain('--headless');
|
expect(puppeteer.defaultArgs({headless: false})).not.toContain('--headless');
|
||||||
expect(puppeteer.defaultArgs({userDataDir: 'foo'})).toContain('--user-data-dir=foo');
|
expect(puppeteer.defaultArgs({userDataDir: 'foo'})).toContain('--user-data-dir=foo');
|
||||||
|
} else if (FFOX) {
|
||||||
|
expect(puppeteer.defaultArgs()).toContain('--headless');
|
||||||
|
expect(puppeteer.defaultArgs()).toContain('--no-remote');
|
||||||
|
expect(puppeteer.defaultArgs()).toContain('--foreground');
|
||||||
|
expect(puppeteer.defaultArgs({headless: false})).not.toContain('--headless');
|
||||||
|
expect(puppeteer.defaultArgs({userDataDir: 'foo'})).toContain('--profile');
|
||||||
|
expect(puppeteer.defaultArgs({userDataDir: 'foo'})).toContain('foo');
|
||||||
} else {
|
} else {
|
||||||
expect(puppeteer.defaultArgs()).toContain('-headless');
|
expect(puppeteer.defaultArgs()).toContain('-headless');
|
||||||
expect(puppeteer.defaultArgs({headless: false})).not.toContain('-headless');
|
expect(puppeteer.defaultArgs({headless: false})).not.toContain('-headless');
|
||||||
@ -202,10 +209,10 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
it('should report the correct product', async() => {
|
it('should report the correct product', async() => {
|
||||||
if (CHROME)
|
if (CHROME)
|
||||||
expect(puppeteer.product).toBe('chrome');
|
expect(puppeteer.product).toBe('chrome');
|
||||||
else if (FFOX && !JUGGLER)
|
else if (FFOX)
|
||||||
expect(puppeteer.product).toBe('firefox');
|
expect(puppeteer.product).toBe('firefox');
|
||||||
});
|
});
|
||||||
it('should work with no default arguments', async() => {
|
it_fails_ffox('should work with no default arguments', async() => {
|
||||||
const options = Object.assign({}, defaultBrowserOptions);
|
const options = Object.assign({}, defaultBrowserOptions);
|
||||||
options.ignoreDefaultArgs = true;
|
options.ignoreDefaultArgs = true;
|
||||||
const browser = await puppeteer.launch(options);
|
const browser = await puppeteer.launch(options);
|
||||||
@ -214,7 +221,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
await page.close();
|
await page.close();
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
it('should filter out ignored default arguments', async() => {
|
it_fails_ffox('should filter out ignored default arguments', async() => {
|
||||||
// Make sure we launch with `--enable-automation` by default.
|
// Make sure we launch with `--enable-automation` by default.
|
||||||
const defaultArgs = puppeteer.defaultArgs();
|
const defaultArgs = puppeteer.defaultArgs();
|
||||||
const browser = await puppeteer.launch(Object.assign({}, defaultBrowserOptions, {
|
const browser = await puppeteer.launch(Object.assign({}, defaultBrowserOptions, {
|
||||||
@ -227,7 +234,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
|
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
it_fails_ffox('should have default URL when launching browser', async function() {
|
it('should have default URL when launching browser', async function() {
|
||||||
const browser = await puppeteer.launch(defaultBrowserOptions);
|
const browser = await puppeteer.launch(defaultBrowserOptions);
|
||||||
const pages = (await browser.pages()).map(page => page.url());
|
const pages = (await browser.pages()).map(page => page.url());
|
||||||
expect(pages).toEqual(['about:blank']);
|
expect(pages).toEqual(['about:blank']);
|
||||||
@ -267,7 +274,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
expect(page.viewport()).toBe(null);
|
expect(page.viewport()).toBe(null);
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
it('should take fullPage screenshots when defaultViewport is null', async({server}) => {
|
it_fails_ffox('should take fullPage screenshots when defaultViewport is null', async({server}) => {
|
||||||
const options = Object.assign({}, defaultBrowserOptions, {
|
const options = Object.assign({}, defaultBrowserOptions, {
|
||||||
defaultViewport: null
|
defaultViewport: null
|
||||||
});
|
});
|
||||||
@ -305,7 +312,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
remoteBrowser.close(),
|
remoteBrowser.close(),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
it('should support ignoreHTTPSErrors option', async({httpsServer}) => {
|
it_fails_ffox('should support ignoreHTTPSErrors option', async({httpsServer}) => {
|
||||||
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
|
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
|
||||||
const browserWSEndpoint = originalBrowser.wsEndpoint();
|
const browserWSEndpoint = originalBrowser.wsEndpoint();
|
||||||
|
|
||||||
@ -324,7 +331,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
await page.close();
|
await page.close();
|
||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
it('should be able to reconnect to a disconnected browser', async({server}) => {
|
it_fails_ffox('should be able to reconnect to a disconnected browser', async({server}) => {
|
||||||
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
|
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
|
||||||
const browserWSEndpoint = originalBrowser.wsEndpoint();
|
const browserWSEndpoint = originalBrowser.wsEndpoint();
|
||||||
const page = await originalBrowser.newPage();
|
const page = await originalBrowser.newPage();
|
||||||
@ -345,7 +352,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
await browser.close();
|
await browser.close();
|
||||||
});
|
});
|
||||||
// @see https://github.com/puppeteer/puppeteer/issues/4197#issuecomment-481793410
|
// @see https://github.com/puppeteer/puppeteer/issues/4197#issuecomment-481793410
|
||||||
it('should be able to connect to the same page simultaneously', async({server}) => {
|
it_fails_ffox('should be able to connect to the same page simultaneously', async({server}) => {
|
||||||
const browserOne = await puppeteer.launch();
|
const browserOne = await puppeteer.launch();
|
||||||
const browserTwo = await puppeteer.connect({ browserWSEndpoint: browserOne.wsEndpoint() });
|
const browserTwo = await puppeteer.connect({ browserWSEndpoint: browserOne.wsEndpoint() });
|
||||||
const [page1, page2] = await Promise.all([
|
const [page1, page2] = await Promise.all([
|
||||||
@ -359,7 +366,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
|
|
||||||
});
|
});
|
||||||
describe('Puppeteer.executablePath', function() {
|
describe('Puppeteer.executablePath', function() {
|
||||||
it('should work', async({server}) => {
|
it_fails_ffox('should work', async({server}) => {
|
||||||
const executablePath = puppeteer.executablePath();
|
const executablePath = puppeteer.executablePath();
|
||||||
expect(fs.existsSync(executablePath)).toBe(true);
|
expect(fs.existsSync(executablePath)).toBe(true);
|
||||||
expect(fs.realpathSync(executablePath)).toBe(executablePath);
|
expect(fs.realpathSync(executablePath)).toBe(executablePath);
|
||||||
@ -379,7 +386,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Browser target events', function() {
|
describe('Browser target events', function() {
|
||||||
it('should work', async({server}) => {
|
it_fails_ffox('should work', async({server}) => {
|
||||||
const browser = await puppeteer.launch(defaultBrowserOptions);
|
const browser = await puppeteer.launch(defaultBrowserOptions);
|
||||||
const events = [];
|
const events = [];
|
||||||
browser.on('targetcreated', () => events.push('CREATED'));
|
browser.on('targetcreated', () => events.push('CREATED'));
|
||||||
|
@ -55,7 +55,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
expect(event.isTrusted).toBe(true);
|
expect(event.isTrusted).toBe(true);
|
||||||
expect(event.button).toBe(0);
|
expect(event.button).toBe(0);
|
||||||
});
|
});
|
||||||
it('should resize the textarea', async({page, server}) => {
|
it_fails_ffox('should resize the textarea', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
const {x, y, width, height} = await page.evaluate(dimensions);
|
const {x, y, width, height} = await page.evaluate(dimensions);
|
||||||
const mouse = page.mouse;
|
const mouse = page.mouse;
|
||||||
@ -67,7 +67,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
expect(newDimensions.width).toBe(Math.round(width + 104));
|
expect(newDimensions.width).toBe(Math.round(width + 104));
|
||||||
expect(newDimensions.height).toBe(Math.round(height + 104));
|
expect(newDimensions.height).toBe(Math.round(height + 104));
|
||||||
});
|
});
|
||||||
it('should select the text with mouse', async({page, server}) => {
|
it_fails_ffox('should select the text with mouse', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||||
await page.focus('textarea');
|
await page.focus('textarea');
|
||||||
const text = 'This is the text that we are going to try to select. Let\'s see how it goes.';
|
const text = 'This is the text that we are going to try to select. Let\'s see how it goes.';
|
||||||
@ -85,7 +85,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
|
return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);
|
||||||
})).toBe(text);
|
})).toBe(text);
|
||||||
});
|
});
|
||||||
it('should trigger hover state', async({page, server}) => {
|
it_fails_ffox('should trigger hover state', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||||
await page.hover('#button-6');
|
await page.hover('#button-6');
|
||||||
expect(await page.evaluate(() => document.querySelector('button:hover').id)).toBe('button-6');
|
expect(await page.evaluate(() => document.querySelector('button:hover').id)).toBe('button-6');
|
||||||
@ -120,7 +120,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
throw new Error(modifiers[modifier] + ' should be false');
|
throw new Error(modifiers[modifier] + ' should be false');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('should tween mouse movement', async({page, server}) => {
|
it_fails_ffox('should tween mouse movement', async({page, server}) => {
|
||||||
await page.mouse.move(100, 100);
|
await page.mouse.move(100, 100);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.result = [];
|
window.result = [];
|
||||||
@ -138,7 +138,7 @@ module.exports.addTests = function({testRunner, expect, FFOX}) {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
// @see https://crbug.com/929806
|
// @see https://crbug.com/929806
|
||||||
it('should work with mobile viewports and cross process navigations', async({page, server}) => {
|
it_fails_ffox('should work with mobile viewports and cross process navigations', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setViewport({width: 360, height: 640, isMobile: true});
|
await page.setViewport({width: 360, height: 640, isMobile: true});
|
||||||
await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');
|
await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||||
});
|
});
|
||||||
it('should work with anchor navigation', async({page, server}) => {
|
it_fails_ffox('should work with anchor navigation', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||||
await page.goto(server.EMPTY_PAGE + '#foo');
|
await page.goto(server.EMPTY_PAGE + '#foo');
|
||||||
@ -44,7 +44,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
const response = await page.goto('about:blank');
|
const response = await page.goto('about:blank');
|
||||||
expect(response).toBe(null);
|
expect(response).toBe(null);
|
||||||
});
|
});
|
||||||
it('should return response when page changes its URL after load', async({page, server}) => {
|
it_fails_ffox('should return response when page changes its URL after load', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/historyapi.html');
|
const response = await page.goto(server.PREFIX + '/historyapi.html');
|
||||||
expect(response.status()).toBe(200);
|
expect(response.status()).toBe(200);
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
});
|
});
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
});
|
});
|
||||||
it('should fail when server returns 204', async({page, server}) => {
|
it_fails_ffox('should fail when server returns 204', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.statusCode = 204;
|
res.statusCode = 204;
|
||||||
res.end();
|
res.end();
|
||||||
@ -68,11 +68,11 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
else
|
else
|
||||||
expect(error.message).toContain('NS_BINDING_ABORTED');
|
expect(error.message).toContain('NS_BINDING_ABORTED');
|
||||||
});
|
});
|
||||||
it('should navigate to empty page with domcontentloaded', async({page, server}) => {
|
it_fails_ffox('should navigate to empty page with domcontentloaded', async({page, server}) => {
|
||||||
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'domcontentloaded'});
|
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'domcontentloaded'});
|
||||||
expect(response.status()).toBe(200);
|
expect(response.status()).toBe(200);
|
||||||
});
|
});
|
||||||
it('should work when page calls history API in beforeunload', async({page, server}) => {
|
it_fails_ffox('should work when page calls history API in beforeunload', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.addEventListener('beforeunload', () => history.replaceState(null, 'initial', window.location.href), false);
|
window.addEventListener('beforeunload', () => history.replaceState(null, 'initial', window.location.href), false);
|
||||||
@ -88,7 +88,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle2'});
|
const response = await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle2'});
|
||||||
expect(response.status()).toBe(200);
|
expect(response.status()).toBe(200);
|
||||||
});
|
});
|
||||||
it('should fail when navigating to bad url', async({page, server}) => {
|
it_fails_ffox('should fail when navigating to bad url', async({page, server}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.goto('asdfasdf').catch(e => error = e);
|
await page.goto('asdfasdf').catch(e => error = e);
|
||||||
if (CHROME)
|
if (CHROME)
|
||||||
@ -96,7 +96,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
else
|
else
|
||||||
expect(error.message).toContain('Invalid url');
|
expect(error.message).toContain('Invalid url');
|
||||||
});
|
});
|
||||||
it('should fail when navigating to bad SSL', async({page, httpsServer}) => {
|
it_fails_ffox('should fail when navigating to bad SSL', async({page, httpsServer}) => {
|
||||||
// Make sure that network events do not emit 'undefined'.
|
// Make sure that network events do not emit 'undefined'.
|
||||||
// @see https://crbug.com/750469
|
// @see https://crbug.com/750469
|
||||||
page.on('request', request => expect(request).toBeTruthy());
|
page.on('request', request => expect(request).toBeTruthy());
|
||||||
@ -109,7 +109,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
else
|
else
|
||||||
expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||||
});
|
});
|
||||||
it('should fail when navigating to bad SSL after redirects', async({page, server, httpsServer}) => {
|
it_fails_ffox('should fail when navigating to bad SSL after redirects', async({page, server, httpsServer}) => {
|
||||||
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
||||||
server.setRedirect('/redirect/2.html', '/empty.html');
|
server.setRedirect('/redirect/2.html', '/empty.html');
|
||||||
let error = null;
|
let error = null;
|
||||||
@ -119,12 +119,12 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
else
|
else
|
||||||
expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should throw if networkidle is passed as an option', async({page, server}) => {
|
it('should throw if networkidle is passed as an option', async({page, server}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle'}).catch(err => error = err);
|
await page.goto(server.EMPTY_PAGE, {waitUntil: 'networkidle'}).catch(err => error = err);
|
||||||
expect(error.message).toContain('"networkidle" option is no longer supported');
|
expect(error.message).toContain('"networkidle" option is no longer supported');
|
||||||
});
|
});
|
||||||
it('should fail when main resources failed to load', async({page, server}) => {
|
it_fails_ffox('should fail when main resources failed to load', async({page, server}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.goto('http://localhost:44123/non-existing-url').catch(e => error = e);
|
await page.goto('http://localhost:44123/non-existing-url').catch(e => error = e);
|
||||||
if (CHROME)
|
if (CHROME)
|
||||||
@ -176,7 +176,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
expect(error).toBe(null);
|
expect(error).toBe(null);
|
||||||
expect(loaded).toBe(true);
|
expect(loaded).toBe(true);
|
||||||
});
|
});
|
||||||
it('should work when navigating to valid url', async({page, server}) => {
|
it_fails_ffox('should work when navigating to valid url', async({page, server}) => {
|
||||||
const response = await page.goto(server.EMPTY_PAGE);
|
const response = await page.goto(server.EMPTY_PAGE);
|
||||||
expect(response.ok()).toBe(true);
|
expect(response.ok()).toBe(true);
|
||||||
});
|
});
|
||||||
@ -184,12 +184,12 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
const response = await page.goto('data:text/html,hello');
|
const response = await page.goto('data:text/html,hello');
|
||||||
expect(response.ok()).toBe(true);
|
expect(response.ok()).toBe(true);
|
||||||
});
|
});
|
||||||
it('should work when navigating to 404', async({page, server}) => {
|
it_fails_ffox('should work when navigating to 404', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/not-found');
|
const response = await page.goto(server.PREFIX + '/not-found');
|
||||||
expect(response.ok()).toBe(false);
|
expect(response.ok()).toBe(false);
|
||||||
expect(response.status()).toBe(404);
|
expect(response.status()).toBe(404);
|
||||||
});
|
});
|
||||||
it('should return last response in redirect chain', async({page, server}) => {
|
it_fails_ffox('should return last response in redirect chain', async({page, server}) => {
|
||||||
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
||||||
server.setRedirect('/redirect/2.html', '/redirect/3.html');
|
server.setRedirect('/redirect/2.html', '/redirect/3.html');
|
||||||
server.setRedirect('/redirect/3.html', server.EMPTY_PAGE);
|
server.setRedirect('/redirect/3.html', server.EMPTY_PAGE);
|
||||||
@ -263,7 +263,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
process.removeListener('warning', warningHandler);
|
process.removeListener('warning', warningHandler);
|
||||||
expect(warning).toBe(null);
|
expect(warning).toBe(null);
|
||||||
});
|
});
|
||||||
it('should not leak listeners during bad navigation', async({page, server}) => {
|
it_fails_ffox('should not leak listeners during bad navigation', async({page, server}) => {
|
||||||
let warning = null;
|
let warning = null;
|
||||||
const warningHandler = w => warning = w;
|
const warningHandler = w => warning = w;
|
||||||
process.on('warning', warningHandler);
|
process.on('warning', warningHandler);
|
||||||
@ -302,12 +302,12 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
expect(requests.length).toBe(1);
|
expect(requests.length).toBe(1);
|
||||||
expect(requests[0].url()).toBe(server.EMPTY_PAGE);
|
expect(requests[0].url()).toBe(server.EMPTY_PAGE);
|
||||||
});
|
});
|
||||||
it('should work with self requesting page', async({page, server}) => {
|
it_fails_ffox('should work with self requesting page', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/self-request.html');
|
const response = await page.goto(server.PREFIX + '/self-request.html');
|
||||||
expect(response.status()).toBe(200);
|
expect(response.status()).toBe(200);
|
||||||
expect(response.url()).toContain('self-request.html');
|
expect(response.url()).toContain('self-request.html');
|
||||||
});
|
});
|
||||||
it('should fail when navigating and show the url at the error message', async function({page, server, httpsServer}) {
|
it_fails_ffox('should fail when navigating and show the url at the error message', async function({page, server, httpsServer}) {
|
||||||
const url = httpsServer.PREFIX + '/redirect/1.html';
|
const url = httpsServer.PREFIX + '/redirect/1.html';
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
@ -317,7 +317,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
}
|
}
|
||||||
expect(error.message).toContain(url);
|
expect(error.message).toContain(url);
|
||||||
});
|
});
|
||||||
it('should send referer', async({page, server}) => {
|
it_fails_ffox('should send referer', async({page, server}) => {
|
||||||
const [request1, request2] = await Promise.all([
|
const [request1, request2] = await Promise.all([
|
||||||
server.waitForRequest('/grid.html'),
|
server.waitForRequest('/grid.html'),
|
||||||
server.waitForRequest('/digits/1.png'),
|
server.waitForRequest('/digits/1.png'),
|
||||||
@ -332,7 +332,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.waitForNavigation', function() {
|
describe('Page.waitForNavigation', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const [response] = await Promise.all([
|
const [response] = await Promise.all([
|
||||||
page.waitForNavigation(),
|
page.waitForNavigation(),
|
||||||
@ -361,7 +361,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
await bothFiredPromise;
|
await bothFiredPromise;
|
||||||
await navigationPromise;
|
await navigationPromise;
|
||||||
});
|
});
|
||||||
it('should work with clicking on anchor links', async({page, server}) => {
|
it_fails_ffox('should work with clicking on anchor links', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setContent(`<a href='#foobar'>foobar</a>`);
|
await page.setContent(`<a href='#foobar'>foobar</a>`);
|
||||||
const [response] = await Promise.all([
|
const [response] = await Promise.all([
|
||||||
@ -371,7 +371,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
expect(response).toBe(null);
|
expect(response).toBe(null);
|
||||||
expect(page.url()).toBe(server.EMPTY_PAGE + '#foobar');
|
expect(page.url()).toBe(server.EMPTY_PAGE + '#foobar');
|
||||||
});
|
});
|
||||||
it('should work with history.pushState()', async({page, server}) => {
|
it_fails_ffox('should work with history.pushState()', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
<a onclick='javascript:pushState()'>SPA</a>
|
<a onclick='javascript:pushState()'>SPA</a>
|
||||||
@ -386,7 +386,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
expect(response).toBe(null);
|
expect(response).toBe(null);
|
||||||
expect(page.url()).toBe(server.PREFIX + '/wow.html');
|
expect(page.url()).toBe(server.PREFIX + '/wow.html');
|
||||||
});
|
});
|
||||||
it('should work with history.replaceState()', async({page, server}) => {
|
it_fails_ffox('should work with history.replaceState()', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
<a onclick='javascript:replaceState()'>SPA</a>
|
<a onclick='javascript:replaceState()'>SPA</a>
|
||||||
@ -427,7 +427,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
expect(forwardResponse).toBe(null);
|
expect(forwardResponse).toBe(null);
|
||||||
expect(page.url()).toBe(server.PREFIX + '/second.html');
|
expect(page.url()).toBe(server.PREFIX + '/second.html');
|
||||||
});
|
});
|
||||||
it('should work when subframe issues window.stop()', async({page, server}) => {
|
it_fails_ffox('should work when subframe issues window.stop()', async({page, server}) => {
|
||||||
server.setRoute('/frames/style.css', (req, res) => {});
|
server.setRoute('/frames/style.css', (req, res) => {});
|
||||||
const navigationPromise = page.goto(server.PREFIX + '/frames/one-frame.html');
|
const navigationPromise = page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
const frame = await utils.waitEvent(page, 'frameattached');
|
const frame = await utils.waitEvent(page, 'frameattached');
|
||||||
@ -444,7 +444,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.goBack', function() {
|
describe_fails_ffox('Page.goBack', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
@ -477,7 +477,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame.goto', function() {
|
describe_fails_ffox('Frame.goto', function() {
|
||||||
it('should navigate subframes', async({page, server}) => {
|
it('should navigate subframes', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
expect(page.frames()[0].url()).toContain('/frames/one-frame.html');
|
expect(page.frames()[0].url()).toContain('/frames/one-frame.html');
|
||||||
@ -527,7 +527,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame.waitForNavigation', function() {
|
describe_fails_ffox('Frame.waitForNavigation', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
await page.goto(server.PREFIX + '/frames/one-frame.html');
|
||||||
const frame = page.frames()[1];
|
const frame = page.frames()[1];
|
||||||
|
@ -30,7 +30,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(requests.length).toBe(1);
|
expect(requests.length).toBe(1);
|
||||||
});
|
});
|
||||||
it('should fire for iframes', async({page, server}) => {
|
it_fails_ffox('should fire for iframes', async({page, server}) => {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
page.on('request', request => !utils.isFavicon(request) && requests.push(request));
|
page.on('request', request => !utils.isFavicon(request) && requests.push(request));
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -54,7 +54,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(requests.length).toBe(1);
|
expect(requests.length).toBe(1);
|
||||||
expect(requests[0].frame()).toBe(page.mainFrame());
|
expect(requests[0].frame()).toBe(page.mainFrame());
|
||||||
});
|
});
|
||||||
it('should work for subframe navigation request', async({page, server}) => {
|
it_fails_ffox('should work for subframe navigation request', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const requests = [];
|
const requests = [];
|
||||||
page.on('request', request => !utils.isFavicon(request) && requests.push(request));
|
page.on('request', request => !utils.isFavicon(request) && requests.push(request));
|
||||||
@ -73,7 +73,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Request.headers', function() {
|
describe_fails_ffox('Request.headers', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
const response = await page.goto(server.EMPTY_PAGE);
|
const response = await page.goto(server.EMPTY_PAGE);
|
||||||
if (CHROME)
|
if (CHROME)
|
||||||
@ -83,7 +83,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Response.headers', function() {
|
describe_fails_ffox('Response.headers', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.setHeader('foo', 'bar');
|
res.setHeader('foo', 'bar');
|
||||||
@ -139,7 +139,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Request.postData', function() {
|
describe_fails_ffox('Request.postData', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
server.setRoute('/post', (req, res) => res.end());
|
server.setRoute('/post', (req, res) => res.end());
|
||||||
@ -155,7 +155,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Response.text', function() {
|
describe_fails_ffox('Response.text', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/simple.json');
|
const response = await page.goto(server.PREFIX + '/simple.json');
|
||||||
expect(await response.text()).toBe('{"foo": "bar"}\n');
|
expect(await response.text()).toBe('{"foo": "bar"}\n');
|
||||||
@ -212,14 +212,14 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Response.json', function() {
|
describe_fails_ffox('Response.json', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/simple.json');
|
const response = await page.goto(server.PREFIX + '/simple.json');
|
||||||
expect(await response.json()).toEqual({foo: 'bar'});
|
expect(await response.json()).toEqual({foo: 'bar'});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Response.buffer', function() {
|
describe_fails_ffox('Response.buffer', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
const response = await page.goto(server.PREFIX + '/pptr.png');
|
const response = await page.goto(server.PREFIX + '/pptr.png');
|
||||||
const imageBuffer = fs.readFileSync(path.join(__dirname, 'assets', 'pptr.png'));
|
const imageBuffer = fs.readFileSync(path.join(__dirname, 'assets', 'pptr.png'));
|
||||||
@ -235,7 +235,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Response.statusText', function() {
|
describe_fails_ffox('Response.statusText', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
server.setRoute('/cool', (req, res) => {
|
server.setRoute('/cool', (req, res) => {
|
||||||
res.writeHead(200, 'cool!');
|
res.writeHead(200, 'cool!');
|
||||||
@ -246,7 +246,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Network Events', function() {
|
describe_fails_ffox('Network Events', function() {
|
||||||
it('Page.Events.Request', async({page, server}) => {
|
it('Page.Events.Request', async({page, server}) => {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
page.on('request', request => requests.push(request));
|
page.on('request', request => requests.push(request));
|
||||||
@ -340,7 +340,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Request.isNavigationRequest', () => {
|
describe('Request.isNavigationRequest', () => {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
const requests = new Map();
|
const requests = new Map();
|
||||||
page.on('request', request => requests.set(request.url().split('/').pop(), request));
|
page.on('request', request => requests.set(request.url().split('/').pop(), request));
|
||||||
server.setRedirect('/rrredirect', '/frames/one-frame.html');
|
server.setRedirect('/rrredirect', '/frames/one-frame.html');
|
||||||
@ -351,7 +351,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(requests.get('script.js').isNavigationRequest()).toBe(false);
|
expect(requests.get('script.js').isNavigationRequest()).toBe(false);
|
||||||
expect(requests.get('style.css').isNavigationRequest()).toBe(false);
|
expect(requests.get('style.css').isNavigationRequest()).toBe(false);
|
||||||
});
|
});
|
||||||
it('should work with request interception', async({page, server}) => {
|
it_fails_ffox('should work with request interception', async({page, server}) => {
|
||||||
const requests = new Map();
|
const requests = new Map();
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
requests.set(request.url().split('/').pop(), request);
|
requests.set(request.url().split('/').pop(), request);
|
||||||
@ -374,7 +374,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setExtraHTTPHeaders', function() {
|
describe_fails_ffox('Page.setExtraHTTPHeaders', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setExtraHTTPHeaders({
|
await page.setExtraHTTPHeaders({
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
|
@ -39,7 +39,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await newPage.close();
|
await newPage.close();
|
||||||
expect(await browser.pages()).not.toContain(newPage);
|
expect(await browser.pages()).not.toContain(newPage);
|
||||||
});
|
});
|
||||||
it('should run beforeunload if asked for', async({context, server}) => {
|
it_fails_ffox('should run beforeunload if asked for', async({context, server}) => {
|
||||||
const newPage = await context.newPage();
|
const newPage = await context.newPage();
|
||||||
await newPage.goto(server.PREFIX + '/beforeunload.html');
|
await newPage.goto(server.PREFIX + '/beforeunload.html');
|
||||||
// We have to interact with a page so that 'beforeunload' handlers
|
// We have to interact with a page so that 'beforeunload' handlers
|
||||||
@ -56,7 +56,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await dialog.accept();
|
await dialog.accept();
|
||||||
await pageClosingPromise;
|
await pageClosingPromise;
|
||||||
});
|
});
|
||||||
it('should *not* run beforeunload by default', async({context, server}) => {
|
it_fails_ffox('should *not* run beforeunload by default', async({context, server}) => {
|
||||||
const newPage = await context.newPage();
|
const newPage = await context.newPage();
|
||||||
await newPage.goto(server.PREFIX + '/beforeunload.html');
|
await newPage.goto(server.PREFIX + '/beforeunload.html');
|
||||||
// We have to interact with a page so that 'beforeunload' handlers
|
// We have to interact with a page so that 'beforeunload' handlers
|
||||||
@ -94,7 +94,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Async stacks', () => {
|
describe_fails_ffox('Async stacks', () => {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
res.statusCode = 204;
|
res.statusCode = 204;
|
||||||
@ -117,7 +117,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.Events.Popup', function() {
|
describe_fails_ffox('Page.Events.Popup', function() {
|
||||||
it('should work', async({page}) => {
|
it('should work', async({page}) => {
|
||||||
const [popup] = await Promise.all([
|
const [popup] = await Promise.all([
|
||||||
new Promise(x => page.once('popup', x)),
|
new Promise(x => page.once('popup', x)),
|
||||||
@ -175,7 +175,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('prompt');
|
expect(await getPermission(page, 'geolocation')).toBe('prompt');
|
||||||
});
|
});
|
||||||
it('should deny permission when not listed', async({page, server, context}) => {
|
it_fails_ffox('should deny permission when not listed', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await context.overridePermissions(server.EMPTY_PAGE, []);
|
await context.overridePermissions(server.EMPTY_PAGE, []);
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('denied');
|
expect(await getPermission(page, 'geolocation')).toBe('denied');
|
||||||
@ -186,19 +186,19 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await context.overridePermissions(server.EMPTY_PAGE, ['foo']).catch(e => error = e);
|
await context.overridePermissions(server.EMPTY_PAGE, ['foo']).catch(e => error = e);
|
||||||
expect(error.message).toBe('Unknown permission: foo');
|
expect(error.message).toBe('Unknown permission: foo');
|
||||||
});
|
});
|
||||||
it('should grant permission when listed', async({page, server, context}) => {
|
it_fails_ffox('should grant permission when listed', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await context.overridePermissions(server.EMPTY_PAGE, ['geolocation']);
|
await context.overridePermissions(server.EMPTY_PAGE, ['geolocation']);
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
||||||
});
|
});
|
||||||
it('should reset permissions', async({page, server, context}) => {
|
it_fails_ffox('should reset permissions', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await context.overridePermissions(server.EMPTY_PAGE, ['geolocation']);
|
await context.overridePermissions(server.EMPTY_PAGE, ['geolocation']);
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
expect(await getPermission(page, 'geolocation')).toBe('granted');
|
||||||
await context.clearPermissionOverrides();
|
await context.clearPermissionOverrides();
|
||||||
expect(await getPermission(page, 'geolocation')).toBe('prompt');
|
expect(await getPermission(page, 'geolocation')).toBe('prompt');
|
||||||
});
|
});
|
||||||
it('should trigger permission onchange', async({page, server, context}) => {
|
it_fails_ffox('should trigger permission onchange', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => {
|
await page.evaluate(() => {
|
||||||
window.events = [];
|
window.events = [];
|
||||||
@ -217,7 +217,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await context.clearPermissionOverrides();
|
await context.clearPermissionOverrides();
|
||||||
expect(await page.evaluate(() => window.events)).toEqual(['prompt', 'denied', 'granted', 'prompt']);
|
expect(await page.evaluate(() => window.events)).toEqual(['prompt', 'denied', 'granted', 'prompt']);
|
||||||
});
|
});
|
||||||
it('should isolate permissions between browser contexts', async({page, server, context, browser}) => {
|
it_fails_ffox('should isolate permissions between browser contexs', async({page, server, context, browser}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const otherContext = await browser.createIncognitoBrowserContext();
|
const otherContext = await browser.createIncognitoBrowserContext();
|
||||||
const otherPage = await otherContext.newPage();
|
const otherPage = await otherContext.newPage();
|
||||||
@ -238,8 +238,8 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe_fails_ffox('Page.setGeolocation', function() {
|
describe('Page.setGeolocation', function() {
|
||||||
it('should work', async({page, server, context}) => {
|
it_fails_ffox('should work', async({page, server, context}) => {
|
||||||
await context.overridePermissions(server.PREFIX, ['geolocation']);
|
await context.overridePermissions(server.PREFIX, ['geolocation']);
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setGeolocation({longitude: 10, latitude: 10});
|
await page.setGeolocation({longitude: 10, latitude: 10});
|
||||||
@ -281,8 +281,8 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe_fails_ffox('ExecutionContext.queryObjects', function() {
|
describe('ExecutionContext.queryObjects', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
// Instantiate an object
|
// Instantiate an object
|
||||||
await page.evaluate(() => window.set = new Set(['hello', 'world']));
|
await page.evaluate(() => window.set = new Set(['hello', 'world']));
|
||||||
const prototypeHandle = await page.evaluateHandle(() => Set.prototype);
|
const prototypeHandle = await page.evaluateHandle(() => Set.prototype);
|
||||||
@ -292,7 +292,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
const values = await page.evaluate(objects => Array.from(objects[0].values()), objectsHandle);
|
const values = await page.evaluate(objects => Array.from(objects[0].values()), objectsHandle);
|
||||||
expect(values).toEqual(['hello', 'world']);
|
expect(values).toEqual(['hello', 'world']);
|
||||||
});
|
});
|
||||||
it('should work for non-blank page', async({page, server}) => {
|
it_fails_ffox('should work for non-blank page', async({page, server}) => {
|
||||||
// Instantiate an object
|
// Instantiate an object
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => window.set = new Set(['hello', 'world']));
|
await page.evaluate(() => window.set = new Set(['hello', 'world']));
|
||||||
@ -316,7 +316,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.Events.Console', function() {
|
describe_fails_ffox('Page.Events.Console', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
let message = null;
|
let message = null;
|
||||||
page.once('console', m => message = m);
|
page.once('console', m => message = m);
|
||||||
@ -377,7 +377,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
else
|
else
|
||||||
expect(message.type()).toEqual('warn');
|
expect(message.type()).toEqual('warn');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should have location when fetch fails', async({page, server}) => {
|
it('should have location when fetch fails', async({page, server}) => {
|
||||||
// The point of this test is to make sure that we report console messages from
|
// The point of this test is to make sure that we report console messages from
|
||||||
// Log domain: https://vanilla.aslushnikov.com/?Log.entryAdded
|
// Log domain: https://vanilla.aslushnikov.com/?Log.entryAdded
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -407,7 +407,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
// @see https://github.com/puppeteer/puppeteer/issues/3865
|
// @see https://github.com/puppeteer/puppeteer/issues/3865
|
||||||
it_fails_ffox('should not throw when there are console messages in detached iframes', async({browser, page, server}) => {
|
it('should not throw when there are console messages in detached iframes', async({browser, page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(async() => {
|
await page.evaluate(async() => {
|
||||||
// 1. Create a popup that Puppeteer is not connected to.
|
// 1. Create a popup that Puppeteer is not connected to.
|
||||||
@ -522,7 +522,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.waitForResponse', function() {
|
describe('Page.waitForResponse', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const [response] = await Promise.all([
|
const [response] = await Promise.all([
|
||||||
page.waitForResponse(server.PREFIX + '/digits/2.png'),
|
page.waitForResponse(server.PREFIX + '/digits/2.png'),
|
||||||
@ -545,7 +545,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await page.waitForResponse(() => false).catch(e => error = e);
|
await page.waitForResponse(() => false).catch(e => error = e);
|
||||||
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
||||||
});
|
});
|
||||||
it('should work with predicate', async({page, server}) => {
|
it_fails_ffox('should work with predicate', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const [response] = await Promise.all([
|
const [response] = await Promise.all([
|
||||||
page.waitForResponse(response => response.url() === server.PREFIX + '/digits/2.png'),
|
page.waitForResponse(response => response.url() === server.PREFIX + '/digits/2.png'),
|
||||||
@ -557,7 +557,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
]);
|
]);
|
||||||
expect(response.url()).toBe(server.PREFIX + '/digits/2.png');
|
expect(response.url()).toBe(server.PREFIX + '/digits/2.png');
|
||||||
});
|
});
|
||||||
it('should work with no timeout', async({page, server}) => {
|
it_fails_ffox('should work with no timeout', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const [response] = await Promise.all([
|
const [response] = await Promise.all([
|
||||||
page.waitForResponse(server.PREFIX + '/digits/2.png', {timeout: 0}),
|
page.waitForResponse(server.PREFIX + '/digits/2.png', {timeout: 0}),
|
||||||
@ -571,7 +571,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.exposeFunction', function() {
|
describe_fails_ffox('Page.exposeFunction', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.exposeFunction('compute', function(a, b) {
|
await page.exposeFunction('compute', function(a, b) {
|
||||||
return a * b;
|
return a * b;
|
||||||
@ -671,7 +671,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.Events.PageError', function() {
|
describe_fails_ffox('Page.Events.PageError', function() {
|
||||||
it('should fire', async({page, server}) => {
|
it('should fire', async({page, server}) => {
|
||||||
let error = null;
|
let error = null;
|
||||||
page.once('pageerror', e => error = e);
|
page.once('pageerror', e => error = e);
|
||||||
@ -693,7 +693,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
]);
|
]);
|
||||||
expect(request.headers['user-agent']).toBe('foobar');
|
expect(request.headers['user-agent']).toBe('foobar');
|
||||||
});
|
});
|
||||||
it('should work for subframes', async({page, server}) => {
|
it_fails_ffox('should work for subframes', async({page, server}) => {
|
||||||
expect(await page.evaluate(() => navigator.userAgent)).toContain('Mozilla');
|
expect(await page.evaluate(() => navigator.userAgent)).toContain('Mozilla');
|
||||||
await page.setUserAgent('foobar');
|
await page.setUserAgent('foobar');
|
||||||
const [request] = await Promise.all([
|
const [request] = await Promise.all([
|
||||||
@ -710,7 +710,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setContent', function() {
|
describe_fails_ffox('Page.setContent', function() {
|
||||||
const expectedOutput = '<html><head></head><body><div>hello</div></body></html>';
|
const expectedOutput = '<html><head></head><body><div>hello</div></body></html>';
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setContent('<div>hello</div>');
|
await page.setContent('<div>hello</div>');
|
||||||
@ -730,7 +730,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
const result = await page.content();
|
const result = await page.content();
|
||||||
expect(result).toBe(`${doctype}${expectedOutput}`);
|
expect(result).toBe(`${doctype}${expectedOutput}`);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should respect timeout', async({page, server}) => {
|
it('should respect timeout', async({page, server}) => {
|
||||||
const imgPath = '/img.png';
|
const imgPath = '/img.png';
|
||||||
// stall for image
|
// stall for image
|
||||||
server.setRoute(imgPath, (req, res) => {});
|
server.setRoute(imgPath, (req, res) => {});
|
||||||
@ -738,7 +738,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`, {timeout: 1}).catch(e => error = e);
|
await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`, {timeout: 1}).catch(e => error = e);
|
||||||
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should respect default navigation timeout', async({page, server}) => {
|
it('should respect default navigation timeout', async({page, server}) => {
|
||||||
page.setDefaultNavigationTimeout(1);
|
page.setDefaultNavigationTimeout(1);
|
||||||
const imgPath = '/img.png';
|
const imgPath = '/img.png';
|
||||||
// stall for image
|
// stall for image
|
||||||
@ -747,7 +747,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).catch(e => error = e);
|
await page.setContent(`<img src="${server.PREFIX + imgPath}"></img>`).catch(e => error = e);
|
||||||
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
expect(error).toBeInstanceOf(puppeteer.errors.TimeoutError);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should await resources to load', async({page, server}) => {
|
it('should await resources to load', async({page, server}) => {
|
||||||
const imgPath = '/img.png';
|
const imgPath = '/img.png';
|
||||||
let imgResponse = null;
|
let imgResponse = null;
|
||||||
server.setRoute(imgPath, (req, res) => imgResponse = res);
|
server.setRoute(imgPath, (req, res) => imgResponse = res);
|
||||||
@ -969,7 +969,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
expect(styleContent).toContain(path.join('assets', 'injectedstyle.css'));
|
expect(styleContent).toContain(path.join('assets', 'injectedstyle.css'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should work with content', async({page, server}) => {
|
it_fails_ffox('should work with content', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const styleHandle = await page.addStyleTag({ content: 'body { background-color: green; }' });
|
const styleHandle = await page.addStyleTag({ content: 'body { background-color: green; }' });
|
||||||
expect(styleHandle.asElement()).not.toBeNull();
|
expect(styleHandle.asElement()).not.toBeNull();
|
||||||
@ -999,7 +999,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.setJavaScriptEnabled', function() {
|
describe_fails_ffox('Page.setJavaScriptEnabled', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setJavaScriptEnabled(false);
|
await page.setJavaScriptEnabled(false);
|
||||||
await page.goto('data:text/html, <script>var something = "forbidden"</script>');
|
await page.goto('data:text/html, <script>var something = "forbidden"</script>');
|
||||||
@ -1030,7 +1030,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
]);
|
]);
|
||||||
expect(nonCachedRequest.headers['if-modified-since']).toBe(undefined);
|
expect(nonCachedRequest.headers['if-modified-since']).toBe(undefined);
|
||||||
});
|
});
|
||||||
it('should stay disabled when toggling request interception on/off', async({page, server}) => {
|
it_fails_ffox('should stay disabled when toggling request interception on/off', async({page, server}) => {
|
||||||
await page.setCacheEnabled(false);
|
await page.setCacheEnabled(false);
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
await page.setRequestInterception(false);
|
await page.setRequestInterception(false);
|
||||||
@ -1074,7 +1074,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
expect(await page.evaluate(() => result.onInput)).toEqual(['blue']);
|
expect(await page.evaluate(() => result.onInput)).toEqual(['blue']);
|
||||||
expect(await page.evaluate(() => result.onChange)).toEqual(['blue']);
|
expect(await page.evaluate(() => result.onChange)).toEqual(['blue']);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should not throw when select causes navigation', async({page, server}) => {
|
it('should not throw when select causes navigation', async({page, server}) => {
|
||||||
await page.goto(server.PREFIX + '/input/select.html');
|
await page.goto(server.PREFIX + '/input/select.html');
|
||||||
await page.$eval('select', select => select.addEventListener('input', () => window.location = '/empty.html'));
|
await page.$eval('select', select => select.addEventListener('input', () => window.location = '/empty.html'));
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@ -1136,7 +1136,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
await page.select('select');
|
await page.select('select');
|
||||||
expect(await page.$eval('select', select => Array.from(select.options).every(option => !option.selected))).toEqual(true);
|
expect(await page.$eval('select', select => Array.from(select.options).every(option => !option.selected))).toEqual(true);
|
||||||
});
|
});
|
||||||
it('should throw if passed in non-strings', async({page, server}) => {
|
it_fails_ffox('should throw if passed in non-strings', async({page, server}) => {
|
||||||
await page.setContent('<select><option value="12"/></select>');
|
await page.setContent('<select><option value="12"/></select>');
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
@ -1157,7 +1157,7 @@ module.exports.addTests = function({testRunner, expect, headless, puppeteer, CHR
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.Events.Close', function() {
|
describe('Page.Events.Close', function() {
|
||||||
it('should work with window.close', async function({ page, context, server }) {
|
it_fails_ffox('should work with window.close', async function({ page, context, server }) {
|
||||||
const newPagePromise = new Promise(fulfill => context.once('targetcreated', target => fulfill(target.page())));
|
const newPagePromise = new Promise(fulfill => context.once('targetcreated', target => fulfill(target.page())));
|
||||||
await page.evaluate(() => window['newPage'] = window.open('about:blank'));
|
await page.evaluate(() => window['newPage'] = window.open('about:blank'));
|
||||||
const newPage = await newPagePromise;
|
const newPage = await newPagePromise;
|
||||||
|
@ -28,8 +28,7 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
|
|||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
const CHROME = product === 'Chromium';
|
const CHROME = product === 'Chromium';
|
||||||
const FFOX = (product === 'Firefox' || product === 'Juggler');
|
const FFOX = product === 'Firefox';
|
||||||
const JUGGLER = product === 'Juggler';
|
|
||||||
|
|
||||||
const puppeteer = require(puppeteerPath);
|
const puppeteer = require(puppeteerPath);
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
|
|||||||
throw new Error(`Browser is not downloaded at ${executablePath}. Run 'npm install' and try to re-run tests`);
|
throw new Error(`Browser is not downloaded at ${executablePath}. Run 'npm install' and try to re-run tests`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const suffix = JUGGLER ? 'firefox' : product.toLowerCase();
|
const suffix = FFOX ? 'firefox' : product.toLowerCase();
|
||||||
const GOLDEN_DIR = path.join(__dirname, 'golden-' + suffix);
|
const GOLDEN_DIR = path.join(__dirname, 'golden-' + suffix);
|
||||||
const OUTPUT_DIR = path.join(__dirname, 'output-' + suffix);
|
const OUTPUT_DIR = path.join(__dirname, 'output-' + suffix);
|
||||||
if (fs.existsSync(OUTPUT_DIR))
|
if (fs.existsSync(OUTPUT_DIR))
|
||||||
@ -73,7 +72,6 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
|
|||||||
product,
|
product,
|
||||||
FFOX,
|
FFOX,
|
||||||
CHROME,
|
CHROME,
|
||||||
JUGGLER,
|
|
||||||
puppeteer,
|
puppeteer,
|
||||||
expect,
|
expect,
|
||||||
defaultBrowserOptions,
|
defaultBrowserOptions,
|
||||||
@ -81,10 +79,6 @@ module.exports.addTests = ({testRunner, product, puppeteerPath}) => {
|
|||||||
headless: !!defaultBrowserOptions.headless,
|
headless: !!defaultBrowserOptions.headless,
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
if (JUGGLER && defaultBrowserOptions.executablePath)
|
|
||||||
await require('../experimental/puppeteer-firefox/misc/install-preferences')(defaultBrowserOptions.executablePath);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Browser', function() {
|
describe('Browser', function() {
|
||||||
beforeAll(async state => {
|
beforeAll(async state => {
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, product}) {
|
module.exports.addTests = function({testRunner, expect, product}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.$eval', function() {
|
describe_fails_ffox('Page.$eval', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setContent('<section id="testAttribute">43543</section>');
|
await page.setContent('<section id="testAttribute">43543</section>');
|
||||||
const idAttribute = await page.$eval('section', e => e.id);
|
const idAttribute = await page.$eval('section', e => e.id);
|
||||||
@ -43,7 +43,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.$$eval', function() {
|
describe_fails_ffox('Page.$$eval', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');
|
||||||
const divsCount = await page.$$eval('div', divs => divs.length);
|
const divsCount = await page.$$eval('div', divs => divs.length);
|
||||||
@ -51,7 +51,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.$', function() {
|
describe_fails_ffox('Page.$', function() {
|
||||||
it('should query existing element', async({page, server}) => {
|
it('should query existing element', async({page, server}) => {
|
||||||
await page.setContent('<section>test</section>');
|
await page.setContent('<section>test</section>');
|
||||||
const element = await page.$('section');
|
const element = await page.$('section');
|
||||||
@ -64,7 +64,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Page.$$', function() {
|
describe('Page.$$', function() {
|
||||||
it('should query existing elements', async({page, server}) => {
|
it_fails_ffox('should query existing elements', async({page, server}) => {
|
||||||
await page.setContent('<div>A</div><br/><div>B</div>');
|
await page.setContent('<div>A</div><br/><div>B</div>');
|
||||||
const elements = await page.$$('div');
|
const elements = await page.$$('div');
|
||||||
expect(elements.length).toBe(2);
|
expect(elements.length).toBe(2);
|
||||||
@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Path.$x', function() {
|
describe_fails_ffox('Path.$x', function() {
|
||||||
it('should query existing element', async({page, server}) => {
|
it('should query existing element', async({page, server}) => {
|
||||||
await page.setContent('<section>test</section>');
|
await page.setContent('<section>test</section>');
|
||||||
const elements = await page.$x('/html/body/section');
|
const elements = await page.$x('/html/body/section');
|
||||||
@ -108,14 +108,14 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
expect(content).toBe('A');
|
expect(content).toBe('A');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null for non-existing element', async({page, server}) => {
|
it_fails_ffox('should return null for non-existing element', async({page, server}) => {
|
||||||
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
|
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
|
||||||
const html = await page.$('html');
|
const html = await page.$('html');
|
||||||
const second = await html.$('.third');
|
const second = await html.$('.third');
|
||||||
expect(second).toBe(null);
|
expect(second).toBe(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('ElementHandle.$eval', function() {
|
describe_fails_ffox('ElementHandle.$eval', function() {
|
||||||
it('should work', async({page, server}) => {
|
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>');
|
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');
|
const tweet = await page.$('.tweet');
|
||||||
@ -139,7 +139,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
expect(errorMessage).toBe(`Error: failed to find element matching selector ".a"`);
|
expect(errorMessage).toBe(`Error: failed to find element matching selector ".a"`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('ElementHandle.$$eval', function() {
|
describe_fails_ffox('ElementHandle.$$eval', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="like">10</div></div></body></html>');
|
await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="like">10</div></div></body></html>');
|
||||||
const tweet = await page.$('.tweet');
|
const tweet = await page.$('.tweet');
|
||||||
@ -165,7 +165,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ElementHandle.$$', function() {
|
describe_fails_ffox('ElementHandle.$$', function() {
|
||||||
it('should query existing elements', async({page, server}) => {
|
it('should query existing elements', async({page, server}) => {
|
||||||
await page.setContent('<html><body><div>A</div><br/><div>B</div></body></html>');
|
await page.setContent('<html><body><div>A</div><br/><div>B</div></body></html>');
|
||||||
const html = await page.$('html');
|
const html = await page.$('html');
|
||||||
@ -195,7 +195,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
expect(content).toBe('A');
|
expect(content).toBe('A');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null for non-existing element', async({page, server}) => {
|
it_fails_ffox('should return null for non-existing element', async({page, server}) => {
|
||||||
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
|
await page.setContent('<html><body><div class="second"><div class="inner">B</div></div></body></html>');
|
||||||
const html = await page.$('html');
|
const html = await page.$('html');
|
||||||
const second = await html.$x(`/div[contains(@class, 'third')]`);
|
const second = await html.$x(`/div[contains(@class, 'third')]`);
|
||||||
|
@ -23,7 +23,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.setRequestInterception', function() {
|
describe_fails_ffox('Page.setRequestInterception', function() {
|
||||||
it('should intercept', async({page, server}) => {
|
it('should intercept', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
@ -171,7 +171,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(response.request().failure()).toBe(null);
|
expect(response.request().failure()).toBe(null);
|
||||||
expect(failedRequests).toBe(1);
|
expect(failedRequests).toBe(1);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should be abortable with custom error codes', async({page, server}) => {
|
it('should be abortable with custom error codes', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
request.abort('internetdisconnected');
|
request.abort('internetdisconnected');
|
||||||
@ -303,7 +303,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
]));
|
]));
|
||||||
expect(results).toEqual(['11', 'FAILED', '22']);
|
expect(results).toEqual(['11', 'FAILED', '22']);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should navigate to dataURL and fire dataURL requests', async({page, server}) => {
|
it('should navigate to dataURL and fire dataURL requests', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
const requests = [];
|
const requests = [];
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
@ -316,7 +316,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(requests.length).toBe(1);
|
expect(requests.length).toBe(1);
|
||||||
expect(requests[0].url()).toBe(dataURL);
|
expect(requests[0].url()).toBe(dataURL);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should be able to fetch dataURL and fire dataURL requests', async({page, server}) => {
|
it('should be able to fetch dataURL and fire dataURL requests', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
const requests = [];
|
const requests = [];
|
||||||
@ -330,7 +330,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(requests.length).toBe(1);
|
expect(requests.length).toBe(1);
|
||||||
expect(requests[0].url()).toBe(dataURL);
|
expect(requests[0].url()).toBe(dataURL);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should navigate to URL with hash and and fire requests without hash', async({page, server}) => {
|
it('should navigate to URL with hash and and fire requests without hash', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
const requests = [];
|
const requests = [];
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
@ -358,7 +358,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
const response = await page.goto(server.PREFIX + '/malformed?rnd=%911');
|
const response = await page.goto(server.PREFIX + '/malformed?rnd=%911');
|
||||||
expect(response.status()).toBe(200);
|
expect(response.status()).toBe(200);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should work with encoded server - 2', async({page, server}) => {
|
it('should work with encoded server - 2', async({page, server}) => {
|
||||||
// The requestWillBeSent will report URL as-is, whereas interception will
|
// The requestWillBeSent will report URL as-is, whereas interception will
|
||||||
// report encoded URL for stylesheet. @see crbug.com/759388
|
// report encoded URL for stylesheet. @see crbug.com/759388
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
@ -372,7 +372,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(requests.length).toBe(2);
|
expect(requests.length).toBe(2);
|
||||||
expect(requests[1].response().status()).toBe(404);
|
expect(requests[1].response().status()).toBe(404);
|
||||||
});
|
});
|
||||||
it_fails_ffox('should not throw "Invalid Interception Id" if the request was cancelled', async({page, server}) => {
|
it('should not throw "Invalid Interception Id" if the request was cancelled', async({page, server}) => {
|
||||||
await page.setContent('<iframe></iframe>');
|
await page.setContent('<iframe></iframe>');
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
let request = null;
|
let request = null;
|
||||||
@ -398,7 +398,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
expect(error.message).toContain('Request Interception is not enabled');
|
expect(error.message).toContain('Request Interception is not enabled');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should work with file URLs', async({page, server}) => {
|
it('should work with file URLs', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
const urls = new Set();
|
const urls = new Set();
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
@ -412,7 +412,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Request.continue', function() {
|
describe_fails_ffox('Request.continue', function() {
|
||||||
it('should work', async({page, server}) => {
|
it('should work', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
page.on('request', request => request.continue());
|
page.on('request', request => request.continue());
|
||||||
@ -432,7 +432,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
]);
|
]);
|
||||||
expect(request.headers['foo']).toBe('bar');
|
expect(request.headers['foo']).toBe('bar');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should redirect in a way non-observable to page', async({page, server}) => {
|
it('should redirect in a way non-observable to page', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
const redirectURL = request.url().includes('/empty.html') ? server.PREFIX + '/consolelog.html' : undefined;
|
const redirectURL = request.url().includes('/empty.html') ? server.PREFIX + '/consolelog.html' : undefined;
|
||||||
@ -444,7 +444,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
expect(page.url()).toBe(server.EMPTY_PAGE);
|
expect(page.url()).toBe(server.EMPTY_PAGE);
|
||||||
expect(consoleMessage.text()).toBe('yellow');
|
expect(consoleMessage.text()).toBe('yellow');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should amend method', async({page, server}) => {
|
it('should amend method', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
@ -457,7 +457,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
]);
|
]);
|
||||||
expect(request.method).toBe('POST');
|
expect(request.method).toBe('POST');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should amend post data', async({page, server}) => {
|
it('should amend post data', async({page, server}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
|
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
@ -470,7 +470,7 @@ module.exports.addTests = function({testRunner, expect, CHROME}) {
|
|||||||
]);
|
]);
|
||||||
expect(await serverRequest.postBody).toBe('doggo');
|
expect(await serverRequest.postBody).toBe('doggo');
|
||||||
});
|
});
|
||||||
it_fails_ffox('should amend both post data and method on navigation', async({page, server}) => {
|
it('should amend both post data and method on navigation', async({page, server}) => {
|
||||||
await page.setRequestInterception(true);
|
await page.setRequestInterception(true);
|
||||||
page.on('request', request => {
|
page.on('request', request => {
|
||||||
request.continue({ method: 'POST', postData: 'doggo' });
|
request.continue({ method: 'POST', postData: 'doggo' });
|
||||||
|
@ -20,13 +20,13 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.screenshot', function() {
|
describe('Page.screenshot', function() {
|
||||||
it('should work', async({page, server}) => {
|
it_fails_ffox('should work', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
const screenshot = await page.screenshot();
|
const screenshot = await page.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-sanity.png');
|
expect(screenshot).toBeGolden('screenshot-sanity.png');
|
||||||
});
|
});
|
||||||
it('should clip rect', async({page, server}) => {
|
it_fails_ffox('should clip rect', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
@ -69,7 +69,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const screenshots = await Promise.all(promises);
|
const screenshots = await Promise.all(promises);
|
||||||
expect(screenshots[1]).toBeGolden('grid-cell-1.png');
|
expect(screenshots[1]).toBeGolden('grid-cell-1.png');
|
||||||
});
|
});
|
||||||
it('should take fullPage screenshots', async({page, server}) => {
|
it_fails_ffox('should take fullPage screenshots', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
@ -115,7 +115,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
});
|
});
|
||||||
expect(screenshot).toBeGolden('screenshot-clip-odd-size.png');
|
expect(screenshot).toBeGolden('screenshot-clip-odd-size.png');
|
||||||
});
|
});
|
||||||
it('should return base64', async({page, server}) => {
|
it_fails_ffox('should return base64', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
@ -134,7 +134,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-element-bounding-box.png');
|
expect(screenshot).toBeGolden('screenshot-element-bounding-box.png');
|
||||||
});
|
});
|
||||||
it('should take into account padding and border', async({page, server}) => {
|
it_fails_ffox('should take into account padding and border', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
something above
|
something above
|
||||||
@ -151,7 +151,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-element-padding-border.png');
|
expect(screenshot).toBeGolden('screenshot-element-padding-border.png');
|
||||||
});
|
});
|
||||||
it('should capture full element when larger than viewport', async({page, server}) => {
|
it_fails_ffox('should capture full element when larger than viewport', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
|
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
@ -175,7 +175,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
|
|
||||||
expect(await page.evaluate(() => ({ w: window.innerWidth, h: window.innerHeight }))).toEqual({ w: 500, h: 500 });
|
expect(await page.evaluate(() => ({ w: window.innerWidth, h: window.innerHeight }))).toEqual({ w: 500, h: 500 });
|
||||||
});
|
});
|
||||||
it('should scroll element into view', async({page, server}) => {
|
it_fails_ffox('should scroll element into view', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.setContent(`
|
await page.setContent(`
|
||||||
something above
|
something above
|
||||||
@ -198,7 +198,7 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-element-scrolled-into-view.png');
|
expect(screenshot).toBeGolden('screenshot-element-scrolled-into-view.png');
|
||||||
});
|
});
|
||||||
it('should work with a rotated element', async({page, server}) => {
|
it_fails_ffox('should work with a rotated element', async({page, server}) => {
|
||||||
await page.setViewport({width: 500, height: 500});
|
await page.setViewport({width: 500, height: 500});
|
||||||
await page.setContent(`<div style="position:absolute;
|
await page.setContent(`<div style="position:absolute;
|
||||||
top: 100px;
|
top: 100px;
|
||||||
@ -211,26 +211,26 @@ module.exports.addTests = function({testRunner, expect, product}) {
|
|||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-element-rotate.png');
|
expect(screenshot).toBeGolden('screenshot-element-rotate.png');
|
||||||
});
|
});
|
||||||
it('should fail to screenshot a detached element', async({page, server}) => {
|
it_fails_ffox('should fail to screenshot a detached element', async({page, server}) => {
|
||||||
await page.setContent('<h1>remove this</h1>');
|
await page.setContent('<h1>remove this</h1>');
|
||||||
const elementHandle = await page.$('h1');
|
const elementHandle = await page.$('h1');
|
||||||
await page.evaluate(element => element.remove(), elementHandle);
|
await page.evaluate(element => element.remove(), elementHandle);
|
||||||
const screenshotError = await elementHandle.screenshot().catch(error => error);
|
const screenshotError = await elementHandle.screenshot().catch(error => error);
|
||||||
expect(screenshotError.message).toBe('Node is either not visible or not an HTMLElement');
|
expect(screenshotError.message).toBe('Node is either not visible or not an HTMLElement');
|
||||||
});
|
});
|
||||||
it('should not hang with zero width/height element', async({page, server}) => {
|
it_fails_ffox('should not hang with zero width/height element', async({page, server}) => {
|
||||||
await page.setContent('<div style="width: 50px; height: 0"></div>');
|
await page.setContent('<div style="width: 50px; height: 0"></div>');
|
||||||
const div = await page.$('div');
|
const div = await page.$('div');
|
||||||
const error = await div.screenshot().catch(e => e);
|
const error = await div.screenshot().catch(e => e);
|
||||||
expect(error.message).toBe('Node has 0 height.');
|
expect(error.message).toBe('Node has 0 height.');
|
||||||
});
|
});
|
||||||
it('should work for an element with fractional dimensions', async({page}) => {
|
it_fails_ffox('should work for an element with fractional dimensions', async({page}) => {
|
||||||
await page.setContent('<div style="width:48.51px;height:19.8px;border:1px solid black;"></div>');
|
await page.setContent('<div style="width:48.51px;height:19.8px;border:1px solid black;"></div>');
|
||||||
const elementHandle = await page.$('div');
|
const elementHandle = await page.$('div');
|
||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
expect(screenshot).toBeGolden('screenshot-element-fractional.png');
|
expect(screenshot).toBeGolden('screenshot-element-fractional.png');
|
||||||
});
|
});
|
||||||
it('should work for an element with an offset', async({page}) => {
|
it_fails_ffox('should work for an element with an offset', async({page}) => {
|
||||||
await page.setContent('<div style="position:absolute; top: 10.3px; left: 20.4px;width:50.3px;height:20.2px;border:1px solid black;"></div>');
|
await page.setContent('<div style="position:absolute; top: 10.3px; left: 20.4px;width:50.3px;height:20.2px;border:1px solid black;"></div>');
|
||||||
const elementHandle = await page.$('div');
|
const elementHandle = await page.$('div');
|
||||||
const screenshot = await elementHandle.screenshot();
|
const screenshot = await elementHandle.screenshot();
|
||||||
|
@ -49,7 +49,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(await originalPage.evaluate(() => ['Hello', 'world'].join(' '))).toBe('Hello world');
|
expect(await originalPage.evaluate(() => ['Hello', 'world'].join(' '))).toBe('Hello world');
|
||||||
expect(await originalPage.$('body')).toBeTruthy();
|
expect(await originalPage.$('body')).toBeTruthy();
|
||||||
});
|
});
|
||||||
it('should report when a new page is created and closed', async({page, server, context}) => {
|
it_fails_ffox('should report when a new page is created and closed', async({page, server, context}) => {
|
||||||
const [otherPage] = await Promise.all([
|
const [otherPage] = await Promise.all([
|
||||||
context.waitForTarget(target => target.url() === server.CROSS_PROCESS_PREFIX + '/empty.html').then(target => target.page()),
|
context.waitForTarget(target => target.url() === server.CROSS_PROCESS_PREFIX + '/empty.html').then(target => target.page()),
|
||||||
page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html'),
|
page.evaluate(url => window.open(url), server.CROSS_PROCESS_PREFIX + '/empty.html'),
|
||||||
@ -99,7 +99,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
const worker = await target.worker();
|
const worker = await target.worker();
|
||||||
expect(await worker.evaluate(() => self.toString())).toBe('[object SharedWorkerGlobalScope]');
|
expect(await worker.evaluate(() => self.toString())).toBe('[object SharedWorkerGlobalScope]');
|
||||||
});
|
});
|
||||||
it('should report when a target url changes', async({page, server, context}) => {
|
it_fails_ffox('should report when a target url changes', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
let changedTarget = new Promise(fulfill => context.once('targetchanged', target => fulfill(target)));
|
let changedTarget = new Promise(fulfill => context.once('targetchanged', target => fulfill(target)));
|
||||||
await page.goto(server.CROSS_PROCESS_PREFIX + '/');
|
await page.goto(server.CROSS_PROCESS_PREFIX + '/');
|
||||||
@ -128,7 +128,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
expect(targetChanged).toBe(false, 'target should not be reported as changed');
|
expect(targetChanged).toBe(false, 'target should not be reported as changed');
|
||||||
context.removeListener('targetchanged', listener);
|
context.removeListener('targetchanged', listener);
|
||||||
});
|
});
|
||||||
it('should not crash while redirecting if original request was missed', async({page, server, context}) => {
|
it_fails_ffox('should not crash while redirecting if original request was missed', async({page, server, context}) => {
|
||||||
let serverResponse = null;
|
let serverResponse = null;
|
||||||
server.setRoute('/one-style.css', (req, res) => serverResponse = res);
|
server.setRoute('/one-style.css', (req, res) => serverResponse = res);
|
||||||
// Open a new page. Use window.open to connect to the page later.
|
// Open a new page. Use window.open to connect to the page later.
|
||||||
@ -147,7 +147,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
// Cleanup.
|
// Cleanup.
|
||||||
await newPage.close();
|
await newPage.close();
|
||||||
});
|
});
|
||||||
it('should have an opener', async({page, server, context}) => {
|
it_fails_ffox('should have an opener', async({page, server, context}) => {
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
const [createdTarget] = await Promise.all([
|
const [createdTarget] = await Promise.all([
|
||||||
new Promise(fulfill => context.once('targetcreated', target => fulfill(target))),
|
new Promise(fulfill => context.once('targetcreated', target => fulfill(target))),
|
||||||
@ -160,7 +160,7 @@ module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Browser.waitForTarget', () => {
|
describe('Browser.waitForTarget', () => {
|
||||||
it('should wait for a target', async function({browser, server}) {
|
it_fails_ffox('should wait for a target', async function({browser, server}) {
|
||||||
let resolved = false;
|
let resolved = false;
|
||||||
const targetPromise = browser.waitForTarget(target => target.url() === server.EMPTY_PAGE);
|
const targetPromise = browser.waitForTarget(target => target.url() === server.EMPTY_PAGE);
|
||||||
targetPromise.then(() => resolved = true);
|
targetPromise.then(() => resolved = true);
|
||||||
|
19
test/test.js
19
test/test.js
@ -26,10 +26,10 @@ if (parallelArgIndex !== -1)
|
|||||||
parallel = parseInt(process.argv[parallelArgIndex + 1], 10);
|
parallel = parseInt(process.argv[parallelArgIndex + 1], 10);
|
||||||
require('events').defaultMaxListeners *= parallel;
|
require('events').defaultMaxListeners *= parallel;
|
||||||
|
|
||||||
// Timeout to 20 seconds on Appveyor instances.
|
const defaultTimeout = process.env.PUPPETEER_PRODUCT === 'firefox' ? 15 * 1000 : 10 * 1000;
|
||||||
let timeout = process.env.APPVEYOR ? 20 * 1000 : 10 * 1000;
|
let timeout = process.env.APPVEYOR ? 20 * 1000 : defaultTimeout;
|
||||||
if (!isNaN(process.env.TIMEOUT))
|
if (!isNaN(process.env.TIMEOUT))
|
||||||
timeout = parseInt(process.env.TIMEOUT, 10);
|
timeout = parseInt(process.env.TIMEOUT, defaultTimeout);
|
||||||
const testRunner = new TestRunner({
|
const testRunner = new TestRunner({
|
||||||
timeout,
|
timeout,
|
||||||
parallel,
|
parallel,
|
||||||
@ -86,19 +86,6 @@ switch (process.env.PUPPETEER_PRODUCT) {
|
|||||||
puppeteerPath: utils.projectRoot(),
|
puppeteerPath: utils.projectRoot(),
|
||||||
testRunner,
|
testRunner,
|
||||||
});
|
});
|
||||||
if (process.env.COVERAGE)
|
|
||||||
utils.recordAPICoverage(testRunner, require('../lib/api'), require('../lib/Events').Events, CHROMIUM_NO_COVERAGE);
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case 'juggler':
|
|
||||||
testRunner.addTestDSL('it_fails_ffox', 'skip');
|
|
||||||
testRunner.addSuiteDSL('describe_fails_ffox', 'skip');
|
|
||||||
describe('Firefox (Juggler)', () => {
|
|
||||||
require('./puppeteer.spec.js').addTests({
|
|
||||||
product: 'Juggler',
|
|
||||||
puppeteerPath: path.resolve(__dirname, '../experimental/puppeteer-firefox/'),
|
|
||||||
testRunner,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'chrome':
|
case 'chrome':
|
||||||
|
@ -15,11 +15,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
module.exports.addTests = function({testRunner, expect, puppeteer}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const iPhone = puppeteer.devices['iPhone 6'];
|
const iPhone = puppeteer.devices['iPhone 6'];
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
describe('Touchscreen', function() {
|
describe_fails_ffox('Touchscreen', function() {
|
||||||
it('should tap the button', async({page, server}) => {
|
it('should tap the button', async({page, server}) => {
|
||||||
await page.emulate(iPhone);
|
await page.emulate(iPhone);
|
||||||
await page.goto(server.PREFIX + '/input/button.html');
|
await page.goto(server.PREFIX + '/input/button.html');
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
const utils = require('./utils');
|
const utils = require('./utils');
|
||||||
|
|
||||||
module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
||||||
const {describe, xdescribe, fdescribe} = testRunner;
|
const {describe, xdescribe, fdescribe, describe_fails_ffox} = testRunner;
|
||||||
const {it, fit, xit, it_fails_ffox} = testRunner;
|
const {it, fit, xit, it_fails_ffox} = testRunner;
|
||||||
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
|
||||||
|
|
||||||
describe('Page.waitFor', function() {
|
describe('Page.waitFor', function() {
|
||||||
it('should wait for selector', async({page, server}) => {
|
it_fails_ffox('should wait for selector', async({page, server}) => {
|
||||||
let found = false;
|
let found = false;
|
||||||
const waitFor = page.waitFor('div').then(() => found = true);
|
const waitFor = page.waitFor('div').then(() => found = true);
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -31,7 +31,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
await waitFor;
|
await waitFor;
|
||||||
expect(found).toBe(true);
|
expect(found).toBe(true);
|
||||||
});
|
});
|
||||||
it('should wait for an xpath', async({page, server}) => {
|
it_fails_ffox('should wait for an xpath', async({page, server}) => {
|
||||||
let found = false;
|
let found = false;
|
||||||
const waitFor = page.waitFor('//div').then(() => found = true);
|
const waitFor = page.waitFor('//div').then(() => found = true);
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
@ -40,7 +40,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
await waitFor;
|
await waitFor;
|
||||||
expect(found).toBe(true);
|
expect(found).toBe(true);
|
||||||
});
|
});
|
||||||
it('should not allow you to select an element with single slash xpath', async({page, server}) => {
|
it_fails_ffox('should not allow you to select an element with single slash xpath', async({page, server}) => {
|
||||||
await page.setContent(`<div>some text</div>`);
|
await page.setContent(`<div>some text</div>`);
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.waitFor('/html/body/div').catch(e => error = e);
|
await page.waitFor('/html/body/div').catch(e => error = e);
|
||||||
@ -80,7 +80,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
await page.evaluate(() => window.__FOO = 1);
|
await page.evaluate(() => window.__FOO = 1);
|
||||||
await watchdog;
|
await watchdog;
|
||||||
});
|
});
|
||||||
it('should work when resolved right before execution context disposal', async({page, server}) => {
|
it_fails_ffox('should work when resolved right before execution context disposal', async({page, server}) => {
|
||||||
await page.evaluateOnNewDocument(() => window.__RELOADED = true);
|
await page.evaluateOnNewDocument(() => window.__RELOADED = true);
|
||||||
await page.waitForFunction(() => {
|
await page.waitForFunction(() => {
|
||||||
if (!window.__RELOADED)
|
if (!window.__RELOADED)
|
||||||
@ -150,7 +150,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
it('should return the window as a success value', async({ page }) => {
|
it('should return the window as a success value', async({ page }) => {
|
||||||
expect(await page.waitForFunction(() => window)).toBeTruthy();
|
expect(await page.waitForFunction(() => window)).toBeTruthy();
|
||||||
});
|
});
|
||||||
it('should accept ElementHandle arguments', async({page}) => {
|
it_fails_ffox('should accept ElementHandle arguments', async({page}) => {
|
||||||
await page.setContent('<div></div>');
|
await page.setContent('<div></div>');
|
||||||
const div = await page.$('div');
|
const div = await page.$('div');
|
||||||
let resolved = false;
|
let resolved = false;
|
||||||
@ -204,7 +204,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame.waitForSelector', function() {
|
describe_fails_ffox('Frame.waitForSelector', function() {
|
||||||
const addElement = tag => document.body.appendChild(document.createElement(tag));
|
const addElement = tag => document.body.appendChild(document.createElement(tag));
|
||||||
|
|
||||||
it('should immediately resolve promise if node exists', async({page, server}) => {
|
it('should immediately resolve promise if node exists', async({page, server}) => {
|
||||||
@ -215,7 +215,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
await frame.waitForSelector('div');
|
await frame.waitForSelector('div');
|
||||||
});
|
});
|
||||||
|
|
||||||
it_fails_ffox('should work with removed MutationObserver', async({page, server}) => {
|
it('should work with removed MutationObserver', async({page, server}) => {
|
||||||
await page.evaluate(() => delete window.MutationObserver);
|
await page.evaluate(() => delete window.MutationObserver);
|
||||||
const [handle] = await Promise.all([
|
const [handle] = await Promise.all([
|
||||||
page.waitForSelector('.zombo'),
|
page.waitForSelector('.zombo'),
|
||||||
@ -366,7 +366,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
await page.evaluate(() => document.querySelector('div').className = 'zombo');
|
await page.evaluate(() => document.querySelector('div').className = 'zombo');
|
||||||
expect(await waitForSelector).toBe(true);
|
expect(await waitForSelector).toBe(true);
|
||||||
});
|
});
|
||||||
it('should return the element handle', async({page, server}) => {
|
it_fails_ffox('should return the element handle', async({page, server}) => {
|
||||||
const waitForSelector = page.waitForSelector('.zombo');
|
const waitForSelector = page.waitForSelector('.zombo');
|
||||||
await page.setContent(`<div class='zombo'>anything</div>`);
|
await page.setContent(`<div class='zombo'>anything</div>`);
|
||||||
expect(await page.evaluate(x => x.textContent, await waitForSelector)).toBe('anything');
|
expect(await page.evaluate(x => x.textContent, await waitForSelector)).toBe('anything');
|
||||||
@ -378,7 +378,7 @@ module.exports.addTests = function({testRunner, expect, product, puppeteer}) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Frame.waitForXPath', function() {
|
describe_fails_ffox('Frame.waitForXPath', function() {
|
||||||
const addElement = tag => document.body.appendChild(document.createElement(tag));
|
const addElement = tag => document.body.appendChild(document.createElement(tag));
|
||||||
|
|
||||||
it('should support some fancy xpath', async({page, server}) => {
|
it('should support some fancy xpath', async({page, server}) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user