Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: roll test runner 0.9.16 #3998

Merged
merged 1 commit into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 19 additions & 46 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"ws": "^7.3.1"
},
"devDependencies": {
"@playwright/test": "^0.9.6",
"@playwright/test-runner": "^0.9.15",
"@playwright/test": "^0.9.7",
"@playwright/test-runner": "^0.9.16",
"@types/debug": "^4.1.5",
"@types/extract-zip": "^1.6.2",
"@types/mime": "^2.0.3",
Expand All @@ -76,7 +76,7 @@
"socksv5": "0.0.6",
"ts-loader": "^8.0.3",
"typescript": "^4.0.2",
"webpack": "^4.44.1",
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"yaml": "^1.10.0"
}
Expand Down
10 changes: 7 additions & 3 deletions src/client/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,15 @@ import { ChromiumCoverage } from './chromiumCoverage';
import { Waiter } from './waiter';

import * as fs from 'fs';
import * as path from 'path';
import * as util from 'util';
import { Size, URLMatch, Headers, LifecycleEvent, WaitForEventOptions, SelectOption, SelectOptionOptions, FilePayload, WaitForFunctionOptions } from './types';
import { evaluationScript, urlMatches } from './clientHelper';
import { isString, isRegExp, isObject, mkdirIfNeeded, headersObjectToArray } from '../utils/utils';

const fsWriteFileAsync = util.promisify(fs.writeFile.bind(fs));
const mkdirAsync = util.promisify(fs.mkdir);

type PDFOptions = Omit<channels.PagePdfParams, 'width' | 'height' | 'margin'> & {
width?: string | number,
height?: string | number,
Expand All @@ -56,8 +60,6 @@ type PDFOptions = Omit<channels.PagePdfParams, 'width' | 'height' | 'margin'> &
};
type Listener = (...args: any[]) => void;

const fsWriteFileAsync = util.promisify(fs.writeFile.bind(fs));

export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitializer> {
private _browserContext: BrowserContext;
_ownedContext: BrowserContext | undefined;
Expand Down Expand Up @@ -581,8 +583,10 @@ export class Page extends ChannelOwner<channels.PageChannel, channels.PageInitia
}
const result = await this._channel.pdf(transportOptions);
const buffer = Buffer.from(result.pdf, 'base64');
if (options.path)
if (options.path) {
await mkdirAsync(path.dirname(options.path), { recursive: true });
await fsWriteFileAsync(options.path, buffer);
}
return buffer;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/trace/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Tracer implements ContextListener {
async onContextCreated(context: BrowserContext): Promise<void> {
if (!context._options.recordTrace)
return;
const traceStorageDir = path.join(context._browser._options.artifactsPath!, '.playwright-shared');
const traceStorageDir = path.join(context._browser._options.artifactsPath!, 'trace-resources');
const traceFile = path.join(context._artifactsPath!, 'playwright.trace');
const contextTracer = new ContextTracer(context, traceStorageDir, traceFile);
this._contextTracers.set(context, contextTracer);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed test/__snapshots__/request-fulfill/webkit/mock-svg.png
Diff not rendered.
4 changes: 2 additions & 2 deletions test/chromium/oopif.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ describe('oopif', (suite, { browserName }) => {
expect(intercepted).toBe(true);
});

it('should take screenshot', async ({browser, page, server, golden}) => {
it('should take screenshot', async ({browser, page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/dynamic-oopif.html');
expect(page.frames().length).toBe(2);
expect(await countOOPIFs(browser)).toBe(1);
expect(await page.screenshot()).toMatchImage(golden('screenshot-oopif.png'), { threshold: 0.3 });
expect(await page.screenshot()).toMatchImage('screenshot-oopif.png', { threshold: 0.3 });
});

it('should load oopif iframes with subresources and route', async function({browser, page, server, context}) {
Expand Down
8 changes: 4 additions & 4 deletions test/chromium/tracing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type TestState = {
const fixtures = playwrightFixtures.declareTestFixtures<TestState>();
const { it, expect, describe, defineTestFixture } = fixtures;

defineTestFixture('outputTraceFile', async ({testOutputDir}, test) => {
await test(path.join(testOutputDir, `trace.json`));
defineTestFixture('outputTraceFile', async ({testOutputPath}, test) => {
await test(testOutputPath(path.join(`trace.json`)));
});

describe('oopif', (suite, { browserName }) => {
Expand All @@ -39,8 +39,8 @@ describe('oopif', (suite, { browserName }) => {
expect(fs.existsSync(outputTraceFile)).toBe(true);
});

it('should create directories as needed', async ({browser, page, server, testOutputDir}) => {
const filePath = path.join(testOutputDir, 'these', 'are', 'directories', 'trace.json');
it('should create directories as needed', async ({browser, page, server, testOutputPath}) => {
const filePath = testOutputPath(path.join('these', 'are', 'directories', 'trace.json'));
await (browser as ChromiumBrowser).startTracing(page, {screenshots: true, path: filePath});
await page.goto(server.PREFIX + '/grid.html');
await (browser as ChromiumBrowser).stopTracing();
Expand Down
Loading