Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: move all page tests to a subdirectory (#6427)
Dmitry Gozman9433cae4feb6
diff --git a/tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png b/tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png b/tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png b/tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png b/tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png b/tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.pngrename to tests/__snapshots__/page/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png b/tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.pngrename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png b/tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.pngsimilarity index 100%rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.pngrename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpg b/tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpgrename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpg b/tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpgrename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpg b/tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpgrename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-work/chromium/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-work/chromium/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-work/firefox/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-work/firefox/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/path-option-should-work/webkit/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/path-option-should-work/webkit/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.png b/tests/__snapshots__/page/page-screenshot/should-allow-transparency/chromium/transparent.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.pngrename to tests/__snapshots__/page/page-screenshot/should-allow-transparency/chromium/transparent.pngdiff --git a/tests/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png b/tests/__snapshots__/page/page-screenshot/should-allow-transparency/webkit/transparent.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.pngrename to tests/__snapshots__/page/page-screenshot/should-allow-transparency/webkit/transparent.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.png b/tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.png b/tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png b/tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png b/tests/__snapshots__/page/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.pngrename to tests/__snapshots__/page/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.pngdiff --git a/tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg b/tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpgrename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg b/tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpgrename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg b/tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpgsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpgrename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpgdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.png b/tests/__snapshots__/page/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.pngrename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.png b/tests/__snapshots__/page/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.pngrename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png b/tests/__snapshots__/page/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.pngrename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.png b/tests/__snapshots__/page/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.png b/tests/__snapshots__/page/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png b/tests/__snapshots__/page/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.png b/tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.png b/tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png b/tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.png b/tests/__snapshots__/page/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.png b/tests/__snapshots__/page/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.pngrename to tests/__snapshots__/page/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.png b/tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png b/tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.png b/tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png b/tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png b/tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.png b/tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png b/tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.pngrename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/chromium/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/should-work/chromium/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/firefox/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/should-work/firefox/screenshot-sanity.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/webkit/screenshot-sanity.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.pngrename to tests/__snapshots__/page/page-screenshot/should-work/webkit/screenshot-sanity.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png b/tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.pngrename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png b/tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.pngrename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.png b/tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.pngrename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.pngdiff --git a/tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png b/tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.pngsimilarity index 100%rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.pngrename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.pngdiff --git a/tests/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png b/tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.pngrename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png b/tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.pngrename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.png b/tests/__snapshots__/screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.pngrename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.png b/tests/__snapshots__/screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.pngrename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.pngdiff --git a/tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png b/tests/__snapshots__/screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.pngsimilarity index 100%rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.pngrename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.pngdiff --git a/tests/browsercontext-basic.spec.ts b/tests/browsercontext-basic.spec.tsindex 81daecb6cd..a685a20726 100644--- a/tests/browsercontext-basic.spec.ts+++ b/tests/browsercontext-basic.spec.ts@@ -16,7 +16,7 @@*/import { browserTest as it, expect } from './config/browserTest';-import { verifyViewport } from './config/utils';+import { attachFrame, verifyViewport } from './config/utils';it('should create new context', async function({browser}) {expect(browser.contexts().length).toBe(0);@@ -240,3 +240,38 @@ it('should emulate navigator.onLine', async ({browser, server}) => {expect(await page.evaluate(() => window.navigator.onLine)).toBe(true);await context.close();});++it('should emulate media in popup', async ({browser, server}) => {+ {+ const context = await browser.newContext({ colorScheme: 'dark' });+ const page = await context.newPage();+ await page.goto(server.EMPTY_PAGE);+ const [popup] = await Promise.all([+ page.waitForEvent('popup'),+ page.evaluate(url => { window.open(url); }, server.EMPTY_PAGE),+ ]);+ expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches)).toBe(false);+ expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);+ await context.close();+ }+ {+ const page = await browser.newPage({ colorScheme: 'light' });+ await page.goto(server.EMPTY_PAGE);+ const [popup] = await Promise.all([+ page.waitForEvent('popup'),+ page.evaluate(url => { window.open(url); }, server.EMPTY_PAGE),+ ]);+ expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches)).toBe(true);+ expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(false);+ await page.close();+ }+});++it('should emulate media in cross-process iframe', async ({browser, server}) => {+ const page = await browser.newPage({ colorScheme: 'dark' });+ await page.goto(server.EMPTY_PAGE);+ await attachFrame(page, 'frame1', server.CROSS_PROCESS_PREFIX + '/empty.html');+ const frame = page.frames()[1];+ expect(await frame.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);+ await page.close();+});diff --git a/tests/browsercontext-locale.spec.ts b/tests/browsercontext-locale.spec.tsindex c349ceb759..db13548dc0 100644--- a/tests/browsercontext-locale.spec.ts+++ b/tests/browsercontext-locale.spec.ts@@ -162,3 +162,15 @@ it('should not change default locale in another context', async ({browser, serveawait context.close();}});++it('should format number in workers', async ({browser, server}) => {+ const context = await browser.newContext({ locale: 'ru-RU' });+ const page = await context.newPage();+ await page.goto(server.EMPTY_PAGE);+ const [worker] = await Promise.all([+ page.waitForEvent('worker'),+ page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))),+ ]);+ expect(await worker.evaluate(() => (10000.20).toLocaleString())).toBe('10\u00A0000,2');+ await context.close();+});diff --git a/tests/page-in-context.spec.ts b/tests/browsercontext-pages.spec.tssimilarity index 87%rename from tests/page-in-context.spec.tsrename to tests/browsercontext-pages.spec.tsindex f114093e9e..ab08116f45 100644--- a/tests/page-in-context.spec.ts+++ b/tests/browsercontext-pages.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { browserTest as it, expect } from './config/browserTest';+import { browserTest as it, expect, slowBrowserTest } from './config/browserTest';import { attachFrame, chromiumVersionLessThan } from './config/utils';it('should not be visible in context.pages', async ({contextFactory}) => {@@ -108,3 +108,15 @@ it('should click the button with offset with page scale', async ({browser, serveawait context.close();});+// We open 20 pages here!+slowBrowserTest('should not leak listeners during navigation of 20 pages', async ({contextFactory, server}) => {+ const context = await contextFactory();+ let warning = null;+ const warningHandler = w => warning = w;+ process.on('warning', warningHandler);+ const pages = await Promise.all([...Array(20)].map(() => context.newPage()));+ await Promise.all(pages.map(page => page.goto(server.EMPTY_PAGE)));+ await Promise.all(pages.map(page => page.close()));+ process.off('warning', warningHandler);+ expect(warning).toBe(null);+});diff --git a/tests/browsercontext-route.spec.ts b/tests/browsercontext-route.spec.tsindex 0fd1fa900f..d8ed567e96 100644--- a/tests/browsercontext-route.spec.ts+++ b/tests/browsercontext-route.spec.ts@@ -107,3 +107,94 @@ it('should fall back to context.route', async ({browser, server}) => {expect(await response.text()).toBe('context');await context.close();});++it('should support Set-Cookie header', async ({contextFactory, server, browserName}) => {+ it.fixme(browserName === 'webkit');++ const context = await contextFactory();+ const page = await context.newPage();+ await page.route('https://example.com/', (route, request) => {+ route.fulfill({+ headers: {+ 'Set-Cookie': 'name=value; domain=.example.com; Path=/'+ },+ contentType: 'text/html',+ body: 'done'+ });+ });+ await page.goto('https://example.com');+ expect(await context.cookies()).toEqual([{+ sameSite: 'None',+ name: 'name',+ value: 'value',+ domain: '.example.com',+ path: '/',+ expires: -1,+ httpOnly: false,+ secure: false+ }]);+});++it('should ignore secure Set-Cookie header for insecure requests', async ({contextFactory, server, browserName}) => {+ it.fixme(browserName === 'webkit');++ const context = await contextFactory();+ const page = await context.newPage();+ await page.route('http://example.com/', (route, request) => {+ route.fulfill({+ headers: {+ 'Set-Cookie': 'name=value; domain=.example.com; Path=/; Secure'+ },+ contentType: 'text/html',+ body: 'done'+ });+ });+ await page.goto('http://example.com');+ expect(await context.cookies()).toEqual([]);+});++it('should use Set-Cookie header in future requests', async ({contextFactory, server, browserName}) => {+ it.fixme(browserName === 'webkit');++ const context = await contextFactory();+ const page = await context.newPage();++ await page.route(server.EMPTY_PAGE, (route, request) => {+ route.fulfill({+ headers: {+ 'Set-Cookie': 'name=value'+ },+ contentType: 'text/html',+ body: 'done'+ });+ });+ await page.goto(server.EMPTY_PAGE);+ expect(await context.cookies()).toEqual([{+ sameSite: 'None',+ name: 'name',+ value: 'value',+ domain: 'localhost',+ path: '/',+ expires: -1,+ httpOnly: false,+ secure: false+ }]);++ let cookie = '';+ server.setRoute('/foo.html', (req, res) => {+ cookie = req.headers.cookie;+ res.end();+ });+ await page.goto(server.PREFIX + '/foo.html');+ expect(cookie).toBe('name=value');+});++it('should work with ignoreHTTPSErrors', async ({browser, httpsServer}) => {+ const context = await browser.newContext({ ignoreHTTPSErrors: true });+ const page = await context.newPage();++ await page.route('**/*', route => route.continue());+ const response = await page.goto(httpsServer.EMPTY_PAGE);+ expect(response.status()).toBe(200);+ await context.close();+});diff --git a/tests/browsercontext-viewport-mobile.spec.ts b/tests/browsercontext-viewport-mobile.spec.tsindex 4ee170ad40..a583d3ec78 100644--- a/tests/browsercontext-viewport-mobile.spec.ts+++ b/tests/browsercontext-viewport-mobile.spec.ts@@ -155,4 +155,22 @@ it.describe('mobile viewport', () => {expect(await desktopPage.evaluate(() => matchMedia('(any-pointer: fine)').matches)).toBe(true);await desktopPage.close();});++ it('mouse should work with mobile viewports and cross process navigations', async ({browser, server, browserName}) => {+ // @see https://crbug.com/929806+ const context = await browser.newContext({ viewport: {width: 360, height: 640}, isMobile: true });+ const page = await context.newPage();+ await page.goto(server.EMPTY_PAGE);+ await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');+ await page.evaluate(() => {+ document.addEventListener('click', event => {+ window['result'] = {x: event.clientX, y: event.clientY};+ });+ });++ await page.mouse.click(30, 40);++ expect(await page.evaluate('result')).toEqual({x: 30, y: 40});+ await context.close();+ });});diff --git a/tests/elementhandle-bounding-box.spec.ts b/tests/page/elementhandle-bounding-box.spec.tssimilarity index 98%rename from tests/elementhandle-bounding-box.spec.tsrename to tests/page/elementhandle-bounding-box.spec.tsindex cffad209c9..64dff77f53 100644--- a/tests/elementhandle-bounding-box.spec.ts+++ b/tests/page/elementhandle-bounding-box.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';+import { test as it, expect } from '../config/pageTest';+import { browserTest } from '../config/browserTest';it.skip(({ isAndroid }) => isAndroid);diff --git a/tests/elementhandle-click.spec.ts b/tests/page/elementhandle-click.spec.tssimilarity index 98%rename from tests/elementhandle-click.spec.tsrename to tests/page/elementhandle-click.spec.tsindex 5d495ba810..9b7fc204c3 100644--- a/tests/elementhandle-click.spec.ts+++ b/tests/page/elementhandle-click.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page, server }) => {await page.goto(server.PREFIX + '/input/button.html');diff --git a/tests/elementhandle-content-frame.spec.ts b/tests/page/elementhandle-content-frame.spec.tssimilarity index 95%rename from tests/elementhandle-content-frame.spec.tsrename to tests/page/elementhandle-content-frame.spec.tsindex 22a6812c0b..4ec54e62ad 100644--- a/tests/elementhandle-content-frame.spec.ts+++ b/tests/page/elementhandle-content-frame.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/elementhandle-convenience.spec.ts b/tests/page/elementhandle-convenience.spec.tssimilarity index 99%rename from tests/elementhandle-convenience.spec.tsrename to tests/page/elementhandle-convenience.spec.tsindex b4754893b5..532aecdc54 100644--- a/tests/elementhandle-convenience.spec.ts+++ b/tests/page/elementhandle-convenience.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should have a nice preview', async ({ page, server }) => {await page.goto(`${server.PREFIX}/dom.html`);diff --git a/tests/elementhandle-eval-on-selector.spec.ts b/tests/page/elementhandle-eval-on-selector.spec.tssimilarity index 98%rename from tests/elementhandle-eval-on-selector.spec.tsrename to tests/page/elementhandle-eval-on-selector.spec.tsindex 3b1b164c6a..2c4c8a5b09 100644--- a/tests/elementhandle-eval-on-selector.spec.ts+++ b/tests/page/elementhandle-eval-on-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page, server}) => {await page.setContent('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');diff --git a/tests/elementhandle-misc.spec.ts b/tests/page/elementhandle-misc.spec.tssimilarity index 98%rename from tests/elementhandle-misc.spec.tsrename to tests/page/elementhandle-misc.spec.tsindex ca8320ddc0..e939514537 100644--- a/tests/elementhandle-misc.spec.ts+++ b/tests/page/elementhandle-misc.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should hover', async ({ page, server }) => {await page.goto(server.PREFIX + '/input/scrollable.html');diff --git a/tests/elementhandle-owner-frame.spec.ts b/tests/page/elementhandle-owner-frame.spec.tssimilarity index 97%rename from tests/elementhandle-owner-frame.spec.tsrename to tests/page/elementhandle-owner-frame.spec.tsindex 854ca736d9..10ecdc4434 100644--- a/tests/elementhandle-owner-frame.spec.ts+++ b/tests/page/elementhandle-owner-frame.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should work', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/elementhandle-press.spec.ts b/tests/page/elementhandle-press.spec.tssimilarity index 97%rename from tests/elementhandle-press.spec.tsrename to tests/page/elementhandle-press.spec.tsindex ec88eeddd5..d36040c85a 100644--- a/tests/elementhandle-press.spec.ts+++ b/tests/page/elementhandle-press.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page }) => {await page.setContent(`<input type='text' />`);diff --git a/tests/elementhandle-query-selector.spec.ts b/tests/page/elementhandle-query-selector.spec.tssimilarity index 98%rename from tests/elementhandle-query-selector.spec.tsrename to tests/page/elementhandle-query-selector.spec.tsindex bdbe3b3da1..b67ad7a7a1 100644--- a/tests/elementhandle-query-selector.spec.ts+++ b/tests/page/elementhandle-query-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should query existing element', async ({page, server}) => {await page.goto(server.PREFIX + '/playground.html');diff --git a/tests/elementhandle-screenshot.spec.ts b/tests/page/elementhandle-screenshot.spec.tssimilarity index 59%rename from tests/elementhandle-screenshot.spec.tsrename to tests/page/elementhandle-screenshot.spec.tsindex 30e4983c2d..a2d90ec45f 100644--- a/tests/elementhandle-screenshot.spec.ts+++ b/tests/page/elementhandle-screenshot.spec.ts@@ -15,10 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';-import { verifyViewport } from './config/utils';-import {PNG} from 'pngjs';+import { test as it, expect } from '../config/pageTest';+import { verifyViewport } from '../config/utils';import path from 'path';import fs from 'fs';@@ -273,151 +271,3 @@ it.describe('element screenshot', () => {expect(resizeTriggered).toBeFalsy();});});--browserTest.describe('element sceenshot', () => {- browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful);-- browserTest('should work with a mobile viewport', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');-- 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).toMatchSnapshot('screenshot-element-mobile.png');- await context.close();- });-- browserTest('should work with device scale factor', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');-- 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).toMatchSnapshot('screenshot-element-mobile-dsf.png');- await context.close();- });-- browserTest('should take screenshots when default viewport is null', async ({server, browser}) => {- const context = await browser.newContext({ viewport: null });- const page = await context.newPage();- await page.setContent(`<div style='height: 10000px; background: red'></div>`);- const windowSize = await page.evaluate(() => ({ width: window.innerWidth * window.devicePixelRatio, height: window.innerHeight * window.devicePixelRatio }));- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));-- const screenshot = await page.screenshot();- expect(screenshot).toBeInstanceOf(Buffer);- const decoded = PNG.sync.read(screenshot);- expect(decoded.width).toBe(windowSize.width);- expect(decoded.height).toBe(windowSize.height);-- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));- expect(sizeBefore.width).toBe(sizeAfter.width);- expect(sizeBefore.height).toBe(sizeAfter.height);- await context.close();- });-- browserTest('should take fullPage screenshots when default viewport is null', async ({server, browser}) => {- const context = await browser.newContext({ viewport: null });- const page = await context.newPage();- await page.goto(server.PREFIX + '/grid.html');- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));- const screenshot = await page.screenshot({- fullPage: true- });- expect(screenshot).toBeInstanceOf(Buffer);-- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));- expect(sizeBefore.width).toBe(sizeAfter.width);- expect(sizeBefore.height).toBe(sizeAfter.height);- await context.close();- });-- browserTest('should restore default viewport after fullPage screenshot', async ({ browser }) => {- const context = await browser.newContext({ viewport: { width: 456, height: 789 } });- const page = await context.newPage();- await verifyViewport(page, 456, 789);- const screenshot = await page.screenshot({ fullPage: true });- expect(screenshot).toBeInstanceOf(Buffer);- await verifyViewport(page, 456, 789);- await context.close();- });-- browserTest('should restore viewport after page screenshot and exception', async ({ browser, server, mode }) => {- browserTest.skip(mode !== 'default');-- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });- const page = await context.newPage();- await page.goto(server.PREFIX + '/grid.html');- const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };- const error = await page.screenshot({ fullPage: true, __testHookBeforeScreenshot } as any).catch(e => e);- expect(error.message).toContain('oh my');- await verifyViewport(page, 350, 360);- await context.close();- });-- browserTest('should restore viewport after page screenshot and timeout', async ({ browser, server, mode }) => {- browserTest.skip(mode !== 'default');-- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });- const page = await context.newPage();- await page.goto(server.PREFIX + '/grid.html');- const __testHookAfterScreenshot = () => new Promise(f => setTimeout(f, 5000));- const error = await page.screenshot({ fullPage: true, __testHookAfterScreenshot, timeout: 3000 } as any).catch(e => e);- expect(error.message).toContain('page.screenshot: Timeout 3000ms exceeded');- await verifyViewport(page, 350, 360);- await page.setViewportSize({ width: 400, height: 400 });- await page.waitForTimeout(3000); // Give it some time to wrongly restore previous viewport.- await verifyViewport(page, 400, 400);- await context.close();- });-- browserTest('should take element screenshot when default viewport is null and restore back', async ({server, browser}) => {- const context = await browser.newContext({viewport: null});- const page = await context.newPage();- await page.setContent(`- <div style="height: 14px">oooo</div>- <style>- div.to-screenshot {- border: 1px solid blue;- width: 600px;- height: 600px;- margin-left: 50px;- }- ::-webkit-scrollbar{- display: none;- }- </style>- <div class="to-screenshot"></div>- <div class="to-screenshot"></div>- <div class="to-screenshot"></div>- `);- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));- const elementHandle = await page.$('div.to-screenshot');- const screenshot = await elementHandle.screenshot();- expect(screenshot).toBeInstanceOf(Buffer);- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));- expect(sizeBefore.width).toBe(sizeAfter.width);- expect(sizeBefore.height).toBe(sizeAfter.height);- await context.close();- });-- browserTest('should restore viewport after element screenshot and exception', async ({browser, mode}) => {- browserTest.skip(mode !== 'default');-- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });- const page = await context.newPage();- await page.setContent(`<div style="width:600px;height:600px;"></div>`);- const elementHandle = await page.$('div');- const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };- const error = await elementHandle.screenshot({ __testHookBeforeScreenshot } as any).catch(e => e);- expect(error.message).toContain('oh my');- await verifyViewport(page, 350, 360);- await context.close();- });-});diff --git a/tests/elementhandle-scroll-into-view.spec.ts b/tests/page/elementhandle-scroll-into-view.spec.tssimilarity index 98%rename from tests/elementhandle-scroll-into-view.spec.tsrename to tests/page/elementhandle-scroll-into-view.spec.tsindex 7544577b71..c8391d06f8 100644--- a/tests/elementhandle-scroll-into-view.spec.ts+++ b/tests/page/elementhandle-scroll-into-view.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page, server, isAndroid }) => {it.fixme(isAndroid);diff --git a/tests/elementhandle-select-text.spec.ts b/tests/page/elementhandle-select-text.spec.tssimilarity index 98%rename from tests/elementhandle-select-text.spec.tsrename to tests/page/elementhandle-select-text.spec.tsindex 4c88f504f3..69fc72d5ba 100644--- a/tests/elementhandle-select-text.spec.ts+++ b/tests/page/elementhandle-select-text.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should select textarea', async ({ page, server, isFirefox }) => {await page.goto(server.PREFIX + '/input/textarea.html');diff --git a/tests/elementhandle-type.spec.ts b/tests/page/elementhandle-type.spec.tssimilarity index 97%rename from tests/elementhandle-type.spec.tsrename to tests/page/elementhandle-type.spec.tsindex bce65b2362..b6356b08f8 100644--- a/tests/elementhandle-type.spec.ts+++ b/tests/page/elementhandle-type.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page }) => {await page.setContent(`<input type='text' />`);diff --git a/tests/elementhandle-wait-for-element-state.spec.ts b/tests/page/elementhandle-wait-for-element-state.spec.tssimilarity index 98%rename from tests/elementhandle-wait-for-element-state.spec.tsrename to tests/page/elementhandle-wait-for-element-state.spec.tsindex a90b296900..b01b84fffc 100644--- a/tests/elementhandle-wait-for-element-state.spec.ts+++ b/tests/page/elementhandle-wait-for-element-state.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';async function giveItAChanceToResolve(page) {for (let i = 0; i < 5; i++)diff --git a/tests/eval-on-selector-all.spec.ts b/tests/page/eval-on-selector-all.spec.tssimilarity index 98%rename from tests/eval-on-selector-all.spec.tsrename to tests/page/eval-on-selector-all.spec.tsindex 1b53f7ff98..5295aa1dff 100644--- a/tests/eval-on-selector-all.spec.ts+++ b/tests/page/eval-on-selector-all.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work with css selector', async ({page, server}) => {await page.setContent('<div>hello</div><div>beautiful</div><div>world!</div>');diff --git a/tests/eval-on-selector.spec.ts b/tests/page/eval-on-selector.spec.tssimilarity index 99%rename from tests/eval-on-selector.spec.tsrename to tests/page/eval-on-selector.spec.tsindex c1188ace49..d86df1dac2 100644--- a/tests/eval-on-selector.spec.ts+++ b/tests/page/eval-on-selector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work with css selector', async ({page, server}) => {await page.setContent('<section id="testAttribute">43543</section>');diff --git a/tests/frame-evaluate.spec.ts b/tests/page/frame-evaluate.spec.tssimilarity index 98%rename from tests/frame-evaluate.spec.tsrename to tests/page/frame-evaluate.spec.tsindex 308104c347..30e754d7bf 100644--- a/tests/frame-evaluate.spec.ts+++ b/tests/page/frame-evaluate.spec.ts@@ -15,9 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from './config/utils';-import type { Frame } from '../src/client/frame';+import { test as it, expect } from '../config/pageTest';+import { attachFrame, detachFrame } from '../config/utils';+import type { Frame } from '../../src/client/frame';it('should have different execution contexts', async ({ page, server }) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/frame-frame-element.spec.ts b/tests/page/frame-frame-element.spec.tssimilarity index 95%rename from tests/frame-frame-element.spec.tsrename to tests/page/frame-frame-element.spec.tsindex b471510e06..8473020271 100644--- a/tests/frame-frame-element.spec.ts+++ b/tests/page/frame-frame-element.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/frame-goto.spec.ts b/tests/page/frame-goto.spec.tssimilarity index 96%rename from tests/frame-goto.spec.tsrename to tests/page/frame-goto.spec.tsindex 8ce31437a7..129ed4f004 100644--- a/tests/frame-goto.spec.ts+++ b/tests/page/frame-goto.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should navigate subframes', async ({page, server}) => {await page.goto(server.PREFIX + '/frames/one-frame.html');diff --git a/tests/frame-hierarchy.spec.ts b/tests/page/frame-hierarchy.spec.tssimilarity index 98%rename from tests/frame-hierarchy.spec.tsrename to tests/page/frame-hierarchy.spec.tsindex 41c60ea7d6..c63d56dedc 100644--- a/tests/frame-hierarchy.spec.ts+++ b/tests/page/frame-hierarchy.spec.ts@@ -15,9 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from './config/utils';-import type { Frame } from '../index';+import { test as it, expect } from '../config/pageTest';+import { attachFrame, detachFrame } from '../config/utils';+import type { Frame } from '../../index';function dumpFrames(frame: Frame, indentation: string = ''): string[] {let description = frame.url().replace(/:\d+\//, ':<PORT>/');diff --git a/tests/interception.spec.ts b/tests/page/interception.spec.tssimilarity index 92%rename from tests/interception.spec.tsrename to tests/page/interception.spec.tsindex c49bd51634..53527431b5 100644--- a/tests/interception.spec.ts+++ b/tests/page/interception.spec.ts@@ -15,9 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';-import { globToRegex } from '../lib/client/clientHelper';+import { test as it, expect } from '../config/pageTest';+import { globToRegex } from '../../lib/client/clientHelper';import vm from 'vm';it('should work with navigation', async ({page, server}) => {@@ -34,16 +33,6 @@ it('should work with navigation', async ({page, server}) => {expect(requests.get('style.css').isNavigationRequest()).toBe(false);});-browserTest('should work with ignoreHTTPSErrors', async ({browser, httpsServer}) => {- const context = await browser.newContext({ ignoreHTTPSErrors: true });- const page = await context.newPage();-- await page.route('**/*', route => route.continue());- const response = await page.goto(httpsServer.EMPTY_PAGE);- expect(response.status()).toBe(200);- await context.close();-});-it('should intercept after a service worker', async ({page, server, isAndroid}) => {it.skip(isAndroid);diff --git a/tests/jshandle-as-element.spec.ts b/tests/page/jshandle-as-element.spec.tssimilarity index 97%rename from tests/jshandle-as-element.spec.tsrename to tests/page/jshandle-as-element.spec.tsindex 0d11bc9969..3530ed6d9e 100644--- a/tests/jshandle-as-element.spec.ts+++ b/tests/page/jshandle-as-element.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test, expect } from './config/pageTest';+import { test, expect } from '../config/pageTest';test('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => document.body);diff --git a/tests/jshandle-evaluate.spec.ts b/tests/page/jshandle-evaluate.spec.tssimilarity index 95%rename from tests/jshandle-evaluate.spec.tsrename to tests/page/jshandle-evaluate.spec.tsindex 337dc5fc97..d8b3eefdfa 100644--- a/tests/jshandle-evaluate.spec.ts+++ b/tests/page/jshandle-evaluate.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work with function', async ({page}) => {const windowHandle = await page.evaluateHandle(() => {diff --git a/tests/jshandle-json-value.spec.ts b/tests/page/jshandle-json-value.spec.tssimilarity index 96%rename from tests/jshandle-json-value.spec.tsrename to tests/page/jshandle-json-value.spec.tsindex 5cad2b592c..f38017b51d 100644--- a/tests/jshandle-json-value.spec.ts+++ b/tests/page/jshandle-json-value.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => ({foo: 'bar'}));diff --git a/tests/jshandle-properties.spec.ts b/tests/page/jshandle-properties.spec.tssimilarity index 97%rename from tests/jshandle-properties.spec.tsrename to tests/page/jshandle-properties.spec.tsindex 3afc5f1986..aa4b89ff25 100644--- a/tests/jshandle-properties.spec.ts+++ b/tests/page/jshandle-properties.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import type { ElementHandle } from '../index';+import { test as it, expect } from '../config/pageTest';+import type { ElementHandle } from '../../index';it('should work', async ({page}) => {const aHandle = await page.evaluateHandle(() => ({diff --git a/tests/jshandle-to-string.spec.ts b/tests/page/jshandle-to-string.spec.tssimilarity index 98%rename from tests/jshandle-to-string.spec.tsrename to tests/page/jshandle-to-string.spec.tsindex cec0417dfd..e2add5adfe 100644--- a/tests/jshandle-to-string.spec.ts+++ b/tests/page/jshandle-to-string.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work for primitives', async ({page}) => {const numberHandle = await page.evaluateHandle(() => 2);diff --git a/tests/network-post-data.spec.ts b/tests/page/network-post-data.spec.tssimilarity index 98%rename from tests/network-post-data.spec.tsrename to tests/page/network-post-data.spec.tsindex e5d9c56695..4e3a39fbc9 100644--- a/tests/network-post-data.spec.ts+++ b/tests/page/network-post-data.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it.fixme(({ isAndroid }) => isAndroid, 'Post data does not work');diff --git a/tests/page-accessibility.spec.ts b/tests/page/page-accessibility.spec.tssimilarity index 99%rename from tests/page-accessibility.spec.tsrename to tests/page/page-accessibility.spec.tsindex 88f61a3ff1..16fb5a3eef 100644--- a/tests/page-accessibility.spec.ts+++ b/tests/page/page-accessibility.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page, isFirefox, isChromium }) => {await page.setContent(`diff --git a/tests/page-add-init-script.spec.ts b/tests/page/page-add-init-script.spec.tssimilarity index 98%rename from tests/page-add-init-script.spec.tsrename to tests/page/page-add-init-script.spec.tsindex 1de68bbee8..86cc52acb0 100644--- a/tests/page-add-init-script.spec.ts+++ b/tests/page/page-add-init-script.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should evaluate before anything else on the page', async ({ page, server }) => {await page.addInitScript(function() {diff --git a/tests/page-add-script-tag.spec.ts b/tests/page/page-add-script-tag.spec.tssimilarity index 98%rename from tests/page-add-script-tag.spec.tsrename to tests/page/page-add-script-tag.spec.tsindex 8e5a34b78d..ddbea94340 100644--- a/tests/page-add-script-tag.spec.ts+++ b/tests/page/page-add-script-tag.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import path from 'path';it('should throw an error if no options are provided', async ({page, server}) => {diff --git a/tests/page-add-style-tag.spec.ts b/tests/page/page-add-style-tag.spec.tssimilarity index 98%rename from tests/page-add-style-tag.spec.tsrename to tests/page/page-add-style-tag.spec.tsindex 73a51959b0..e334d829a0 100644--- a/tests/page-add-style-tag.spec.ts+++ b/tests/page/page-add-style-tag.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import path from 'path';it('should throw an error if no options are provided', async ({page, server}) => {diff --git a/tests/page-autowaiting-basic.spec.ts b/tests/page/page-autowaiting-basic.spec.tssimilarity index 98%rename from tests/page-autowaiting-basic.spec.tsrename to tests/page/page-autowaiting-basic.spec.tsindex 4fd7adb2a7..7a4a694cda 100644--- a/tests/page-autowaiting-basic.spec.ts+++ b/tests/page/page-autowaiting-basic.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { TestServer } from '../utils/testserver';-import { test as it, expect } from './config/pageTest';+import { TestServer } from '../../utils/testserver';+import { test as it, expect } from '../config/pageTest';function initServer(server: TestServer): string[] {const messages = [];diff --git a/tests/page-autowaiting-no-hang.spec.ts b/tests/page/page-autowaiting-no-hang.spec.tssimilarity index 97%rename from tests/page-autowaiting-no-hang.spec.tsrename to tests/page/page-autowaiting-no-hang.spec.tsindex a725641acb..16634221f8 100644--- a/tests/page-autowaiting-no-hang.spec.ts+++ b/tests/page/page-autowaiting-no-hang.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it } from './config/pageTest';+import { test as it } from '../config/pageTest';it('clicking on links which do not commit navigation', async ({page, server, httpsServer}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/page-basic.spec.ts b/tests/page/page-basic.spec.tssimilarity index 99%rename from tests/page-basic.spec.tsrename to tests/page/page-basic.spec.tsindex 5c839fa637..fe754c8554 100644--- a/tests/page-basic.spec.ts+++ b/tests/page/page-basic.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should reject all promises when page is closed', async ({page}) => {let error = null;diff --git a/tests/page-check.spec.ts b/tests/page/page-check.spec.tssimilarity index 98%rename from tests/page-check.spec.tsrename to tests/page/page-check.spec.tsindex 7e806c4dfb..69fba491b1 100644--- a/tests/page-check.spec.ts+++ b/tests/page/page-check.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should check the box', async ({page}) => {await page.setContent(`<input id='checkbox' type='checkbox'></input>`);diff --git a/tests/page-click-react.spec.ts b/tests/page/page-click-react.spec.tssimilarity index 99%rename from tests/page-click-react.spec.tsrename to tests/page/page-click-react.spec.tsindex c966b72f0c..615ab1047b 100644--- a/tests/page-click-react.spec.ts+++ b/tests/page/page-click-react.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';declare const renderComponent;declare const e;diff --git a/tests/page-click-scroll.spec.ts b/tests/page/page-click-scroll.spec.tssimilarity index 96%rename from tests/page-click-scroll.spec.tsrename to tests/page/page-click-scroll.spec.tsindex a0a27b1144..5823d16574 100644--- a/tests/page-click-scroll.spec.ts+++ b/tests/page/page-click-scroll.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test as it } from './config/pageTest';+import { test as it } from '../config/pageTest';it('should not hit scroll bar', async ({page, isAndroid, isWebKit, platform}) => {it.fixme(isWebKit && platform === 'darwin');diff --git a/tests/page-click-timeout-1.spec.ts b/tests/page/page-click-timeout-1.spec.tssimilarity index 96%rename from tests/page-click-timeout-1.spec.tsrename to tests/page/page-click-timeout-1.spec.tsindex 8b17236696..5e90ed5e47 100644--- a/tests/page-click-timeout-1.spec.ts+++ b/tests/page/page-click-timeout-1.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should avoid side effects after timeout', async ({page, server, mode}) => {it.skip(mode !== 'default');diff --git a/tests/page-click-timeout-2.spec.ts b/tests/page/page-click-timeout-2.spec.tssimilarity index 96%rename from tests/page-click-timeout-2.spec.tsrename to tests/page/page-click-timeout-2.spec.tsindex 6406671005..7fc79b5f6a 100644--- a/tests/page-click-timeout-2.spec.ts+++ b/tests/page/page-click-timeout-2.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should timeout waiting for display:none to be gone', async ({page, server}) => {await page.goto(server.PREFIX + '/input/button.html');diff --git a/tests/page-click-timeout-3.spec.ts b/tests/page/page-click-timeout-3.spec.tssimilarity index 98%rename from tests/page-click-timeout-3.spec.tsrename to tests/page/page-click-timeout-3.spec.tsindex df0cf693aa..341e6a332d 100644--- a/tests/page-click-timeout-3.spec.ts+++ b/tests/page/page-click-timeout-3.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should fail when element jumps during hit testing', async ({page, mode}) => {it.skip(mode !== 'default');diff --git a/tests/page-click-timeout-4.spec.ts b/tests/page/page-click-timeout-4.spec.tssimilarity index 95%rename from tests/page-click-timeout-4.spec.tsrename to tests/page/page-click-timeout-4.spec.tsindex bd46f8f2ca..9510aaeab2 100644--- a/tests/page-click-timeout-4.spec.ts+++ b/tests/page/page-click-timeout-4.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should timeout waiting for stable position', async ({page, server}) => {await page.goto(server.PREFIX + '/input/button.html');diff --git a/tests/page-click.spec.ts b/tests/page/page-click.spec.tssimilarity index 99%rename from tests/page-click.spec.tsrename to tests/page/page-click.spec.tsindex 98c2bc34a3..37bcfd3deb 100644--- a/tests/page-click.spec.ts+++ b/tests/page/page-click.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';async function giveItAChanceToClick(page) {for (let i = 0; i < 5; i++)diff --git a/tests/page-close.spec.ts b/tests/page/page-close.spec.tssimilarity index 95%rename from tests/page-close.spec.tsrename to tests/page/page-close.spec.tsindex d6a15309aa..ab21212ddc 100644--- a/tests/page-close.spec.ts+++ b/tests/page/page-close.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should close page with active dialog', async ({page}) => {await page.setContent(`<button onclick="setTimeout(() => alert(1))">alert</button>`);diff --git a/tests/page-dialog.spec.ts b/tests/page/page-dialog.spec.tssimilarity index 98%rename from tests/page-dialog.spec.tsrename to tests/page/page-dialog.spec.tsindex 906b5ba8bc..3b38283854 100644--- a/tests/page-dialog.spec.ts+++ b/tests/page/page-dialog.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should fire', async ({page, server}) => {page.on('dialog', dialog => {diff --git a/tests/page-dispatchevent.spec.ts b/tests/page/page-dispatchevent.spec.tssimilarity index 99%rename from tests/page-dispatchevent.spec.tsrename to tests/page/page-dispatchevent.spec.tsindex 2dcd3b7808..74ec960072 100644--- a/tests/page-dispatchevent.spec.ts+++ b/tests/page/page-dispatchevent.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should dispatch click event', async ({page, server}) => {await page.goto(server.PREFIX + '/input/button.html');diff --git a/tests/page-drag.spec.ts b/tests/page/page-drag.spec.tssimilarity index 97%rename from tests/page-drag.spec.tsrename to tests/page/page-drag.spec.tsindex 1a69837d13..eb5f0cbe1c 100644--- a/tests/page-drag.spec.ts+++ b/tests/page/page-drag.spec.ts@@ -14,9 +14,9 @@* limitations under the License.*/-import type { ElementHandle } from '../index';-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import type { ElementHandle } from '../../index';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it.describe('Drag and drop', () => {it.skip(({ isAndroid }) => isAndroid);diff --git a/tests/page-emulate-media.spec.ts b/tests/page/page-emulate-media.spec.tssimilarity index 73%rename from tests/page-emulate-media.spec.tsrename to tests/page/page-emulate-media.spec.tsindex 1080288678..df26c85117 100644--- a/tests/page-emulate-media.spec.ts+++ b/tests/page/page-emulate-media.spec.ts@@ -15,9 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';it.skip(({ isAndroid }) => isAndroid);@@ -84,41 +82,6 @@ it('should work during navigation', async ({page, server}) => {expect(await page.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);});-browserTest('should work in popup', async ({browser, server}) => {- {- const context = await browser.newContext({ colorScheme: 'dark' });- const page = await context.newPage();- await page.goto(server.EMPTY_PAGE);- const [popup] = await Promise.all([- page.waitForEvent('popup'),- page.evaluate(url => { window.open(url); }, server.EMPTY_PAGE),- ]);- expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches)).toBe(false);- expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);- await context.close();- }- {- const page = await browser.newPage({ colorScheme: 'light' });- await page.goto(server.EMPTY_PAGE);- const [popup] = await Promise.all([- page.waitForEvent('popup'),- page.evaluate(url => { window.open(url); }, server.EMPTY_PAGE),- ]);- expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: light)').matches)).toBe(true);- expect(await popup.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(false);- await page.close();- }-});--browserTest('should work in cross-process iframe', async ({browser, server}) => {- const page = await browser.newPage({ colorScheme: 'dark' });- await page.goto(server.EMPTY_PAGE);- await attachFrame(page, 'frame1', server.CROSS_PROCESS_PREFIX + '/empty.html');- const frame = page.frames()[1];- expect(await frame.evaluate(() => matchMedia('(prefers-color-scheme: dark)').matches)).toBe(true);- await page.close();-});-it('should change the actual colors in css', async ({page}) => {await page.setContent(`<style>diff --git a/tests/page-evaluate-handle.spec.ts b/tests/page/page-evaluate-handle.spec.tssimilarity index 98%rename from tests/page-evaluate-handle.spec.tsrename to tests/page/page-evaluate-handle.spec.tsindex 9f416e7b5b..a0d74161fa 100644--- a/tests/page-evaluate-handle.spec.ts+++ b/tests/page/page-evaluate-handle.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page}) => {const windowHandle = await page.evaluateHandle(() => window);diff --git a/tests/page-evaluate-no-stall.spec.ts b/tests/page/page-evaluate-no-stall.spec.tssimilarity index 97%rename from tests/page-evaluate-no-stall.spec.tsrename to tests/page/page-evaluate-no-stall.spec.tsindex 2fe9611434..cead2d2d06 100644--- a/tests/page-evaluate-no-stall.spec.ts+++ b/tests/page/page-evaluate-no-stall.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test, expect } from './config/pageTest';+import { test, expect } from '../config/pageTest';test.describe('non-stalling evaluate', () => {test.skip(({mode}) => mode !== 'default');diff --git a/tests/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.tssimilarity index 99%rename from tests/page-evaluate.spec.tsrename to tests/page/page-evaluate.spec.tsindex da1531d22d..47350b7dba 100644--- a/tests/page-evaluate.spec.ts+++ b/tests/page/page-evaluate.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({ page }) => {const result = await page.evaluate(() => 7 * 3);diff --git a/tests/page-event-console.spec.ts b/tests/page/page-event-console.spec.tssimilarity index 98%rename from tests/page-event-console.spec.tsrename to tests/page/page-event-console.spec.tsindex be9928bc67..01b2b71d09 100644--- a/tests/page-event-console.spec.ts+++ b/tests/page/page-event-console.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import util from 'util';it('should work', async ({page}) => {diff --git a/tests/page-event-crash.spec.ts b/tests/page/page-event-crash.spec.tssimilarity index 98%rename from tests/page-event-crash.spec.tsrename to tests/page/page-event-crash.spec.tsindex d13d53346e..25c68c116a 100644--- a/tests/page-event-crash.spec.ts+++ b/tests/page/page-event-crash.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import * as os from 'os';function crash({ page, toImpl, browserName, platform, mode }: any) {diff --git a/tests/page-event-network.spec.ts b/tests/page/page-event-network.spec.tssimilarity index 98%rename from tests/page-event-network.spec.tsrename to tests/page/page-event-network.spec.tsindex 8a4481ff5f..d22f647c82 100644--- a/tests/page-event-network.spec.ts+++ b/tests/page/page-event-network.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('Page.Events.Request', async ({page, server}) => {const requests = [];diff --git a/tests/page-event-pageerror.spec.ts b/tests/page/page-event-pageerror.spec.tssimilarity index 98%rename from tests/page-event-pageerror.spec.tsrename to tests/page/page-event-pageerror.spec.tsindex 80ca2805b7..cea1bad416 100644--- a/tests/page-event-pageerror.spec.ts+++ b/tests/page/page-event-pageerror.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should fire', async ({page, server, isWebKit}) => {const [error] = await Promise.all([diff --git a/tests/page-event-popup.spec.ts b/tests/page/page-event-popup.spec.tssimilarity index 99%rename from tests/page-event-popup.spec.tsrename to tests/page/page-event-popup.spec.tsindex 7c64c860a8..77519310cf 100644--- a/tests/page-event-popup.spec.ts+++ b/tests/page/page-event-popup.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page}) => {const [popup] = await Promise.all([diff --git a/tests/page-event-request.spec.ts b/tests/page/page-event-request.spec.tssimilarity index 95%rename from tests/page-event-request.spec.tsrename to tests/page/page-event-request.spec.tsindex f5a2985ed3..04ed5e1eaf 100644--- a/tests/page-event-request.spec.ts+++ b/tests/page/page-event-request.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should fire for navigation requests', async ({page, server}) => {const requests = [];diff --git a/tests/page-expose-function.spec.ts b/tests/page/page-expose-function.spec.tssimilarity index 96%rename from tests/page-expose-function.spec.tsrename to tests/page/page-expose-function.spec.tsindex 1dddc3cc63..0c29440dc8 100644--- a/tests/page-expose-function.spec.ts+++ b/tests/page/page-expose-function.spec.ts@@ -15,9 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';-import type { ElementHandle } from '../index';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';+import type { ElementHandle } from '../../index';it('exposeBinding should work', async ({page}) => {let bindingSource;@@ -244,7 +244,7 @@ it('should work with internal bindings', async ({page, toImpl, server, mode, broit.skip(isAndroid);it.skip(isElectron);- const implPage: import('../src/server/page').Page = toImpl(page);+ const implPage: import('../../src/server/page').Page = toImpl(page);let foo;await implPage.exposeBinding('foo', false, ({}, arg) => {foo = arg;@@ -264,7 +264,7 @@ it('should work with internal bindings', async ({page, toImpl, server, mode, bro// should work inside framesconst frame = await attachFrame(page, 'myframe', server.CROSS_PROCESS_PREFIX + '/empty.html');expect(await frame.evaluate('!!window.foo')).toBe(false);- const implFrame: import('../src/server/frames').Frame = toImpl(frame);+ const implFrame: import('../../src/server/frames').Frame = toImpl(frame);await implFrame.evaluateExpression('window.foo(789)', false, {}, 'utility');expect(foo).toBe(789);});diff --git a/tests/page-fill.spec.ts b/tests/page/page-fill.spec.tssimilarity index 99%rename from tests/page-fill.spec.tsrename to tests/page/page-fill.spec.tsindex 674c6fbb60..7d8b020148 100644--- a/tests/page-fill.spec.ts+++ b/tests/page/page-fill.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';async function giveItAChanceToFill(page) {for (let i = 0; i < 5; i++)diff --git a/tests/page-focus.spec.ts b/tests/page/page-focus.spec.tssimilarity index 98%rename from tests/page-focus.spec.tsrename to tests/page/page-focus.spec.tsindex 5c66400ca0..9502d7b6cc 100644--- a/tests/page-focus.spec.ts+++ b/tests/page/page-focus.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async function({page, browserName}) {it.skip(browserName === 'firefox');diff --git a/tests/page-goto.spec.ts b/tests/page/page-goto.spec.tssimilarity index 96%rename from tests/page-goto.spec.tsrename to tests/page/page-goto.spec.tsindex e73b298529..999ec2e420 100644--- a/tests/page-goto.spec.ts+++ b/tests/page/page-goto.spec.ts@@ -17,9 +17,8 @@import url from 'url';import os from 'os';-import { test as it, expect } from './config/pageTest';-import { slowBrowserTest as slowTest } from './config/browserTest';-import { expectedSSLError } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { expectedSSLError } from '../config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);@@ -373,19 +372,6 @@ it('should not leak listeners during bad navigation', async ({page, server}) =>expect(warning).toBe(null);});-// We open 20 pages here!-slowTest('should not leak listeners during navigation of 20 pages', async ({contextFactory, server}) => {- const context = await contextFactory();- let warning = null;- const warningHandler = w => warning = w;- process.on('warning', warningHandler);- const pages = await Promise.all([...Array(20)].map(() => context.newPage()));- await Promise.all(pages.map(page => page.goto(server.EMPTY_PAGE)));- await Promise.all(pages.map(page => page.close()));- process.off('warning', warningHandler);- expect(warning).toBe(null);-});-it('should not leak listeners during 20 waitForNavigation', async ({page, server}) => {let warning = null;const warningHandler = w => warning = w;diff --git a/tests/page-history.spec.ts b/tests/page/page-history.spec.tssimilarity index 99%rename from tests/page-history.spec.tsrename to tests/page/page-history.spec.tsindex 7b07294036..743e7e94a6 100644--- a/tests/page-history.spec.ts+++ b/tests/page/page-history.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import url from 'url';it('page.goBack should work', async ({page, server}) => {diff --git a/tests/page-keyboard.spec.ts b/tests/page/page-keyboard.spec.tssimilarity index 99%rename from tests/page-keyboard.spec.tsrename to tests/page/page-keyboard.spec.tsindex ec037f81a4..37cd155596 100644--- a/tests/page-keyboard.spec.ts+++ b/tests/page/page-keyboard.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it.skip(({ isAndroid }) => isAndroid);diff --git a/tests/page-mouse.spec.ts b/tests/page/page-mouse.spec.tssimilarity index 88%rename from tests/page-mouse.spec.tsrename to tests/page/page-mouse.spec.tsindex 351b2e404f..eb75ad67ec 100644--- a/tests/page-mouse.spec.ts+++ b/tests/page/page-mouse.spec.ts@@ -15,8 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';+import { test as it, expect } from '../config/pageTest';function dimensions() {const rect = document.querySelector('textarea').getBoundingClientRect();@@ -165,23 +164,3 @@ it('should tween mouse movement', async ({page, isWebKit, isAndroid}) => {[200, 300]]);});--browserTest('should work with mobile viewports and cross process navigations', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');-- // @see https://crbug.com/929806- const context = await browser.newContext({ viewport: {width: 360, height: 640}, isMobile: true });- const page = await context.newPage();- await page.goto(server.EMPTY_PAGE);- await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');- await page.evaluate(() => {- document.addEventListener('click', event => {- window['result'] = {x: event.clientX, y: event.clientY};- });- });-- await page.mouse.click(30, 40);-- expect(await page.evaluate('result')).toEqual({x: 30, y: 40});- await context.close();-});diff --git a/tests/page-navigation.spec.ts b/tests/page/page-navigation.spec.tssimilarity index 96%rename from tests/page-navigation.spec.tsrename to tests/page/page-navigation.spec.tsindex f66eb4d554..1781658f8c 100644--- a/tests/page-navigation.spec.ts+++ b/tests/page/page-navigation.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it } from './config/pageTest';+import { test as it } from '../config/pageTest';it('should work with _blank target', async ({page, server}) => {server.setRoute('/empty.html', (req, res) => {diff --git a/tests/page-network-idle.spec.ts b/tests/page/page-network-idle.spec.tssimilarity index 97%rename from tests/page-network-idle.spec.tsrename to tests/page/page-network-idle.spec.tsindex 6c03e38142..0c5f761ada 100644--- a/tests/page-network-idle.spec.ts+++ b/tests/page/page-network-idle.spec.ts@@ -15,9 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import type { Frame } from '../index';-import { TestServer } from '../utils/testserver';+import { test as it, expect } from '../config/pageTest';+import type { Frame } from '../../index';+import { TestServer } from '../../utils/testserver';it('should navigate to empty page with networkidle', async ({page, server}) => {const response = await page.goto(server.EMPTY_PAGE, { waitUntil: 'networkidle' });diff --git a/tests/page-network-request.spec.ts b/tests/page/page-network-request.spec.tssimilarity index 99%rename from tests/page-network-request.spec.tsrename to tests/page/page-network-request.spec.tsindex 478cac5e53..230c049cbb 100644--- a/tests/page-network-request.spec.ts+++ b/tests/page/page-network-request.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';it('should work for main frame navigation request', async ({page, server}) => {const requests = [];diff --git a/tests/page-network-response.spec.ts b/tests/page/page-network-response.spec.tssimilarity index 98%rename from tests/page-network-response.spec.tsrename to tests/page/page-network-response.spec.tsindex d10fe5d37e..ab8f4872d2 100644--- a/tests/page-network-response.spec.ts+++ b/tests/page/page-network-response.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import fs from 'fs';it('should work', async ({page, server}) => {diff --git a/tests/page-request-continue.spec.ts b/tests/page/page-request-continue.spec.tssimilarity index 99%rename from tests/page-request-continue.spec.tsrename to tests/page/page-request-continue.spec.tsindex 2a61a3efe8..44cb43f859 100644--- a/tests/page-request-continue.spec.ts+++ b/tests/page/page-request-continue.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page, server}) => {await page.route('**/*', route => route.continue());diff --git a/tests/page-request-fulfill.spec.ts b/tests/page/page-request-fulfill.spec.tssimilarity index 73%rename from tests/page-request-fulfill.spec.tsrename to tests/page/page-request-fulfill.spec.tsindex 7809a08db1..1e30af9ae2 100644--- a/tests/page-request-fulfill.spec.ts+++ b/tests/page/page-request-fulfill.spec.ts@@ -15,8 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';+import { test as it, expect } from '../config/pageTest';import fs from 'fs';it('should work', async ({page, server}) => {@@ -182,84 +181,3 @@ it('should include the origin header', async ({page, server, isAndroid}) => {expect(text).toBe('done');expect(interceptedRequest.headers()['origin']).toEqual(server.PREFIX);});--browserTest('should support Set-Cookie header', async ({contextFactory, server, browserName}) => {- browserTest.fixme(browserName === 'webkit');-- const context = await contextFactory();- const page = await context.newPage();- await page.route('https://example.com/', (route, request) => {- route.fulfill({- headers: {- 'Set-Cookie': 'name=value; domain=.example.com; Path=/'- },- contentType: 'text/html',- body: 'done'- });- });- await page.goto('https://example.com');- expect(await context.cookies()).toEqual([{- sameSite: 'None',- name: 'name',- value: 'value',- domain: '.example.com',- path: '/',- expires: -1,- httpOnly: false,- secure: false- }]);-});--browserTest('should ignore secure Set-Cookie header for insecure requests', async ({contextFactory, server, browserName}) => {- browserTest.fixme(browserName === 'webkit');-- const context = await contextFactory();- const page = await context.newPage();- await page.route('http://example.com/', (route, request) => {- route.fulfill({- headers: {- 'Set-Cookie': 'name=value; domain=.example.com; Path=/; Secure'- },- contentType: 'text/html',- body: 'done'- });- });- await page.goto('http://example.com');- expect(await context.cookies()).toEqual([]);-});--browserTest('should use Set-Cookie header in future requests', async ({contextFactory, server, browserName}) => {- browserTest.fixme(browserName === 'webkit');-- const context = await contextFactory();- const page = await context.newPage();-- await page.route(server.EMPTY_PAGE, (route, request) => {- route.fulfill({- headers: {- 'Set-Cookie': 'name=value'- },- contentType: 'text/html',- body: 'done'- });- });- await page.goto(server.EMPTY_PAGE);- expect(await context.cookies()).toEqual([{- sameSite: 'None',- name: 'name',- value: 'value',- domain: 'localhost',- path: '/',- expires: -1,- httpOnly: false,- secure: false- }]);-- let cookie = '';- server.setRoute('/foo.html', (req, res) => {- cookie = req.headers.cookie;- res.end();- });- await page.goto(server.PREFIX + '/foo.html');- expect(cookie).toBe('name=value');-});diff --git a/tests/page-route.spec.ts b/tests/page/page-route.spec.tssimilarity index 99%rename from tests/page-route.spec.tsrename to tests/page/page-route.spec.tsindex efcf383856..ee0387def4 100644--- a/tests/page-route.spec.ts+++ b/tests/page/page-route.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should intercept', async ({page, server}) => {let intercepted = false;diff --git a/tests/page-screenshot.spec.ts b/tests/page/page-screenshot.spec.tssimilarity index 69%rename from tests/page-screenshot.spec.tsrename to tests/page/page-screenshot.spec.tsindex 34beaa61a3..cdf5dbddc9 100644--- a/tests/page-screenshot.spec.ts+++ b/tests/page/page-screenshot.spec.ts@@ -15,12 +15,10 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest, slowBrowserTest } from './config/browserTest';-import { verifyViewport } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { verifyViewport } from '../config/utils';import path from 'path';import fs from 'fs';-import { PNG } from 'pngjs';it.describe('page screenshot', () => {it.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');@@ -274,107 +272,6 @@ it.describe('page screenshot', () => {const screenshot = await page.screenshot({ fullPage: true });expect(screenshot).toMatchSnapshot('screenshot-grid-fullpage.png');});-});--browserTest.describe('page screenshot', () => {- browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');-- browserTest('should run in parallel in multiple pages', async ({server, contextFactory}) => {- const context = await contextFactory();- const N = 5;- const pages = await Promise.all(Array(N).fill(0).map(async () => {- const page = await context.newPage();- await page.goto(server.PREFIX + '/grid.html');- return page;- }));- const promises = [];- for (let i = 0; i < N; ++i)- 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]).toMatchSnapshot(`grid-cell-${i % 2}.png`);- await Promise.all(pages.map(page => page.close()));- });-- browserTest('should work with a mobile viewport', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');- browserTest.fixme(browserName === 'chromium');-- 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).toMatchSnapshot('screenshot-mobile.png');- await context.close();- });-- browserTest('should work with a mobile viewport and clip', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');- browserTest.skip(process.env.CRPATH); // Does not work in stable Chrome.-- 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).toMatchSnapshot('screenshot-mobile-clip.png');- await context.close();- });-- browserTest('should work with a mobile viewport and fullPage', async ({browser, server, browserName}) => {- browserTest.skip(browserName === 'firefox');-- 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).toMatchSnapshot('screenshot-mobile-fullpage.png');- await context.close();- });--- browserTest('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).toMatchSnapshot('screenshot-device-scale-factor.png');- await context.close();- });-- // Large screenshot is slow.- slowBrowserTest('should work with large size', async ({ browserName, headful, platform, contextFactory }) => {- slowBrowserTest.fixme(browserName === 'chromium' && headful === true && platform === 'linux', 'Chromium has gpu problems on linux with large screnshots');-- const context = await contextFactory();- const page = await context.newPage();-- await page.setViewportSize({ width: 1280, height: 800 });- await page.evaluate(() => {- document.body.style.margin = '0';- document.body.style.padding = '0';- document.documentElement.style.margin = '0';- document.documentElement.style.padding = '0';- const div = document.createElement('div');- div.style.width = '1250px';- div.style.height = '8440px';- div.style.background = 'linear-gradient(red, blue)';- document.body.appendChild(div);- });- const buffer = await page.screenshot({ fullPage: true });- const decoded = PNG.sync.read(buffer);-- const pixel = (x: number, y: number) => {- const dst = new PNG({ width: 1, height: 1 });- PNG.bitblt(decoded, dst, x, y, 1, 1);- const pixels = dst.data;- return { r: pixels[0], g: pixels[1], b: pixels[2], a: pixels[3] };- };-- expect(pixel(0, 0).r).toBeGreaterThan(128);- expect(pixel(0, 0).b).toBeLessThan(128);- expect(pixel(0, 8339).r).toBeLessThan(128);- expect(pixel(0, 8339).b).toBeGreaterThan(128);- });it('should take fullPage screenshots during navigation', async ({page, server}) => {await page.setViewportSize({width: 500, height: 500});diff --git a/tests/page-select-option.spec.ts b/tests/page/page-select-option.spec.tssimilarity index 99%rename from tests/page-select-option.spec.tsrename to tests/page/page-select-option.spec.tsindex 8c02d142ee..fab6992fff 100644--- a/tests/page-select-option.spec.ts+++ b/tests/page/page-select-option.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';async function giveItAChanceToResolve(page) {for (let i = 0; i < 5; i++)diff --git a/tests/page-set-content.spec.ts b/tests/page/page-set-content.spec.tssimilarity index 98%rename from tests/page-set-content.spec.tsrename to tests/page/page-set-content.spec.tsindex 3756285950..16b0cbf9d5 100644--- a/tests/page-set-content.spec.ts+++ b/tests/page/page-set-content.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';const expectedOutput = '<html><head></head><body><div>hello</div></body></html>';diff --git a/tests/page-set-extra-http-headers.spec.ts b/tests/page/page-set-extra-http-headers.spec.tssimilarity index 97%rename from tests/page-set-extra-http-headers.spec.tsrename to tests/page/page-set-extra-http-headers.spec.tsindex 47ec217dde..6df65ee88a 100644--- a/tests/page-set-extra-http-headers.spec.ts+++ b/tests/page/page-set-extra-http-headers.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page, server}) => {await page.setExtraHTTPHeaders({diff --git a/tests/page-set-input-files.spec.ts b/tests/page/page-set-input-files.spec.tssimilarity index 99%rename from tests/page-set-input-files.spec.tsrename to tests/page/page-set-input-files.spec.tsindex ac99c17a92..3e392c6a95 100644--- a/tests/page-set-input-files.spec.ts+++ b/tests/page/page-set-input-files.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import path from 'path';import fs from 'fs';diff --git a/tests/page-wait-for-function.spec.ts b/tests/page/page-wait-for-function.spec.tssimilarity index 99%rename from tests/page-wait-for-function.spec.tsrename to tests/page/page-wait-for-function.spec.tsindex 87b5e40d21..77de880281 100644--- a/tests/page-wait-for-function.spec.ts+++ b/tests/page/page-wait-for-function.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should timeout', async ({page}) => {const startTime = Date.now();diff --git a/tests/page-wait-for-load-state.spec.ts b/tests/page/page-wait-for-load-state.spec.tssimilarity index 98%rename from tests/page-wait-for-load-state.spec.tsrename to tests/page/page-wait-for-load-state.spec.tsindex a988f3777a..82c84f7a14 100644--- a/tests/page-wait-for-load-state.spec.ts+++ b/tests/page/page-wait-for-load-state.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import type { Route } from '../index';+import { test as it, expect } from '../config/pageTest';+import type { Route } from '../../index';it('should pick up ongoing navigation', async ({page, server}) => {let response = null;diff --git a/tests/page-wait-for-navigation.spec.ts b/tests/page/page-wait-for-navigation.spec.tssimilarity index 97%rename from tests/page-wait-for-navigation.spec.tsrename to tests/page/page-wait-for-navigation.spec.tsindex c74495bdf9..a55550e4b5 100644--- a/tests/page-wait-for-navigation.spec.ts+++ b/tests/page/page-wait-for-navigation.spec.ts@@ -15,9 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import type { Frame } from '../index';-import { expectedSSLError } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import type { Frame } from '../../index';+import { expectedSSLError } from '../config/utils';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);@@ -144,7 +144,7 @@ it('should work when subframe issues window.stop()', async ({page, server}) => {server.setRoute('/frames/style.css', (req, res) => {});const navigationPromise = page.goto(server.PREFIX + '/frames/one-frame.html');const frame = await new Promise<Frame>(f => page.once('frameattached', f));- await new Promise(fulfill => page.on('framenavigated', f => {+ await new Promise<void>(fulfill => page.on('framenavigated', f => {if (f === frame)fulfill();}));diff --git a/tests/page-wait-for-request.spec.ts b/tests/page/page-wait-for-request.spec.tssimilarity index 98%rename from tests/page-wait-for-request.spec.tsrename to tests/page/page-wait-for-request.spec.tsindex 77668e3386..a42cd81b25 100644--- a/tests/page-wait-for-request.spec.ts+++ b/tests/page/page-wait-for-request.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';import vm from 'vm';it('should work', async ({page, server}) => {diff --git a/tests/page-wait-for-response.spec.ts b/tests/page/page-wait-for-response.spec.tssimilarity index 98%rename from tests/page-wait-for-response.spec.tsrename to tests/page/page-wait-for-response.spec.tsindex 031b5329df..844dae592c 100644--- a/tests/page-wait-for-response.spec.ts+++ b/tests/page/page-wait-for-response.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/page-wait-for-selector-1.spec.ts b/tests/page/page-wait-for-selector-1.spec.tssimilarity index 98%rename from tests/page-wait-for-selector-1.spec.tsrename to tests/page/page-wait-for-selector-1.spec.tsindex d50ac4233e..aef147fd7b 100644--- a/tests/page-wait-for-selector-1.spec.ts+++ b/tests/page/page-wait-for-selector-1.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame, detachFrame } from '../config/utils';async function giveItTimeToLog(frame) {await frame.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));diff --git a/tests/page-wait-for-selector-2.spec.ts b/tests/page/page-wait-for-selector-2.spec.tssimilarity index 99%rename from tests/page-wait-for-selector-2.spec.tsrename to tests/page/page-wait-for-selector-2.spec.tsindex 3449718edb..08d4a94000 100644--- a/tests/page-wait-for-selector-2.spec.ts+++ b/tests/page/page-wait-for-selector-2.spec.ts@@ -15,8 +15,8 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { attachFrame, detachFrame } from './config/utils';+import { test as it, expect } from '../config/pageTest';+import { attachFrame, detachFrame } from '../config/utils';const addElement = tag => document.body.appendChild(document.createElement(tag));diff --git a/tests/page-wait-for-url.spec.ts b/tests/page/page-wait-for-url.spec.tssimilarity index 98%rename from tests/page-wait-for-url.spec.tsrename to tests/page/page-wait-for-url.spec.tsindex badb32d795..bbaf56a7bf 100644--- a/tests/page-wait-for-url.spec.ts+++ b/tests/page/page-wait-for-url.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page, server}) => {await page.goto(server.EMPTY_PAGE);diff --git a/tests/queryselector.spec.ts b/tests/page/queryselector.spec.tssimilarity index 98%rename from tests/queryselector.spec.tsrename to tests/page/queryselector.spec.tsindex 9622945c46..1e6477e909 100644--- a/tests/queryselector.spec.ts+++ b/tests/page/queryselector.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should throw for non-string selector', async ({page}) => {const error = await page.$(null).catch(e => e);diff --git a/tests/selectors-css.spec.ts b/tests/page/selectors-css.spec.tssimilarity index 99%rename from tests/selectors-css.spec.tsrename to tests/page/selectors-css.spec.tsindex d9106130b9..7d0323dbbf 100644--- a/tests/selectors-css.spec.ts+++ b/tests/page/selectors-css.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work with large DOM', async ({page, server}) => {await page.evaluate(() => {diff --git a/tests/selectors-misc.spec.ts b/tests/page/selectors-misc.spec.tssimilarity index 99%rename from tests/selectors-misc.spec.tsrename to tests/page/selectors-misc.spec.tsindex d83696af9d..7329f5f7c1 100644--- a/tests/selectors-misc.spec.ts+++ b/tests/page/selectors-misc.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work for open shadow roots', async ({page, server}) => {await page.goto(server.PREFIX + '/deep-shadow.html');diff --git a/tests/selectors-text.spec.ts b/tests/page/selectors-text.spec.tssimilarity index 99%rename from tests/selectors-text.spec.tsrename to tests/page/selectors-text.spec.tsindex 7d774f909e..7521de07ac 100644--- a/tests/selectors-text.spec.ts+++ b/tests/page/selectors-text.spec.ts@@ -15,7 +15,7 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';+import { test as it, expect } from '../config/pageTest';it('should work', async ({page}) => {await page.setContent(`<div>yo</div><div>ya</div><div>\nye </div>`);diff --git a/tests/workers.spec.ts b/tests/page/workers.spec.tssimilarity index 90%rename from tests/workers.spec.tsrename to tests/page/workers.spec.tsindex 99eab154b7..ea5ccd1fff 100644--- a/tests/workers.spec.ts+++ b/tests/page/workers.spec.ts@@ -15,10 +15,9 @@* limitations under the License.*/-import { test as it, expect } from './config/pageTest';-import { browserTest } from './config/browserTest';-import { attachFrame } from './config/utils';-import type { ConsoleMessage } from '../index';+import { test as it, expect } from '../config/pageTest';+import { attachFrame } from '../config/utils';+import type { ConsoleMessage } from '../../index';it('Page.workers', async function({page, server}) {await Promise.all([@@ -171,15 +170,3 @@ it('should report network activity on worker creation', async function({page, seexpect(response.request()).toBe(request);expect(response.ok()).toBe(true);});--browserTest('should format number using context locale', async ({browser, server}) => {- const context = await browser.newContext({ locale: 'ru-RU' });- const page = await context.newPage();- await page.goto(server.EMPTY_PAGE);- const [worker] = await Promise.all([- page.waitForEvent('worker'),- page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))),- ]);- expect(await worker.evaluate(() => (10000.20).toLocaleString())).toBe('10\u00A0000,2');- await context.close();-});diff --git a/tests/screenshot.spec.ts b/tests/screenshot.spec.tsnew file mode 100644index 0000000000..c9b32b6f9c--- /dev/null+++ b/tests/screenshot.spec.ts@@ -0,0 +1,268 @@+/**+ * Copyright 2018 Google Inc. All rights reserved.+ * Modifications copyright (c) Microsoft Corporation.+ *+ * 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 { expect, browserTest, slowBrowserTest } from './config/browserTest';+import { PNG } from 'pngjs';+import { verifyViewport } from './config/utils';++browserTest.describe('page screenshot', () => {+ browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');++ browserTest('should run in parallel in multiple pages', async ({server, contextFactory}) => {+ const context = await contextFactory();+ const N = 5;+ const pages = await Promise.all(Array(N).fill(0).map(async () => {+ const page = await context.newPage();+ await page.goto(server.PREFIX + '/grid.html');+ return page;+ }));+ const promises = [];+ for (let i = 0; i < N; ++i)+ 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]).toMatchSnapshot(`grid-cell-${i % 2}.png`);+ await Promise.all(pages.map(page => page.close()));+ });++ browserTest('should work with a mobile viewport', async ({browser, server, browserName}) => {+ browserTest.skip(browserName === 'firefox');+ browserTest.fixme(browserName === 'chromium');++ 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).toMatchSnapshot('screenshot-mobile.png');+ await context.close();+ });++ browserTest('should work with a mobile viewport and clip', async ({browser, server, browserName}) => {+ browserTest.skip(browserName === 'firefox');+ browserTest.skip(process.env.CRPATH); // Does not work in stable Chrome.++ 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).toMatchSnapshot('screenshot-mobile-clip.png');+ await context.close();+ });++ browserTest('should work with a mobile viewport and fullPage', async ({browser, server, browserName}) => {+ browserTest.skip(browserName === 'firefox');++ 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).toMatchSnapshot('screenshot-mobile-fullpage.png');+ await context.close();+ });++ browserTest('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).toMatchSnapshot('screenshot-device-scale-factor.png');+ await context.close();+ });++ // Large screenshot is slow.+ slowBrowserTest('should work with large size', async ({ browserName, headful, platform, contextFactory }) => {+ slowBrowserTest.fixme(browserName === 'chromium' && headful === true && platform === 'linux', 'Chromium has gpu problems on linux with large screnshots');++ const context = await contextFactory();+ const page = await context.newPage();++ await page.setViewportSize({ width: 1280, height: 800 });+ await page.evaluate(() => {+ document.body.style.margin = '0';+ document.body.style.padding = '0';+ document.documentElement.style.margin = '0';+ document.documentElement.style.padding = '0';+ const div = document.createElement('div');+ div.style.width = '1250px';+ div.style.height = '8440px';+ div.style.background = 'linear-gradient(red, blue)';+ document.body.appendChild(div);+ });+ const buffer = await page.screenshot({ fullPage: true });+ const decoded = PNG.sync.read(buffer);++ const pixel = (x: number, y: number) => {+ const dst = new PNG({ width: 1, height: 1 });+ PNG.bitblt(decoded, dst, x, y, 1, 1);+ const pixels = dst.data;+ return { r: pixels[0], g: pixels[1], b: pixels[2], a: pixels[3] };+ };++ expect(pixel(0, 0).r).toBeGreaterThan(128);+ expect(pixel(0, 0).b).toBeLessThan(128);+ expect(pixel(0, 8339).r).toBeLessThan(128);+ expect(pixel(0, 8339).b).toBeGreaterThan(128);+ });+});++browserTest.describe('element sceenshot', () => {+ browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful);++ browserTest('element screenshot should work with a mobile viewport', async ({browser, server, browserName}) => {+ browserTest.skip(browserName === 'firefox');++ 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).toMatchSnapshot('screenshot-element-mobile.png');+ await context.close();+ });++ browserTest('element screenshot should work with device scale factor', async ({browser, server, browserName}) => {+ browserTest.skip(browserName === 'firefox');++ 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).toMatchSnapshot('screenshot-element-mobile-dsf.png');+ await context.close();+ });++ browserTest('should take screenshots when default viewport is null', async ({server, browser}) => {+ const context = await browser.newContext({ viewport: null });+ const page = await context.newPage();+ await page.setContent(`<div style='height: 10000px; background: red'></div>`);+ const windowSize = await page.evaluate(() => ({ width: window.innerWidth * window.devicePixelRatio, height: window.innerHeight * window.devicePixelRatio }));+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));++ const screenshot = await page.screenshot();+ expect(screenshot).toBeInstanceOf(Buffer);+ const decoded = PNG.sync.read(screenshot);+ expect(decoded.width).toBe(windowSize.width);+ expect(decoded.height).toBe(windowSize.height);++ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));+ expect(sizeBefore.width).toBe(sizeAfter.width);+ expect(sizeBefore.height).toBe(sizeAfter.height);+ await context.close();+ });++ browserTest('should take fullPage screenshots when default viewport is null', async ({server, browser}) => {+ const context = await browser.newContext({ viewport: null });+ const page = await context.newPage();+ await page.goto(server.PREFIX + '/grid.html');+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));+ const screenshot = await page.screenshot({+ fullPage: true+ });+ expect(screenshot).toBeInstanceOf(Buffer);++ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));+ expect(sizeBefore.width).toBe(sizeAfter.width);+ expect(sizeBefore.height).toBe(sizeAfter.height);+ await context.close();+ });++ browserTest('should restore default viewport after fullPage screenshot', async ({ browser }) => {+ const context = await browser.newContext({ viewport: { width: 456, height: 789 } });+ const page = await context.newPage();+ await verifyViewport(page, 456, 789);+ const screenshot = await page.screenshot({ fullPage: true });+ expect(screenshot).toBeInstanceOf(Buffer);+ await verifyViewport(page, 456, 789);+ await context.close();+ });++ browserTest('should restore viewport after page screenshot and exception', async ({ browser, server, mode }) => {+ browserTest.skip(mode !== 'default');++ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });+ const page = await context.newPage();+ await page.goto(server.PREFIX + '/grid.html');+ const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };+ const error = await page.screenshot({ fullPage: true, __testHookBeforeScreenshot } as any).catch(e => e);+ expect(error.message).toContain('oh my');+ await verifyViewport(page, 350, 360);+ await context.close();+ });++ browserTest('should restore viewport after page screenshot and timeout', async ({ browser, server, mode }) => {+ browserTest.skip(mode !== 'default');++ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });+ const page = await context.newPage();+ await page.goto(server.PREFIX + '/grid.html');+ const __testHookAfterScreenshot = () => new Promise(f => setTimeout(f, 5000));+ const error = await page.screenshot({ fullPage: true, __testHookAfterScreenshot, timeout: 3000 } as any).catch(e => e);+ expect(error.message).toContain('page.screenshot: Timeout 3000ms exceeded');+ await verifyViewport(page, 350, 360);+ await page.setViewportSize({ width: 400, height: 400 });+ await page.waitForTimeout(3000); // Give it some time to wrongly restore previous viewport.+ await verifyViewport(page, 400, 400);+ await context.close();+ });++ browserTest('should take element screenshot when default viewport is null and restore back', async ({server, browser}) => {+ const context = await browser.newContext({viewport: null});+ const page = await context.newPage();+ await page.setContent(`+ <div style="height: 14px">oooo</div>+ <style>+ div.to-screenshot {+ border: 1px solid blue;+ width: 600px;+ height: 600px;+ margin-left: 50px;+ }+ ::-webkit-scrollbar{+ display: none;+ }+ </style>+ <div class="to-screenshot"></div>+ <div class="to-screenshot"></div>+ <div class="to-screenshot"></div>+ `);+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));+ const elementHandle = await page.$('div.to-screenshot');+ const screenshot = await elementHandle.screenshot();+ expect(screenshot).toBeInstanceOf(Buffer);+ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));+ expect(sizeBefore.width).toBe(sizeAfter.width);+ expect(sizeBefore.height).toBe(sizeAfter.height);+ await context.close();+ });++ browserTest('should restore viewport after element screenshot and exception', async ({browser, mode}) => {+ browserTest.skip(mode !== 'default');++ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });+ const page = await context.newPage();+ await page.setContent(`<div style="width:600px;height:600px;"></div>`);+ const elementHandle = await page.$('div');+ const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };+ const error = await elementHandle.screenshot({ __testHookBeforeScreenshot } as any).catch(e => e);+ expect(error.message).toContain('oh my');+ await verifyViewport(page, 350, 360);+ await context.close();+ });+});