From eacfaadcee8c2a4447ff6252238a04f6b510e7a8 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 5 Aug 2024 14:18:16 +0200 Subject: [PATCH] different approach --- tests/android/device.spec.ts | 2 +- tests/config/browserTest.ts | 2 +- tests/config/comparator.ts | 2 +- tests/config/serverFixtures.ts | 2 +- tests/config/testserver/index.ts | 2 +- tests/config/utils.ts | 3 +-- tests/electron/globalSetup.ts | 2 +- tests/image_tools/fixtures.spec.ts | 2 +- tests/image_tools/utils.ts | 2 +- tests/installation/globalSetup.ts | 2 +- tests/installation/npmTest.ts | 2 +- tests/installation/registry.ts | 2 +- tests/library/browsertype-connect.spec.ts | 3 +-- .../library/chromium/connect-over-cdp.spec.ts | 2 +- tests/library/client-certificates.spec.ts | 2 +- tests/library/component-parser.spec.ts | 2 +- tests/library/css-parser.spec.ts | 2 +- tests/library/debug-controller.spec.ts | 2 +- .../events/check-listener-leaks.spec.ts | 2 +- tests/library/global-fetch.spec.ts | 2 +- tests/library/har.spec.ts | 2 +- tests/library/headful.spec.ts | 2 +- tests/library/locator-generator.spec.ts | 3 +-- tests/library/screenshot.spec.ts | 2 +- tests/library/tracing.spec.ts | 2 +- tests/library/video.spec.ts | 3 +-- tests/page/interception.spec.ts | 2 +- tests/page/page-leaks.spec.ts | 2 +- tests/playwright-test/expect.spec.ts | 2 +- .../playwright-test-fixtures.ts | 2 +- tests/playwright-test/reporter-blob.spec.ts | 2 +- tests/playwright-test/reporter-html.spec.ts | 2 +- .../to-have-screenshot.spec.ts | 2 +- .../ui-mode-test-progress.spec.ts | 2 +- tests/playwright-test/web-server.spec.ts | 2 +- tests/typed-imports/index.d.ts | 24 +++++++++++++++++ tests/typed-imports/index.js | 26 +++++++++++++++++++ .../playwright-core/cssParser.d.ts | 17 ------------ .../playwright-core/cssParser.js | 17 ------------ .../playwright-core/locatorGenerators.d.ts | 17 ------------ .../playwright-core/locatorGenerators.js | 17 ------------ .../playwright-core/locatorParser.d.ts | 17 ------------ .../playwright-core/locatorParser.js | 17 ------------ .../playwright-core/selectorParser.d.ts | 17 ------------ .../playwright-core/selectorParser.js | 17 ------------ .../playwright-core/socksProxy.d.ts | 17 ------------ .../playwright-core/socksProxy.js | 17 ------------ .../playwright-core/traceUtils.d.ts | 17 ------------ .../playwright-core/traceUtils.js | 17 ------------ .../typed-imports/playwright-core/utils.d.ts | 17 ------------ tests/typed-imports/playwright-core/utils.js | 17 ------------ .../playwright-core/utilsBundle.d.ts | 17 ------------ .../playwright-core/utilsBundle.js | 17 ------------ 53 files changed, 85 insertions(+), 311 deletions(-) create mode 100644 tests/typed-imports/index.d.ts create mode 100644 tests/typed-imports/index.js delete mode 100644 tests/typed-imports/playwright-core/cssParser.d.ts delete mode 100644 tests/typed-imports/playwright-core/cssParser.js delete mode 100644 tests/typed-imports/playwright-core/locatorGenerators.d.ts delete mode 100644 tests/typed-imports/playwright-core/locatorGenerators.js delete mode 100644 tests/typed-imports/playwright-core/locatorParser.d.ts delete mode 100644 tests/typed-imports/playwright-core/locatorParser.js delete mode 100644 tests/typed-imports/playwright-core/selectorParser.d.ts delete mode 100644 tests/typed-imports/playwright-core/selectorParser.js delete mode 100644 tests/typed-imports/playwright-core/socksProxy.d.ts delete mode 100644 tests/typed-imports/playwright-core/socksProxy.js delete mode 100644 tests/typed-imports/playwright-core/traceUtils.d.ts delete mode 100644 tests/typed-imports/playwright-core/traceUtils.js delete mode 100644 tests/typed-imports/playwright-core/utils.d.ts delete mode 100644 tests/typed-imports/playwright-core/utils.js delete mode 100644 tests/typed-imports/playwright-core/utilsBundle.d.ts delete mode 100644 tests/typed-imports/playwright-core/utilsBundle.js diff --git a/tests/android/device.spec.ts b/tests/android/device.spec.ts index 3c77c17366..c9d1e34612 100644 --- a/tests/android/device.spec.ts +++ b/tests/android/device.spec.ts @@ -16,7 +16,7 @@ import fs from 'fs'; import { join } from 'path'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import { androidTest as test, expect } from './androidTest'; diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index 780fca4f97..eea6c49107 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -19,7 +19,7 @@ import * as os from 'os'; import type { PageTestFixtures, PageWorkerFixtures } from '../page/pageTestApi'; import * as path from 'path'; import type { BrowserContext, BrowserContextOptions, BrowserType, Page } from 'playwright-core'; -import { removeFolders } from '../typed-imports/playwright-core/utils'; +import { removeFolders } from '../typed-imports'; import { baseTest } from './baseTest'; import { type RemoteServerOptions, type PlaywrightServer, RunServer, RemoteServer } from './remoteServer'; import type { Log } from '../../packages/trace/src/har'; diff --git a/tests/config/comparator.ts b/tests/config/comparator.ts index dd3ecc1f65..f5ae40d0db 100644 --- a/tests/config/comparator.ts +++ b/tests/config/comparator.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { getComparator } from '../typed-imports/playwright-core/utils'; +import { getComparator } from '../typed-imports'; const pngComparator = getComparator('image/png'); type ComparatorResult = { diff?: Buffer; errorMessage: string; } | null; type ImageComparatorOptions = { threshold?: number, maxDiffPixels?: number, maxDiffPixelRatio?: number }; diff --git a/tests/config/serverFixtures.ts b/tests/config/serverFixtures.ts index 576fcfdfab..1658e9e71e 100644 --- a/tests/config/serverFixtures.ts +++ b/tests/config/serverFixtures.ts @@ -20,7 +20,7 @@ import { TestServer } from './testserver'; import { TestProxy } from './proxy'; import type { SocksSocketRequestedPayload } from '../../packages/playwright-core/src/common/socksProxy'; -import { SocksProxy } from '../typed-imports/playwright-core/socksProxy'; +import { SocksProxy } from '../typed-imports'; export type ServerWorkerOptions = { loopback?: string; diff --git a/tests/config/testserver/index.ts b/tests/config/testserver/index.ts index ce7ae7dd36..893177e8a1 100644 --- a/tests/config/testserver/index.ts +++ b/tests/config/testserver/index.ts @@ -24,7 +24,7 @@ import url from 'url'; import util from 'util'; import ws from 'ws'; import zlib, { gzip } from 'zlib'; -import { createHttpServer, createHttpsServer } from '../../typed-imports/playwright-core/utils'; +import { createHttpServer, createHttpsServer } from '../../typed-imports'; const fulfillSymbol = Symbol('fulfil callback'); const rejectSymbol = Symbol('reject callback'); diff --git a/tests/config/utils.ts b/tests/config/utils.ts index 6317f125a7..3254498c0f 100644 --- a/tests/config/utils.ts +++ b/tests/config/utils.ts @@ -15,10 +15,9 @@ */ import type { Frame, Page } from 'playwright-core'; -import { ZipFile } from '../typed-imports/playwright-core/utils'; +import { ZipFile, parseClientSideCallMetadata } from '../typed-imports'; import type { TraceModelBackend } from '../../packages/trace-viewer/src/traceModel'; import type { StackFrame } from '../../packages/protocol/src/channels'; -import { parseClientSideCallMetadata } from '../typed-imports/playwright-core/traceUtils'; import { TraceModel } from '../../packages/trace-viewer/src/traceModel'; import type { ActionTreeItem } from '../../packages/trace-viewer/src/ui/modelUtil'; import { buildActionTree, MultiTraceModel } from '../../packages/trace-viewer/src/ui/modelUtil'; diff --git a/tests/electron/globalSetup.ts b/tests/electron/globalSetup.ts index 1f9f83ba81..ea07c0ee38 100644 --- a/tests/electron/globalSetup.ts +++ b/tests/electron/globalSetup.ts @@ -15,7 +15,7 @@ */ import assert from 'assert'; -import { spawnAsync } from '../typed-imports/playwright-core/utils'; +import { spawnAsync } from '../typed-imports'; export default async () => { const result = await spawnAsync('npx', ['electron', require.resolve('./electron-print-chromium-version.js'), '--no-sandbox'], { diff --git a/tests/image_tools/fixtures.spec.ts b/tests/image_tools/fixtures.spec.ts index 792b0a5d89..b63590fc40 100644 --- a/tests/image_tools/fixtures.spec.ts +++ b/tests/image_tools/fixtures.spec.ts @@ -15,7 +15,7 @@ */ import { test, expect } from '../playwright-test/stable-test-runner'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import { compare } from 'playwright-core/lib/image_tools/compare'; import fs from 'fs'; import path from 'path'; diff --git a/tests/image_tools/utils.ts b/tests/image_tools/utils.ts index d86b32183d..a1a9bc6379 100644 --- a/tests/image_tools/utils.ts +++ b/tests/image_tools/utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import { ImageChannel } from 'playwright-core/lib/image_tools/imageChannel'; // mulberry32 diff --git a/tests/installation/globalSetup.ts b/tests/installation/globalSetup.ts index dae79abd56..0e8243c5ed 100644 --- a/tests/installation/globalSetup.ts +++ b/tests/installation/globalSetup.ts @@ -16,7 +16,7 @@ import path from 'path'; import fs from 'fs'; -import { spawnAsync, removeFolders } from '../typed-imports/playwright-core/utils'; +import { spawnAsync, removeFolders } from '../typed-imports'; import { TMP_WORKSPACES } from './npmTest'; const PACKAGE_BUILDER_SCRIPT = path.join(__dirname, '..', '..', 'utils', 'pack_package.js'); diff --git a/tests/installation/npmTest.ts b/tests/installation/npmTest.ts index f5b93710c8..802a0d5ac7 100644 --- a/tests/installation/npmTest.ts +++ b/tests/installation/npmTest.ts @@ -22,7 +22,7 @@ import debugLogger from 'debug'; import { Registry } from './registry'; import type { CommonFixtures, CommonWorkerFixtures } from '../config/commonFixtures'; import { commonFixtures } from '../config/commonFixtures'; -import { spawnAsync, removeFolders } from '../typed-imports/playwright-core/utils'; +import { spawnAsync, removeFolders } from '../typed-imports'; import type { SpawnOptions } from 'child_process'; export const TMP_WORKSPACES = path.join(os.platform() === 'darwin' ? '/tmp' : os.tmpdir(), 'pwt', 'workspaces'); diff --git a/tests/installation/registry.ts b/tests/installation/registry.ts index 49b73038bf..b50cb8f997 100644 --- a/tests/installation/registry.ts +++ b/tests/installation/registry.ts @@ -19,7 +19,7 @@ import type { Server } from 'http'; import type http from 'http'; import https from 'https'; import path from 'path'; -import { spawnAsync, createHttpServer } from '../typed-imports/playwright-core/utils'; +import { spawnAsync, createHttpServer } from '../typed-imports'; const kPublicNpmRegistry = 'https://registry.npmjs.org'; const kContentTypeAbbreviatedMetadata = 'application/vnd.npm.install-v1+json'; diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.ts index 8fa4305abc..d2b4e23adc 100644 --- a/tests/library/browsertype-connect.spec.ts +++ b/tests/library/browsertype-connect.spec.ts @@ -20,13 +20,12 @@ import os from 'os'; import type http from 'http'; import type net from 'net'; import * as path from 'path'; -import { getUserAgent, getPlaywrightVersion } from '../typed-imports/playwright-core/utils'; +import { getUserAgent, getPlaywrightVersion, createHttpServer } from '../typed-imports'; import WebSocket from 'ws'; import { expect, playwrightTest } from '../config/browserTest'; import { parseTrace, suppressCertificateWarning } from '../config/utils'; import formidable from 'formidable'; import type { Browser, ConnectOptions } from 'playwright-core'; -import { createHttpServer } from '../typed-imports/playwright-core/utils'; import { kTargetClosedErrorMessage } from '../config/errors'; import { RunServer } from '../config/remoteServer'; diff --git a/tests/library/chromium/connect-over-cdp.spec.ts b/tests/library/chromium/connect-over-cdp.spec.ts index 70bb2e75b0..db548237b2 100644 --- a/tests/library/chromium/connect-over-cdp.spec.ts +++ b/tests/library/chromium/connect-over-cdp.spec.ts @@ -18,7 +18,7 @@ import { playwrightTest as test, expect } from '../../config/browserTest'; import http from 'http'; import fs from 'fs'; -import { getUserAgent } from '../../typed-imports/playwright-core/utils'; +import { getUserAgent } from '../../typed-imports'; import { suppressCertificateWarning } from '../../config/utils'; test.skip(({ mode }) => mode === 'service2'); diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts index 9fdec236ad..fc0859d294 100644 --- a/tests/library/client-certificates.spec.ts +++ b/tests/library/client-certificates.spec.ts @@ -20,7 +20,7 @@ import type http from 'http'; import { expect, playwrightTest as base } from '../config/browserTest'; import type net from 'net'; import type { BrowserContextOptions } from 'packages/playwright-test'; -import { createHttpsServer, createHttp2Server } from '../typed-imports/playwright-core/utils'; +import { createHttpsServer, createHttp2Server } from '../typed-imports'; type TestOptions = { startCCServer(options?: { diff --git a/tests/library/component-parser.spec.ts b/tests/library/component-parser.spec.ts index 970d53467a..a8ce3960b3 100644 --- a/tests/library/component-parser.spec.ts +++ b/tests/library/component-parser.spec.ts @@ -16,7 +16,7 @@ import { playwrightTest as it, expect } from '../config/browserTest'; import type { AttributeSelector } from '../../packages/playwright-core/src/selectorParser'; -import { parseAttributeSelector } from '../typed-imports/playwright-core/selectorParser'; +import { parseAttributeSelector } from '../typed-imports'; const parse = (selector: string) => parseAttributeSelector(selector, false); const serialize = (parsed: AttributeSelector) => { diff --git a/tests/library/css-parser.spec.ts b/tests/library/css-parser.spec.ts index 19b6ab5d0a..9a513524c4 100644 --- a/tests/library/css-parser.spec.ts +++ b/tests/library/css-parser.spec.ts @@ -15,7 +15,7 @@ */ import { playwrightTest as it, expect } from '../config/browserTest'; -import { parseCSS, serializeSelector as serialize } from '../typed-imports/playwright-core/cssParser'; +import { parseCSS, serializeSelector as serialize } from '../typed-imports'; const parse = (selector: string) => { return parseCSS(selector, new Set(['text', 'not', 'has', 'react', 'scope', 'right-of', 'is'])).selector; diff --git a/tests/library/debug-controller.spec.ts b/tests/library/debug-controller.spec.ts index 8b55158146..ceb6f8a5a3 100644 --- a/tests/library/debug-controller.spec.ts +++ b/tests/library/debug-controller.spec.ts @@ -16,7 +16,7 @@ import { expect, playwrightTest as baseTest } from '../config/browserTest'; import { PlaywrightServer } from '../../packages/playwright-core/lib/remote/playwrightServer'; -import { createGuid } from '../typed-imports/playwright-core/utils'; +import { createGuid } from '../typed-imports'; import { Backend } from '../config/debugControllerBackend'; import type { Browser, BrowserContext } from '@playwright/test'; import type * as channels from '@protocol/channels'; diff --git a/tests/library/events/check-listener-leaks.spec.ts b/tests/library/events/check-listener-leaks.spec.ts index 6aaf48e6df..c5a87144ad 100644 --- a/tests/library/events/check-listener-leaks.spec.ts +++ b/tests/library/events/check-listener-leaks.spec.ts @@ -22,7 +22,7 @@ import events from 'events'; import { EventEmitter } from '../../../packages/playwright-core/lib/client/eventEmitter'; -import { setUnderTest } from '../../typed-imports/playwright-core/utils'; +import { setUnderTest } from '../../typed-imports'; import { test, expect } from '@playwright/test'; import * as common from './utils'; diff --git a/tests/library/global-fetch.spec.ts b/tests/library/global-fetch.spec.ts index 8495690a16..43de6f2ccf 100644 --- a/tests/library/global-fetch.spec.ts +++ b/tests/library/global-fetch.spec.ts @@ -16,7 +16,7 @@ import os from 'os'; import util from 'util'; -import { getPlaywrightVersion } from '../typed-imports/playwright-core/utils'; +import { getPlaywrightVersion } from '../typed-imports'; import { expect, playwrightTest as base } from '../config/browserTest'; import { kTargetClosedErrorMessage } from 'tests/config/errors'; diff --git a/tests/library/har.spec.ts b/tests/library/har.spec.ts index 3bb60a48c6..7061849813 100644 --- a/tests/library/har.spec.ts +++ b/tests/library/har.spec.ts @@ -22,7 +22,7 @@ import type { BrowserContext, BrowserContextOptions } from 'playwright-core'; import type { AddressInfo } from 'net'; import type { Log } from '../../packages/trace/src/har'; import { parseHar } from '../config/utils'; -import { createHttp2Server } from '../typed-imports/playwright-core/utils'; +import { createHttp2Server } from '../typed-imports'; async function pageWithHar(contextFactory: (options?: BrowserContextOptions) => Promise, testInfo: any, options: { outputPath?: string, content?: 'embed' | 'attach' | 'omit', omitContent?: boolean } = {}) { const harPath = testInfo.outputPath(options.outputPath || 'test.har'); diff --git a/tests/library/headful.spec.ts b/tests/library/headful.spec.ts index ec68f2206d..747fcfb3f9 100644 --- a/tests/library/headful.spec.ts +++ b/tests/library/headful.spec.ts @@ -15,7 +15,7 @@ */ import { compare } from 'playwright-core/lib/image_tools/compare'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import { expect, playwrightTest as it } from '../config/browserTest'; it.use({ headless: false }); diff --git a/tests/library/locator-generator.spec.ts b/tests/library/locator-generator.spec.ts index 7368dd3e89..72ed3e876e 100644 --- a/tests/library/locator-generator.spec.ts +++ b/tests/library/locator-generator.spec.ts @@ -15,8 +15,7 @@ */ import { contextTest as it, expect } from '../config/browserTest'; -import { asLocator, asLocators } from '../typed-imports/playwright-core/locatorGenerators'; -import { locatorOrSelectorAsSelector as parseLocator } from '../typed-imports/playwright-core/locatorParser'; +import { asLocator, asLocators, locatorOrSelectorAsSelector as parseLocator } from '../typed-imports'; import type { Page, Frame, Locator, FrameLocator } from 'playwright-core'; it.skip(({ mode }) => mode !== 'default'); diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.ts index 6e7b4db6ad..0a1aa7455a 100644 --- a/tests/library/screenshot.spec.ts +++ b/tests/library/screenshot.spec.ts @@ -16,7 +16,7 @@ */ import { expect, browserTest } from '../config/browserTest'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import { verifyViewport } from '../config/utils'; browserTest.describe('page screenshot', () => { diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.ts index 2224a998fc..2b2b71d8b3 100644 --- a/tests/library/tracing.spec.ts +++ b/tests/library/tracing.spec.ts @@ -15,7 +15,7 @@ */ import fs from 'fs'; -import { jpegjs } from '../typed-imports/playwright-core/utilsBundle'; +import { jpegjs } from '../typed-imports'; import path from 'path'; import { browserTest, contextTest as test, expect } from '../config/browserTest'; import { parseTraceRaw } from '../config/utils'; diff --git a/tests/library/video.spec.ts b/tests/library/video.spec.ts index 26a8dde514..f65f915f37 100644 --- a/tests/library/video.spec.ts +++ b/tests/library/video.spec.ts @@ -19,9 +19,8 @@ import fs from 'fs'; import path from 'path'; import type { Page } from 'playwright-core'; import { spawnSync } from 'child_process'; -import { PNG, jpegjs } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG, jpegjs, rewriteErrorMessage } from '../typed-imports'; import { registry } from '../../packages/playwright-core/lib/server'; -import { rewriteErrorMessage } from '../typed-imports/playwright-core/utils'; import { parseTraceRaw } from '../config/utils'; const ffmpeg = registry.findExecutable('ffmpeg')!.executablePath('javascript'); diff --git a/tests/page/interception.spec.ts b/tests/page/interception.spec.ts index 016fbd47cd..b8befa2229 100644 --- a/tests/page/interception.spec.ts +++ b/tests/page/interception.spec.ts @@ -16,7 +16,7 @@ */ import { test as it, expect } from './pageTest'; -import { globToRegex } from '../typed-imports/playwright-core/utils'; +import { globToRegex } from '../typed-imports'; import vm from 'vm'; it('should work with navigation @smoke', async ({ page, server }) => { diff --git a/tests/page/page-leaks.spec.ts b/tests/page/page-leaks.spec.ts index 10662d2a9b..30e9dcb48e 100644 --- a/tests/page/page-leaks.spec.ts +++ b/tests/page/page-leaks.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { MultiMap } from '../typed-imports/playwright-core/utils'; +import { MultiMap } from '../typed-imports'; import { test, expect } from './pageTest'; function leakedJSHandles(): string { diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts index 1da7c3723b..a4318290f7 100644 --- a/tests/playwright-test/expect.spec.ts +++ b/tests/playwright-test/expect.spec.ts @@ -16,7 +16,7 @@ import path from 'path'; import { test, expect, parseTestRunnerOutput, stripAnsi } from './playwright-test-fixtures'; -import { spawnAsync } from '../typed-imports/playwright-core/utils'; +import { spawnAsync } from '../typed-imports'; test('should be able to call expect.extend in config', async ({ runInlineTest }) => { const result = await runInlineTest({ diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts index ec600f01a2..be9e7e8792 100644 --- a/tests/playwright-test/playwright-test-fixtures.ts +++ b/tests/playwright-test/playwright-test-fixtures.ts @@ -18,7 +18,7 @@ import type { JSONReport, JSONReportSpec, JSONReportSuite, JSONReportTest, JSONR import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import type { CommonFixtures, CommonWorkerFixtures, TestChildProcess } from '../config/commonFixtures'; import { commonFixtures } from '../config/commonFixtures'; import type { ServerFixtures, ServerWorkerOptions } from '../config/serverFixtures'; diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts index a3c5983c0a..2ec974654d 100644 --- a/tests/playwright-test/reporter-blob.spec.ts +++ b/tests/playwright-test/reporter-blob.spec.ts @@ -23,7 +23,7 @@ import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/h import { expect as baseExpect, test as baseTest, stripAnsi } from './playwright-test-fixtures'; import extractZip from '../../packages/playwright-core/bundles/zip/node_modules/extract-zip'; import * as yazl from '../../packages/playwright-core/bundles/zip/node_modules/yazl'; -import { getUserAgent } from '../typed-imports/playwright-core/utils'; +import { getUserAgent } from '../typed-imports'; import { Readable } from 'stream'; const DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === 'win32' && process.env.TERM_PROGRAM !== 'vscode' && !process.env.WT_SESSION; diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts index f35dd06696..7510bc569d 100644 --- a/tests/playwright-test/reporter-html.spec.ts +++ b/tests/playwright-test/reporter-html.spec.ts @@ -21,7 +21,7 @@ import { test as baseTest, expect as baseExpect, createImage } from './playwrigh import type { HttpServer } from '../../packages/playwright-core/src/utils'; import { startHtmlReportServer } from '../../packages/playwright/lib/reporters/html'; import { msToString } from '../../packages/web/src/uiUtils'; -import { spawnAsync } from '../typed-imports/playwright-core/utils'; +import { spawnAsync } from '../typed-imports'; const test = baseTest.extend<{ showReport: (reportFolder?: string) => Promise }>({ showReport: async ({ page }, use, testInfo) => { diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.ts index fda861dd2e..2d5767dedd 100644 --- a/tests/playwright-test/to-have-screenshot.spec.ts +++ b/tests/playwright-test/to-have-screenshot.spec.ts @@ -15,7 +15,7 @@ */ import * as fs from 'fs'; -import { PNG } from '../typed-imports/playwright-core/utilsBundle'; +import { PNG } from '../typed-imports'; import * as path from 'path'; import { pathToFileURL } from 'url'; import { test, expect, createImage, paintBlackPixels } from './playwright-test-fixtures'; diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.ts index 3118fa0918..a8a814cd8d 100644 --- a/tests/playwright-test/ui-mode-test-progress.spec.ts +++ b/tests/playwright-test/ui-mode-test-progress.spec.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ManualPromise } from '../typed-imports/playwright-core/utils'; +import { ManualPromise } from '../typed-imports'; import { test, expect, retries, dumpTestTree } from './ui-mode-fixtures'; test.describe.configure({ mode: 'parallel', retries }); diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.ts index 4ef9635fa1..0b66046514 100644 --- a/tests/playwright-test/web-server.spec.ts +++ b/tests/playwright-test/web-server.spec.ts @@ -17,7 +17,7 @@ import type http from 'http'; import path from 'path'; import { test, expect, parseTestRunnerOutput } from './playwright-test-fixtures'; -import { createHttpServer } from '../typed-imports/playwright-core/utils'; +import { createHttpServer } from '../typed-imports'; const SIMPLE_SERVER_PATH = path.join(__dirname, 'assets', 'simple-server.js'); diff --git a/tests/typed-imports/index.d.ts b/tests/typed-imports/index.d.ts new file mode 100644 index 0000000000..f4948a9339 --- /dev/null +++ b/tests/typed-imports/index.d.ts @@ -0,0 +1,24 @@ +/** + * 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. + */ + +export * from '../../packages/playwright-core/src/utils/isomorphic/cssParser'; +export * from '../../packages/playwright-core/src/utils/isomorphic/locatorGenerators'; +export * from '../../packages/playwright-core/src/utils/isomorphic/locatorParser'; +export * from '../../packages/playwright-core/src/utils/isomorphic/selectorParser'; +export * from '../../packages/playwright-core/src/common/socksProxy'; +export * from '../../packages/playwright-core/src/utils/isomorphic/traceUtils'; +export * from '../../packages/playwright-core/src/utils'; +export * from '../../packages/playwright-core/src/utilsBundle'; \ No newline at end of file diff --git a/tests/typed-imports/index.js b/tests/typed-imports/index.js new file mode 100644 index 0000000000..212081e8db --- /dev/null +++ b/tests/typed-imports/index.js @@ -0,0 +1,26 @@ +/** + * 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. + */ + +module.exports = { + ...require('../../packages/playwright-core/lib/utils'), + ...require('../../packages/playwright-core/lib/utilsBundle'), + ...require('../../packages/playwright-core/lib/common/socksProxy'), + ...require('../../packages/playwright-core/lib/utils/isomorphic/traceUtils'), + ...require('../../packages/playwright-core/lib/utils/isomorphic/locatorGenerators'), + ...require('../../packages/playwright-core/lib/utils/isomorphic/selectorParser'), + ...require('../../packages/playwright-core/lib/utils/isomorphic/locatorParser'), + ...require('../../packages/playwright-core/lib/utils/isomorphic/cssParser'), +}; diff --git a/tests/typed-imports/playwright-core/cssParser.d.ts b/tests/typed-imports/playwright-core/cssParser.d.ts deleted file mode 100644 index 012716a1bd..0000000000 --- a/tests/typed-imports/playwright-core/cssParser.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils/isomorphic/cssParser'; diff --git a/tests/typed-imports/playwright-core/cssParser.js b/tests/typed-imports/playwright-core/cssParser.js deleted file mode 100644 index 9c0f6e5474..0000000000 --- a/tests/typed-imports/playwright-core/cssParser.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/cssParser'); diff --git a/tests/typed-imports/playwright-core/locatorGenerators.d.ts b/tests/typed-imports/playwright-core/locatorGenerators.d.ts deleted file mode 100644 index c30296f805..0000000000 --- a/tests/typed-imports/playwright-core/locatorGenerators.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils/isomorphic/locatorGenerators'; diff --git a/tests/typed-imports/playwright-core/locatorGenerators.js b/tests/typed-imports/playwright-core/locatorGenerators.js deleted file mode 100644 index fdb3f6584f..0000000000 --- a/tests/typed-imports/playwright-core/locatorGenerators.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/locatorGenerators'); diff --git a/tests/typed-imports/playwright-core/locatorParser.d.ts b/tests/typed-imports/playwright-core/locatorParser.d.ts deleted file mode 100644 index 64f3650799..0000000000 --- a/tests/typed-imports/playwright-core/locatorParser.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils/isomorphic/locatorParser'; diff --git a/tests/typed-imports/playwright-core/locatorParser.js b/tests/typed-imports/playwright-core/locatorParser.js deleted file mode 100644 index 8fae4f0a41..0000000000 --- a/tests/typed-imports/playwright-core/locatorParser.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/locatorParser'); diff --git a/tests/typed-imports/playwright-core/selectorParser.d.ts b/tests/typed-imports/playwright-core/selectorParser.d.ts deleted file mode 100644 index 7da3c34b03..0000000000 --- a/tests/typed-imports/playwright-core/selectorParser.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils/isomorphic/selectorParser'; diff --git a/tests/typed-imports/playwright-core/selectorParser.js b/tests/typed-imports/playwright-core/selectorParser.js deleted file mode 100644 index b39a5454b9..0000000000 --- a/tests/typed-imports/playwright-core/selectorParser.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/selectorParser'); diff --git a/tests/typed-imports/playwright-core/socksProxy.d.ts b/tests/typed-imports/playwright-core/socksProxy.d.ts deleted file mode 100644 index f7c641293e..0000000000 --- a/tests/typed-imports/playwright-core/socksProxy.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/common/socksProxy'; diff --git a/tests/typed-imports/playwright-core/socksProxy.js b/tests/typed-imports/playwright-core/socksProxy.js deleted file mode 100644 index f2f98105e4..0000000000 --- a/tests/typed-imports/playwright-core/socksProxy.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/common/socksProxy'); diff --git a/tests/typed-imports/playwright-core/traceUtils.d.ts b/tests/typed-imports/playwright-core/traceUtils.d.ts deleted file mode 100644 index f8acc92185..0000000000 --- a/tests/typed-imports/playwright-core/traceUtils.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils/isomorphic/traceUtils'; diff --git a/tests/typed-imports/playwright-core/traceUtils.js b/tests/typed-imports/playwright-core/traceUtils.js deleted file mode 100644 index b024e3dee8..0000000000 --- a/tests/typed-imports/playwright-core/traceUtils.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils/isomorphic/traceUtils'); diff --git a/tests/typed-imports/playwright-core/utils.d.ts b/tests/typed-imports/playwright-core/utils.d.ts deleted file mode 100644 index caf553c6c9..0000000000 --- a/tests/typed-imports/playwright-core/utils.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from '../../../packages/playwright-core/src/utils'; \ No newline at end of file diff --git a/tests/typed-imports/playwright-core/utils.js b/tests/typed-imports/playwright-core/utils.js deleted file mode 100644 index 6b9cbe8194..0000000000 --- a/tests/typed-imports/playwright-core/utils.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utils'); \ No newline at end of file diff --git a/tests/typed-imports/playwright-core/utilsBundle.d.ts b/tests/typed-imports/playwright-core/utilsBundle.d.ts deleted file mode 100644 index efea88d63f..0000000000 --- a/tests/typed-imports/playwright-core/utilsBundle.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -export * from 'playwright-core/src/utilsBundle'; diff --git a/tests/typed-imports/playwright-core/utilsBundle.js b/tests/typed-imports/playwright-core/utilsBundle.js deleted file mode 100644 index 2ee4d4d8ec..0000000000 --- a/tests/typed-imports/playwright-core/utilsBundle.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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. - */ - -module.exports = require('../../../packages/playwright-core/lib/utilsBundle');