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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/firefox/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/webkit/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/chromium/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/firefox/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport-in-parallel/webkit/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/chromium/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/firefox/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-capture-full-element-when-larger-than-viewport/webkit/screenshot-element-larger-than-viewport.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/chromium/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/firefox/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-15000px-into-view/webkit/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/chromium/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/firefox/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-scroll-element-into-view/webkit/screenshot-element-scrolled-into-view.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/chromium/screenshot-element-padding-border.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/firefox/screenshot-element-padding-border.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-take-into-account-padding-and-border/webkit/screenshot-element-padding-border.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/chromium/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/firefox/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-element-to-stop-moving/webkit/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/chromium/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/firefox/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-wait-for-visible/webkit/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/chromium/screenshot-element-fractional-offset.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/firefox/screenshot-element-fractional-offset.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-an-offset/webkit/screenshot-element-fractional-offset.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/chromium/screenshot-element-fractional.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/firefox/screenshot-element-fractional.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-for-an-element-with-fractional-dimensions/webkit/screenshot-element-fractional.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/chromium/screenshot-element-rotate.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/firefox/screenshot-element-rotate.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work-with-a-rotated-element/webkit/screenshot-element-rotate.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work/chromium/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work/firefox/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png rename to tests/__snapshots__/page/elementhandle-screenshot/should-work/webkit/screenshot-element-bounding-box.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/chromium/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/firefox/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-binary-responses/webkit/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/chromium/mock-svg.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/firefox/mock-svg.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png rename to tests/__snapshots__/page/page-request-fulfill/should-allow-mocking-svg-with-charset/webkit/mock-svg.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/chromium/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/firefox/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png rename to tests/__snapshots__/page/page-request-fulfill/should-work-with-file-path/webkit/mock-binary-response.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/chromium/screenshot-sanity.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/firefox/screenshot-sanity.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-create-subdirectories/webkit/screenshot-sanity.png diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpg rename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/chromium/white.jpg diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpg rename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/firefox/white.jpg diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpg rename to tests/__snapshots__/page/page-screenshot/path-option-should-detect-jpeg/webkit/white.jpg diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-work/chromium/screenshot-sanity.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-work/firefox/screenshot-sanity.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/path-option-should-work/webkit/screenshot-sanity.png diff --git a/tests/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.png b/tests/__snapshots__/page/page-screenshot/should-allow-transparency/chromium/transparent.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-allow-transparency/chromium/transparent.png rename to tests/__snapshots__/page/page-screenshot/should-allow-transparency/chromium/transparent.png diff --git a/tests/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png b/tests/__snapshots__/page/page-screenshot/should-allow-transparency/webkit/transparent.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-allow-transparency/webkit/transparent.png rename to tests/__snapshots__/page/page-screenshot/should-allow-transparency/webkit/transparent.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.png rename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/chromium/screenshot-offscreen-clip.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.png rename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/firefox/screenshot-offscreen-clip.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png rename to tests/__snapshots__/page/page-screenshot/should-clip-elements-to-the-viewport/webkit/screenshot-offscreen-clip.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/chromium/screenshot-clip-rect.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/firefox/screenshot-clip-rect.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect-with-fullPage/webkit/screenshot-clip-rect.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect/chromium/screenshot-clip-rect.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect/firefox/screenshot-clip-rect.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png rename to tests/__snapshots__/page/page-screenshot/should-clip-rect/webkit/screenshot-clip-rect.png diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg rename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/chromium/white.jpg diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg rename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/firefox/white.jpg diff --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.jpg similarity index 100% rename from tests/__snapshots__/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg rename to tests/__snapshots__/page/page-screenshot/should-render-white-background-on-jpeg-file/webkit/white.jpg diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.png rename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.png rename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png rename to tests/__snapshots__/page/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/chromium/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/firefox/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-take-fullPage-screenshots/webkit/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/chromium/screenshot-canvas.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/firefox/screenshot-canvas.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-canvas/webkit/screenshot-canvas.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/chromium/screenshot-translateZ.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/firefox/screenshot-translateZ.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-translateZ/webkit/screenshot-translateZ.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-webgl/chromium/screenshot-webgl.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.png rename to tests/__snapshots__/page/page-screenshot/should-work-for-webgl/webkit/screenshot-webgl.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/chromium/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/firefox/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-Array-deleted/webkit/screenshot-grid-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/chromium/screenshot-iframe.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/firefox/screenshot-iframe.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-iframe-in-shadow/webkit/screenshot-iframe.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/chromium/screenshot-clip-odd-size.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/firefox/screenshot-clip-odd-size.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png rename to tests/__snapshots__/page/page-screenshot/should-work-with-odd-clip-size-on-Retina-displays/webkit/screenshot-clip-odd-size.png diff --git a/tests/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/chromium/screenshot-sanity.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work/chromium/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/should-work/chromium/screenshot-sanity.png diff --git a/tests/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/firefox/screenshot-sanity.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work/firefox/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/should-work/firefox/screenshot-sanity.png diff --git a/tests/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png b/tests/__snapshots__/page/page-screenshot/should-work/webkit/screenshot-sanity.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work/webkit/screenshot-sanity.png rename to tests/__snapshots__/page/page-screenshot/should-work/webkit/screenshot-sanity.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png rename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/chromium/screenshot-element-mobile.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png rename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-a-mobile-viewport/webkit/screenshot-element-mobile.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.png rename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/chromium/screenshot-element-mobile-dsf.png diff --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.png similarity index 100% rename from tests/__snapshots__/elementhandle-screenshot/should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png rename to tests/__snapshots__/screenshot/element-screenshot-should-work-with-device-scale-factor/webkit/screenshot-element-mobile-dsf.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-0.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/chromium/grid-cell-1.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/chromium/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-0.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/firefox/grid-cell-1.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/firefox/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-0.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-run-in-parallel/webkit/grid-cell-1.png rename to tests/__snapshots__/screenshot/should-run-in-parallel-in-multiple-pages/webkit/grid-cell-1.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/chromium/screenshot-mobile-clip.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-clip/webkit/screenshot-mobile-clip.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/chromium/screenshot-mobile-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport-and-fullPage/webkit/screenshot-mobile-fullpage.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/chromium/screenshot-mobile.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png rename to tests/__snapshots__/screenshot/should-work-with-a-mobile-viewport/webkit/screenshot-mobile.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.png rename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/chromium/screenshot-device-scale-factor.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.png rename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/firefox/screenshot-device-scale-factor.png diff --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.png similarity index 100% rename from tests/__snapshots__/page-screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png rename to tests/__snapshots__/screenshot/should-work-with-device-scale-factor/webkit/screenshot-device-scale-factor.png diff --git a/tests/browsercontext-basic.spec.ts b/tests/browsercontext-basic.spec.ts index 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.ts index 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, serve await 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.ts similarity index 87% rename from tests/page-in-context.spec.ts rename to tests/browsercontext-pages.spec.ts index 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, serve await 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.ts index 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.ts index 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.ts similarity index 98% rename from tests/elementhandle-bounding-box.spec.ts rename to tests/page/elementhandle-bounding-box.spec.ts index 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.ts similarity index 98% rename from tests/elementhandle-click.spec.ts rename to tests/page/elementhandle-click.spec.ts index 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.ts similarity index 95% rename from tests/elementhandle-content-frame.spec.ts rename to tests/page/elementhandle-content-frame.spec.ts index 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.ts similarity index 99% rename from tests/elementhandle-convenience.spec.ts rename to tests/page/elementhandle-convenience.spec.ts index 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.ts similarity index 98% rename from tests/elementhandle-eval-on-selector.spec.ts rename to tests/page/elementhandle-eval-on-selector.spec.ts index 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('
100
10
'); diff --git a/tests/elementhandle-misc.spec.ts b/tests/page/elementhandle-misc.spec.ts similarity index 98% rename from tests/elementhandle-misc.spec.ts rename to tests/page/elementhandle-misc.spec.ts index 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.ts similarity index 97% rename from tests/elementhandle-owner-frame.spec.ts rename to tests/page/elementhandle-owner-frame.spec.ts index 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.ts similarity index 97% rename from tests/elementhandle-press.spec.ts rename to tests/page/elementhandle-press.spec.ts index 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(``); diff --git a/tests/elementhandle-query-selector.spec.ts b/tests/page/elementhandle-query-selector.spec.ts similarity index 98% rename from tests/elementhandle-query-selector.spec.ts rename to tests/page/elementhandle-query-selector.spec.ts index 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.ts similarity index 59% rename from tests/elementhandle-screenshot.spec.ts rename to tests/page/elementhandle-screenshot.spec.ts index 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(`
`); - 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(` -
oooo
- -
-
-
- `); - 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(`
`); - 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.ts similarity index 98% rename from tests/elementhandle-scroll-into-view.spec.ts rename to tests/page/elementhandle-scroll-into-view.spec.ts index 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.ts similarity index 98% rename from tests/elementhandle-select-text.spec.ts rename to tests/page/elementhandle-select-text.spec.ts index 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.ts similarity index 97% rename from tests/elementhandle-type.spec.ts rename to tests/page/elementhandle-type.spec.ts index 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(``); diff --git a/tests/elementhandle-wait-for-element-state.spec.ts b/tests/page/elementhandle-wait-for-element-state.spec.ts similarity index 98% rename from tests/elementhandle-wait-for-element-state.spec.ts rename to tests/page/elementhandle-wait-for-element-state.spec.ts index 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.ts similarity index 98% rename from tests/eval-on-selector-all.spec.ts rename to tests/page/eval-on-selector-all.spec.ts index 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('
hello
beautiful
world!
'); diff --git a/tests/eval-on-selector.spec.ts b/tests/page/eval-on-selector.spec.ts similarity index 99% rename from tests/eval-on-selector.spec.ts rename to tests/page/eval-on-selector.spec.ts index 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('
43543
'); diff --git a/tests/frame-evaluate.spec.ts b/tests/page/frame-evaluate.spec.ts similarity index 98% rename from tests/frame-evaluate.spec.ts rename to tests/page/frame-evaluate.spec.ts index 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.ts similarity index 95% rename from tests/frame-frame-element.spec.ts rename to tests/page/frame-frame-element.spec.ts index 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.ts similarity index 96% rename from tests/frame-goto.spec.ts rename to tests/page/frame-goto.spec.ts index 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.ts similarity index 98% rename from tests/frame-hierarchy.spec.ts rename to tests/page/frame-hierarchy.spec.ts index 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+\//, ':/'); diff --git a/tests/interception.spec.ts b/tests/page/interception.spec.ts similarity index 92% rename from tests/interception.spec.ts rename to tests/page/interception.spec.ts index 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.ts similarity index 97% rename from tests/jshandle-as-element.spec.ts rename to tests/page/jshandle-as-element.spec.ts index 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.ts similarity index 95% rename from tests/jshandle-evaluate.spec.ts rename to tests/page/jshandle-evaluate.spec.ts index 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.ts similarity index 96% rename from tests/jshandle-json-value.spec.ts rename to tests/page/jshandle-json-value.spec.ts index 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.ts similarity index 97% rename from tests/jshandle-properties.spec.ts rename to tests/page/jshandle-properties.spec.ts index 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.ts similarity index 98% rename from tests/jshandle-to-string.spec.ts rename to tests/page/jshandle-to-string.spec.ts index 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.ts similarity index 98% rename from tests/network-post-data.spec.ts rename to tests/page/network-post-data.spec.ts index 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.ts similarity index 99% rename from tests/page-accessibility.spec.ts rename to tests/page/page-accessibility.spec.ts index 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.ts similarity index 98% rename from tests/page-add-init-script.spec.ts rename to tests/page/page-add-init-script.spec.ts index 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.ts similarity index 98% rename from tests/page-add-script-tag.spec.ts rename to tests/page/page-add-script-tag.spec.ts index 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.ts similarity index 98% rename from tests/page-add-style-tag.spec.ts rename to tests/page/page-add-style-tag.spec.ts index 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.ts similarity index 98% rename from tests/page-autowaiting-basic.spec.ts rename to tests/page/page-autowaiting-basic.spec.ts index 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.ts similarity index 97% rename from tests/page-autowaiting-no-hang.spec.ts rename to tests/page/page-autowaiting-no-hang.spec.ts index 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.ts similarity index 99% rename from tests/page-basic.spec.ts rename to tests/page/page-basic.spec.ts index 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.ts similarity index 98% rename from tests/page-check.spec.ts rename to tests/page/page-check.spec.ts index 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(``); diff --git a/tests/page-click-react.spec.ts b/tests/page/page-click-react.spec.ts similarity index 99% rename from tests/page-click-react.spec.ts rename to tests/page/page-click-react.spec.ts index 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.ts similarity index 96% rename from tests/page-click-scroll.spec.ts rename to tests/page/page-click-scroll.spec.ts index 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.ts similarity index 96% rename from tests/page-click-timeout-1.spec.ts rename to tests/page/page-click-timeout-1.spec.ts index 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.ts similarity index 96% rename from tests/page-click-timeout-2.spec.ts rename to tests/page/page-click-timeout-2.spec.ts index 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.ts similarity index 98% rename from tests/page-click-timeout-3.spec.ts rename to tests/page/page-click-timeout-3.spec.ts index 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.ts similarity index 95% rename from tests/page-click-timeout-4.spec.ts rename to tests/page/page-click-timeout-4.spec.ts index 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.ts similarity index 99% rename from tests/page-click.spec.ts rename to tests/page/page-click.spec.ts index 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.ts similarity index 95% rename from tests/page-close.spec.ts rename to tests/page/page-close.spec.ts index 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(``); diff --git a/tests/page-dialog.spec.ts b/tests/page/page-dialog.spec.ts similarity index 98% rename from tests/page-dialog.spec.ts rename to tests/page/page-dialog.spec.ts index 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.ts similarity index 99% rename from tests/page-dispatchevent.spec.ts rename to tests/page/page-dispatchevent.spec.ts index 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.ts similarity index 97% rename from tests/page-drag.spec.ts rename to tests/page/page-drag.spec.ts index 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.ts similarity index 73% rename from tests/page-emulate-media.spec.ts rename to tests/page/page-emulate-media.spec.ts index 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(` +
+
+
+ `); + 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(`
`); + 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(); + }); +});