Skip to content

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

chore: move mount implementation to ct-core (#22506)

Pavel Feldmanba8aed9dea7c
diff --git a/packages/playwright-ct-core/.npmignore b/packages/playwright-ct-core/.npmignore
index 19509990b8..d3d3dc5a76 100644
--- a/packages/playwright-ct-core/.npmignore
+++ b/packages/playwright-ct-core/.npmignore
@@ -4,3 +4,4 @@
!LICENSE
!cli.js
!lib/**
+!types/**
diff --git a/packages/playwright-ct-core/package.json b/packages/playwright-ct-core/package.json
index 88ba6f0af8..1f96800c90 100644
--- a/packages/playwright-ct-core/package.json
+++ b/packages/playwright-ct-core/package.json
@@ -13,6 +13,7 @@
"license": "Apache-2.0",
"exports": {
"./cli": "./cli.js",
+ "./lib/mount": "./lib/mount.js",
"./lib/vitePlugin": "./lib/vitePlugin.js"
},
"dependencies": {
diff --git a/packages/playwright-test/src/mount.ts b/packages/playwright-ct-core/src/mount.ts
similarity index 97%
rename from packages/playwright-test/src/mount.ts
rename to packages/playwright-ct-core/src/mount.ts
index 609f7bd38f..fbdc133fff 100644
--- a/packages/playwright-test/src/mount.ts
+++ b/packages/playwright-ct-core/src/mount.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from '../types/test';
-import type { Component, JsxComponent, MountOptions } from '../types/experimentalComponent';
-import type { ContextReuseMode, FullConfigInternal } from './common/config';
+import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from '@playwright/test';
+import type { Component, JsxComponent, MountOptions } from '../types/component';
+import type { ContextReuseMode, FullConfigInternal } from '../../playwright-test/src/common/config';
let boundCallbacksForMount: Function[] = [];
diff --git a/packages/playwright-test/types/experimentalComponent.d.ts b/packages/playwright-ct-core/types/component.d.ts
similarity index 100%
rename from packages/playwright-test/types/experimentalComponent.d.ts
rename to packages/playwright-ct-core/types/component.d.ts
diff --git a/packages/playwright-ct-react/hooks.d.ts b/packages/playwright-ct-react/hooks.d.ts
index 658146662c..0fa7cf3e1a 100644
--- a/packages/playwright-ct-react/hooks.d.ts
+++ b/packages/playwright-ct-react/hooks.d.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig; App: () => JSX.Element }) => Promise<void | JSX.Element>
diff --git a/packages/playwright-ct-react/index.d.ts b/packages/playwright-ct-react/index.d.ts
index 3835c7cd44..e7717c9b68 100644
--- a/packages/playwright-ct-react/index.d.ts
+++ b/packages/playwright-ct-react/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
diff --git a/packages/playwright-ct-react/index.js b/packages/playwright-ct-react/index.js
index 0d2641d9eb..7ec0f6b567 100644
--- a/packages/playwright-ct-react/index.js
+++ b/packages/playwright-ct-react/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-react/registerSource.mjs b/packages/playwright-ct-react/registerSource.mjs
index 0ba05eebef..d3c7cda8fe 100644
--- a/packages/playwright-ct-react/registerSource.mjs
+++ b/packages/playwright-ct-react/registerSource.mjs
@@ -20,7 +20,7 @@
import * as __pwReact from 'react';
import { createRoot as __pwCreateRoot } from 'react-dom/client';
-/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
+/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('react').FunctionComponent} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */
diff --git a/packages/playwright-ct-react17/hooks.d.ts b/packages/playwright-ct-react17/hooks.d.ts
index 658146662c..0fa7cf3e1a 100644
--- a/packages/playwright-ct-react17/hooks.d.ts
+++ b/packages/playwright-ct-react17/hooks.d.ts
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig; App: () => JSX.Element }) => Promise<void | JSX.Element>
diff --git a/packages/playwright-ct-react17/index.d.ts b/packages/playwright-ct-react17/index.d.ts
index 3835c7cd44..e7717c9b68 100644
--- a/packages/playwright-ct-react17/index.d.ts
+++ b/packages/playwright-ct-react17/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
diff --git a/packages/playwright-ct-react17/index.js b/packages/playwright-ct-react17/index.js
index 0d2641d9eb..7ec0f6b567 100644
--- a/packages/playwright-ct-react17/index.js
+++ b/packages/playwright-ct-react17/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-react17/registerSource.mjs b/packages/playwright-ct-react17/registerSource.mjs
index 3ffcf0c5ba..e77a546038 100644
--- a/packages/playwright-ct-react17/registerSource.mjs
+++ b/packages/playwright-ct-react17/registerSource.mjs
@@ -21,7 +21,7 @@
import __pwReact from 'react';
import __pwReactDOM from 'react-dom';
-/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
+/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('react').FunctionComponent} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */
diff --git a/packages/playwright-ct-solid/hooks.d.ts b/packages/playwright-ct-solid/hooks.d.ts
index a3c357085c..38d483ec6d 100644
--- a/packages/playwright-ct-solid/hooks.d.ts
+++ b/packages/playwright-ct-solid/hooks.d.ts
@@ -15,7 +15,7 @@
*/
import { JSXElement } from "solid-js";
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig, App: () => JSXElement }) => Promise<void | JSXElement>
diff --git a/packages/playwright-ct-solid/index.d.ts b/packages/playwright-ct-solid/index.d.ts
index 3835c7cd44..e7717c9b68 100644
--- a/packages/playwright-ct-solid/index.d.ts
+++ b/packages/playwright-ct-solid/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
diff --git a/packages/playwright-ct-solid/index.js b/packages/playwright-ct-solid/index.js
index 9724316de6..6d81c3b0ea 100644
--- a/packages/playwright-ct-solid/index.js
+++ b/packages/playwright-ct-solid/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-solid/registerSource.mjs b/packages/playwright-ct-solid/registerSource.mjs
index cfa6f390da..426c414038 100644
--- a/packages/playwright-ct-solid/registerSource.mjs
+++ b/packages/playwright-ct-solid/registerSource.mjs
@@ -20,7 +20,7 @@
import { render as __pwSolidRender, createComponent as __pwSolidCreateComponent } from 'solid-js/web';
import __pwH from 'solid-js/h';
-/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
+/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {() => import('solid-js').JSX.Element} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */
diff --git a/packages/playwright-ct-svelte/hooks.d.ts b/packages/playwright-ct-svelte/hooks.d.ts
index 0a086825c4..bcad0538d0 100644
--- a/packages/playwright-ct-svelte/hooks.d.ts
+++ b/packages/playwright-ct-svelte/hooks.d.ts
@@ -15,7 +15,7 @@
*/
import type { SvelteComponent } from 'svelte';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig }) => Promise<void>
diff --git a/packages/playwright-ct-svelte/index.d.ts b/packages/playwright-ct-svelte/index.d.ts
index 55e0e24911..65f4cc85fe 100644
--- a/packages/playwright-ct-svelte/index.d.ts
+++ b/packages/playwright-ct-svelte/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime';
diff --git a/packages/playwright-ct-svelte/index.js b/packages/playwright-ct-svelte/index.js
index 507f968420..d315751c05 100644
--- a/packages/playwright-ct-svelte/index.js
+++ b/packages/playwright-ct-svelte/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-svelte/registerSource.mjs b/packages/playwright-ct-svelte/registerSource.mjs
index 0fbb392b6c..99f6dcf1c7 100644
--- a/packages/playwright-ct-svelte/registerSource.mjs
+++ b/packages/playwright-ct-svelte/registerSource.mjs
@@ -20,7 +20,7 @@
import { detach as __pwDetach, insert as __pwInsert, noop as __pwNoop } from 'svelte/internal';
-/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
+/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {any} FrameworkComponent */
/** @typedef {import('svelte').SvelteComponent} SvelteComponent */
diff --git a/packages/playwright-ct-vue/hooks.d.ts b/packages/playwright-ct-vue/hooks.d.ts
index 19ec4cb41e..2a18496007 100644
--- a/packages/playwright-ct-vue/hooks.d.ts
+++ b/packages/playwright-ct-vue/hooks.d.ts
@@ -15,7 +15,7 @@
*/
import type { App, ComponentPublicInstance } from 'vue';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { app: App; hooksConfig?: HooksConfig }) => Promise<void>
diff --git a/packages/playwright-ct-vue/index.d.ts b/packages/playwright-ct-vue/index.d.ts
index 6bcdc5706b..f992773bee 100644
--- a/packages/playwright-ct-vue/index.d.ts
+++ b/packages/playwright-ct-vue/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
diff --git a/packages/playwright-ct-vue/index.js b/packages/playwright-ct-vue/index.js
index bc55b04ef3..b56283bff8 100644
--- a/packages/playwright-ct-vue/index.js
+++ b/packages/playwright-ct-vue/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-vue2/hooks.d.ts b/packages/playwright-ct-vue2/hooks.d.ts
index a8c16dddcc..4c3a391117 100644
--- a/packages/playwright-ct-vue2/hooks.d.ts
+++ b/packages/playwright-ct-vue2/hooks.d.ts
@@ -16,7 +16,7 @@
import { ComponentOptions } from 'vue';
import { CombinedVueInstance, Vue, VueConstructor } from 'vue/types/vue';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: {
diff --git a/packages/playwright-ct-vue2/index.d.ts b/packages/playwright-ct-vue2/index.d.ts
index a9cb47a132..08046733c5 100644
--- a/packages/playwright-ct-vue2/index.d.ts
+++ b/packages/playwright-ct-vue2/index.d.ts
@@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
-import type { JsonObject } from '@playwright/test/types/experimentalComponent';
+import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
diff --git a/packages/playwright-ct-vue2/index.js b/packages/playwright-ct-vue2/index.js
index 6122b97526..19e0b9d318 100644
--- a/packages/playwright-ct-vue2/index.js
+++ b/packages/playwright-ct-vue2/index.js
@@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
-const { fixtures } = require('@playwright/test/lib/mount');
+const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {
diff --git a/packages/playwright-ct-vue2/registerSource.mjs b/packages/playwright-ct-vue2/registerSource.mjs
index fd8a2d063d..54bd466090 100644
--- a/packages/playwright-ct-vue2/registerSource.mjs
+++ b/packages/playwright-ct-vue2/registerSource.mjs
@@ -20,7 +20,7 @@
import __pwVue, { h as __pwH } from 'vue';
-/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
+/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('vue').Component} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */
diff --git a/packages/playwright-test/package.json b/packages/playwright-test/package.json
index 3d823e84fc..e983951304 100644
--- a/packages/playwright-test/package.json
+++ b/packages/playwright-test/package.json
@@ -22,7 +22,6 @@
"./lib/common/compilationCache": "./lib/common/compilationCache.js",
"./lib/internalsForTest": "./lib/internalsForTest.js",
"./lib/experimentalLoader": "./lib/experimentalLoader.js",
- "./lib/mount": "./lib/mount.js",
"./lib/plugins": "./lib/plugins/index.js",
"./lib/util": "./lib/util.js",
"./lib/utilsBundle": "./lib/utilsBundle.js",