diff --git a/packages/playwright-ct-core/types/index.d.ts b/packages/playwright-ct-core/types/index.d.ts new file mode 100644 index 00000000000000..aff781664a20b4 --- /dev/null +++ b/packages/playwright-ct-core/types/index.d.ts @@ -0,0 +1,30 @@ +import type { InlineConfig } from 'vite'; +import type { + TestType as BaseTestType, + PlaywrightTestArgs, + PlaywrightTestConfig as BasePlaywrightTestConfig, + PlaywrightTestOptions, + PlaywrightWorkerArgs, + PlaywrightWorkerOptions, +} from 'playwright/test'; + +export type PlaywrightTestConfig = Omit, 'use'> & { + use?: BasePlaywrightTestConfig['use'] & { + ctPort?: number; + ctTemplateDir?: string; + ctCacheDir?: string; + ctViteConfig?: InlineConfig | (() => Promise); + }; +}; + +export type TestType = BaseTestType< + PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, + PlaywrightWorkerArgs & PlaywrightWorkerOptions +>; + +export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; +export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; +export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; +export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; diff --git a/packages/playwright-ct-react/index.d.ts b/packages/playwright-ct-react/index.d.ts index 3e994cf8fa7d8e..605bced1ac8c26 100644 --- a/packages/playwright-ct-react/index.d.ts +++ b/packages/playwright-ct-react/index.d.ts @@ -14,26 +14,9 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; export interface MountOptions { hooksConfig?: HooksConfig; @@ -44,26 +27,12 @@ interface MountResult extends Locator { update(component: JSX.Element): Promise; } -export interface ComponentFixtures { +export const test: TestType<{ mount( component: JSX.Element, options?: MountOptions ): Promise; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -/** - * Defines Playwright config - */ -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-react/register.d.ts b/packages/playwright-ct-react/register.d.ts index 9ca8259f0a69f6..1f44530ed625da 100644 --- a/packages/playwright-ct-react/register.d.ts +++ b/packages/playwright-ct-react/register.d.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export default function pwRegister(components: Record): void +export default function pwRegister(components: Record): void; diff --git a/packages/playwright-ct-react17/index.d.ts b/packages/playwright-ct-react17/index.d.ts index 3e994cf8fa7d8e..605bced1ac8c26 100644 --- a/packages/playwright-ct-react17/index.d.ts +++ b/packages/playwright-ct-react17/index.d.ts @@ -14,26 +14,9 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; export interface MountOptions { hooksConfig?: HooksConfig; @@ -44,26 +27,12 @@ interface MountResult extends Locator { update(component: JSX.Element): Promise; } -export interface ComponentFixtures { +export const test: TestType<{ mount( component: JSX.Element, options?: MountOptions ): Promise; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -/** - * Defines Playwright config - */ -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-react17/register.d.ts b/packages/playwright-ct-react17/register.d.ts index 9ca8259f0a69f6..1f44530ed625da 100644 --- a/packages/playwright-ct-react17/register.d.ts +++ b/packages/playwright-ct-react17/register.d.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export default function pwRegister(components: Record): void +export default function pwRegister(components: Record): void; diff --git a/packages/playwright-ct-solid/index.d.ts b/packages/playwright-ct-solid/index.d.ts index 3e994cf8fa7d8e..605bced1ac8c26 100644 --- a/packages/playwright-ct-solid/index.d.ts +++ b/packages/playwright-ct-solid/index.d.ts @@ -14,26 +14,9 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; export interface MountOptions { hooksConfig?: HooksConfig; @@ -44,26 +27,12 @@ interface MountResult extends Locator { update(component: JSX.Element): Promise; } -export interface ComponentFixtures { +export const test: TestType<{ mount( component: JSX.Element, options?: MountOptions ): Promise; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -/** - * Defines Playwright config - */ -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-solid/register.d.ts b/packages/playwright-ct-solid/register.d.ts index 9ca8259f0a69f6..1f44530ed625da 100644 --- a/packages/playwright-ct-solid/register.d.ts +++ b/packages/playwright-ct-solid/register.d.ts @@ -14,4 +14,4 @@ * limitations under the License. */ -export default function pwRegister(components: Record): void +export default function pwRegister(components: Record): void; diff --git a/packages/playwright-ct-svelte/index.d.ts b/packages/playwright-ct-svelte/index.d.ts index d1f7a5a07bc4a2..c5868e6b9ebab0 100644 --- a/packages/playwright-ct-svelte/index.d.ts +++ b/packages/playwright-ct-svelte/index.d.ts @@ -14,27 +14,10 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; type ComponentSlot = string | string[]; type ComponentSlots = Record & { default?: ComponentSlot }; @@ -55,23 +38,12 @@ interface MountResult extends Locator { }): Promise; } -interface ComponentFixtures { +export const test: TestType<{ mount( component: new (...args: any[]) => Component, options?: MountOptions ): Promise>; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-vue/index.d.ts b/packages/playwright-ct-vue/index.d.ts index 6cb5c751b37c56..24ce6e6a45d08f 100644 --- a/packages/playwright-ct-vue/index.d.ts +++ b/packages/playwright-ct-vue/index.d.ts @@ -14,26 +14,9 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; type ComponentSlot = string | string[]; type ComponentSlots = Record & { default?: ComponentSlot }; @@ -71,7 +54,7 @@ interface MountResultJsx extends Locator { update(component: JSX.Element): Promise; } -export interface ComponentFixtures { +export const test: TestType<{ mount( component: JSX.Element, options: MountOptionsJsx @@ -80,18 +63,7 @@ export interface ComponentFixtures { component: Component, options?: MountOptions ): Promise>; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-vue/register.d.ts b/packages/playwright-ct-vue/register.d.ts index e0ed7b0efedd33..f88e9be59d3b30 100644 --- a/packages/playwright-ct-vue/register.d.ts +++ b/packages/playwright-ct-vue/register.d.ts @@ -21,4 +21,4 @@ export default function pwRegister( setDevtoolsHook: any, h: any, } -): void +): void; diff --git a/packages/playwright-ct-vue2/index.d.ts b/packages/playwright-ct-vue2/index.d.ts index b3a22bed846325..4ca865d1584285 100644 --- a/packages/playwright-ct-vue2/index.d.ts +++ b/packages/playwright-ct-vue2/index.d.ts @@ -14,26 +14,9 @@ * limitations under the License. */ -import type { - TestType, - PlaywrightTestArgs, - PlaywrightTestConfig as BasePlaywrightTestConfig, - PlaywrightTestOptions, - PlaywrightWorkerArgs, - PlaywrightWorkerOptions, - Locator, -} from 'playwright/test'; +import type { Locator } from 'playwright/test'; import type { JsonObject } from '@playwright/experimental-ct-core/types/component'; -import type { InlineConfig } from 'vite'; - -export type PlaywrightTestConfig = Omit, 'use'> & { - use?: BasePlaywrightTestConfig['use'] & { - ctPort?: number; - ctTemplateDir?: string; - ctCacheDir?: string; - ctViteConfig?: InlineConfig | (() => Promise); - }; -}; +import type { TestType } from '@playwright/experimental-ct-core/types'; type Slot = string | string[]; type ComponentSlots = Record & { default?: Slot }; @@ -71,7 +54,7 @@ interface MountResultJsx extends Locator { update(component: JSX.Element): Promise; } -export interface ComponentFixtures { +export const test: TestType<{ mount( component: JSX.Element, options?: MountOptionsJsx @@ -80,18 +63,7 @@ export interface ComponentFixtures { component: Component, options?: MountOptions ): Promise>; -} - -export const test: TestType< - PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures, - PlaywrightWorkerArgs & PlaywrightWorkerOptions ->; - -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; -export function defineConfig(config: PlaywrightTestConfig, ...configs: PlaywrightTestConfig[]): PlaywrightTestConfig; +}>; +export { defineConfig, PlaywrightTestConfig } from '@playwright/experimental-ct-core/types'; export { expect, devices } from 'playwright/test'; diff --git a/packages/playwright-ct-vue2/register.d.ts b/packages/playwright-ct-vue2/register.d.ts index e0ed7b0efedd33..f88e9be59d3b30 100644 --- a/packages/playwright-ct-vue2/register.d.ts +++ b/packages/playwright-ct-vue2/register.d.ts @@ -21,4 +21,4 @@ export default function pwRegister( setDevtoolsHook: any, h: any, } -): void +): void;