Skip to content

Commit

Permalink
chore: roll test runner to 0.3.9 (#3847)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelfeldman authored Sep 11, 2020
1 parent 38ed8de commit f94df31
Show file tree
Hide file tree
Showing 77 changed files with 446 additions and 441 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ws": "^7.3.1"
},
"devDependencies": {
"@playwright/test-runner": "^0.3.5",
"@playwright/test-runner": "^0.3.9",
"@types/debug": "^4.1.5",
"@types/extract-zip": "^1.6.2",
"@types/mime": "^2.0.3",
Expand Down
50 changes: 25 additions & 25 deletions test/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import { it, expect, describe, options } from './playwright.fixtures';

it('should work', async function({page}) {
it('should work', async ({ page, isFirefox, isChromium }) => {
await page.setContent(`
<head>
<title>Accessibility Test</title>
Expand All @@ -36,7 +36,7 @@ it('should work', async function({page}) {
// autofocus happens after a delay in chrome these days
await page.waitForFunction(() => document.activeElement.hasAttribute('autofocus'));

const golden = options.FIREFOX ? {
const golden = isFirefox ? {
role: 'document',
name: 'Accessibility Test',
children: [
Expand All @@ -49,7 +49,7 @@ it('should work', async function({page}) {
{role: 'textbox', name: '', value: 'and a value'}, // firefox doesn't use aria-placeholder for the name
{role: 'textbox', name: '', value: 'and a value', description: 'This is a description!'}, // and here
]
} : options.CHROMIUM ? {
} : isChromium ? {
role: 'WebArea',
name: 'Accessibility Test',
children: [
Expand Down Expand Up @@ -79,11 +79,11 @@ it('should work', async function({page}) {
expect(await page.accessibility.snapshot()).toEqual(golden);
});

it('should work with regular text', async ({page}) => {
it('should work with regular text', async ({page, isFirefox}) => {
await page.setContent(`<div>Hello World</div>`);
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0]).toEqual({
role: options.FIREFOX ? 'text leaf' : 'text',
role: isFirefox ? 'text leaf' : 'text',
name: 'Hello World',
});
});
Expand Down Expand Up @@ -118,14 +118,14 @@ it('keyshortcuts', async ({page}) => {
expect(snapshot.children[0].keyshortcuts).toEqual('foo');
});

it('should not report text nodes inside controls', async function({page}) {
it('should not report text nodes inside controls', async function({page, isFirefox}) {
await page.setContent(`
<div role="tablist">
<div role="tab" aria-selected="true"><b>Tab1</b></div>
<div role="tab">Tab2</div>
</div>`);
const golden = {
role: options.FIREFOX ? 'document' : 'WebArea',
role: isFirefox ? 'document' : 'WebArea',
name: '',
children: [{
role: 'tab',
Expand All @@ -139,14 +139,14 @@ it('should not report text nodes inside controls', async function({page}) {
expect(await page.accessibility.snapshot()).toEqual(golden);
});

it('rich text editable fields should have children', test => {
test.skip(options.WEBKIT, 'WebKit rich text accessibility is iffy');
}, async function({page}) {
it('rich text editable fields should have children', (test, parameters) => {
test.skip(options.WEBKIT(parameters), 'WebKit rich text accessibility is iffy');
}, async function({page, isFirefox}) {
await page.setContent(`
<div contenteditable="true">
Edit this image: <img src="fakeimage.png" alt="my fake image">
</div>`);
const golden = options.FIREFOX ? {
const golden = isFirefox ? {
role: 'section',
name: '',
children: [{
Expand All @@ -172,14 +172,14 @@ it('rich text editable fields should have children', test => {
expect(snapshot.children[0]).toEqual(golden);
});

it('rich text editable fields with role should have children', test => {
test.skip(options.WEBKIT, 'WebKit rich text accessibility is iffy');
}, async function({page}) {
it('rich text editable fields with role should have children', (test, parameters) => {
test.skip(options.WEBKIT(parameters), 'WebKit rich text accessibility is iffy');
}, async function({page, isFirefox}) {
await page.setContent(`
<div contenteditable="true" role='textbox'>
Edit this image: <img src="fakeimage.png" alt="my fake image">
</div>`);
const golden = options.FIREFOX ? {
const golden = isFirefox ? {
role: 'textbox',
name: '',
value: 'Edit this image: my fake image',
Expand All @@ -203,9 +203,9 @@ it('rich text editable fields with role should have children', test => {
expect(snapshot.children[0]).toEqual(golden);
});

describe('contenteditable', suite => {
suite.skip(options.FIREFOX, 'Firefox does not support contenteditable="plaintext-only"');
suite.skip(options.WEBKIT, 'WebKit rich text accessibility is iffy');
describe('contenteditable', (suite, parameters) => {
suite.skip(options.FIREFOX(parameters), 'Firefox does not support contenteditable="plaintext-only"');
suite.skip(options.WEBKIT(parameters), 'WebKit rich text accessibility is iffy');
}, () => {
it('plain text field with role should not have children', async function({page}) {
await page.setContent(`
Expand Down Expand Up @@ -239,17 +239,17 @@ describe('contenteditable', suite => {
});
});

it('non editable textbox with role and tabIndex and label should not have children', async function({page}) {
it('non editable textbox with role and tabIndex and label should not have children', async function({page, isChromium, isFirefox}) {
await page.setContent(`
<div role="textbox" tabIndex=0 aria-checked="true" aria-label="my favorite textbox">
this is the inner content
<img alt="yo" src="fakeimg.png">
</div>`);
const golden = options.FIREFOX ? {
const golden = isFirefox ? {
role: 'textbox',
name: 'my favorite textbox',
value: 'this is the inner content yo'
} : options.CHROMIUM ? {
} : isChromium ? {
role: 'textbox',
name: 'my favorite textbox',
value: 'this is the inner content '
Expand Down Expand Up @@ -277,13 +277,13 @@ it('checkbox with and tabIndex and label should not have children', async functi
expect(snapshot.children[0]).toEqual(golden);
});

it('checkbox without label should not have children', async function({page}) {
it('checkbox without label should not have children', async ({page, isFirefox}) => {
await page.setContent(`
<div role="checkbox" aria-checked="true">
this is the inner content
<img alt="yo" src="fakeimg.png">
</div>`);
const golden = options.FIREFOX ? {
const golden = isFirefox ? {
role: 'checkbox',
name: 'this is the inner content yo',
checked: true
Expand Down Expand Up @@ -317,7 +317,7 @@ it('should work an input', async ({page}) => {
});
});

it('should work on a menu', async ({page}) => {
it('should work on a menu', async ({page, isWebKit}) => {
await page.setContent(`
<div role="menu" title="My Menu">
<div role="menuitem">First Item</div>
Expand All @@ -334,7 +334,7 @@ it('should work on a menu', async ({page}) => {
[ { role: 'menuitem', name: 'First Item' },
{ role: 'menuitem', name: 'Second Item' },
{ role: 'menuitem', name: 'Third Item' } ],
orientation: options.WEBKIT ? 'vertical' : undefined
orientation: isWebKit ? 'vertical' : undefined
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/autowaiting-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ it('should work with goto following click', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
});

it('should report navigation in the log when clicking anchor', test => {
it('should report navigation in the log when clicking anchor', (test, parameters) => {
test.skip(options.WIRE);
}, async ({page, server}) => {
await page.setContent(`<a href="${server.PREFIX + '/frames/one-frame.html'}">click me</a>`);
Expand Down
6 changes: 3 additions & 3 deletions test/browser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { it, expect, options } from './playwright.fixtures';
import { it, expect } from './playwright.fixtures';

it('should create new page', async function({browser}) {
const page1 = await browser.newPage();
Expand All @@ -38,9 +38,9 @@ it('should throw upon second create new page', async function({browser}) {
expect(error.message).toContain('Please use browser.newContext()');
});

it('version should work', async function({browser}) {
it('version should work', async function({browser, isChromium}) {
const version = browser.version();
if (options.CHROMIUM)
if (isChromium)
expect(version.match(/^\d+\.\d+\.\d+\.\d+$/)).toBeTruthy();
else
expect(version.match(/^\d+\.\d+/)).toBeTruthy();
Expand Down
8 changes: 4 additions & 4 deletions test/browsercontext-add-cookies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { it, expect, options } from './playwright.fixtures';
import { it, expect } from './playwright.fixtures';

it('should work', async ({context, page, server}) => {
await page.goto(server.EMPTY_PAGE);
Expand Down Expand Up @@ -139,7 +139,7 @@ it('should isolate send cookie header', async ({server, context, browser}) => {
}
});

it('should isolate cookies between launches', test => {
it('should isolate cookies between launches', (test, parameters) => {
test.slow();
}, async ({browserType, server, defaultBrowserOptions}) => {
const browser1 = await browserType.launch(defaultBrowserOptions);
Expand Down Expand Up @@ -315,7 +315,7 @@ it('should set cookies for a frame', async ({context, page, server}) => {
expect(await page.frames()[1].evaluate('document.cookie')).toBe('frame-cookie=value');
});

it('should(not) block third party cookies', async ({context, page, server}) => {
it('should(not) block third party cookies', async ({context, page, server, isChromium, isFirefox}) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(src => {
let fulfill;
Expand All @@ -328,7 +328,7 @@ it('should(not) block third party cookies', async ({context, page, server}) => {
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);
await page.waitForTimeout(2000);
const allowsThirdParty = options.CHROMIUM || options.FIREFOX;
const allowsThirdParty = isChromium || isFirefox;
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) {
expect(cookies).toEqual([
Expand Down
6 changes: 3 additions & 3 deletions test/browsercontext-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { it, expect, options } from './playwright.fixtures';
import { it, expect } from './playwright.fixtures';

import utils from './utils';

Expand Down Expand Up @@ -178,14 +178,14 @@ it('should close all belonging pages once closing context', async function({brow
expect(context.pages().length).toBe(0);
});

it('should disable javascript', async ({browser}) => {
it('should disable javascript', async ({browser, isWebKit}) => {
{
const context = await browser.newContext({ javaScriptEnabled: false });
const page = await context.newPage();
await page.goto('data:text/html, <script>var something = "forbidden"</script>');
let error = null;
await page.evaluate('something').catch(e => error = e);
if (options.WEBKIT)
if (isWebKit)
expect(error.message).toContain('Can\'t find variable: something');
else
expect(error.message).toContain('something is not defined');
Expand Down
8 changes: 4 additions & 4 deletions test/browsercontext-cookies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ it('should properly report httpOnly cookie', async ({context, page, server}) =>
expect(cookies[0].httpOnly).toBe(true);
});

it('should properly report "Strict" sameSite cookie', test => {
test.fail(options.WEBKIT && WIN);
it('should properly report "Strict" sameSite cookie', (test, parameters) => {
test.fail(options.WEBKIT(parameters) && WIN);
}, async ({context, page, server}) => {
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Strict');
Expand All @@ -86,8 +86,8 @@ it('should properly report "Strict" sameSite cookie', test => {
expect(cookies[0].sameSite).toBe('Strict');
});

it('should properly report "Lax" sameSite cookie', test => {
test.fail(options.WEBKIT && WIN);
it('should properly report "Lax" sameSite cookie', (test, parameters) => {
test.fail(options.WEBKIT(parameters) && WIN);
}, async ({context, page, server}) => {
server.setRoute('/empty.html', (req, res) => {
res.setHeader('Set-Cookie', 'name=value;SameSite=Lax');
Expand Down
8 changes: 4 additions & 4 deletions test/browsercontext-credentials.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import { it, expect, options } from './playwright.fixtures';

it('should fail without credentials', test => {
test.fail(options.CHROMIUM && !options.HEADLESS);
it('should fail without credentials', (test, parameters) => {
test.fail(options.CHROMIUM(parameters) && !options.HEADLESS);
}, async ({browser, server}) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext();
Expand All @@ -28,8 +28,8 @@ it('should fail without credentials', test => {
await context.close();
});

it('should work with setHTTPCredentials', test => {
test.fail(options.CHROMIUM && !options.HEADLESS);
it('should work with setHTTPCredentials', (test, parameters) => {
test.fail(options.CHROMIUM(parameters) && !options.HEADLESS);
}, async ({browser, server}) => {
server.setAuth('/empty.html', 'user', 'pass');
const context = await browser.newContext();
Expand Down
4 changes: 2 additions & 2 deletions test/browsercontext-device.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import { it, expect, describe, options } from './playwright.fixtures';

describe('device', suite => {
suite.skip(options.FIREFOX);
describe('device', (suite, parameters) => {
suite.skip(options.FIREFOX(parameters));
}, () => {
it('should work', async ({playwright, browser, server}) => {
const iPhone = playwright.devices['iPhone 6'];
Expand Down
10 changes: 5 additions & 5 deletions test/browsercontext-page-event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ it('should fire page lifecycle events', async function({browser, server}) {
await context.close();
});

it('should work with Shift-clicking', test => {
test.fixme(options.WEBKIT, 'WebKit: Shift+Click does not open a new window.');
it('should work with Shift-clicking', (test, parameters) => {
test.fixme(options.WEBKIT(parameters), 'WebKit: Shift+Click does not open a new window.');
}, async ({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
Expand All @@ -172,9 +172,9 @@ it('should work with Shift-clicking', test => {
await context.close();
});

it('should work with Ctrl-clicking', test => {
test.fixme(options.WEBKIT, 'Ctrl+Click does not open a new tab.');
test.fixme(options.FIREFOX, 'Reports an opener in this case.');
it('should work with Ctrl-clicking', (test, parameters) => {
test.fixme(options.WEBKIT(parameters), 'Ctrl+Click does not open a new tab.');
test.fixme(options.FIREFOX(parameters), 'Reports an opener in this case.');
}, async ({browser, server}) => {
const context = await browser.newContext();
const page = await context.newPage();
Expand Down
4 changes: 2 additions & 2 deletions test/browsercontext-viewport-mobile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import { it, expect, describe, options } from './playwright.fixtures';

describe('mobile viewport', suite => {
suite.skip(options.FIREFOX);
describe('mobile viewport', (suite, parameters) => {
suite.skip(options.FIREFOX(parameters));
}, () => {
it('should support mobile emulation', async ({playwright, browser, server}) => {
const iPhone = playwright.devices['iPhone 6'];
Expand Down
Loading

0 comments on commit f94df31

Please sign in to comment.