Skip to content

Commit 74f640f

Browse files
committed
fix: types playwright test
1 parent e520d51 commit 74f640f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

playwright/core/mountFixture.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22

3+
// eslint-disable-next-line import/no-extraneous-dependencies
34
import type {JsonObject} from '@playwright/experimental-ct-core/types/component';
45
import type {MountOptions} from '@playwright/experimental-ct-react';
56

playwright/core/types.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type {ComponentFixtures} from '@playwright/experimental-ct-react';
21
import type {
32
Locator,
43
PageScreenshotOptions,
@@ -8,6 +7,26 @@ import type {
87
PlaywrightWorkerOptions,
98
TestFixture,
109
} from '@playwright/test';
10+
import type {MountOptions} from '@playwright/experimental-ct-react';
11+
12+
type JsonPrimitive = string | number | boolean | null;
13+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
14+
type JsonArray = JsonValue[];
15+
16+
type JsonObject = {[Key in string]?: JsonValue};
17+
18+
interface MountResult extends Locator {
19+
unmount(): Promise<void>;
20+
update(component: JSX.Element): Promise<void>;
21+
}
22+
23+
interface ComponentFixtures {
24+
mount<HooksConfig extends JsonObject>(
25+
component: JSX.Element,
26+
options?: MountOptions<HooksConfig>,
27+
style?: React.CSSProperties | undefined,
28+
): Promise<MountResult>;
29+
}
1130

1231
type PlaywrightTestFixtures = PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures;
1332
type PlaywrightWorkerFixtures = PlaywrightWorkerArgs & PlaywrightWorkerOptions;

0 commit comments

Comments
 (0)