From 217cbe3e2128d8f35ebe3f3179024559e743e61b Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Thu, 6 May 2021 07:08:22 -0700 Subject: [PATCH] test: cleanup bad usages of pageTest (#6430) --- package-lock.json | 2 +- tests/browsercontext-viewport.spec.ts | 5 +--- tests/chromium/chromium.spec.ts | 16 ++++++------- tests/chromium/css-coverage.spec.ts | 2 +- tests/chromium/js-coverage.spec.ts | 3 +-- tests/chromium/session.spec.ts | 2 +- tests/config/android.config.ts | 2 +- tests/config/default.config.ts | 2 +- tests/config/electron.config.ts | 2 +- tests/emulation-focus.spec.ts | 23 +++++-------------- tests/page/elementhandle-bounding-box.spec.ts | 2 +- tests/page/elementhandle-click.spec.ts | 2 +- .../page/elementhandle-content-frame.spec.ts | 2 +- tests/page/elementhandle-convenience.spec.ts | 2 +- .../elementhandle-eval-on-selector.spec.ts | 2 +- tests/page/elementhandle-misc.spec.ts | 2 +- tests/page/elementhandle-owner-frame.spec.ts | 2 +- tests/page/elementhandle-press.spec.ts | 2 +- .../page/elementhandle-query-selector.spec.ts | 2 +- tests/page/elementhandle-screenshot.spec.ts | 2 +- .../elementhandle-scroll-into-view.spec.ts | 2 +- tests/page/elementhandle-select-text.spec.ts | 2 +- tests/page/elementhandle-type.spec.ts | 2 +- ...ementhandle-wait-for-element-state.spec.ts | 2 +- tests/page/eval-on-selector-all.spec.ts | 2 +- tests/page/eval-on-selector.spec.ts | 2 +- tests/page/frame-evaluate.spec.ts | 2 +- tests/page/frame-frame-element.spec.ts | 2 +- tests/page/frame-goto.spec.ts | 2 +- tests/page/frame-hierarchy.spec.ts | 2 +- tests/page/interception.spec.ts | 2 +- tests/page/jshandle-as-element.spec.ts | 2 +- tests/page/jshandle-evaluate.spec.ts | 2 +- tests/page/jshandle-json-value.spec.ts | 2 +- tests/page/jshandle-properties.spec.ts | 2 +- tests/page/jshandle-to-string.spec.ts | 2 +- tests/page/network-post-data.spec.ts | 2 +- tests/page/page-accessibility.spec.ts | 2 +- tests/page/page-add-init-script.spec.ts | 2 +- tests/page/page-add-script-tag.spec.ts | 2 +- tests/page/page-add-style-tag.spec.ts | 2 +- tests/page/page-autowaiting-basic.spec.ts | 2 +- tests/page/page-autowaiting-no-hang.spec.ts | 2 +- tests/page/page-basic.spec.ts | 2 +- tests/page/page-check.spec.ts | 2 +- tests/page/page-click-react.spec.ts | 2 +- tests/page/page-click-scroll.spec.ts | 2 +- tests/page/page-click-timeout-1.spec.ts | 2 +- tests/page/page-click-timeout-2.spec.ts | 2 +- tests/page/page-click-timeout-3.spec.ts | 2 +- tests/page/page-click-timeout-4.spec.ts | 2 +- tests/page/page-click.spec.ts | 2 +- tests/page/page-close.spec.ts | 2 +- tests/page/page-dialog.spec.ts | 2 +- tests/page/page-dispatchevent.spec.ts | 2 +- tests/page/page-drag.spec.ts | 2 +- tests/page/page-emulate-media.spec.ts | 2 +- tests/page/page-evaluate-handle.spec.ts | 2 +- tests/page/page-evaluate-no-stall.spec.ts | 2 +- tests/page/page-evaluate.spec.ts | 2 +- tests/page/page-event-console.spec.ts | 2 +- tests/page/page-event-crash.spec.ts | 2 +- tests/page/page-event-network.spec.ts | 2 +- tests/page/page-event-pageerror.spec.ts | 2 +- tests/page/page-event-popup.spec.ts | 2 +- tests/page/page-event-request.spec.ts | 2 +- tests/page/page-expose-function.spec.ts | 2 +- tests/page/page-fill.spec.ts | 2 +- tests/page/page-focus.spec.ts | 2 +- tests/page/page-goto.spec.ts | 2 +- tests/page/page-history.spec.ts | 2 +- tests/page/page-keyboard.spec.ts | 2 +- tests/page/page-mouse.spec.ts | 2 +- tests/page/page-navigation.spec.ts | 2 +- tests/page/page-network-idle.spec.ts | 2 +- tests/page/page-network-request.spec.ts | 2 +- tests/page/page-network-response.spec.ts | 2 +- tests/page/page-request-continue.spec.ts | 2 +- tests/page/page-request-fulfill.spec.ts | 2 +- tests/page/page-route.spec.ts | 2 +- tests/page/page-screenshot.spec.ts | 2 +- tests/page/page-select-option.spec.ts | 2 +- tests/page/page-set-content.spec.ts | 2 +- .../page/page-set-extra-http-headers.spec.ts | 2 +- tests/page/page-set-input-files.spec.ts | 2 +- tests/page/page-wait-for-function.spec.ts | 2 +- tests/page/page-wait-for-load-state.spec.ts | 2 +- tests/page/page-wait-for-navigation.spec.ts | 2 +- tests/page/page-wait-for-request.spec.ts | 2 +- tests/page/page-wait-for-response.spec.ts | 2 +- tests/page/page-wait-for-selector-1.spec.ts | 2 +- tests/page/page-wait-for-selector-2.spec.ts | 2 +- tests/page/page-wait-for-url.spec.ts | 2 +- tests/{config => page}/pageTest.ts | 2 +- tests/page/queryselector.spec.ts | 2 +- tests/page/selectors-css.spec.ts | 2 +- tests/page/selectors-misc.spec.ts | 2 +- tests/page/selectors-text.spec.ts | 2 +- tests/page/workers.spec.ts | 2 +- tests/slowmo.spec.ts | 2 +- tests/web-socket.spec.ts | 4 +--- 101 files changed, 112 insertions(+), 131 deletions(-) rename tests/{config => page}/pageTest.ts (95%) diff --git a/package-lock.json b/package-lock.json index b72944e4e4..90948e1667 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "playwright-internal", - "version": "1.11.0-next", + "version": "1.12.0-next", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tests/browsercontext-viewport.spec.ts b/tests/browsercontext-viewport.spec.ts index 99f6e46507..725f48b07b 100644 --- a/tests/browsercontext-viewport.spec.ts +++ b/tests/browsercontext-viewport.spec.ts @@ -15,13 +15,10 @@ * limitations under the License. */ -import { test as it, expect } from './config/pageTest'; +import { contextTest as it, expect } from './config/browserTest'; import { browserTest } from './config/browserTest'; import { verifyViewport } from './config/utils'; -it.skip(({ isAndroid }) => isAndroid, 'Default viewport is null'); -it.skip(({ isElectron }) => isElectron, 'Default viewport is null'); - it('should get the proper default viewport size', async ({page, server}) => { await verifyViewport(page, 1280, 720); }); diff --git a/tests/chromium/chromium.spec.ts b/tests/chromium/chromium.spec.ts index 324c078f59..f21326a8ab 100644 --- a/tests/chromium/chromium.spec.ts +++ b/tests/chromium/chromium.spec.ts @@ -15,16 +15,14 @@ * limitations under the License. */ -import { test as pageTest, expect } from '../config/pageTest'; +import { contextTest as test, expect } from '../config/browserTest'; import { playwrightTest } from '../config/browserTest'; import http from 'http'; -pageTest.describe('chromium', () => { - pageTest.skip(({ browserName }) => browserName !== 'chromium'); - pageTest.skip(({ isAndroid }) => isAndroid); - pageTest.skip(({ isElectron }) => isElectron); +test.describe('chromium', () => { + test.skip(({ browserName }) => browserName !== 'chromium'); - pageTest('should create a worker from a service worker', async ({page, server}) => { + test('should create a worker from a service worker', async ({page, server}) => { const [worker] = await Promise.all([ page.context().waitForEvent('serviceworker'), page.goto(server.PREFIX + '/serviceworkers/empty/sw.html') @@ -32,7 +30,7 @@ pageTest.describe('chromium', () => { expect(await worker.evaluate(() => self.toString())).toBe('[object ServiceWorkerGlobalScope]'); }); - pageTest('serviceWorkers() should return current workers', async ({page, server}) => { + test('serviceWorkers() should return current workers', async ({page, server}) => { const context = page.context(); const [worker1] = await Promise.all([ context.waitForEvent('serviceworker'), @@ -51,7 +49,7 @@ pageTest.describe('chromium', () => { expect(workers).toContain(worker2); }); - pageTest('should not create a worker from a shared worker', async ({page, server}) => { + test('should not create a worker from a shared worker', async ({page, server}) => { await page.goto(server.EMPTY_PAGE); let serviceWorkerCreated; page.context().once('serviceworker', () => serviceWorkerCreated = true); @@ -61,7 +59,7 @@ pageTest.describe('chromium', () => { expect(serviceWorkerCreated).not.toBeTruthy(); }); - pageTest('Page.route should work with intervention headers', async ({server, page}) => { + test('Page.route should work with intervention headers', async ({server, page}) => { server.setRoute('/intervention', (req, res) => res.end(`