Skip to content

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

test: move all page tests to a subdirectory (#6427)

Dmitry Gozman9433cae4feb6
diff --git a/tests/__snapshots__/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.png b/tests/__snapshots__/page/elementhandle-screenshot/path-option-should-create-subdirectories/chromium/screenshot-element-bounding-box.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('<html><body><div class="tweet"><div class="like">100</div><div class="retweets">10</div></div></body></html>');
diff --git a/tests/elementhandle-misc.spec.ts b/tests/page/elementhandle-misc.spec.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(`<input type='text' />`);
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(`<div style='height: 10000px; background: red'></div>`);
- const windowSize = await page.evaluate(() => ({ width: window.innerWidth * window.devicePixelRatio, height: window.innerHeight * window.devicePixelRatio }));
- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
-
- const screenshot = await page.screenshot();
- expect(screenshot).toBeInstanceOf(Buffer);
- const decoded = PNG.sync.read(screenshot);
- expect(decoded.width).toBe(windowSize.width);
- expect(decoded.height).toBe(windowSize.height);
-
- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
- expect(sizeBefore.width).toBe(sizeAfter.width);
- expect(sizeBefore.height).toBe(sizeAfter.height);
- await context.close();
- });
-
- browserTest('should take fullPage screenshots when default viewport is null', async ({server, browser}) => {
- const context = await browser.newContext({ viewport: null });
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/grid.html');
- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
- const screenshot = await page.screenshot({
- fullPage: true
- });
- expect(screenshot).toBeInstanceOf(Buffer);
-
- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
- expect(sizeBefore.width).toBe(sizeAfter.width);
- expect(sizeBefore.height).toBe(sizeAfter.height);
- await context.close();
- });
-
- browserTest('should restore default viewport after fullPage screenshot', async ({ browser }) => {
- const context = await browser.newContext({ viewport: { width: 456, height: 789 } });
- const page = await context.newPage();
- await verifyViewport(page, 456, 789);
- const screenshot = await page.screenshot({ fullPage: true });
- expect(screenshot).toBeInstanceOf(Buffer);
- await verifyViewport(page, 456, 789);
- await context.close();
- });
-
- browserTest('should restore viewport after page screenshot and exception', async ({ browser, server, mode }) => {
- browserTest.skip(mode !== 'default');
-
- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/grid.html');
- const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };
- const error = await page.screenshot({ fullPage: true, __testHookBeforeScreenshot } as any).catch(e => e);
- expect(error.message).toContain('oh my');
- await verifyViewport(page, 350, 360);
- await context.close();
- });
-
- browserTest('should restore viewport after page screenshot and timeout', async ({ browser, server, mode }) => {
- browserTest.skip(mode !== 'default');
-
- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/grid.html');
- const __testHookAfterScreenshot = () => new Promise(f => setTimeout(f, 5000));
- const error = await page.screenshot({ fullPage: true, __testHookAfterScreenshot, timeout: 3000 } as any).catch(e => e);
- expect(error.message).toContain('page.screenshot: Timeout 3000ms exceeded');
- await verifyViewport(page, 350, 360);
- await page.setViewportSize({ width: 400, height: 400 });
- await page.waitForTimeout(3000); // Give it some time to wrongly restore previous viewport.
- await verifyViewport(page, 400, 400);
- await context.close();
- });
-
- browserTest('should take element screenshot when default viewport is null and restore back', async ({server, browser}) => {
- const context = await browser.newContext({viewport: null});
- const page = await context.newPage();
- await page.setContent(`
- <div style="height: 14px">oooo</div>
- <style>
- div.to-screenshot {
- border: 1px solid blue;
- width: 600px;
- height: 600px;
- margin-left: 50px;
- }
- ::-webkit-scrollbar{
- display: none;
- }
- </style>
- <div class="to-screenshot"></div>
- <div class="to-screenshot"></div>
- <div class="to-screenshot"></div>
- `);
- const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
- const elementHandle = await page.$('div.to-screenshot');
- const screenshot = await elementHandle.screenshot();
- expect(screenshot).toBeInstanceOf(Buffer);
- const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
- expect(sizeBefore.width).toBe(sizeAfter.width);
- expect(sizeBefore.height).toBe(sizeAfter.height);
- await context.close();
- });
-
- browserTest('should restore viewport after element screenshot and exception', async ({browser, mode}) => {
- browserTest.skip(mode !== 'default');
-
- const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
- const page = await context.newPage();
- await page.setContent(`<div style="width:600px;height:600px;"></div>`);
- const elementHandle = await page.$('div');
- const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };
- const error = await elementHandle.screenshot({ __testHookBeforeScreenshot } as any).catch(e => e);
- expect(error.message).toContain('oh my');
- await verifyViewport(page, 350, 360);
- await context.close();
- });
-});
diff --git a/tests/elementhandle-scroll-into-view.spec.ts b/tests/page/elementhandle-scroll-into-view.spec.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(`<input type='text' />`);
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('<div>hello</div><div>beautiful</div><div>world!</div>');
diff --git a/tests/eval-on-selector.spec.ts b/tests/page/eval-on-selector.spec.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('<section id="testAttribute">43543</section>');
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+\//, ':<PORT>/');
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(`<input id='checkbox' type='checkbox'></input>`);
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(`<button onclick="setTimeout(() => alert(1))">alert</button>`);
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(`
<style>
diff --git a/tests/page-evaluate-handle.spec.ts b/tests/page/page-evaluate-handle.spec.ts
similarity index 98%
rename from tests/page-evaluate-handle.spec.ts
rename to tests/page/page-evaluate-handle.spec.ts
index 9f416e7b5b..a0d74161fa 100644
--- a/tests/page-evaluate-handle.spec.ts
+++ b/tests/page/page-evaluate-handle.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page}) => {
const windowHandle = await page.evaluateHandle(() => window);
diff --git a/tests/page-evaluate-no-stall.spec.ts b/tests/page/page-evaluate-no-stall.spec.ts
similarity index 97%
rename from tests/page-evaluate-no-stall.spec.ts
rename to tests/page/page-evaluate-no-stall.spec.ts
index 2fe9611434..cead2d2d06 100644
--- a/tests/page-evaluate-no-stall.spec.ts
+++ b/tests/page/page-evaluate-no-stall.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { test, expect } from './config/pageTest';
+import { test, expect } from '../config/pageTest';
test.describe('non-stalling evaluate', () => {
test.skip(({mode}) => mode !== 'default');
diff --git a/tests/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.ts
similarity index 99%
rename from tests/page-evaluate.spec.ts
rename to tests/page/page-evaluate.spec.ts
index da1531d22d..47350b7dba 100644
--- a/tests/page-evaluate.spec.ts
+++ b/tests/page/page-evaluate.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({ page }) => {
const result = await page.evaluate(() => 7 * 3);
diff --git a/tests/page-event-console.spec.ts b/tests/page/page-event-console.spec.ts
similarity index 98%
rename from tests/page-event-console.spec.ts
rename to tests/page/page-event-console.spec.ts
index be9928bc67..01b2b71d09 100644
--- a/tests/page-event-console.spec.ts
+++ b/tests/page/page-event-console.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import util from 'util';
it('should work', async ({page}) => {
diff --git a/tests/page-event-crash.spec.ts b/tests/page/page-event-crash.spec.ts
similarity index 98%
rename from tests/page-event-crash.spec.ts
rename to tests/page/page-event-crash.spec.ts
index d13d53346e..25c68c116a 100644
--- a/tests/page-event-crash.spec.ts
+++ b/tests/page/page-event-crash.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import * as os from 'os';
function crash({ page, toImpl, browserName, platform, mode }: any) {
diff --git a/tests/page-event-network.spec.ts b/tests/page/page-event-network.spec.ts
similarity index 98%
rename from tests/page-event-network.spec.ts
rename to tests/page/page-event-network.spec.ts
index 8a4481ff5f..d22f647c82 100644
--- a/tests/page-event-network.spec.ts
+++ b/tests/page/page-event-network.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('Page.Events.Request', async ({page, server}) => {
const requests = [];
diff --git a/tests/page-event-pageerror.spec.ts b/tests/page/page-event-pageerror.spec.ts
similarity index 98%
rename from tests/page-event-pageerror.spec.ts
rename to tests/page/page-event-pageerror.spec.ts
index 80ca2805b7..cea1bad416 100644
--- a/tests/page-event-pageerror.spec.ts
+++ b/tests/page/page-event-pageerror.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should fire', async ({page, server, isWebKit}) => {
const [error] = await Promise.all([
diff --git a/tests/page-event-popup.spec.ts b/tests/page/page-event-popup.spec.ts
similarity index 99%
rename from tests/page-event-popup.spec.ts
rename to tests/page/page-event-popup.spec.ts
index 7c64c860a8..77519310cf 100644
--- a/tests/page-event-popup.spec.ts
+++ b/tests/page/page-event-popup.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page}) => {
const [popup] = await Promise.all([
diff --git a/tests/page-event-request.spec.ts b/tests/page/page-event-request.spec.ts
similarity index 95%
rename from tests/page-event-request.spec.ts
rename to tests/page/page-event-request.spec.ts
index f5a2985ed3..04ed5e1eaf 100644
--- a/tests/page-event-request.spec.ts
+++ b/tests/page/page-event-request.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame } from '../config/utils';
it('should fire for navigation requests', async ({page, server}) => {
const requests = [];
diff --git a/tests/page-expose-function.spec.ts b/tests/page/page-expose-function.spec.ts
similarity index 96%
rename from tests/page-expose-function.spec.ts
rename to tests/page/page-expose-function.spec.ts
index 1dddc3cc63..0c29440dc8 100644
--- a/tests/page-expose-function.spec.ts
+++ b/tests/page/page-expose-function.spec.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame } from './config/utils';
-import type { ElementHandle } from '../index';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame } from '../config/utils';
+import type { ElementHandle } from '../../index';
it('exposeBinding should work', async ({page}) => {
let bindingSource;
@@ -244,7 +244,7 @@ it('should work with internal bindings', async ({page, toImpl, server, mode, bro
it.skip(isAndroid);
it.skip(isElectron);
- const implPage: import('../src/server/page').Page = toImpl(page);
+ const implPage: import('../../src/server/page').Page = toImpl(page);
let foo;
await implPage.exposeBinding('foo', false, ({}, arg) => {
foo = arg;
@@ -264,7 +264,7 @@ it('should work with internal bindings', async ({page, toImpl, server, mode, bro
// should work inside frames
const frame = await attachFrame(page, 'myframe', server.CROSS_PROCESS_PREFIX + '/empty.html');
expect(await frame.evaluate('!!window.foo')).toBe(false);
- const implFrame: import('../src/server/frames').Frame = toImpl(frame);
+ const implFrame: import('../../src/server/frames').Frame = toImpl(frame);
await implFrame.evaluateExpression('window.foo(789)', false, {}, 'utility');
expect(foo).toBe(789);
});
diff --git a/tests/page-fill.spec.ts b/tests/page/page-fill.spec.ts
similarity index 99%
rename from tests/page-fill.spec.ts
rename to tests/page/page-fill.spec.ts
index 674c6fbb60..7d8b020148 100644
--- a/tests/page-fill.spec.ts
+++ b/tests/page/page-fill.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
async function giveItAChanceToFill(page) {
for (let i = 0; i < 5; i++)
diff --git a/tests/page-focus.spec.ts b/tests/page/page-focus.spec.ts
similarity index 98%
rename from tests/page-focus.spec.ts
rename to tests/page/page-focus.spec.ts
index 5c66400ca0..9502d7b6cc 100644
--- a/tests/page-focus.spec.ts
+++ b/tests/page/page-focus.spec.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async function({page, browserName}) {
it.skip(browserName === 'firefox');
diff --git a/tests/page-goto.spec.ts b/tests/page/page-goto.spec.ts
similarity index 96%
rename from tests/page-goto.spec.ts
rename to tests/page/page-goto.spec.ts
index e73b298529..999ec2e420 100644
--- a/tests/page-goto.spec.ts
+++ b/tests/page/page-goto.spec.ts
@@ -17,9 +17,8 @@
import url from 'url';
import os from 'os';
-import { test as it, expect } from './config/pageTest';
-import { slowBrowserTest as slowTest } from './config/browserTest';
-import { expectedSSLError } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { expectedSSLError } from '../config/utils';
it('should work', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
@@ -373,19 +372,6 @@ it('should not leak listeners during bad navigation', async ({page, server}) =>
expect(warning).toBe(null);
});
-// We open 20 pages here!
-slowTest('should not leak listeners during navigation of 20 pages', async ({contextFactory, server}) => {
- const context = await contextFactory();
- let warning = null;
- const warningHandler = w => warning = w;
- process.on('warning', warningHandler);
- const pages = await Promise.all([...Array(20)].map(() => context.newPage()));
- await Promise.all(pages.map(page => page.goto(server.EMPTY_PAGE)));
- await Promise.all(pages.map(page => page.close()));
- process.off('warning', warningHandler);
- expect(warning).toBe(null);
-});
-
it('should not leak listeners during 20 waitForNavigation', async ({page, server}) => {
let warning = null;
const warningHandler = w => warning = w;
diff --git a/tests/page-history.spec.ts b/tests/page/page-history.spec.ts
similarity index 99%
rename from tests/page-history.spec.ts
rename to tests/page/page-history.spec.ts
index 7b07294036..743e7e94a6 100644
--- a/tests/page-history.spec.ts
+++ b/tests/page/page-history.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import url from 'url';
it('page.goBack should work', async ({page, server}) => {
diff --git a/tests/page-keyboard.spec.ts b/tests/page/page-keyboard.spec.ts
similarity index 99%
rename from tests/page-keyboard.spec.ts
rename to tests/page/page-keyboard.spec.ts
index ec037f81a4..37cd155596 100644
--- a/tests/page-keyboard.spec.ts
+++ b/tests/page/page-keyboard.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame } from '../config/utils';
it.skip(({ isAndroid }) => isAndroid);
diff --git a/tests/page-mouse.spec.ts b/tests/page/page-mouse.spec.ts
similarity index 88%
rename from tests/page-mouse.spec.ts
rename to tests/page/page-mouse.spec.ts
index 351b2e404f..eb75ad67ec 100644
--- a/tests/page-mouse.spec.ts
+++ b/tests/page/page-mouse.spec.ts
@@ -15,8 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { browserTest } from './config/browserTest';
+import { test as it, expect } from '../config/pageTest';
function dimensions() {
const rect = document.querySelector('textarea').getBoundingClientRect();
@@ -165,23 +164,3 @@ it('should tween mouse movement', async ({page, isWebKit, isAndroid}) => {
[200, 300]
]);
});
-
-browserTest('should work with mobile viewports and cross process navigations', async ({browser, server, browserName}) => {
- browserTest.skip(browserName === 'firefox');
-
- // @see https://crbug.com/929806
- const context = await browser.newContext({ viewport: {width: 360, height: 640}, isMobile: true });
- const page = await context.newPage();
- await page.goto(server.EMPTY_PAGE);
- await page.goto(server.CROSS_PROCESS_PREFIX + '/mobile.html');
- await page.evaluate(() => {
- document.addEventListener('click', event => {
- window['result'] = {x: event.clientX, y: event.clientY};
- });
- });
-
- await page.mouse.click(30, 40);
-
- expect(await page.evaluate('result')).toEqual({x: 30, y: 40});
- await context.close();
-});
diff --git a/tests/page-navigation.spec.ts b/tests/page/page-navigation.spec.ts
similarity index 96%
rename from tests/page-navigation.spec.ts
rename to tests/page/page-navigation.spec.ts
index f66eb4d554..1781658f8c 100644
--- a/tests/page-navigation.spec.ts
+++ b/tests/page/page-navigation.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it } from './config/pageTest';
+import { test as it } from '../config/pageTest';
it('should work with _blank target', async ({page, server}) => {
server.setRoute('/empty.html', (req, res) => {
diff --git a/tests/page-network-idle.spec.ts b/tests/page/page-network-idle.spec.ts
similarity index 97%
rename from tests/page-network-idle.spec.ts
rename to tests/page/page-network-idle.spec.ts
index 6c03e38142..0c5f761ada 100644
--- a/tests/page-network-idle.spec.ts
+++ b/tests/page/page-network-idle.spec.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import type { Frame } from '../index';
-import { TestServer } from '../utils/testserver';
+import { test as it, expect } from '../config/pageTest';
+import type { Frame } from '../../index';
+import { TestServer } from '../../utils/testserver';
it('should navigate to empty page with networkidle', async ({page, server}) => {
const response = await page.goto(server.EMPTY_PAGE, { waitUntil: 'networkidle' });
diff --git a/tests/page-network-request.spec.ts b/tests/page/page-network-request.spec.ts
similarity index 99%
rename from tests/page-network-request.spec.ts
rename to tests/page/page-network-request.spec.ts
index 478cac5e53..230c049cbb 100644
--- a/tests/page-network-request.spec.ts
+++ b/tests/page/page-network-request.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame } from '../config/utils';
it('should work for main frame navigation request', async ({page, server}) => {
const requests = [];
diff --git a/tests/page-network-response.spec.ts b/tests/page/page-network-response.spec.ts
similarity index 98%
rename from tests/page-network-response.spec.ts
rename to tests/page/page-network-response.spec.ts
index d10fe5d37e..ab8f4872d2 100644
--- a/tests/page-network-response.spec.ts
+++ b/tests/page/page-network-response.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import fs from 'fs';
it('should work', async ({page, server}) => {
diff --git a/tests/page-request-continue.spec.ts b/tests/page/page-request-continue.spec.ts
similarity index 99%
rename from tests/page-request-continue.spec.ts
rename to tests/page/page-request-continue.spec.ts
index 2a61a3efe8..44cb43f859 100644
--- a/tests/page-request-continue.spec.ts
+++ b/tests/page/page-request-continue.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page, server}) => {
await page.route('**/*', route => route.continue());
diff --git a/tests/page-request-fulfill.spec.ts b/tests/page/page-request-fulfill.spec.ts
similarity index 73%
rename from tests/page-request-fulfill.spec.ts
rename to tests/page/page-request-fulfill.spec.ts
index 7809a08db1..1e30af9ae2 100644
--- a/tests/page-request-fulfill.spec.ts
+++ b/tests/page/page-request-fulfill.spec.ts
@@ -15,8 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { browserTest } from './config/browserTest';
+import { test as it, expect } from '../config/pageTest';
import fs from 'fs';
it('should work', async ({page, server}) => {
@@ -182,84 +181,3 @@ it('should include the origin header', async ({page, server, isAndroid}) => {
expect(text).toBe('done');
expect(interceptedRequest.headers()['origin']).toEqual(server.PREFIX);
});
-
-browserTest('should support Set-Cookie header', async ({contextFactory, server, browserName}) => {
- browserTest.fixme(browserName === 'webkit');
-
- const context = await contextFactory();
- const page = await context.newPage();
- await page.route('https://example.com/', (route, request) => {
- route.fulfill({
- headers: {
- 'Set-Cookie': 'name=value; domain=.example.com; Path=/'
- },
- contentType: 'text/html',
- body: 'done'
- });
- });
- await page.goto('https://example.com');
- expect(await context.cookies()).toEqual([{
- sameSite: 'None',
- name: 'name',
- value: 'value',
- domain: '.example.com',
- path: '/',
- expires: -1,
- httpOnly: false,
- secure: false
- }]);
-});
-
-browserTest('should ignore secure Set-Cookie header for insecure requests', async ({contextFactory, server, browserName}) => {
- browserTest.fixme(browserName === 'webkit');
-
- const context = await contextFactory();
- const page = await context.newPage();
- await page.route('http://example.com/', (route, request) => {
- route.fulfill({
- headers: {
- 'Set-Cookie': 'name=value; domain=.example.com; Path=/; Secure'
- },
- contentType: 'text/html',
- body: 'done'
- });
- });
- await page.goto('http://example.com');
- expect(await context.cookies()).toEqual([]);
-});
-
-browserTest('should use Set-Cookie header in future requests', async ({contextFactory, server, browserName}) => {
- browserTest.fixme(browserName === 'webkit');
-
- const context = await contextFactory();
- const page = await context.newPage();
-
- await page.route(server.EMPTY_PAGE, (route, request) => {
- route.fulfill({
- headers: {
- 'Set-Cookie': 'name=value'
- },
- contentType: 'text/html',
- body: 'done'
- });
- });
- await page.goto(server.EMPTY_PAGE);
- expect(await context.cookies()).toEqual([{
- sameSite: 'None',
- name: 'name',
- value: 'value',
- domain: 'localhost',
- path: '/',
- expires: -1,
- httpOnly: false,
- secure: false
- }]);
-
- let cookie = '';
- server.setRoute('/foo.html', (req, res) => {
- cookie = req.headers.cookie;
- res.end();
- });
- await page.goto(server.PREFIX + '/foo.html');
- expect(cookie).toBe('name=value');
-});
diff --git a/tests/page-route.spec.ts b/tests/page/page-route.spec.ts
similarity index 99%
rename from tests/page-route.spec.ts
rename to tests/page/page-route.spec.ts
index efcf383856..ee0387def4 100644
--- a/tests/page-route.spec.ts
+++ b/tests/page/page-route.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should intercept', async ({page, server}) => {
let intercepted = false;
diff --git a/tests/page-screenshot.spec.ts b/tests/page/page-screenshot.spec.ts
similarity index 69%
rename from tests/page-screenshot.spec.ts
rename to tests/page/page-screenshot.spec.ts
index 34beaa61a3..cdf5dbddc9 100644
--- a/tests/page-screenshot.spec.ts
+++ b/tests/page/page-screenshot.spec.ts
@@ -15,12 +15,10 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { browserTest, slowBrowserTest } from './config/browserTest';
-import { verifyViewport } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { verifyViewport } from '../config/utils';
import path from 'path';
import fs from 'fs';
-import { PNG } from 'pngjs';
it.describe('page screenshot', () => {
it.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');
@@ -274,107 +272,6 @@ it.describe('page screenshot', () => {
const screenshot = await page.screenshot({ fullPage: true });
expect(screenshot).toMatchSnapshot('screenshot-grid-fullpage.png');
});
-});
-
-browserTest.describe('page screenshot', () => {
- browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');
-
- browserTest('should run in parallel in multiple pages', async ({server, contextFactory}) => {
- const context = await contextFactory();
- const N = 5;
- const pages = await Promise.all(Array(N).fill(0).map(async () => {
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/grid.html');
- return page;
- }));
- const promises = [];
- for (let i = 0; i < N; ++i)
- promises.push(pages[i].screenshot({ clip: { x: 50 * (i % 2), y: 0, width: 50, height: 50 } }));
- const screenshots = await Promise.all(promises);
- for (let i = 0; i < N; ++i)
- expect(screenshots[i]).toMatchSnapshot(`grid-cell-${i % 2}.png`);
- await Promise.all(pages.map(page => page.close()));
- });
-
- browserTest('should work with a mobile viewport', async ({browser, server, browserName}) => {
- browserTest.skip(browserName === 'firefox');
- browserTest.fixme(browserName === 'chromium');
-
- const context = await browser.newContext({ viewport: { width: 320, height: 480 }, isMobile: true });
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/overflow.html');
- const screenshot = await page.screenshot();
- expect(screenshot).toMatchSnapshot('screenshot-mobile.png');
- await context.close();
- });
-
- browserTest('should work with a mobile viewport and clip', async ({browser, server, browserName}) => {
- browserTest.skip(browserName === 'firefox');
- browserTest.skip(process.env.CRPATH); // Does not work in stable Chrome.
-
- const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/overflow.html');
- const screenshot = await page.screenshot({ clip: { x: 10, y: 10, width: 100, height: 150 } });
- expect(screenshot).toMatchSnapshot('screenshot-mobile-clip.png');
- await context.close();
- });
-
- browserTest('should work with a mobile viewport and fullPage', async ({browser, server, browserName}) => {
- browserTest.skip(browserName === 'firefox');
-
- const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/overflow-large.html');
- const screenshot = await page.screenshot({ fullPage: true });
- expect(screenshot).toMatchSnapshot('screenshot-mobile-fullpage.png');
- await context.close();
- });
-
-
- browserTest('should work with device scale factor', async ({browser, server}) => {
- const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
- const page = await context.newPage();
- await page.goto(server.PREFIX + '/grid.html');
- const screenshot = await page.screenshot();
- expect(screenshot).toMatchSnapshot('screenshot-device-scale-factor.png');
- await context.close();
- });
-
- // Large screenshot is slow.
- slowBrowserTest('should work with large size', async ({ browserName, headful, platform, contextFactory }) => {
- slowBrowserTest.fixme(browserName === 'chromium' && headful === true && platform === 'linux', 'Chromium has gpu problems on linux with large screnshots');
-
- const context = await contextFactory();
- const page = await context.newPage();
-
- await page.setViewportSize({ width: 1280, height: 800 });
- await page.evaluate(() => {
- document.body.style.margin = '0';
- document.body.style.padding = '0';
- document.documentElement.style.margin = '0';
- document.documentElement.style.padding = '0';
- const div = document.createElement('div');
- div.style.width = '1250px';
- div.style.height = '8440px';
- div.style.background = 'linear-gradient(red, blue)';
- document.body.appendChild(div);
- });
- const buffer = await page.screenshot({ fullPage: true });
- const decoded = PNG.sync.read(buffer);
-
- const pixel = (x: number, y: number) => {
- const dst = new PNG({ width: 1, height: 1 });
- PNG.bitblt(decoded, dst, x, y, 1, 1);
- const pixels = dst.data;
- return { r: pixels[0], g: pixels[1], b: pixels[2], a: pixels[3] };
- };
-
- expect(pixel(0, 0).r).toBeGreaterThan(128);
- expect(pixel(0, 0).b).toBeLessThan(128);
- expect(pixel(0, 8339).r).toBeLessThan(128);
- expect(pixel(0, 8339).b).toBeGreaterThan(128);
- });
it('should take fullPage screenshots during navigation', async ({page, server}) => {
await page.setViewportSize({width: 500, height: 500});
diff --git a/tests/page-select-option.spec.ts b/tests/page/page-select-option.spec.ts
similarity index 99%
rename from tests/page-select-option.spec.ts
rename to tests/page/page-select-option.spec.ts
index 8c02d142ee..fab6992fff 100644
--- a/tests/page-select-option.spec.ts
+++ b/tests/page/page-select-option.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
async function giveItAChanceToResolve(page) {
for (let i = 0; i < 5; i++)
diff --git a/tests/page-set-content.spec.ts b/tests/page/page-set-content.spec.ts
similarity index 98%
rename from tests/page-set-content.spec.ts
rename to tests/page/page-set-content.spec.ts
index 3756285950..16b0cbf9d5 100644
--- a/tests/page-set-content.spec.ts
+++ b/tests/page/page-set-content.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
const expectedOutput = '<html><head></head><body><div>hello</div></body></html>';
diff --git a/tests/page-set-extra-http-headers.spec.ts b/tests/page/page-set-extra-http-headers.spec.ts
similarity index 97%
rename from tests/page-set-extra-http-headers.spec.ts
rename to tests/page/page-set-extra-http-headers.spec.ts
index 47ec217dde..6df65ee88a 100644
--- a/tests/page-set-extra-http-headers.spec.ts
+++ b/tests/page/page-set-extra-http-headers.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page, server}) => {
await page.setExtraHTTPHeaders({
diff --git a/tests/page-set-input-files.spec.ts b/tests/page/page-set-input-files.spec.ts
similarity index 99%
rename from tests/page-set-input-files.spec.ts
rename to tests/page/page-set-input-files.spec.ts
index ac99c17a92..3e392c6a95 100644
--- a/tests/page-set-input-files.spec.ts
+++ b/tests/page/page-set-input-files.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import path from 'path';
import fs from 'fs';
diff --git a/tests/page-wait-for-function.spec.ts b/tests/page/page-wait-for-function.spec.ts
similarity index 99%
rename from tests/page-wait-for-function.spec.ts
rename to tests/page/page-wait-for-function.spec.ts
index 87b5e40d21..77de880281 100644
--- a/tests/page-wait-for-function.spec.ts
+++ b/tests/page/page-wait-for-function.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should timeout', async ({page}) => {
const startTime = Date.now();
diff --git a/tests/page-wait-for-load-state.spec.ts b/tests/page/page-wait-for-load-state.spec.ts
similarity index 98%
rename from tests/page-wait-for-load-state.spec.ts
rename to tests/page/page-wait-for-load-state.spec.ts
index a988f3777a..82c84f7a14 100644
--- a/tests/page-wait-for-load-state.spec.ts
+++ b/tests/page/page-wait-for-load-state.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import type { Route } from '../index';
+import { test as it, expect } from '../config/pageTest';
+import type { Route } from '../../index';
it('should pick up ongoing navigation', async ({page, server}) => {
let response = null;
diff --git a/tests/page-wait-for-navigation.spec.ts b/tests/page/page-wait-for-navigation.spec.ts
similarity index 97%
rename from tests/page-wait-for-navigation.spec.ts
rename to tests/page/page-wait-for-navigation.spec.ts
index c74495bdf9..a55550e4b5 100644
--- a/tests/page-wait-for-navigation.spec.ts
+++ b/tests/page/page-wait-for-navigation.spec.ts
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import type { Frame } from '../index';
-import { expectedSSLError } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import type { Frame } from '../../index';
+import { expectedSSLError } from '../config/utils';
it('should work', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
@@ -144,7 +144,7 @@ it('should work when subframe issues window.stop()', async ({page, server}) => {
server.setRoute('/frames/style.css', (req, res) => {});
const navigationPromise = page.goto(server.PREFIX + '/frames/one-frame.html');
const frame = await new Promise<Frame>(f => page.once('frameattached', f));
- await new Promise(fulfill => page.on('framenavigated', f => {
+ await new Promise<void>(fulfill => page.on('framenavigated', f => {
if (f === frame)
fulfill();
}));
diff --git a/tests/page-wait-for-request.spec.ts b/tests/page/page-wait-for-request.spec.ts
similarity index 98%
rename from tests/page-wait-for-request.spec.ts
rename to tests/page/page-wait-for-request.spec.ts
index 77668e3386..a42cd81b25 100644
--- a/tests/page-wait-for-request.spec.ts
+++ b/tests/page/page-wait-for-request.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
import vm from 'vm';
it('should work', async ({page, server}) => {
diff --git a/tests/page-wait-for-response.spec.ts b/tests/page/page-wait-for-response.spec.ts
similarity index 98%
rename from tests/page-wait-for-response.spec.ts
rename to tests/page/page-wait-for-response.spec.ts
index 031b5329df..844dae592c 100644
--- a/tests/page-wait-for-response.spec.ts
+++ b/tests/page/page-wait-for-response.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
diff --git a/tests/page-wait-for-selector-1.spec.ts b/tests/page/page-wait-for-selector-1.spec.ts
similarity index 98%
rename from tests/page-wait-for-selector-1.spec.ts
rename to tests/page/page-wait-for-selector-1.spec.ts
index d50ac4233e..aef147fd7b 100644
--- a/tests/page-wait-for-selector-1.spec.ts
+++ b/tests/page/page-wait-for-selector-1.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame, detachFrame } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame, detachFrame } from '../config/utils';
async function giveItTimeToLog(frame) {
await frame.evaluate(() => new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f))));
diff --git a/tests/page-wait-for-selector-2.spec.ts b/tests/page/page-wait-for-selector-2.spec.ts
similarity index 99%
rename from tests/page-wait-for-selector-2.spec.ts
rename to tests/page/page-wait-for-selector-2.spec.ts
index 3449718edb..08d4a94000 100644
--- a/tests/page-wait-for-selector-2.spec.ts
+++ b/tests/page/page-wait-for-selector-2.spec.ts
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { attachFrame, detachFrame } from './config/utils';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame, detachFrame } from '../config/utils';
const addElement = tag => document.body.appendChild(document.createElement(tag));
diff --git a/tests/page-wait-for-url.spec.ts b/tests/page/page-wait-for-url.spec.ts
similarity index 98%
rename from tests/page-wait-for-url.spec.ts
rename to tests/page/page-wait-for-url.spec.ts
index badb32d795..bbaf56a7bf 100644
--- a/tests/page-wait-for-url.spec.ts
+++ b/tests/page/page-wait-for-url.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
diff --git a/tests/queryselector.spec.ts b/tests/page/queryselector.spec.ts
similarity index 98%
rename from tests/queryselector.spec.ts
rename to tests/page/queryselector.spec.ts
index 9622945c46..1e6477e909 100644
--- a/tests/queryselector.spec.ts
+++ b/tests/page/queryselector.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should throw for non-string selector', async ({page}) => {
const error = await page.$(null).catch(e => e);
diff --git a/tests/selectors-css.spec.ts b/tests/page/selectors-css.spec.ts
similarity index 99%
rename from tests/selectors-css.spec.ts
rename to tests/page/selectors-css.spec.ts
index d9106130b9..7d0323dbbf 100644
--- a/tests/selectors-css.spec.ts
+++ b/tests/page/selectors-css.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work with large DOM', async ({page, server}) => {
await page.evaluate(() => {
diff --git a/tests/selectors-misc.spec.ts b/tests/page/selectors-misc.spec.ts
similarity index 99%
rename from tests/selectors-misc.spec.ts
rename to tests/page/selectors-misc.spec.ts
index d83696af9d..7329f5f7c1 100644
--- a/tests/selectors-misc.spec.ts
+++ b/tests/page/selectors-misc.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work for open shadow roots', async ({page, server}) => {
await page.goto(server.PREFIX + '/deep-shadow.html');
diff --git a/tests/selectors-text.spec.ts b/tests/page/selectors-text.spec.ts
similarity index 99%
rename from tests/selectors-text.spec.ts
rename to tests/page/selectors-text.spec.ts
index 7d774f909e..7521de07ac 100644
--- a/tests/selectors-text.spec.ts
+++ b/tests/page/selectors-text.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
+import { test as it, expect } from '../config/pageTest';
it('should work', async ({page}) => {
await page.setContent(`<div>yo</div><div>ya</div><div>\nye </div>`);
diff --git a/tests/workers.spec.ts b/tests/page/workers.spec.ts
similarity index 90%
rename from tests/workers.spec.ts
rename to tests/page/workers.spec.ts
index 99eab154b7..ea5ccd1fff 100644
--- a/tests/workers.spec.ts
+++ b/tests/page/workers.spec.ts
@@ -15,10 +15,9 @@
* limitations under the License.
*/
-import { test as it, expect } from './config/pageTest';
-import { browserTest } from './config/browserTest';
-import { attachFrame } from './config/utils';
-import type { ConsoleMessage } from '../index';
+import { test as it, expect } from '../config/pageTest';
+import { attachFrame } from '../config/utils';
+import type { ConsoleMessage } from '../../index';
it('Page.workers', async function({page, server}) {
await Promise.all([
@@ -171,15 +170,3 @@ it('should report network activity on worker creation', async function({page, se
expect(response.request()).toBe(request);
expect(response.ok()).toBe(true);
});
-
-browserTest('should format number using context locale', async ({browser, server}) => {
- const context = await browser.newContext({ locale: 'ru-RU' });
- const page = await context.newPage();
- await page.goto(server.EMPTY_PAGE);
- const [worker] = await Promise.all([
- page.waitForEvent('worker'),
- page.evaluate(() => new Worker(URL.createObjectURL(new Blob(['console.log(1)'], {type: 'application/javascript'})))),
- ]);
- expect(await worker.evaluate(() => (10000.20).toLocaleString())).toBe('10\u00A0000,2');
- await context.close();
-});
diff --git a/tests/screenshot.spec.ts b/tests/screenshot.spec.ts
new file mode 100644
index 0000000000..c9b32b6f9c
--- /dev/null
+++ b/tests/screenshot.spec.ts
@@ -0,0 +1,268 @@
+/**
+ * Copyright 2018 Google Inc. All rights reserved.
+ * Modifications copyright (c) Microsoft Corporation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { expect, browserTest, slowBrowserTest } from './config/browserTest';
+import { PNG } from 'pngjs';
+import { verifyViewport } from './config/utils';
+
+browserTest.describe('page screenshot', () => {
+ browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful, 'Firefox headful produces a different image.');
+
+ browserTest('should run in parallel in multiple pages', async ({server, contextFactory}) => {
+ const context = await contextFactory();
+ const N = 5;
+ const pages = await Promise.all(Array(N).fill(0).map(async () => {
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ return page;
+ }));
+ const promises = [];
+ for (let i = 0; i < N; ++i)
+ promises.push(pages[i].screenshot({ clip: { x: 50 * (i % 2), y: 0, width: 50, height: 50 } }));
+ const screenshots = await Promise.all(promises);
+ for (let i = 0; i < N; ++i)
+ expect(screenshots[i]).toMatchSnapshot(`grid-cell-${i % 2}.png`);
+ await Promise.all(pages.map(page => page.close()));
+ });
+
+ browserTest('should work with a mobile viewport', async ({browser, server, browserName}) => {
+ browserTest.skip(browserName === 'firefox');
+ browserTest.fixme(browserName === 'chromium');
+
+ const context = await browser.newContext({ viewport: { width: 320, height: 480 }, isMobile: true });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/overflow.html');
+ const screenshot = await page.screenshot();
+ expect(screenshot).toMatchSnapshot('screenshot-mobile.png');
+ await context.close();
+ });
+
+ browserTest('should work with a mobile viewport and clip', async ({browser, server, browserName}) => {
+ browserTest.skip(browserName === 'firefox');
+ browserTest.skip(process.env.CRPATH); // Does not work in stable Chrome.
+
+ const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/overflow.html');
+ const screenshot = await page.screenshot({ clip: { x: 10, y: 10, width: 100, height: 150 } });
+ expect(screenshot).toMatchSnapshot('screenshot-mobile-clip.png');
+ await context.close();
+ });
+
+ browserTest('should work with a mobile viewport and fullPage', async ({browser, server, browserName}) => {
+ browserTest.skip(browserName === 'firefox');
+
+ const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/overflow-large.html');
+ const screenshot = await page.screenshot({ fullPage: true });
+ expect(screenshot).toMatchSnapshot('screenshot-mobile-fullpage.png');
+ await context.close();
+ });
+
+ browserTest('should work with device scale factor', async ({browser, server}) => {
+ const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ const screenshot = await page.screenshot();
+ expect(screenshot).toMatchSnapshot('screenshot-device-scale-factor.png');
+ await context.close();
+ });
+
+ // Large screenshot is slow.
+ slowBrowserTest('should work with large size', async ({ browserName, headful, platform, contextFactory }) => {
+ slowBrowserTest.fixme(browserName === 'chromium' && headful === true && platform === 'linux', 'Chromium has gpu problems on linux with large screnshots');
+
+ const context = await contextFactory();
+ const page = await context.newPage();
+
+ await page.setViewportSize({ width: 1280, height: 800 });
+ await page.evaluate(() => {
+ document.body.style.margin = '0';
+ document.body.style.padding = '0';
+ document.documentElement.style.margin = '0';
+ document.documentElement.style.padding = '0';
+ const div = document.createElement('div');
+ div.style.width = '1250px';
+ div.style.height = '8440px';
+ div.style.background = 'linear-gradient(red, blue)';
+ document.body.appendChild(div);
+ });
+ const buffer = await page.screenshot({ fullPage: true });
+ const decoded = PNG.sync.read(buffer);
+
+ const pixel = (x: number, y: number) => {
+ const dst = new PNG({ width: 1, height: 1 });
+ PNG.bitblt(decoded, dst, x, y, 1, 1);
+ const pixels = dst.data;
+ return { r: pixels[0], g: pixels[1], b: pixels[2], a: pixels[3] };
+ };
+
+ expect(pixel(0, 0).r).toBeGreaterThan(128);
+ expect(pixel(0, 0).b).toBeLessThan(128);
+ expect(pixel(0, 8339).r).toBeLessThan(128);
+ expect(pixel(0, 8339).b).toBeGreaterThan(128);
+ });
+});
+
+browserTest.describe('element sceenshot', () => {
+ browserTest.skip(({ browserName, headful }) => browserName === 'firefox' && headful);
+
+ browserTest('element screenshot should work with a mobile viewport', async ({browser, server, browserName}) => {
+ browserTest.skip(browserName === 'firefox');
+
+ const context = await browser.newContext({viewport: { width: 320, height: 480 }, isMobile: true});
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ await page.evaluate(() => window.scrollBy(50, 100));
+ const elementHandle = await page.$('.box:nth-of-type(3)');
+ const screenshot = await elementHandle.screenshot();
+ expect(screenshot).toMatchSnapshot('screenshot-element-mobile.png');
+ await context.close();
+ });
+
+ browserTest('element screenshot should work with device scale factor', async ({browser, server, browserName}) => {
+ browserTest.skip(browserName === 'firefox');
+
+ const context = await browser.newContext({ viewport: { width: 320, height: 480 }, deviceScaleFactor: 2 });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ await page.evaluate(() => window.scrollBy(50, 100));
+ const elementHandle = await page.$('.box:nth-of-type(3)');
+ const screenshot = await elementHandle.screenshot();
+ expect(screenshot).toMatchSnapshot('screenshot-element-mobile-dsf.png');
+ await context.close();
+ });
+
+ browserTest('should take screenshots when default viewport is null', async ({server, browser}) => {
+ const context = await browser.newContext({ viewport: null });
+ const page = await context.newPage();
+ await page.setContent(`<div style='height: 10000px; background: red'></div>`);
+ const windowSize = await page.evaluate(() => ({ width: window.innerWidth * window.devicePixelRatio, height: window.innerHeight * window.devicePixelRatio }));
+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+
+ const screenshot = await page.screenshot();
+ expect(screenshot).toBeInstanceOf(Buffer);
+ const decoded = PNG.sync.read(screenshot);
+ expect(decoded.width).toBe(windowSize.width);
+ expect(decoded.height).toBe(windowSize.height);
+
+ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+ expect(sizeBefore.width).toBe(sizeAfter.width);
+ expect(sizeBefore.height).toBe(sizeAfter.height);
+ await context.close();
+ });
+
+ browserTest('should take fullPage screenshots when default viewport is null', async ({server, browser}) => {
+ const context = await browser.newContext({ viewport: null });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+ const screenshot = await page.screenshot({
+ fullPage: true
+ });
+ expect(screenshot).toBeInstanceOf(Buffer);
+
+ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+ expect(sizeBefore.width).toBe(sizeAfter.width);
+ expect(sizeBefore.height).toBe(sizeAfter.height);
+ await context.close();
+ });
+
+ browserTest('should restore default viewport after fullPage screenshot', async ({ browser }) => {
+ const context = await browser.newContext({ viewport: { width: 456, height: 789 } });
+ const page = await context.newPage();
+ await verifyViewport(page, 456, 789);
+ const screenshot = await page.screenshot({ fullPage: true });
+ expect(screenshot).toBeInstanceOf(Buffer);
+ await verifyViewport(page, 456, 789);
+ await context.close();
+ });
+
+ browserTest('should restore viewport after page screenshot and exception', async ({ browser, server, mode }) => {
+ browserTest.skip(mode !== 'default');
+
+ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };
+ const error = await page.screenshot({ fullPage: true, __testHookBeforeScreenshot } as any).catch(e => e);
+ expect(error.message).toContain('oh my');
+ await verifyViewport(page, 350, 360);
+ await context.close();
+ });
+
+ browserTest('should restore viewport after page screenshot and timeout', async ({ browser, server, mode }) => {
+ browserTest.skip(mode !== 'default');
+
+ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
+ const page = await context.newPage();
+ await page.goto(server.PREFIX + '/grid.html');
+ const __testHookAfterScreenshot = () => new Promise(f => setTimeout(f, 5000));
+ const error = await page.screenshot({ fullPage: true, __testHookAfterScreenshot, timeout: 3000 } as any).catch(e => e);
+ expect(error.message).toContain('page.screenshot: Timeout 3000ms exceeded');
+ await verifyViewport(page, 350, 360);
+ await page.setViewportSize({ width: 400, height: 400 });
+ await page.waitForTimeout(3000); // Give it some time to wrongly restore previous viewport.
+ await verifyViewport(page, 400, 400);
+ await context.close();
+ });
+
+ browserTest('should take element screenshot when default viewport is null and restore back', async ({server, browser}) => {
+ const context = await browser.newContext({viewport: null});
+ const page = await context.newPage();
+ await page.setContent(`
+ <div style="height: 14px">oooo</div>
+ <style>
+ div.to-screenshot {
+ border: 1px solid blue;
+ width: 600px;
+ height: 600px;
+ margin-left: 50px;
+ }
+ ::-webkit-scrollbar{
+ display: none;
+ }
+ </style>
+ <div class="to-screenshot"></div>
+ <div class="to-screenshot"></div>
+ <div class="to-screenshot"></div>
+ `);
+ const sizeBefore = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+ const elementHandle = await page.$('div.to-screenshot');
+ const screenshot = await elementHandle.screenshot();
+ expect(screenshot).toBeInstanceOf(Buffer);
+ const sizeAfter = await page.evaluate(() => ({ width: document.body.offsetWidth, height: document.body.offsetHeight }));
+ expect(sizeBefore.width).toBe(sizeAfter.width);
+ expect(sizeBefore.height).toBe(sizeAfter.height);
+ await context.close();
+ });
+
+ browserTest('should restore viewport after element screenshot and exception', async ({browser, mode}) => {
+ browserTest.skip(mode !== 'default');
+
+ const context = await browser.newContext({ viewport: { width: 350, height: 360 } });
+ const page = await context.newPage();
+ await page.setContent(`<div style="width:600px;height:600px;"></div>`);
+ const elementHandle = await page.$('div');
+ const __testHookBeforeScreenshot = () => { throw new Error('oh my'); };
+ const error = await elementHandle.screenshot({ __testHookBeforeScreenshot } as any).catch(e => e);
+ expect(error.message).toContain('oh my');
+ await verifyViewport(page, 350, 360);
+ await context.close();
+ });
+});