playwright-clipboard-testing 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,133 @@
1
+ import { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
+ import { C as ClipboardHandler } from './clipboardHandler-CFIUvkc0.cjs';
3
+
4
+ type TimeoutMatcherOptions = {
5
+ timeout?: number;
6
+ };
7
+ type IgnoreCaseMatcherOptions = {
8
+ ignoreCase?: boolean;
9
+ };
10
+ type TrimMatcherOptions = {
11
+ trim?: boolean;
12
+ };
13
+ declare global {
14
+ namespace PlaywrightTest {
15
+ interface Matchers<R, T = unknown> {
16
+ /**
17
+ * Asserts that the clipboard content is empty.
18
+ * Uses smart polling to wait for the clipboard to be updated.
19
+ *
20
+ * @param options Matcher options.
21
+ * @returns A Promise that resolves when the assertion completes.
22
+ *
23
+ * @example
24
+ * await expect(clipboard).toBeBlank();
25
+ */
26
+ toBeBlank(options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<R>;
27
+ /**
28
+ * Asserts that the clipboard content has the expected length.
29
+ * Uses smart polling to wait for the clipboard to be updated.
30
+ *
31
+ * @param expected The expected length of the clipboard content.
32
+ * @param options Matcher options.
33
+ * @returns A Promise that resolves when the assertion completes.
34
+ *
35
+ * @example
36
+ * await expect(clipboard).toHaveContentLength(10);
37
+ */
38
+ toHaveContentLength(expected: number, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<R>;
39
+ /**
40
+ * Asserts that the clipboard content matches the expected text.
41
+ * Uses smart polling to wait for the clipboard to be updated.
42
+ *
43
+ * @param expected The string or regular expression to compare against the clipboard content.
44
+ * @param options Matcher options.
45
+ * @returns A Promise that resolves when the assertion completes.
46
+ *
47
+ * @example
48
+ * await expect(clipboard).toHaveTextContent('Copied value');
49
+ */
50
+ toHaveTextContent(expected: string | RegExp, options?: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions): Promise<R>;
51
+ /**
52
+ * Asserts that the clipboard content matches the expected JSON value.
53
+ * Uses smart polling to wait for the clipboard to be updated.
54
+ *
55
+ * @param expected The JSON value to compare against the clipboard content.
56
+ * @param options Matcher options.
57
+ * @returns A Promise that resolves when the assertion completes.
58
+ *
59
+ * @example
60
+ * await expect(clipboard).toHaveJSONContent({ id: 123, status: 'success' });
61
+ */
62
+ toHaveJSONContent(expected: unknown, options?: TimeoutMatcherOptions): Promise<R>;
63
+ /**
64
+ * Asserts that the clipboard content contains the expected JSON value.
65
+ * Uses smart polling to wait for the clipboard to be updated.
66
+ *
67
+ * @param expected The JSON value to compare against the clipboard content.
68
+ * @param options Matcher options.
69
+ * @returns A Promise that resolves when the assertion completes.
70
+ *
71
+ * @example
72
+ * await expect(clipboard).toMatchJSONContent({ id: 123, status: 'success' });
73
+ */
74
+ toMatchJSONContent(expected: unknown, options?: TimeoutMatcherOptions): Promise<R>;
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Asserts that the clipboard content contains the expected JSON value.
81
+ *
82
+ * @this ExpectMatcherState
83
+ * @param clipboard the clipboard utility instance
84
+ * @param expected The expected JSON value
85
+ * @param options matcher options.
86
+ * @returns A Promise that resolves to a MatcherReturnType object.
87
+ */
88
+ declare function toMatchJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
89
+
90
+ /**
91
+ * Asserts that the clipboard content matches the expected text value.
92
+ *
93
+ * @this ExpectMatcherState
94
+ * @param clipboard The Clipboard utility instance.
95
+ * @param expected The expected text value.
96
+ * @param options Matcher options.
97
+ * @returns A Promise that resolves to a MatcherReturnType object.
98
+ */
99
+ declare function toHaveTextContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: string | RegExp, options?: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
100
+
101
+ /**
102
+ * Asserts that the clipboard content matches the expected JSON value.
103
+ *
104
+ * @this ExpectMatcherState
105
+ * @param clipboard The Clipboard utility instance.
106
+ * @param expected The expected JSON value.
107
+ * @param options Matcher options.
108
+ * @returns A Promise that resolves to a MatcherReturnType object.
109
+ */
110
+ declare function toHaveJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
111
+
112
+ /**
113
+ * Asserts that the clipboard content has the expected length.
114
+ *
115
+ * @this ExpectMatcherState
116
+ * @param clipboard The Clipboard utility instance.
117
+ * @param expected The expected length of the clipboard content.
118
+ * @param options Matcher options.
119
+ * @returns A Promise that resolves to a MatcherReturnType object.
120
+ */
121
+ declare function toHaveContentLength(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: number, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
122
+
123
+ /**
124
+ * Asserts that the clipboard content is blank (empty string).
125
+ *
126
+ * @this ExpectMatcherState
127
+ * @param clipboard The Clipboard utility instance.
128
+ * @param options Matcher options.
129
+ * @returns A Promise that resolves to a MatcherReturnType object.
130
+ */
131
+ declare function toBeBlank(this: ExpectMatcherState, clipboard: ClipboardHandler, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
132
+
133
+ export { toHaveContentLength as a, toHaveJSONContent as b, toHaveTextContent as c, toMatchJSONContent as d, toBeBlank as t };
@@ -0,0 +1,133 @@
1
+ import { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
+ import { C as ClipboardHandler } from './clipboardHandler-CFIUvkc0.js';
3
+
4
+ type TimeoutMatcherOptions = {
5
+ timeout?: number;
6
+ };
7
+ type IgnoreCaseMatcherOptions = {
8
+ ignoreCase?: boolean;
9
+ };
10
+ type TrimMatcherOptions = {
11
+ trim?: boolean;
12
+ };
13
+ declare global {
14
+ namespace PlaywrightTest {
15
+ interface Matchers<R, T = unknown> {
16
+ /**
17
+ * Asserts that the clipboard content is empty.
18
+ * Uses smart polling to wait for the clipboard to be updated.
19
+ *
20
+ * @param options Matcher options.
21
+ * @returns A Promise that resolves when the assertion completes.
22
+ *
23
+ * @example
24
+ * await expect(clipboard).toBeBlank();
25
+ */
26
+ toBeBlank(options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<R>;
27
+ /**
28
+ * Asserts that the clipboard content has the expected length.
29
+ * Uses smart polling to wait for the clipboard to be updated.
30
+ *
31
+ * @param expected The expected length of the clipboard content.
32
+ * @param options Matcher options.
33
+ * @returns A Promise that resolves when the assertion completes.
34
+ *
35
+ * @example
36
+ * await expect(clipboard).toHaveContentLength(10);
37
+ */
38
+ toHaveContentLength(expected: number, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<R>;
39
+ /**
40
+ * Asserts that the clipboard content matches the expected text.
41
+ * Uses smart polling to wait for the clipboard to be updated.
42
+ *
43
+ * @param expected The string or regular expression to compare against the clipboard content.
44
+ * @param options Matcher options.
45
+ * @returns A Promise that resolves when the assertion completes.
46
+ *
47
+ * @example
48
+ * await expect(clipboard).toHaveTextContent('Copied value');
49
+ */
50
+ toHaveTextContent(expected: string | RegExp, options?: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions): Promise<R>;
51
+ /**
52
+ * Asserts that the clipboard content matches the expected JSON value.
53
+ * Uses smart polling to wait for the clipboard to be updated.
54
+ *
55
+ * @param expected The JSON value to compare against the clipboard content.
56
+ * @param options Matcher options.
57
+ * @returns A Promise that resolves when the assertion completes.
58
+ *
59
+ * @example
60
+ * await expect(clipboard).toHaveJSONContent({ id: 123, status: 'success' });
61
+ */
62
+ toHaveJSONContent(expected: unknown, options?: TimeoutMatcherOptions): Promise<R>;
63
+ /**
64
+ * Asserts that the clipboard content contains the expected JSON value.
65
+ * Uses smart polling to wait for the clipboard to be updated.
66
+ *
67
+ * @param expected The JSON value to compare against the clipboard content.
68
+ * @param options Matcher options.
69
+ * @returns A Promise that resolves when the assertion completes.
70
+ *
71
+ * @example
72
+ * await expect(clipboard).toMatchJSONContent({ id: 123, status: 'success' });
73
+ */
74
+ toMatchJSONContent(expected: unknown, options?: TimeoutMatcherOptions): Promise<R>;
75
+ }
76
+ }
77
+ }
78
+
79
+ /**
80
+ * Asserts that the clipboard content contains the expected JSON value.
81
+ *
82
+ * @this ExpectMatcherState
83
+ * @param clipboard the clipboard utility instance
84
+ * @param expected The expected JSON value
85
+ * @param options matcher options.
86
+ * @returns A Promise that resolves to a MatcherReturnType object.
87
+ */
88
+ declare function toMatchJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
89
+
90
+ /**
91
+ * Asserts that the clipboard content matches the expected text value.
92
+ *
93
+ * @this ExpectMatcherState
94
+ * @param clipboard The Clipboard utility instance.
95
+ * @param expected The expected text value.
96
+ * @param options Matcher options.
97
+ * @returns A Promise that resolves to a MatcherReturnType object.
98
+ */
99
+ declare function toHaveTextContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: string | RegExp, options?: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
100
+
101
+ /**
102
+ * Asserts that the clipboard content matches the expected JSON value.
103
+ *
104
+ * @this ExpectMatcherState
105
+ * @param clipboard The Clipboard utility instance.
106
+ * @param expected The expected JSON value.
107
+ * @param options Matcher options.
108
+ * @returns A Promise that resolves to a MatcherReturnType object.
109
+ */
110
+ declare function toHaveJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
111
+
112
+ /**
113
+ * Asserts that the clipboard content has the expected length.
114
+ *
115
+ * @this ExpectMatcherState
116
+ * @param clipboard The Clipboard utility instance.
117
+ * @param expected The expected length of the clipboard content.
118
+ * @param options Matcher options.
119
+ * @returns A Promise that resolves to a MatcherReturnType object.
120
+ */
121
+ declare function toHaveContentLength(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: number, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
122
+
123
+ /**
124
+ * Asserts that the clipboard content is blank (empty string).
125
+ *
126
+ * @this ExpectMatcherState
127
+ * @param clipboard The Clipboard utility instance.
128
+ * @param options Matcher options.
129
+ * @returns A Promise that resolves to a MatcherReturnType object.
130
+ */
131
+ declare function toBeBlank(this: ExpectMatcherState, clipboard: ClipboardHandler, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
132
+
133
+ export { toHaveContentLength as a, toHaveJSONContent as b, toHaveTextContent as c, toMatchJSONContent as d, toBeBlank as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-clipboard-testing",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Playwright fixture and custom matchers for clipboard testing and assertions.",
5
5
  "author": "Sergii Oleksenko <serg.oleksenko@gmail.com>",
6
6
  "license": "MIT",
@@ -34,6 +34,30 @@
34
34
  },
35
35
  "import": "./dist/index.js",
36
36
  "require": "./dist/index.cjs"
37
+ },
38
+ "./constants": {
39
+ "types": {
40
+ "import": "./dist/constants/index.d.ts",
41
+ "require": "./dist/constants/index.d.cts"
42
+ },
43
+ "import": "./dist/constants/index.js",
44
+ "require": "./dist/constants/index.cjs"
45
+ },
46
+ "./fixtures": {
47
+ "types": {
48
+ "import": "./dist/fixtures/index.d.ts",
49
+ "require": "./dist/fixtures/index.d.cts"
50
+ },
51
+ "import": "./dist/fixtures/index.js",
52
+ "require": "./dist/fixtures/index.cjs"
53
+ },
54
+ "./matchers": {
55
+ "types": {
56
+ "import": "./dist/matchers/index.d.ts",
57
+ "require": "./dist/matchers/index.d.cts"
58
+ },
59
+ "import": "./dist/matchers/index.js",
60
+ "require": "./dist/matchers/index.cjs"
37
61
  }
38
62
  },
39
63
  "files": [
@@ -50,16 +74,19 @@
50
74
  "lint:fix": "biome check --write .",
51
75
  "typecheck": "tsc --noEmit",
52
76
  "format": "biome format --write .",
77
+ "serve": "serve tests/e2e/html -l 3000",
78
+ "test:package": "node scripts/test-package.ts",
53
79
  "test:unit": "vitest run",
80
+ "test:watch": "vitest",
54
81
  "test:e2e": "playwright test",
55
82
  "test:e2e:ui": "playwright test --ui",
56
- "test": "npm run test:unit && npm run test:e2e",
57
- "test:watch": "vitest"
83
+ "test": "npm run test:unit && npm run test:e2e"
58
84
  },
59
85
  "devDependencies": {
60
86
  "@biomejs/biome": "2.5.10",
61
87
  "@playwright/test": "^1.63.0",
62
88
  "@types/node": "^26.4.1",
89
+ "serve": "^14.2.6",
63
90
  "tsup": "^8.5.1",
64
91
  "typescript": "5.8.3",
65
92
  "vitest": "^4.1.11"