Skip to content

Commit

Permalink
test: unskip passing Firefox tests (#966)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgozman authored Feb 13, 2020
1 parent aa60a7c commit fbce290
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
6 changes: 4 additions & 2 deletions test/emulation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
await page.emulateMedia({ colorScheme: 'light' });
const navigated = page.goto(server.EMPTY_PAGE);
for (let i = 0; i < 9; i++) {
page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] });
await new Promise(f => setTimeout(f, 1));
await Promise.all([
page.emulateMedia({ colorScheme: ['dark', 'light'][i & 1] }),
new Promise(f => setTimeout(f, 1)),
]);
}
await navigated;
expect(await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);
Expand Down
4 changes: 2 additions & 2 deletions test/navigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
await page.goto(server.PREFIX + '/one-style.html', {waitUntil: []});
await page.waitForLoadState({ waitUntil: 'domcontentloaded' });
});
it.skip(FFOX)('should work with pages that have loaded before being connected to', async({page, context, server}) => {
it('should work with pages that have loaded before being connected to', async({page, context, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(async () => {
const child = window.open(document.location.href);
Expand Down Expand Up @@ -903,7 +903,7 @@ module.exports.describe = function({testRunner, expect, playwright, MAC, WIN, FF
it('should work', async({page, server}) => {
await page.goto(server.PREFIX + '/frames/one-frame.html');
const frame = page.frames()[1];

const requestPromise = new Promise(resolve => page.route(server.PREFIX + '/one-style.css',resolve));
await frame.goto(server.PREFIX + '/one-style.html', {waitUntil: 'domcontentloaded'});
const request = await requestPromise;
Expand Down
12 changes: 6 additions & 6 deletions test/page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
await newPage.close();
expect(newPage.isClosed()).toBe(true);
});
it.skip(FFOX)('should terminate network waiters', async({context, server}) => {
it('should terminate network waiters', async({context, server}) => {
const newPage = await context.newPage();
const results = await Promise.all([
newPage.waitForRequest(server.EMPTY_PAGE).catch(e => e),
Expand Down Expand Up @@ -220,18 +220,18 @@ module.exports.describe = function({testRunner, expect, headless, playwright, FF
});
});
// @see https://github.com/GoogleChrome/puppeteer/issues/3865
it.skip(FFOX)('should not throw when there are console messages in detached iframes', async({page, server}) => {
it('should not throw when there are console messages in detached iframes', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(async() => {
// 1. Create a popup that Playwright is not connected to.
const win = window.open(window.location.href, 'Title', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=200,top=0,left=0');
while (window.document.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100));
if (window.document.readyState !== 'complete')
await new Promise(f => window.addEventListener('load', f));
// 2. In this popup, create an iframe that console.logs a message.
win.document.body.innerHTML = `<iframe src='/consolelog.html'></iframe>`;
const frame = win.document.querySelector('iframe');
while (frame.contentDocument.readyState !== 'complete')
await new Promise(f => setTimeout(f, 100));
if (!frame.contentDocument || frame.contentDocument.readyState !== 'complete')
await new Promise(f => frame.addEventListener('load', f));
// 3. After that, remove the iframe.
frame.remove();
});
Expand Down
8 changes: 4 additions & 4 deletions test/popup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close();
});
it.skip(FFOX)('should work with clicking target=_blank', async({newContext, server}) => {
it('should work with clicking target=_blank', async({newContext, server}) => {
const context = await newContext();
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
Expand All @@ -109,7 +109,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(true);
await context.close();
});
it.skip(FFOX)('should work with fake-clicking target=_blank and rel=noopener', async({newContext, server}) => {
it('should work with fake-clicking target=_blank and rel=noopener', async({newContext, server}) => {
const context = await newContext();
const page = await context.newPage();
// TODO: FFOX sends events for "one-style.html" request to both pages.
Expand All @@ -125,7 +125,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close();
});
it.skip(FFOX)('should work with clicking target=_blank and rel=noopener', async({newContext, server}) => {
it('should work with clicking target=_blank and rel=noopener', async({newContext, server}) => {
const context = await newContext();
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
Expand All @@ -138,7 +138,7 @@ module.exports.describe = function({testRunner, expect, playwright, CHROMIUM, WE
expect(await popup.evaluate(() => !!window.opener)).toBe(false);
await context.close();
});
it.skip(FFOX)('should not treat navigations as new popups', async({newContext, server}) => {
it('should not treat navigations as new popups', async({newContext, server}) => {
const context = await newContext();
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
Expand Down
3 changes: 1 addition & 2 deletions test/screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const screenshot = await page.screenshot();
expect(screenshot).toBeGolden('screenshot-webgl.png');
});
// firefox is flaky
it.skip(FFOX)('should work while navigating', async({page, server}) => {
it('should work while navigating', async({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/redirectloop1.html');
for (let i = 0; i < 10; i++) {
Expand Down
6 changes: 3 additions & 3 deletions test/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface Expect<T> {

type DescribeFunction = ((name: string, inner: () => void) => void) & {skip(condition: boolean): DescribeFunction};

type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>};
type ItFunction<STATE> = ((name: string, inner: (state: STATE) => Promise<void>) => void) & {skip(condition: boolean): ItFunction<STATE>; repeat(n: number): ItFunction<STATE>};

type TestRunner<STATE> = {
describe: DescribeFunction;
Expand Down Expand Up @@ -94,10 +94,10 @@ interface TestServer {
waitForRequest(path: string): Promise<IncomingMessage>;
reset();
serveFile(request: IncomingMessage, response: ServerResponse, pathName: string);

PORT: number;
PREFIX: string;
CROSS_PROCESS_PREFIX: string;
EMPTY_PAGE: string;

}

0 comments on commit fbce290

Please sign in to comment.