Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: roll test runner 0.9.16 (#3998)

Pavel Feldmande1e63dff1fe
diff --git a/package-lock.json b/package-lock.json
index ab6fb9016c..8646bc342b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1187,22 +1187,22 @@
}
},
"@playwright/test": {
- "version": "0.9.6",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-0.9.6.tgz",
- "integrity": "sha512-T3mHVXIKRBfKmd7cTxlB8WmPtqvz5q/1yBTYcDQHUv51vfaP4xciK1bg0N1VJTjqzQ9ytBp1CTwgOgrA4or29w==",
+ "version": "0.9.7",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-0.9.7.tgz",
+ "integrity": "sha512-llqV967KlRZ5mWNm0DpEkqi/42UBIssM/JzZ83KbTQdbmGhmx8L4hcJ6c1ExeFe/qq5uvL0mae1yuKfqxPBrPg==",
"dev": true,
"requires": {
"jpeg-js": "^0.4.2",
"pixelmatch": "^5.2.1",
- "playwright": "^1.3.0",
+ "playwright": "1.4.0-next.1601161680085",
"pngjs": "^5.0.0",
"rimraf": "^3.0.2"
}
},
"@playwright/test-runner": {
- "version": "0.9.15",
- "resolved": "https://registry.npmjs.org/@playwright/test-runner/-/test-runner-0.9.15.tgz",
- "integrity": "sha512-1ilbB+ZDDmr4GnT/7omtGUTthcdAOLvMSOqqUd11OhNOo0IgYn3T6Iu8lwO+gdWYyALwyzk5OKIHldRV33ULXw==",
+ "version": "0.9.16",
+ "resolved": "https://registry.npmjs.org/@playwright/test-runner/-/test-runner-0.9.16.tgz",
+ "integrity": "sha512-dbuF01oydF3uV6K24LnFpy6CIRULIjZK4YainHPgpmjDBpU5/BukTdW6xcJDHPSj4hbs9ycIDHvz6YCS5pMxew==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
@@ -2029,16 +2029,6 @@
"dev": true,
"optional": true
},
- "bindings": {
- "version": "1.5.0",
- "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
- "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
- "dev": true,
- "optional": true,
- "requires": {
- "file-uri-to-path": "1.0.0"
- }
- },
"bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@@ -3003,9 +2993,9 @@
}
},
"electron-to-chromium": {
- "version": "1.3.573",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.573.tgz",
- "integrity": "sha512-oypaNmexr8w0m2GX67fGLQ0Xgsd7uXz7GcwaHZ9eW3ZdQ8uA2+V/wXmLdMTk3gcacbqQGAN7CXWG3fOkfKYftw==",
+ "version": "1.3.575",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.575.tgz",
+ "integrity": "sha512-031VrjcilnE8bXivDGhEeuGjMZrjTAeyAKm3XWPY9SvGYE6Hn8003gCqoNszFu6lh1v0gDx5hrM0VE1cPSMUkQ==",
"dev": true
},
"elliptic": {
@@ -3211,9 +3201,9 @@
}
},
"eslint": {
- "version": "7.9.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz",
- "integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==",
+ "version": "7.10.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.10.0.tgz",
+ "integrity": "sha512-BDVffmqWl7JJXqCjAK6lWtcQThZB/aP1HXSH1JKwGwv0LQEdvpR7qzNrUT487RM39B5goWuboFad5ovMBmD8yA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@@ -3224,7 +3214,7 @@
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"enquirer": "^2.3.5",
- "eslint-scope": "^5.1.0",
+ "eslint-scope": "^5.1.1",
"eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^1.3.0",
"espree": "^7.3.0",
@@ -3728,13 +3718,6 @@
"flat-cache": "^2.0.1"
}
},
- "file-uri-to-path": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
- "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
- "dev": true,
- "optional": true
- },
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -5388,13 +5371,6 @@
"readable-stream": "^2.0.5"
}
},
- "nan": {
- "version": "2.14.1",
- "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
- "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
- "dev": true,
- "optional": true
- },
"nanomatch": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
@@ -5996,9 +5972,9 @@
"dev": true
},
"playwright": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.4.2.tgz",
- "integrity": "sha512-qiQHrhU4JBxup9JoGZff6hdFL2VrD+ae5QLELGHwRq/vYNQFeJF10Z3ENnQ6hWJmG+YnpfzgoBvX+cUg4WHwTw==",
+ "version": "1.4.0-next.1601161680085",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.4.0-next.1601161680085.tgz",
+ "integrity": "sha512-IpBNNG8vPVjm5SeGzzwCrz2aMv1K8KMyUvEsAYJnkDOwgOIVECtdJkM6WZmvIjw2bxS+QxHsX7mA9y42C1B+Qg==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@@ -6008,6 +5984,7 @@
"mime": "^2.4.6",
"pngjs": "^5.0.0",
"progress": "^2.0.3",
+ "proper-lockfile": "^4.1.1",
"proxy-from-env": "^1.1.0",
"rimraf": "^3.0.2",
"ws": "^7.3.1"
@@ -7809,11 +7786,7 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
- "optional": true,
- "requires": {
- "bindings": "^1.5.0",
- "nan": "^2.12.1"
- }
+ "optional": true
},
"glob-parent": {
"version": "3.1.0",
diff --git a/package.json b/package.json
index a65751805a..3a4f8cb4dc 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -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"
}
diff --git a/src/client/page.ts b/src/client/page.ts
index fd0bed3493..2b93e26ee6 100644
--- a/src/client/page.ts
+++ b/src/client/page.ts
@@ -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,
@@ -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;
@@ -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;
}
}
diff --git a/src/trace/tracer.ts b/src/trace/tracer.ts
index 7da65302ed..4c2c2e824e 100644
--- a/src/trace/tracer.ts
+++ b/src/trace/tracer.ts
@@ -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);
diff --git a/test/__snapshots__/chromium/oopif/chromium/screenshot-oopif.png b/test/__snapshots__/chromium/oopif/chromium/screenshot-oopif.png
deleted file mode 100644
index 951e96f178..0000000000
Binary files a/test/__snapshots__/chromium/oopif/chromium/screenshot-oopif.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-iframe.png b/test/__snapshots__/chromium/oopif/should-take-screenshot/chromium/screenshot-oopif.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-iframe.png
rename to test/__snapshots__/chromium/oopif/should-take-screenshot/chromium/screenshot-oopif.png
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional-offset.png b/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional-offset.png
deleted file mode 100644
index 6b65c6fd6b..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional-offset.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional.png b/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional.png
deleted file mode 100644
index bd1810da8b..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-fractional.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-bounding-box.png
rename to test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-bounding-box.png
rename to test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.png
diff --git a/test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..1f74a3bafb
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-larger-than-viewport.png
rename to test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.png
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-larger-than-viewport.png
rename to test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png
new file mode 100644
index 0000000000..c4588132e9
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png
new file mode 100644
index 0000000000..52c1bb2b92
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png
new file mode 100644
index 0000000000..6d28cddcea
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png
new file mode 100644
index 0000000000..c4588132e9
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-scrolled-into-view.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-scrolled-into-view.png
rename to test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.png
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-scrolled-into-view.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-scrolled-into-view.png
rename to test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png
new file mode 100644
index 0000000000..971006d83d
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-padding-border.png
rename to test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.png
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-padding-border.png
rename to test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png b/test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png
new file mode 100644
index 0000000000..971006d83d
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png
new file mode 100644
index 0000000000..fc34319896
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png
new file mode 100644
index 0000000000..2b72c7528b
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png
new file mode 100644
index 0000000000..971006d83d
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-mobile.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-mobile.png
rename to test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..9e208f86d8
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..1f74a3bafb
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..c2c3ddca29
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..9e208f86d8
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..1f74a3bafb
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png
new file mode 100644
index 0000000000..971561ba69
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-fractional-offset.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-fractional-offset.png
rename to test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png
new file mode 100644
index 0000000000..b77e821eaa
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png
new file mode 100644
index 0000000000..35c53377f9
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-fractional.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-fractional.png
rename to test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png
new file mode 100644
index 0000000000..aca659827c
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png
new file mode 100644
index 0000000000..c2c3ddca29
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png
new file mode 100644
index 0000000000..1f74a3bafb
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-rotate.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-rotate.png
rename to test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.png
diff --git a/test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-rotate.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/firefox/screenshot-element-rotate.png
rename to test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png
new file mode 100644
index 0000000000..a075ad82fa
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-mobile-dsf.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.png
similarity index 100%
rename from test/__snapshots__/elementhandle-screenshot/chromium/screenshot-element-mobile-dsf.png
rename to test/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.png
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png b/test/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png
new file mode 100644
index 0000000000..eefbc4136e
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..c2c3ddca29
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..9e208f86d8
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png
new file mode 100644
index 0000000000..1f74a3bafb
Binary files /dev/null and b/test/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-bounding-box.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-bounding-box.png
deleted file mode 100644
index ad6858bf2f..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-bounding-box.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional-offset.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional-offset.png
deleted file mode 100644
index ac79d2f938..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional-offset.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional.png
deleted file mode 100644
index 03c539bc86..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-fractional.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-larger-than-viewport.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-larger-than-viewport.png
deleted file mode 100644
index aacf91548e..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-larger-than-viewport.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile-dsf.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile-dsf.png
deleted file mode 100644
index 8a965e7e64..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile-dsf.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile.png
deleted file mode 100644
index ad6858bf2f..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-mobile.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-padding-border.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-padding-border.png
deleted file mode 100644
index 4a1e362cdb..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-padding-border.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-rotate.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-rotate.png
deleted file mode 100644
index b6eadf8907..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-rotate.png and /dev/null differ
diff --git a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-scrolled-into-view.png b/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-scrolled-into-view.png
deleted file mode 100644
index 4a1e362cdb..0000000000
Binary files a/test/__snapshots__/elementhandle-screenshot/webkit/screenshot-element-scrolled-into-view.png and /dev/null differ
diff --git a/test/__snapshots__/emulation-focus/chromium/grid-cell-0.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/chromium/grid-cell-0.png
similarity index 100%
rename from test/__snapshots__/emulation-focus/chromium/grid-cell-0.png
rename to test/__snapshots__/emulation-focus/should-not-affect-screenshots/chromium/grid-cell-0.png
diff --git a/test/__snapshots__/emulation-focus/chromium/screenshot-sanity.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/chromium/screenshot-sanity.png
similarity index 100%
rename from test/__snapshots__/emulation-focus/chromium/screenshot-sanity.png
rename to test/__snapshots__/emulation-focus/should-not-affect-screenshots/chromium/screenshot-sanity.png
diff --git a/test/__snapshots__/emulation-focus/firefox/grid-cell-0.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/firefox/grid-cell-0.png
similarity index 100%
rename from test/__snapshots__/emulation-focus/firefox/grid-cell-0.png
rename to test/__snapshots__/emulation-focus/should-not-affect-screenshots/firefox/grid-cell-0.png
diff --git a/test/__snapshots__/emulation-focus/firefox/screenshot-sanity.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/firefox/screenshot-sanity.png
similarity index 100%
rename from test/__snapshots__/emulation-focus/firefox/screenshot-sanity.png
rename to test/__snapshots__/emulation-focus/should-not-affect-screenshots/firefox/screenshot-sanity.png
diff --git a/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/grid-cell-0.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/grid-cell-0.png
new file mode 100644
index 0000000000..aa981f033f
Binary files /dev/null and b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/grid-cell-0.png differ
diff --git a/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/screenshot-sanity.png b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/screenshot-sanity.png
new file mode 100644
index 0000000000..af070c52a8
Binary files /dev/null and b/test/__snapshots__/emulation-focus/should-not-affect-screenshots/webkit/screenshot-sanity.png differ
diff --git a/test/__snapshots__/emulation-focus/webkit/grid-cell-0.png b/test/__snapshots__/emulation-focus/webkit/grid-cell-0.png
deleted file mode 100644
index 117929e479..0000000000
Binary files a/test/__snapshots__/emulation-focus/webkit/grid-cell-0.png and /dev/null differ
diff --git a/test/__snapshots__/emulation-focus/webkit/screenshot-sanity.png b/test/__snapshots__/emulation-focus/webkit/screenshot-sanity.png
deleted file mode 100644
index 4cf1a338fc..0000000000
Binary files a/test/__snapshots__/emulation-focus/webkit/screenshot-sanity.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-clip-odd-size.png b/test/__snapshots__/page-screenshot/chromium/screenshot-clip-odd-size.png
deleted file mode 100644
index b010d1f87f..0000000000
Binary files a/test/__snapshots__/page-screenshot/chromium/screenshot-clip-odd-size.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-mobile-fullpage.png b/test/__snapshots__/page-screenshot/chromium/screenshot-mobile-fullpage.png
deleted file mode 100644
index bb975e20ef..0000000000
Binary files a/test/__snapshots__/page-screenshot/chromium/screenshot-mobile-fullpage.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-webgl.png b/test/__snapshots__/page-screenshot/firefox/screenshot-webgl.png
deleted file mode 100644
index 76109512b5..0000000000
Binary files a/test/__snapshots__/page-screenshot/firefox/screenshot-webgl.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-sanity.png
rename to test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-sanity.png
rename to test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.png
diff --git a/test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png
new file mode 100644
index 0000000000..af070c52a8
Binary files /dev/null and b/test/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/white.jpg b/test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpg
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/white.jpg
rename to test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpg
diff --git a/test/__snapshots__/page-screenshot/firefox/white.jpg b/test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpg
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/white.jpg
rename to test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpg
diff --git a/test/__snapshots__/page-screenshot/webkit/white.jpg b/test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpg
similarity index 100%
rename from test/__snapshots__/page-screenshot/webkit/white.jpg
rename to test/__snapshots__/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpg
diff --git a/test/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png
new file mode 100644
index 0000000000..122a4f0ae0
Binary files /dev/null and b/test/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png
new file mode 100644
index 0000000000..7b16493355
Binary files /dev/null and b/test/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png b/test/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png
new file mode 100644
index 0000000000..af070c52a8
Binary files /dev/null and b/test/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/transparent.png b/test/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/transparent.png
rename to test/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.png
diff --git a/test/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png b/test/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png
new file mode 100644
index 0000000000..3a089261de
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-offscreen-clip.png b/test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-offscreen-clip.png
rename to test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-offscreen-clip.png b/test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-offscreen-clip.png
rename to test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.png
diff --git a/test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png b/test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png
new file mode 100644
index 0000000000..2b8dc1065f
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-clip-rect.png
rename to test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-clip-rect.png
rename to test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.png
diff --git a/test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png
new file mode 100644
index 0000000000..7b84d4aecb
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png differ
diff --git a/test/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png
new file mode 100644
index 0000000000..8c4046910b
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png differ
diff --git a/test/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png
new file mode 100644
index 0000000000..6459e3afe7
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png differ
diff --git a/test/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png
new file mode 100644
index 0000000000..7b84d4aecb
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png differ
diff --git a/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg
new file mode 100644
index 0000000000..0bc91643aa
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg differ
diff --git a/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg
new file mode 100644
index 0000000000..40eb86d77b
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg differ
diff --git a/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg
new file mode 100644
index 0000000000..3f6faefd6e
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg differ
diff --git a/test/__snapshots__/page-screenshot/chromium/grid-cell-0.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/grid-cell-0.png
rename to test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.png
diff --git a/test/__snapshots__/page-screenshot/chromium/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/grid-cell-1.png
rename to test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.png
diff --git a/test/__snapshots__/page-screenshot/firefox/grid-cell-0.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/grid-cell-0.png
rename to test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.png
diff --git a/test/__snapshots__/page-screenshot/firefox/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/grid-cell-1.png
rename to test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.png
diff --git a/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png
new file mode 100644
index 0000000000..aa981f033f
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png differ
diff --git a/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png
new file mode 100644
index 0000000000..a1d76a1a89
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png differ
diff --git a/test/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png
new file mode 100644
index 0000000000..2eab11668d
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png differ
diff --git a/test/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png
new file mode 100644
index 0000000000..55d6a44412
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png differ
diff --git a/test/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png b/test/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png
new file mode 100644
index 0000000000..a1d76a1a89
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-grid-fullpage.png b/test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-grid-fullpage.png
rename to test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-grid-fullpage.png b/test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-grid-fullpage.png
rename to test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.png
diff --git a/test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png b/test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png
new file mode 100644
index 0000000000..4c271deec3
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-canvas.png b/test/__snapshots__/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-canvas.png
rename to test/__snapshots__/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-canvas.png b/test/__snapshots__/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-canvas.png
rename to test/__snapshots__/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.png
diff --git a/test/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png b/test/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png
new file mode 100644
index 0000000000..40deba53d5
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-translateZ.png b/test/__snapshots__/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-translateZ.png
rename to test/__snapshots__/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-translateZ.png b/test/__snapshots__/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-translateZ.png
rename to test/__snapshots__/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.png
diff --git a/test/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png b/test/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png
new file mode 100644
index 0000000000..3c5f91d4be
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-webgl.png b/test/__snapshots__/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-webgl.png
rename to test/__snapshots__/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.png
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-mobile-clip.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-mobile-clip.png
rename to test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.png
diff --git a/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png
new file mode 100644
index 0000000000..ce3af8efd7
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png
new file mode 100644
index 0000000000..672ab24729
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png
new file mode 100644
index 0000000000..c136cc08fa
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-mobile.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-mobile.png
rename to test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.png
diff --git a/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png
new file mode 100644
index 0000000000..9ec352d629
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png differ
diff --git a/test/__snapshots__/page-screenshot/chromium/screenshot-device-scale-factor.png b/test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/chromium/screenshot-device-scale-factor.png
rename to test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.png
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-device-scale-factor.png b/test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-device-scale-factor.png
rename to test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.png
diff --git a/test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png b/test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png
new file mode 100644
index 0000000000..77a2f9f97e
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png b/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png
new file mode 100644
index 0000000000..56aa8706bb
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png differ
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-iframe.png b/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-iframe.png
rename to test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.png
diff --git a/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png b/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png
new file mode 100644
index 0000000000..bfaaf908ed
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png b/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png
new file mode 100644
index 0000000000..61c0b7044a
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png differ
diff --git a/test/__snapshots__/page-screenshot/firefox/screenshot-clip-odd-size.png b/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.png
similarity index 100%
rename from test/__snapshots__/page-screenshot/firefox/screenshot-clip-odd-size.png
rename to test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.png
diff --git a/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png b/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png
new file mode 100644
index 0000000000..32f6650cfc
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png b/test/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png
new file mode 100644
index 0000000000..122a4f0ae0
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png b/test/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png
new file mode 100644
index 0000000000..7b16493355
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png b/test/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png
new file mode 100644
index 0000000000..af070c52a8
Binary files /dev/null and b/test/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png differ
diff --git a/test/__snapshots__/page-screenshot/webkit/grid-cell-0.png b/test/__snapshots__/page-screenshot/webkit/grid-cell-0.png
deleted file mode 100644
index 117929e479..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/grid-cell-0.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/grid-cell-1.png b/test/__snapshots__/page-screenshot/webkit/grid-cell-1.png
deleted file mode 100644
index 9007ff0a95..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/grid-cell-1.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-canvas.png b/test/__snapshots__/page-screenshot/webkit/screenshot-canvas.png
deleted file mode 100644
index 0a40e94959..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-canvas.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-clip-odd-size.png b/test/__snapshots__/page-screenshot/webkit/screenshot-clip-odd-size.png
deleted file mode 100644
index 86a4d51ca0..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-clip-odd-size.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-clip-rect.png b/test/__snapshots__/page-screenshot/webkit/screenshot-clip-rect.png
deleted file mode 100644
index 8bfbcda983..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-clip-rect.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-device-scale-factor.png b/test/__snapshots__/page-screenshot/webkit/screenshot-device-scale-factor.png
deleted file mode 100644
index a9729736ef..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-device-scale-factor.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-grid-fullpage.png b/test/__snapshots__/page-screenshot/webkit/screenshot-grid-fullpage.png
deleted file mode 100644
index 494d216e00..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-grid-fullpage.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-iframe.png b/test/__snapshots__/page-screenshot/webkit/screenshot-iframe.png
deleted file mode 100644
index 868ab58ac9..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-iframe.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-clip.png b/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-clip.png
deleted file mode 100644
index fd3a8600b5..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-clip.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-fullpage.png b/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-fullpage.png
deleted file mode 100644
index 8e72219561..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile-fullpage.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile.png b/test/__snapshots__/page-screenshot/webkit/screenshot-mobile.png
deleted file mode 100644
index 4ba38135af..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-mobile.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-offscreen-clip.png b/test/__snapshots__/page-screenshot/webkit/screenshot-offscreen-clip.png
deleted file mode 100644
index 9882dd3b49..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-offscreen-clip.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-sanity.png b/test/__snapshots__/page-screenshot/webkit/screenshot-sanity.png
deleted file mode 100644
index 4cf1a338fc..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-sanity.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-translateZ.png b/test/__snapshots__/page-screenshot/webkit/screenshot-translateZ.png
deleted file mode 100644
index 74a525b9c5..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-translateZ.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/screenshot-webgl.png b/test/__snapshots__/page-screenshot/webkit/screenshot-webgl.png
deleted file mode 100644
index 18d35c5ac1..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/screenshot-webgl.png and /dev/null differ
diff --git a/test/__snapshots__/page-screenshot/webkit/transparent.png b/test/__snapshots__/page-screenshot/webkit/transparent.png
deleted file mode 100644
index 2c60e44978..0000000000
Binary files a/test/__snapshots__/page-screenshot/webkit/transparent.png and /dev/null differ
diff --git a/test/__snapshots__/request-fulfill/chromium/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png
similarity index 95%
rename from test/__snapshots__/request-fulfill/chromium/mock-binary-response.png
rename to test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png
index e4f6191796..c7f8bb7ecd 100644
Binary files a/test/__snapshots__/request-fulfill/chromium/mock-binary-response.png and b/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png differ
diff --git a/test/__snapshots__/request-fulfill/firefox/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.png
similarity index 100%
rename from test/__snapshots__/request-fulfill/firefox/mock-binary-response.png
rename to test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.png
diff --git a/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png
new file mode 100644
index 0000000000..35a14cdc20
Binary files /dev/null and b/test/__snapshots__/request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png differ
diff --git a/test/__snapshots__/request-fulfill/chromium/mock-svg.png b/test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.png
similarity index 100%
rename from test/__snapshots__/request-fulfill/chromium/mock-svg.png
rename to test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.png
diff --git a/test/__snapshots__/request-fulfill/firefox/mock-svg.png b/test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.png
similarity index 100%
rename from test/__snapshots__/request-fulfill/firefox/mock-svg.png
rename to test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.png
diff --git a/test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png b/test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png
new file mode 100644
index 0000000000..471782431e
Binary files /dev/null and b/test/__snapshots__/request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png differ
diff --git a/test/__snapshots__/request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png
new file mode 100644
index 0000000000..c7f8bb7ecd
Binary files /dev/null and b/test/__snapshots__/request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png differ
diff --git a/test/__snapshots__/request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png
new file mode 100644
index 0000000000..e7eaf59779
Binary files /dev/null and b/test/__snapshots__/request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png differ
diff --git a/test/__snapshots__/request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png b/test/__snapshots__/request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png
new file mode 100644
index 0000000000..35a14cdc20
Binary files /dev/null and b/test/__snapshots__/request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png differ
diff --git a/test/__snapshots__/request-fulfill/webkit/mock-binary-response.png b/test/__snapshots__/request-fulfill/webkit/mock-binary-response.png
deleted file mode 100644
index c7598e390e..0000000000
Binary files a/test/__snapshots__/request-fulfill/webkit/mock-binary-response.png and /dev/null differ
diff --git a/test/__snapshots__/request-fulfill/webkit/mock-svg.png b/test/__snapshots__/request-fulfill/webkit/mock-svg.png
deleted file mode 100644
index 668e8292fa..0000000000
Binary files a/test/__snapshots__/request-fulfill/webkit/mock-svg.png and /dev/null differ
diff --git a/test/chromium/oopif.spec.ts b/test/chromium/oopif.spec.ts
index b6077c6c2f..5048b60654 100644
--- a/test/chromium/oopif.spec.ts
+++ b/test/chromium/oopif.spec.ts
@@ -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}) {
diff --git a/test/chromium/tracing.spec.ts b/test/chromium/tracing.spec.ts
index 68c2a5e51d..b4c9749dc7 100644
--- a/test/chromium/tracing.spec.ts
+++ b/test/chromium/tracing.spec.ts
@@ -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 }) => {
@@ -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();
diff --git a/test/download.spec.ts b/test/download.spec.ts
index 3f61462e25..2f62d72179 100644
--- a/test/download.spec.ts
+++ b/test/download.spec.ts
@@ -61,28 +61,28 @@ it('should report downloads with acceptDownloads: true', async ({browser, server
await page.close();
});
-it('should save to user-specified path', async ({testOutputDir, browser, server}) => {
+it('should save to user-specified path', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
await download.saveAs(userPath);
expect(fs.existsSync(userPath)).toBeTruthy();
expect(fs.readFileSync(userPath).toString()).toBe('Hello world');
await page.close();
});
-it('should save to user-specified path without updating original path', async ({testOutputDir, browser, server}) => {
+it('should save to user-specified path without updating original path', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
await download.saveAs(userPath);
expect(fs.existsSync(userPath)).toBeTruthy();
expect(fs.readFileSync(userPath).toString()).toBe('Hello world');
@@ -93,33 +93,33 @@ it('should save to user-specified path without updating original path', async ({
await page.close();
});
-it('should save to two different paths with multiple saveAs calls', async ({testOutputDir, browser, server}) => {
+it('should save to two different paths with multiple saveAs calls', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
await download.saveAs(userPath);
expect(fs.existsSync(userPath)).toBeTruthy();
expect(fs.readFileSync(userPath).toString()).toBe('Hello world');
- const anotherUserPath = path.join(testOutputDir, 'download (2).txt');
+ const anotherUserPath = testOutputPath('download (2).txt');
await download.saveAs(anotherUserPath);
expect(fs.existsSync(anotherUserPath)).toBeTruthy();
expect(fs.readFileSync(anotherUserPath).toString()).toBe('Hello world');
await page.close();
});
-it('should save to overwritten filepath', async ({testOutputDir, browser, server}) => {
+it('should save to overwritten filepath', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const dir = path.join(testOutputDir, 'downloads');
+ const dir = testOutputPath('downloads');
const userPath = path.join(dir, 'download.txt');
await download.saveAs(userPath);
expect((await util.promisify(fs.readdir)(dir)).length).toBe(1);
@@ -130,14 +130,14 @@ it('should save to overwritten filepath', async ({testOutputDir, browser, server
await page.close();
});
-it('should create subdirectories when saving to non-existent user-specified path', async ({testOutputDir, browser, server}) => {
+it('should create subdirectories when saving to non-existent user-specified path', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const nestedPath = path.join(testOutputDir, 'these', 'are', 'directories', 'download.txt');
+ const nestedPath = testOutputPath(path.join('these', 'are', 'directories', 'download.txt'));
await download.saveAs(nestedPath);
expect(fs.existsSync(nestedPath)).toBeTruthy();
expect(fs.readFileSync(nestedPath).toString()).toBe('Hello world');
@@ -146,7 +146,7 @@ it('should create subdirectories when saving to non-existent user-specified path
it('should save when connected remotely', (test, { wire }) => {
test.skip(wire);
-}, async ({testOutputDir, server, browserType, remoteServer}) => {
+}, async ({testOutputPath, server, browserType, remoteServer}) => {
const browser = await browserType.connect({ wsEndpoint: remoteServer.wsEndpoint() });
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
@@ -154,7 +154,7 @@ it('should save when connected remotely', (test, { wire }) => {
page.waitForEvent('download'),
page.click('a')
]);
- const nestedPath = path.join(testOutputDir, 'these', 'are', 'directories', 'download.txt');
+ const nestedPath = testOutputPath(path.join('these', 'are', 'directories', 'download.txt'));
await download.saveAs(nestedPath);
expect(fs.existsSync(nestedPath)).toBeTruthy();
expect(fs.readFileSync(nestedPath).toString()).toBe('Hello world');
@@ -163,27 +163,27 @@ it('should save when connected remotely', (test, { wire }) => {
await browser.close();
});
-it('should error when saving with downloads disabled', async ({testOutputDir, browser, server}) => {
+it('should error when saving with downloads disabled', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: false });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
const { message } = await download.saveAs(userPath).catch(e => e);
expect(message).toContain('Pass { acceptDownloads: true } when you are creating your browser context');
await page.close();
});
-it('should error when saving after deletion', async ({testOutputDir, browser, server}) => {
+it('should error when saving after deletion', async ({testOutputPath, browser, server}) => {
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
await download.delete();
const { message } = await download.saveAs(userPath).catch(e => e);
expect(message).toContain('Download already deleted. Save before deleting.');
@@ -192,7 +192,7 @@ it('should error when saving after deletion', async ({testOutputDir, browser, se
it('should error when saving after deletion when connected remotely', (test, { wire }) => {
test.skip(wire);
-}, async ({testOutputDir, server, browserType, remoteServer}) => {
+}, async ({testOutputPath, server, browserType, remoteServer}) => {
const browser = await browserType.connect({ wsEndpoint: remoteServer.wsEndpoint() });
const page = await browser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
@@ -200,7 +200,7 @@ it('should error when saving after deletion when connected remotely', (test, { w
page.waitForEvent('download'),
page.click('a')
]);
- const userPath = path.join(testOutputDir, 'download.txt');
+ const userPath = testOutputPath('download.txt');
await download.delete();
const { message } = await download.saveAs(userPath).catch(e => e);
expect(message).toContain('Download already deleted. Save before deleting.');
diff --git a/test/downloads-path.spec.ts b/test/downloads-path.spec.ts
index 2a512e548f..55dfd5d3ab 100644
--- a/test/downloads-path.spec.ts
+++ b/test/downloads-path.spec.ts
@@ -26,7 +26,7 @@ type TestState = {
const fixtures = baseFixtures.declareTestFixtures<TestState>();
const { it, expect, defineTestFixture } = fixtures;
-defineTestFixture('downloadsBrowser', async ({server, browserType, defaultBrowserOptions, testOutputDir}, test) => {
+defineTestFixture('downloadsBrowser', async ({server, browserType, defaultBrowserOptions, testOutputPath}, test) => {
server.setRoute('/download', (req, res) => {
res.setHeader('Content-Type', 'application/octet-stream');
res.setHeader('Content-Disposition', 'attachment; filename=file.txt');
@@ -34,13 +34,13 @@ defineTestFixture('downloadsBrowser', async ({server, browserType, defaultBrowse
});
const browser = await browserType.launch({
...defaultBrowserOptions,
- downloadsPath: testOutputDir,
+ downloadsPath: testOutputPath(''),
});
await test(browser);
await browser.close();
});
-defineTestFixture('persistentDownloadsContext', async ({server, launchPersistent, testOutputDir}, test) => {
+defineTestFixture('persistentDownloadsContext', async ({server, launchPersistent, testOutputPath}, test) => {
server.setRoute('/download', (req, res) => {
res.setHeader('Content-Type', 'application/octet-stream');
res.setHeader('Content-Disposition', 'attachment; filename=file.txt');
@@ -48,7 +48,7 @@ defineTestFixture('persistentDownloadsContext', async ({server, launchPersistent
});
const { context, page } = await launchPersistent(
{
- downloadsPath: testOutputDir,
+ downloadsPath: testOutputPath(''),
acceptDownloads: true
}
);
@@ -57,7 +57,7 @@ defineTestFixture('persistentDownloadsContext', async ({server, launchPersistent
await context.close();
});
-it('should keep downloadsPath folder', async ({downloadsBrowser, testOutputDir, server}) => {
+it('should keep downloadsPath folder', async ({downloadsBrowser, testOutputPath, server}) => {
const page = await downloadsBrowser.newPage();
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
@@ -69,7 +69,7 @@ it('should keep downloadsPath folder', async ({downloadsBrowser, testOutputDir,
await download.path().catch(e => void 0);
await page.close();
await downloadsBrowser.close();
- expect(fs.existsSync(testOutputDir)).toBeTruthy();
+ expect(fs.existsSync(testOutputPath(''))).toBeTruthy();
});
it('should delete downloads when context closes', async ({downloadsBrowser, server}) => {
@@ -86,7 +86,7 @@ it('should delete downloads when context closes', async ({downloadsBrowser, serv
});
-it('should report downloads in downloadsPath folder', async ({downloadsBrowser, testOutputDir, server}) => {
+it('should report downloads in downloadsPath folder', async ({downloadsBrowser, testOutputPath, server}) => {
const page = await downloadsBrowser.newPage({ acceptDownloads: true });
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);
const [ download ] = await Promise.all([
@@ -94,11 +94,11 @@ it('should report downloads in downloadsPath folder', async ({downloadsBrowser,
page.click('a')
]);
const path = await download.path();
- expect(path.startsWith(testOutputDir)).toBeTruthy();
+ expect(path.startsWith(testOutputPath(''))).toBeTruthy();
await page.close();
});
-it('should accept downloads', async ({persistentDownloadsContext, testOutputDir, server}) => {
+it('should accept downloads', async ({persistentDownloadsContext, testOutputPath, server}) => {
const page = persistentDownloadsContext.pages()[0];
const [ download ] = await Promise.all([
page.waitForEvent('download'),
@@ -107,7 +107,7 @@ it('should accept downloads', async ({persistentDownloadsContext, testOutputDir,
expect(download.url()).toBe(`${server.PREFIX}/download`);
expect(download.suggestedFilename()).toBe(`file.txt`);
const path = await download.path();
- expect(path.startsWith(testOutputDir)).toBeTruthy();
+ expect(path.startsWith(testOutputPath(''))).toBeTruthy();
});
it('should not delete downloads when the context closes', async ({persistentDownloadsContext}) => {
diff --git a/test/elementhandle-screenshot.spec.ts b/test/elementhandle-screenshot.spec.ts
index da62da7d73..761b77d29f 100644
--- a/test/elementhandle-screenshot.spec.ts
+++ b/test/elementhandle-screenshot.spec.ts
@@ -25,16 +25,16 @@ import fs from 'fs';
describe('element screenshot', (suite, parameters) => {
suite.skip(parameters.browserName === 'firefox' && parameters.headful);
}, () => {
- it('should work', async ({page, server, golden}) => {
+ it('should work', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(50, 100));
const elementHandle = await page.$('.box:nth-of-type(3)');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-bounding-box.png'));
+ expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
});
- it('should take into account padding and border', async ({page, golden}) => {
+ it('should take into account padding and border', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`
<div style="height: 14px">oooo</div>
@@ -49,10 +49,10 @@ describe('element screenshot', (suite, parameters) => {
`);
const elementHandle = await page.$('div#d');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-padding-border.png'));
+ expect(screenshot).toMatchImage('screenshot-element-padding-border.png');
});
- it('should capture full element when larger than viewport in parallel', async ({page, golden}) => {
+ it('should capture full element when larger than viewport in parallel', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`
@@ -75,12 +75,12 @@ describe('element screenshot', (suite, parameters) => {
const elementHandles = await page.$$('div.to-screenshot');
const promises = elementHandles.map(handle => handle.screenshot());
const screenshots = await Promise.all(promises);
- expect(screenshots[2]).toMatchImage(golden('screenshot-element-larger-than-viewport.png'));
+ expect(screenshots[2]).toMatchImage('screenshot-element-larger-than-viewport.png');
await verifyViewport(page, 500, 500);
});
- it('should capture full element when larger than viewport', async ({page, golden}) => {
+ it('should capture full element when larger than viewport', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`
@@ -102,12 +102,12 @@ describe('element screenshot', (suite, parameters) => {
`);
const elementHandle = await page.$('div.to-screenshot');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-larger-than-viewport.png'));
+ expect(screenshot).toMatchImage('screenshot-element-larger-than-viewport.png');
await verifyViewport(page, 500, 500);
});
- it('should scroll element into view', async ({page, golden}) => {
+ it('should scroll element into view', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`
<div style="height: 14px">oooo</div>
@@ -128,10 +128,10 @@ describe('element screenshot', (suite, parameters) => {
`);
const elementHandle = await page.$('div.to-screenshot');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-scrolled-into-view.png'));
+ expect(screenshot).toMatchImage('screenshot-element-scrolled-into-view.png');
});
- it('should scroll 15000px into view', async ({page, golden}) => {
+ it('should scroll 15000px into view', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`
<div style="height: 14px">oooo</div>
@@ -152,10 +152,10 @@ describe('element screenshot', (suite, parameters) => {
`);
const elementHandle = await page.$('div.to-screenshot');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-scrolled-into-view.png'));
+ expect(screenshot).toMatchImage('screenshot-element-scrolled-into-view.png');
});
- it('should work with a rotated element', async ({page, golden}) => {
+ it('should work with a rotated element', async ({page}) => {
await page.setViewportSize({width: 500, height: 500});
await page.setContent(`<div style="position:absolute;
top: 100px;
@@ -166,7 +166,7 @@ describe('element screenshot', (suite, parameters) => {
transform: rotateZ(200deg);">&nbsp;</div>`);
const elementHandle = await page.$('div');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-rotate.png'));
+ expect(screenshot).toMatchImage('screenshot-element-rotate.png');
});
it('should fail to screenshot a detached element', async ({page, server}) => {
@@ -185,7 +185,7 @@ describe('element screenshot', (suite, parameters) => {
expect(error.message).toContain('element is not visible');
});
- it('should wait for visible', async ({page, server, golden}) => {
+ it('should wait for visible', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(50, 100));
@@ -201,47 +201,47 @@ describe('element screenshot', (suite, parameters) => {
expect(done).toBe(false);
await elementHandle.evaluate(e => e.style.visibility = 'visible');
const screenshot = await promise;
- expect(screenshot).toMatchImage(golden('screenshot-element-bounding-box.png'));
+ expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
});
- it('should work for an element with fractional dimensions', async ({page, golden}) => {
+ it('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>');
const elementHandle = await page.$('div');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-fractional.png'));
+ expect(screenshot).toMatchImage('screenshot-element-fractional.png');
});
it('should work with a mobile viewport', (test, { browserName }) => {
test.skip(browserName === 'firefox');
- }, async ({browser, server, golden}) => {
+ }, async ({browser, server}) => {
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
const page = await context.newPage();
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(50, 100));
const elementHandle = await page.$('.box:nth-of-type(3)');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-mobile.png'));
+ expect(screenshot).toMatchImage('screenshot-element-mobile.png');
await context.close();
});
it('should work with device scale factor', (test, { browserName }) => {
test.skip(browserName === 'firefox');
- }, async ({browser, server, golden}) => {
+ }, async ({browser, server}) => {
const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
const page = await context.newPage();
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(50, 100));
const elementHandle = await page.$('.box:nth-of-type(3)');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-mobile-dsf.png'));
+ expect(screenshot).toMatchImage('screenshot-element-mobile-dsf.png');
await context.close();
});
- it('should work for an element with an offset', async ({page, golden}) => {
+ it('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>');
const elementHandle = await page.$('div');
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-fractional-offset.png'));
+ expect(screenshot).toMatchImage('screenshot-element-fractional-offset.png');
});
it('should take screenshots when default viewport is null', async ({server, browser}) => {
@@ -364,7 +364,7 @@ describe('element screenshot', (suite, parameters) => {
it('should wait for element to stop moving', (test, { browserName, headful, platform }) => {
test.flaky(browserName === 'webkit' && headful && platform === 'linux');
- }, async ({ page, server, golden }) => {
+ }, async ({ page, server }) => {
await page.setViewportSize({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/grid.html');
const elementHandle = await page.$('.box:nth-of-type(3)');
@@ -373,7 +373,7 @@ describe('element screenshot', (suite, parameters) => {
return new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)));
});
const screenshot = await elementHandle.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-element-bounding-box.png'));
+ expect(screenshot).toMatchImage('screenshot-element-bounding-box.png');
});
it('should take screenshot of disabled button', async ({page}) => {
@@ -384,13 +384,13 @@ describe('element screenshot', (suite, parameters) => {
expect(screenshot).toBeInstanceOf(Buffer);
});
- it('path option should create subdirectories', async ({page, server, golden, testOutputDir}) => {
+ it('path option should create subdirectories', async ({page, server, testOutputPath}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(50, 100));
const elementHandle = await page.$('.box:nth-of-type(3)');
- const outputPath = path.join(testOutputDir, 'these', 'are', 'directories', 'screenshot.png');
+ const outputPath = testOutputPath(path.join('these', 'are', 'directories', 'screenshot.png'));
await elementHandle.screenshot({path: outputPath});
- expect(await fs.promises.readFile(outputPath)).toMatchImage(golden('screenshot-element-bounding-box.png'));
+ expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-element-bounding-box.png');
});
});
diff --git a/test/emulation-focus.spec.ts b/test/emulation-focus.spec.ts
index 9f5d431821..d31a6af9dc 100644
--- a/test/emulation-focus.spec.ts
+++ b/test/emulation-focus.spec.ts
@@ -103,7 +103,7 @@ it('should change document.activeElement', async ({page, server}) => {
it('should not affect screenshots', (test, { browserName, headful }) => {
test.skip(browserName === 'firefox' && headful);
-}, async ({page, server, golden}) => {
+}, async ({page, server}) => {
// Firefox headful produces a different image.
const page2 = await page.context().newPage();
await Promise.all([
@@ -120,8 +120,8 @@ it('should not affect screenshots', (test, { browserName, headful }) => {
page.screenshot(),
page2.screenshot(),
]);
- expect(screenshots[0]).toMatchImage(golden('screenshot-sanity.png'));
- expect(screenshots[1]).toMatchImage(golden('grid-cell-0.png'));
+ expect(screenshots[0]).toMatchImage('screenshot-sanity.png');
+ expect(screenshots[1]).toMatchImage('grid-cell-0.png');
});
it('should change focused iframe', async ({page, server}) => {
diff --git a/test/fixtures.ts b/test/fixtures.ts
index 24782c1e65..6cf6b1028f 100644
--- a/test/fixtures.ts
+++ b/test/fixtures.ts
@@ -26,7 +26,6 @@ import { Transport } from '../lib/protocol/transport';
import { installCoverageHooks } from './coverage';
import { fixtures as httpFixtures } from './http.fixtures';
import { fixtures as implFixtures } from './impl.fixtures';
-import { fixtures as platformFixtures } from './platform.fixtures';
import { fixtures as playwrightFixtures } from './playwright.fixtures';
export { expect } from '@playwright/test/out/matcher.fixtures';
export { config } from '@playwright/test-runner';
@@ -37,10 +36,6 @@ type AllParameters = {
wire: boolean;
};
-type AllWorkerFixtures = {
- golden: (path: string) => string;
-};
-
type AllTestFixtures = {
createUserDataDir: () => Promise<string>;
launchPersistent: (options?: Parameters<BrowserType<Browser>['launchPersistentContext']>[1]) => Promise<{context: BrowserContext, page: Page}>;
@@ -48,10 +43,8 @@ type AllTestFixtures = {
export const fixtures = playwrightFixtures
.union(httpFixtures)
- .union(platformFixtures)
.union(implFixtures)
.declareParameters<AllParameters>()
- .declareWorkerFixtures<AllWorkerFixtures>()
.declareTestFixtures<AllTestFixtures>();
export const it = fixtures.it;
@@ -67,6 +60,10 @@ export const afterAll = fixtures.afterAll;
fixtures.defineParameter('wire', 'Wire testing mode', !!process.env.PWWIRE || false);
+fixtures.generateParametrizedTests(
+ 'platform',
+ process.env.PWTESTREPORT ? ['win32', 'darwin', 'linux'] : [process.platform as ('win32' | 'linux' | 'darwin')]);
+
const getExecutablePath = browserName => {
if (browserName === 'chromium' && process.env.CRPATH)
return process.env.CRPATH;
@@ -129,15 +126,11 @@ fixtures.overrideWorkerFixture('playwright', async ({ browserName, testWorkerInd
}
});
-fixtures.defineWorkerFixture('golden', async ({browserName}, test) => {
- await test(p => path.join(browserName, p));
-});
-
-fixtures.defineTestFixture('createUserDataDir', async ({testOutputDir}, runTest) => {
+fixtures.defineTestFixture('createUserDataDir', async ({testOutputPath}, runTest) => {
let counter = 0;
const dirs: string[] = [];
async function createUserDataDir() {
- const dir = path.join(testOutputDir, `user-data-dir-${counter++}`);
+ const dir = testOutputPath(`user-data-dir-${counter++}`);
dirs.push(dir);
await fs.promises.mkdir(dir, { recursive: true });
return dir;
@@ -163,3 +156,7 @@ fixtures.defineTestFixture('launchPersistent', async ({createUserDataDir, defaul
if (context)
await context.close();
});
+
+fixtures.overrideTestFixture('testParametersArtifactsPath', async ({ browserName }, runTest) => {
+ await runTest(browserName);
+});
diff --git a/test/page-screenshot.spec.ts b/test/page-screenshot.spec.ts
index 2bf224c732..420810c779 100644
--- a/test/page-screenshot.spec.ts
+++ b/test/page-screenshot.spec.ts
@@ -25,14 +25,14 @@ import fs from 'fs';
describe('page screenshot', (suite, { browserName, headful }) => {
suite.skip(browserName === 'firefox' && headful);
}, () => {
- it('should work', async ({page, server, golden}) => {
+ it('should work', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-sanity.png'));
+ expect(screenshot).toMatchImage('screenshot-sanity.png');
});
- it('should clip rect', async ({page, server, golden}) => {
+ it('should clip rect', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
@@ -43,10 +43,10 @@ describe('page screenshot', (suite, { browserName, headful }) => {
height: 100
}
});
- expect(screenshot).toMatchImage(golden('screenshot-clip-rect.png'));
+ expect(screenshot).toMatchImage('screenshot-clip-rect.png');
});
- it('should clip rect with fullPage', async ({page, server, golden}) => {
+ it('should clip rect with fullPage', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
await page.evaluate(() => window.scrollBy(150, 200));
@@ -59,10 +59,10 @@ describe('page screenshot', (suite, { browserName, headful }) => {
height: 100,
},
});
- expect(screenshot).toMatchImage(golden('screenshot-clip-rect.png'));
+ expect(screenshot).toMatchImage('screenshot-clip-rect.png');
});
- it('should clip elements to the viewport', async ({page, server, golden}) => {
+ it('should clip elements to the viewport', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
@@ -73,10 +73,10 @@ describe('page screenshot', (suite, { browserName, headful }) => {
height: 100
}
});
- expect(screenshot).toMatchImage(golden('screenshot-offscreen-clip.png'));
+ expect(screenshot).toMatchImage('screenshot-offscreen-clip.png');
});
- it('should throw on clip outside the viewport', async ({page, server, golden}) => {
+ it('should throw on clip outside the viewport', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshotError = await page.screenshot({
@@ -90,7 +90,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
expect(screenshotError.message).toContain('Clipped area is either empty or outside the resulting image');
});
- it('should run in parallel', async ({page, server, golden}) => {
+ it('should run in parallel', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const promises = [];
@@ -105,16 +105,16 @@ describe('page screenshot', (suite, { browserName, headful }) => {
}));
}
const screenshots = await Promise.all(promises);
- expect(screenshots[1]).toMatchImage(golden('grid-cell-1.png'));
+ expect(screenshots[1]).toMatchImage('grid-cell-1.png');
});
- it('should take fullPage screenshots', async ({page, server, golden}) => {
+ it('should take fullPage screenshots', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot({
fullPage: true
});
- expect(screenshot).toMatchImage(golden('screenshot-grid-fullpage.png'));
+ expect(screenshot).toMatchImage('screenshot-grid-fullpage.png');
});
it('should restore viewport after fullPage screenshot', async ({page, server}) => {
@@ -125,7 +125,7 @@ describe('page screenshot', (suite, { browserName, headful }) => {
await verifyViewport(page, 500, 500);
});
- it('should run in parallel in multiple pages', async ({server, context, golden}) => {
+ it('should run in parallel in multiple pages', async ({server, context}) => {
const N = 5;
const pages = await Promise.all(Array(N).fill(0).map(async () => {
const page = await context.newPage();
@@ -137,13 +137,13 @@ describe('page screenshot', (suite, { browserName, headful }) => {
promises.push(pages[i].screenshot({ clip: { x: 50 * (i % 2), y: 0, width: 50, height: 50 } }));
const screenshots = await Promise.all(promises);
for (let i = 0; i < N; ++i)
- expect(screenshots[i]).toMatchImage(golden(`grid-cell-${i % 2}.png`));
+ expect(screenshots[i]).toMatchImage(`grid-cell-${i % 2}.png`);
await Promise.all(pages.map(page => page.close()));
});
it('should allow transparency', (test, { browserName }) => {
test.fail(browserName === 'firefox');
- }, async ({page, golden}) => {
+ }, async ({page}) => {
await page.setViewportSize({ width: 50, height: 150 });
await page.setContent(`
<style>
@@ -155,17 +155,17 @@ describe('page screenshot', (suite, { browserName, headful }) => {
<div style="background:transparent"></div>
`);
const screenshot = await page.screenshot({omitBackground: true});
- expect(screenshot).toMatchImage(golden('transparent.png'));
+ expect(screenshot).toMatchImage('transparent.png');
});
- it('should render white background on jpeg file', async ({page, server, golden}) => {
+ it('should render white background on jpeg file', async ({page, server}) => {
await page.setViewportSize({ width: 100, height: 100 });
await page.goto(server.EMPTY_PAGE);
const screenshot = await page.screenshot({omitBackground: true, type: 'jpeg'});
- expect(screenshot).toMatchImage(golden('white.jpg'));
+ expect(screenshot).toMatchImage('white.jpg');
});
- it('should work with odd clip size on Retina displays', async ({page, golden}) => {
+ it('should work with odd clip size on Retina displays', async ({page}) => {
const screenshot = await page.screenshot({
clip: {
x: 0,
@@ -174,64 +174,64 @@ describe('page screenshot', (suite, { browserName, headful }) => {
height: 11,
}
});
- expect(screenshot).toMatchImage(golden('screenshot-clip-odd-size.png'));
+ expect(screenshot).toMatchImage('screenshot-clip-odd-size.png');
});
it('should work with a mobile viewport', (test, { browserName }) => {
test.skip(browserName === 'firefox');
- }, async ({browser, server, golden}) => {
+ }, async ({browser, server}) => {
const context = await browser.newContext({ viewport: { width: 320, height: 480 }, isMobile: true });
const page = await context.newPage();
await page.goto(server.PREFIX + '/overflow.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-mobile.png'));
+ expect(screenshot).toMatchImage('screenshot-mobile.png');
await context.close();
});
it('should work with a mobile viewport and clip', (test, { browserName }) => {
test.skip(browserName === 'firefox');
- }, async ({browser, server, golden}) => {
+ }, async ({browser, server}) => {
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
const page = await context.newPage();
await page.goto(server.PREFIX + '/overflow.html');
const screenshot = await page.screenshot({ clip: { x: 10, y: 10, width: 100, height: 150 } });
- expect(screenshot).toMatchImage(golden('screenshot-mobile-clip.png'));
+ expect(screenshot).toMatchImage('screenshot-mobile-clip.png');
await context.close();
});
it('should work with a mobile viewport and fullPage', (test, { browserName }) => {
test.skip(browserName === 'firefox');
- }, async ({browser, server, golden}) => {
+ }, async ({browser, server}) => {
const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
const page = await context.newPage();
await page.goto(server.PREFIX + '/overflow-large.html');
const screenshot = await page.screenshot({ fullPage: true });
- expect(screenshot).toMatchImage(golden('screenshot-mobile-fullpage.png'));
+ expect(screenshot).toMatchImage('screenshot-mobile-fullpage.png');
await context.close();
});
- it('should work for canvas', async ({page, server, golden}) => {
+ it('should work for canvas', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/screenshots/canvas.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-canvas.png'), { threshold: 0.3 });
+ expect(screenshot).toMatchImage('screenshot-canvas.png', { threshold: 0.3 });
});
it('should work for webgl', (test, { browserName, platform }) => {
test.fixme(browserName === 'firefox');
test.fixme(browserName === 'webkit' && platform === 'linux');
- }, async ({page, server, golden}) => {
+ }, async ({page, server}) => {
await page.setViewportSize({width: 640, height: 480});
await page.goto(server.PREFIX + '/screenshots/webgl.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-webgl.png'));
+ expect(screenshot).toMatchImage('screenshot-webgl.png');
});
- it('should work for translateZ', async ({page, server, golden}) => {
+ it('should work for translateZ', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/screenshots/translateZ.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-translateZ.png'));
+ expect(screenshot).toMatchImage('screenshot-translateZ.png');
});
it('should work while navigating', async ({page, server}) => {
@@ -247,44 +247,44 @@ describe('page screenshot', (suite, { browserName, headful }) => {
}
});
- it('should work with device scale factor', async ({browser, server, golden}) => {
+ it('should work with device scale factor', async ({browser, server}) => {
const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
const page = await context.newPage();
await page.goto(server.PREFIX + '/grid.html');
const screenshot = await page.screenshot();
- expect(screenshot).toMatchImage(golden('screenshot-device-scale-factor.png'));
+ expect(screenshot).toMatchImage('screenshot-device-scale-factor.png');
await context.close();
});
- it('should work with iframe in shadow', async ({page, server, golden}) => {
+ it('should work with iframe in shadow', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid-iframe-in-shadow.html');
- expect(await page.screenshot()).toMatchImage(golden('screenshot-iframe.png'));
+ expect(await page.screenshot()).toMatchImage('screenshot-iframe.png');
});
- it('path option should work', async ({page, server, golden, testOutputDir}) => {
+ it('path option should work', async ({page, server, testOutputPath}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
- const outputPath = path.join(testOutputDir, 'screenshot.png');
+ const outputPath = testOutputPath('screenshot.png');
await page.screenshot({path: outputPath});
- expect(await fs.promises.readFile(outputPath)).toMatchImage(golden('screenshot-sanity.png'));
+ expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-sanity.png');
});
- it('path option should create subdirectories', async ({page, server, golden, testOutputDir}) => {
+ it('path option should create subdirectories', async ({page, server, testOutputPath}) => {
await page.setViewportSize({width: 500, height: 500});
await page.goto(server.PREFIX + '/grid.html');
- const outputPath = path.join(testOutputDir, 'these', 'are', 'directories', 'screenshot.png');
+ const outputPath = testOutputPath(path.join('these', 'are', 'directories', 'screenshot.png'));
await page.screenshot({path: outputPath});
- expect(await fs.promises.readFile(outputPath)).toMatchImage(golden('screenshot-sanity.png'));
+ expect(await fs.promises.readFile(outputPath)).toMatchImage('screenshot-sanity.png');
});
- it('path option should detect jpeg', async ({page, server, golden, testOutputDir}) => {
+ it('path option should detect jpeg', async ({page, server, testOutputPath}) => {
await page.setViewportSize({ width: 100, height: 100 });
await page.goto(server.EMPTY_PAGE);
- const outputPath = path.join(testOutputDir, 'screenshot.jpg');
+ const outputPath = testOutputPath('screenshot.jpg');
const screenshot = await page.screenshot({omitBackground: true, path: outputPath});
- expect(await fs.promises.readFile(outputPath)).toMatchImage(golden('white.jpg'));
- expect(screenshot).toMatchImage(golden('white.jpg'));
+ expect(await fs.promises.readFile(outputPath)).toMatchImage('white.jpg');
+ expect(screenshot).toMatchImage('white.jpg');
});
it('path option should throw for unsupported mime type', async ({page}) => {
diff --git a/test/pdf.spec.ts b/test/pdf.spec.ts
index dfa8a42763..e96f1da2c3 100644
--- a/test/pdf.spec.ts
+++ b/test/pdf.spec.ts
@@ -17,13 +17,12 @@
import { it, expect } from './fixtures';
import fs from 'fs';
-import path from 'path';
it('should be able to save file', (test, { browserName, headful }) => {
test.skip(headful || browserName !== 'chromium', 'Printing to pdf is currently only supported in headless chromium.');
-}, async ({page, testOutputDir}) => {
- const outputFile = path.join(testOutputDir, 'output.pdf');
+}, async ({page, testOutputPath}) => {
+ const outputFile = testOutputPath('output.pdf');
await page.pdf({path: outputFile});
expect(fs.readFileSync(outputFile).byteLength).toBeGreaterThan(0);
});
diff --git a/test/platform.fixtures.ts b/test/platform.fixtures.ts
deleted file mode 100644
index 81263013de..0000000000
--- a/test/platform.fixtures.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright Microsoft Corporation. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import { fixtures as baseFixtures } from '@playwright/test-runner';
-
-type PlatformParameters = {
- platform: 'win32' | 'linux' | 'darwin'
-};
-
-type PlatformWorkerFixtures = {
- isWindows: boolean;
- isMac: boolean;
- isLinux: boolean;
-};
-
-export const fixtures = baseFixtures
- .declareParameters<PlatformParameters>()
- .declareWorkerFixtures<PlatformWorkerFixtures>();
-const { defineWorkerFixture, defineParameter, generateParametrizedTests } = fixtures;
-
-defineParameter('platform', 'Operating system', process.platform as ('win32' | 'linux' | 'darwin'));
-
-generateParametrizedTests(
- 'platform',
- process.env.PWTESTREPORT ? ['win32', 'darwin', 'linux'] : [process.platform as ('win32' | 'linux' | 'darwin')]);
-
-defineWorkerFixture('isWindows', async ({platform}, test) => {
- await test(platform === 'win32');
-});
-
-defineWorkerFixture('isMac', async ({platform}, test) => {
- await test(platform === 'darwin');
-});
-
-defineWorkerFixture('isLinux', async ({platform}, test) => {
- await test(platform === 'linux');
-});
diff --git a/test/playwright.fixtures.ts b/test/playwright.fixtures.ts
index 10422a422c..ca13548fad 100644
--- a/test/playwright.fixtures.ts
+++ b/test/playwright.fixtures.ts
@@ -41,6 +41,8 @@ type PlaywrightParameters = {
screenshotOnFailure: boolean;
// Whether to record the execution trace
trace: boolean;
+ // Host platform
+ platform: 'win32' | 'linux' | 'darwin';
};
@@ -64,6 +66,12 @@ type PlaywrightWorkerFixtures = {
isFirefox: boolean;
// True iff browserName is WebKit
isWebKit: boolean;
+ // True iff running on Windows.
+ isWindows: boolean;
+ // True iff running on Mac.
+ isMac: boolean;
+ // True iff running on Linux.
+ isLinux: boolean;
};
@@ -91,6 +99,7 @@ export const fixtures = baseFixtures
fixtures.defineParameter('browserName', 'Browser type name', process.env.BROWSER || 'chromium' as any);
fixtures.defineParameter('headful', 'Whether to run tests headless or headful', process.env.HEADFUL ? true : false);
+fixtures.defineParameter('platform', 'Operating system', process.platform as ('win32' | 'linux' | 'darwin'));
fixtures.defineParameter('screenshotOnFailure', 'Generate screenshot on failure', false);
fixtures.defineParameter('slowMo', 'Slows down Playwright operations by the specified amount of milliseconds', 0);
fixtures.defineParameter('trace', 'Whether to record the execution trace', !!process.env.TRACING || false);
@@ -100,7 +109,6 @@ fixtures.generateParametrizedTests(
'browserName',
process.env.BROWSER ? [process.env.BROWSER] as any : ['chromium', 'webkit', 'firefox']);
-
// Worker fixtures definitions -------------------------------------------------
fixtures.defineWorkerFixture('defaultBrowserOptions', async ({ headful, slowMo }, runTest) => {
@@ -122,14 +130,6 @@ fixtures.defineWorkerFixture('browserType', async ({playwright, browserName}, ru
await runTest(browserType);
});
-fixtures.defineWorkerFixture('isFirefox', async ({browserName}, runTest) => {
- await runTest(browserName === 'firefox');
-});
-
-fixtures.defineWorkerFixture('isWebKit', async ({browserName}, runTest) => {
- await runTest(browserName === 'webkit');
-});
-
fixtures.defineWorkerFixture('browser', async ({browserType, defaultBrowserOptions}, runTest) => {
const browser = await browserType.launch(defaultBrowserOptions);
await runTest(browser);
@@ -148,17 +148,29 @@ fixtures.defineWorkerFixture('isWebKit', async ({browserName}, runTest) => {
await runTest(browserName === 'webkit');
});
+fixtures.defineWorkerFixture('isWindows', async ({platform}, test) => {
+ await test(platform === 'win32');
+});
+
+fixtures.defineWorkerFixture('isMac', async ({platform}, test) => {
+ await test(platform === 'darwin');
+});
+
+fixtures.defineWorkerFixture('isLinux', async ({platform}, test) => {
+ await test(platform === 'linux');
+});
+
// Test fixtures definitions ---------------------------------------------------
-fixtures.defineTestFixture('defaultContextOptions', async ({ testOutputDir, trace }, runTest) => {
+fixtures.defineTestFixture('defaultContextOptions', async ({ testRelativeArtifactsPath, trace }, runTest) => {
await runTest({
- relativeArtifactsPath: path.relative(config.outputDir, testOutputDir),
+ relativeArtifactsPath: testRelativeArtifactsPath,
recordTrace: trace,
recordVideos: trace,
});
});
-fixtures.defineTestFixture('contextFactory', async ({ browser, defaultContextOptions, testInfo, screenshotOnFailure, testOutputFile }, runTest) => {
+fixtures.defineTestFixture('contextFactory', async ({ browser, defaultContextOptions, testInfo, screenshotOnFailure, testOutputPath }, runTest) => {
const contexts: BrowserContext[] = [];
async function contextFactory(options: BrowserContextOptions = {}) {
const context = await browser.newContext({ ...defaultContextOptions, ...options });
@@ -171,7 +183,7 @@ fixtures.defineTestFixture('contextFactory', async ({ browser, defaultContextOpt
let ordinal = 0;
for (const context of contexts) {
for (const page of context.pages())
- await page.screenshot({ timeout: 5000, path: await testOutputFile(`test-failed-${++ordinal}.png`) });
+ await page.screenshot({ timeout: 5000, path: testOutputPath + `-test-failed-${++ordinal}.png` });
}
}
for (const context of contexts)
@@ -197,11 +209,6 @@ fixtures.defineTestFixture('tmpDir', async ({ }, runTest) => {
await removeFolderAsync(tmpDir).catch(e => { });
});
-fixtures.overrideTestFixture('testOutputDir', async ({ testInfo, browserName }, runTest) => {
- const relativePath = path.relative(config.testDir, testInfo.file)
- .replace(/\.spec\.[jt]s/, '')
- .replace(/\.test\.[jt]s/, '');
- const sanitizedTitle = testInfo.title.replace(/[^\w\d]+/g, '_');
- const testOutputDir = path.join(config.outputDir, relativePath, sanitizedTitle, browserName);
- await runTest(testOutputDir);
+fixtures.overrideTestFixture('testParametersArtifactsPath', async ({ browserName, platform }, runTest) => {
+ await runTest(browserName + '-' + platform);
});
diff --git a/test/request-fulfill.spec.ts b/test/request-fulfill.spec.ts
index 910199dc49..6e850be2cd 100644
--- a/test/request-fulfill.spec.ts
+++ b/test/request-fulfill.spec.ts
@@ -52,7 +52,7 @@ it('should work with status code 422', async ({page, server}) => {
it('should allow mocking binary responses', (test, { browserName, headful }) => {
test.skip(browserName === 'firefox' && headful, '// Firefox headful produces a different image.');
-}, async ({page, server, golden}) => {
+}, async ({page, server}) => {
await page.route('**/*', route => {
const imageBuffer = fs.readFileSync(path.join(__dirname, 'assets', 'pptr.png'));
route.fulfill({
@@ -67,12 +67,12 @@ it('should allow mocking binary responses', (test, { browserName, headful }) =>
return new Promise(fulfill => img.onload = fulfill);
}, server.PREFIX);
const img = await page.$('img');
- expect(await img.screenshot()).toMatchImage(golden('mock-binary-response.png'));
+ expect(await img.screenshot()).toMatchImage('mock-binary-response.png');
});
it('should allow mocking svg with charset', (test, { browserName, headful }) => {
test.skip(browserName === 'firefox' && headful, '// Firefox headful produces a different image.');
-}, async ({page, server, golden}) => {
+}, async ({page, server}) => {
// Firefox headful produces a different image.
await page.route('**/*', route => {
route.fulfill({
@@ -87,10 +87,10 @@ it('should allow mocking svg with charset', (test, { browserName, headful }) =>
return new Promise((f, r) => { img.onload = f; img.onerror = r; });
}, server.PREFIX);
const img = await page.$('img');
- expect(await img.screenshot()).toMatchImage(golden('mock-svg.png'));
+ expect(await img.screenshot()).toMatchImage('mock-svg.png');
});
-it('should work with file path', async ({page, server, golden}) => {
+it('should work with file path', async ({page, server}) => {
await page.route('**/*', route => route.fulfill({ contentType: 'shouldBeIgnored', path: path.join(__dirname, 'assets', 'pptr.png') }));
await page.evaluate(PREFIX => {
const img = document.createElement('img');
@@ -99,7 +99,7 @@ it('should work with file path', async ({page, server, golden}) => {
return new Promise(fulfill => img.onload = fulfill);
}, server.PREFIX);
const img = await page.$('img');
- expect(await img.screenshot()).toMatchImage(golden('mock-binary-response.png'));
+ expect(await img.screenshot()).toMatchImage('mock-binary-response.png');
});
it('should stringify intercepted request response headers', async ({page, server}) => {
diff --git a/test/trace.spec.ts b/test/trace.spec.ts
index 78dcf2979f..37f43b10c5 100644
--- a/test/trace.spec.ts
+++ b/test/trace.spec.ts
@@ -51,7 +51,7 @@ it('should record trace', async ({browserType, defaultBrowserOptions, server, tm
expect(gotoEvent.value).toBe(url);
expect(gotoEvent.snapshot).toBeTruthy();
- expect(fs.existsSync(path.join(tmpDir, '.playwright-shared', gotoEvent.snapshot!.sha1))).toBe(true);
+ expect(fs.existsSync(path.join(tmpDir, 'trace-resources', gotoEvent.snapshot!.sha1))).toBe(true);
});
it('should require artifactsPath', async ({browserType, defaultBrowserOptions}) => {