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.
- package/README.md +117 -36
- package/dist/clipboardHandler-CFIUvkc0.d.cts +51 -0
- package/dist/clipboardHandler-CFIUvkc0.d.ts +51 -0
- package/dist/constants/index.cjs +80 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/index.d.cts +51 -0
- package/dist/constants/index.d.ts +51 -0
- package/dist/constants/index.js +52 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/fixtures/index.cjs +130 -0
- package/dist/fixtures/index.cjs.map +1 -0
- package/dist/fixtures/index.d.cts +40 -0
- package/dist/fixtures/index.d.ts +40 -0
- package/dist/fixtures/index.js +100 -0
- package/dist/fixtures/index.js.map +1 -0
- package/dist/index.cjs +206 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -188
- package/dist/index.d.ts +11 -188
- package/dist/index.js +201 -45
- package/dist/index.js.map +1 -1
- package/dist/matchers/index.cjs +295 -0
- package/dist/matchers/index.cjs.map +1 -0
- package/dist/matchers/index.d.cts +16 -0
- package/dist/matchers/index.d.ts +16 -0
- package/dist/matchers/index.js +268 -0
- package/dist/matchers/index.js.map +1 -0
- package/dist/toBeBlank-uFClUdzK.d.cts +133 -0
- package/dist/toBeBlank-wAm_5G4T.d.ts +133 -0
- package/package.json +30 -3
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/matchers/index.ts
|
|
21
|
+
var matchers_exports = {};
|
|
22
|
+
__export(matchers_exports, {
|
|
23
|
+
clipboardMatchers: () => clipboardMatchers
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(matchers_exports);
|
|
26
|
+
|
|
27
|
+
// src/matchers/toBeBlank.ts
|
|
28
|
+
var import_test = require("@playwright/test");
|
|
29
|
+
|
|
30
|
+
// src/utils/matcherUtils.ts
|
|
31
|
+
function getErrorMessage(name, expected, actual, error, errorMessage) {
|
|
32
|
+
const message = `${this.utils.matcherHint(name, void 0, void 0, { isNot: this.isNot })}
|
|
33
|
+
|
|
34
|
+
`;
|
|
35
|
+
if (error) {
|
|
36
|
+
return () => `${message}An unexpected error occurred:
|
|
37
|
+
${error.message}`;
|
|
38
|
+
}
|
|
39
|
+
if (errorMessage) {
|
|
40
|
+
return () => `${message}${errorMessage}`;
|
|
41
|
+
}
|
|
42
|
+
return () => message + `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}
|
|
43
|
+
Received: ${this.utils.printReceived(actual)}`;
|
|
44
|
+
}
|
|
45
|
+
function normalizeText(data, options = {}) {
|
|
46
|
+
const { ignoreCase, trim } = options;
|
|
47
|
+
if (typeof data === "string") {
|
|
48
|
+
let result = data;
|
|
49
|
+
if (trim) result = result.trim();
|
|
50
|
+
if (ignoreCase) result = result.toLowerCase();
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
if (data instanceof RegExp) {
|
|
54
|
+
const flags = data.flags.replace(/[gy]/g, "");
|
|
55
|
+
const clearFlags = ignoreCase && !flags.includes("i") ? `${flags}i` : flags;
|
|
56
|
+
return new RegExp(data.source, clearFlags);
|
|
57
|
+
}
|
|
58
|
+
return data;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// src/matchers/toBeBlank.ts
|
|
62
|
+
async function toBeBlank(clipboard, options = {}) {
|
|
63
|
+
const name = "toBeBlank";
|
|
64
|
+
let pass;
|
|
65
|
+
let actual;
|
|
66
|
+
let normalizedActual;
|
|
67
|
+
const expected = "";
|
|
68
|
+
let errorReason = null;
|
|
69
|
+
const { timeout = 1e4, trim = false } = options;
|
|
70
|
+
const poll = import_test.expect.poll(
|
|
71
|
+
async () => {
|
|
72
|
+
try {
|
|
73
|
+
actual = await clipboard.read();
|
|
74
|
+
normalizedActual = actual;
|
|
75
|
+
normalizedActual = normalizeText(normalizedActual, { trim });
|
|
76
|
+
errorReason = null;
|
|
77
|
+
return normalizedActual;
|
|
78
|
+
} catch (error) {
|
|
79
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
80
|
+
actual = void 0;
|
|
81
|
+
normalizedActual = void 0;
|
|
82
|
+
throw errorReason;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{ timeout }
|
|
86
|
+
);
|
|
87
|
+
try {
|
|
88
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
89
|
+
await expectation.toEqual(expected);
|
|
90
|
+
pass = true;
|
|
91
|
+
} catch {
|
|
92
|
+
pass = false;
|
|
93
|
+
}
|
|
94
|
+
if (this.isNot) pass = !pass;
|
|
95
|
+
const matcherReturn = {
|
|
96
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
97
|
+
pass,
|
|
98
|
+
name,
|
|
99
|
+
expected,
|
|
100
|
+
actual
|
|
101
|
+
};
|
|
102
|
+
return matcherReturn;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/matchers/toHaveContentLength.ts
|
|
106
|
+
var import_test2 = require("@playwright/test");
|
|
107
|
+
async function toHaveContentLength(clipboard, expected, options = {}) {
|
|
108
|
+
const name = "toHaveContentLength";
|
|
109
|
+
let pass;
|
|
110
|
+
let actual;
|
|
111
|
+
let errorReason = null;
|
|
112
|
+
const { timeout = 1e4, trim = false } = options;
|
|
113
|
+
const poll = import_test2.expect.poll(
|
|
114
|
+
async () => {
|
|
115
|
+
try {
|
|
116
|
+
actual = await clipboard.read();
|
|
117
|
+
actual = normalizeText(actual, { trim });
|
|
118
|
+
errorReason = null;
|
|
119
|
+
return actual;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
122
|
+
actual = void 0;
|
|
123
|
+
throw errorReason;
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{ timeout }
|
|
127
|
+
);
|
|
128
|
+
try {
|
|
129
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
130
|
+
await expectation.toHaveLength(expected);
|
|
131
|
+
pass = true;
|
|
132
|
+
} catch {
|
|
133
|
+
pass = false;
|
|
134
|
+
}
|
|
135
|
+
if (this.isNot) pass = !pass;
|
|
136
|
+
const matcherReturn = {
|
|
137
|
+
message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),
|
|
138
|
+
pass,
|
|
139
|
+
name,
|
|
140
|
+
expected,
|
|
141
|
+
actual: actual?.length
|
|
142
|
+
};
|
|
143
|
+
return matcherReturn;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/matchers/toHaveJSONContent.ts
|
|
147
|
+
var import_test3 = require("@playwright/test");
|
|
148
|
+
async function toHaveJSONContent(clipboard, expected, options = {}) {
|
|
149
|
+
const name = "toHaveJSONContent";
|
|
150
|
+
let pass;
|
|
151
|
+
let actual;
|
|
152
|
+
let errorReason = null;
|
|
153
|
+
const { timeout = 1e4 } = options;
|
|
154
|
+
const poll = import_test3.expect.poll(
|
|
155
|
+
async () => {
|
|
156
|
+
try {
|
|
157
|
+
actual = await clipboard.readJSON();
|
|
158
|
+
errorReason = null;
|
|
159
|
+
return actual;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
162
|
+
try {
|
|
163
|
+
actual = await clipboard.read();
|
|
164
|
+
} catch {
|
|
165
|
+
actual = void 0;
|
|
166
|
+
}
|
|
167
|
+
throw errorReason;
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{ timeout }
|
|
171
|
+
);
|
|
172
|
+
try {
|
|
173
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
174
|
+
await expectation.toEqual(expected);
|
|
175
|
+
pass = true;
|
|
176
|
+
} catch {
|
|
177
|
+
pass = false;
|
|
178
|
+
}
|
|
179
|
+
if (this.isNot) pass = !pass;
|
|
180
|
+
const matcherReturn = {
|
|
181
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
182
|
+
pass,
|
|
183
|
+
name,
|
|
184
|
+
expected,
|
|
185
|
+
actual
|
|
186
|
+
};
|
|
187
|
+
return matcherReturn;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/matchers/toHaveTextContent.ts
|
|
191
|
+
var import_test4 = require("@playwright/test");
|
|
192
|
+
async function toHaveTextContent(clipboard, expected, options = {}) {
|
|
193
|
+
const name = "toHaveTextContent";
|
|
194
|
+
let pass;
|
|
195
|
+
let actual;
|
|
196
|
+
let normalizedActual;
|
|
197
|
+
let errorReason = null;
|
|
198
|
+
const { timeout = 1e4, ignoreCase = false, trim = false } = options;
|
|
199
|
+
const normalizedExpected = normalizeText(expected, { ignoreCase, trim });
|
|
200
|
+
const poll = import_test4.expect.poll(
|
|
201
|
+
async () => {
|
|
202
|
+
try {
|
|
203
|
+
actual = await clipboard.read();
|
|
204
|
+
normalizedActual = actual;
|
|
205
|
+
normalizedActual = normalizeText(normalizedActual, { ignoreCase, trim });
|
|
206
|
+
errorReason = null;
|
|
207
|
+
return normalizedActual;
|
|
208
|
+
} catch (error) {
|
|
209
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
210
|
+
actual = void 0;
|
|
211
|
+
normalizedActual = void 0;
|
|
212
|
+
throw errorReason;
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{ timeout }
|
|
216
|
+
);
|
|
217
|
+
try {
|
|
218
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
219
|
+
if (expected instanceof RegExp) {
|
|
220
|
+
await expectation.toMatch(normalizedExpected);
|
|
221
|
+
} else {
|
|
222
|
+
await expectation.toEqual(normalizedExpected);
|
|
223
|
+
}
|
|
224
|
+
pass = true;
|
|
225
|
+
} catch {
|
|
226
|
+
pass = false;
|
|
227
|
+
}
|
|
228
|
+
if (this.isNot) pass = !pass;
|
|
229
|
+
const matcherReturn = {
|
|
230
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
231
|
+
pass,
|
|
232
|
+
name,
|
|
233
|
+
expected,
|
|
234
|
+
actual
|
|
235
|
+
};
|
|
236
|
+
return matcherReturn;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/matchers/toMatchJSONContent.ts
|
|
240
|
+
var import_test5 = require("@playwright/test");
|
|
241
|
+
async function toMatchJSONContent(clipboard, expected, options = {}) {
|
|
242
|
+
const name = "toMatchJSONContent";
|
|
243
|
+
let pass;
|
|
244
|
+
let actual;
|
|
245
|
+
let errorReason = null;
|
|
246
|
+
const { timeout = 1e4 } = options;
|
|
247
|
+
const poll = import_test5.expect.poll(
|
|
248
|
+
async () => {
|
|
249
|
+
try {
|
|
250
|
+
actual = await clipboard.readJSON();
|
|
251
|
+
errorReason = null;
|
|
252
|
+
return actual;
|
|
253
|
+
} catch (error) {
|
|
254
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
255
|
+
try {
|
|
256
|
+
actual = await clipboard.read();
|
|
257
|
+
} catch {
|
|
258
|
+
actual = void 0;
|
|
259
|
+
}
|
|
260
|
+
throw errorReason;
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{ timeout }
|
|
264
|
+
);
|
|
265
|
+
try {
|
|
266
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
267
|
+
await expectation.toMatchObject(expected);
|
|
268
|
+
pass = true;
|
|
269
|
+
} catch {
|
|
270
|
+
pass = false;
|
|
271
|
+
}
|
|
272
|
+
if (this.isNot) pass = !pass;
|
|
273
|
+
const matcherReturn = {
|
|
274
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
275
|
+
pass,
|
|
276
|
+
name,
|
|
277
|
+
expected,
|
|
278
|
+
actual
|
|
279
|
+
};
|
|
280
|
+
return matcherReturn;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// src/matchers/clipboardMatchers.ts
|
|
284
|
+
var clipboardMatchers = {
|
|
285
|
+
toBeBlank,
|
|
286
|
+
toHaveContentLength,
|
|
287
|
+
toHaveJSONContent,
|
|
288
|
+
toHaveTextContent,
|
|
289
|
+
toMatchJSONContent
|
|
290
|
+
};
|
|
291
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
292
|
+
0 && (module.exports = {
|
|
293
|
+
clipboardMatchers
|
|
294
|
+
});
|
|
295
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/index.ts","../../src/matchers/toBeBlank.ts","../../src/utils/matcherUtils.ts","../../src/matchers/toHaveContentLength.ts","../../src/matchers/toHaveJSONContent.ts","../../src/matchers/toHaveTextContent.ts","../../src/matchers/toMatchJSONContent.ts","../../src/matchers/clipboardMatchers.ts"],"sourcesContent":["import { clipboardMatchers } from './clipboardMatchers.ts';\n\nexport { clipboardMatchers };\n","import { type ExpectMatcherState, expect, type MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content is blank (empty string).\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toBeBlank(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n options: TimeoutMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toBeBlank';\n let pass: boolean;\n let actual: string | undefined;\n let normalizedActual: string | undefined;\n const expected: string = '';\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, trim = false } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n normalizedActual = actual;\n normalizedActual = normalizeText(normalizedActual, { trim });\n errorReason = null;\n\n return normalizedActual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n normalizedActual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toEqual(expected);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState } from '@playwright/test';\n\n/**\n * Generates an error message for a custom matcher.\n *\n * @this ExpectMatcherState\n * @param name The name of the matcher.\n * @param expected The expected value.\n * @param actual The actual value.\n * @param error An optional error object.\n * @param errorMessage An optional error message string.\n * @returns A function that returns the error message string.\n */\nexport function getErrorMessage(\n this: ExpectMatcherState,\n name: string,\n expected: unknown,\n actual: unknown,\n error?: Error | null,\n errorMessage?: string | undefined | null,\n): () => string {\n const message = `${this.utils.matcherHint(name, undefined, undefined, { isNot: this.isNot })}\\n\\n`;\n\n if (error) {\n return () => `${message}An unexpected error occurred:\\n${error.message}`;\n }\n\n if (errorMessage) {\n return () => `${message}${errorMessage}`;\n }\n\n return () =>\n message +\n `Expected: ${this.isNot ? 'not ' : ''}${this.utils.printExpected(expected)}\\n` +\n `Received: ${this.utils.printReceived(actual)}`;\n}\n\nexport function normalizeText<T extends string | RegExp>(\n data: T,\n options: { ignoreCase?: boolean; trim?: boolean } = {},\n): T {\n const { ignoreCase, trim } = options;\n\n if (typeof data === 'string') {\n let result: string = data;\n\n if (trim) result = result.trim();\n\n if (ignoreCase) result = result.toLowerCase();\n\n return result as T;\n }\n\n if (data instanceof RegExp) {\n const flags = data.flags.replace(/[gy]/g, '');\n const clearFlags = ignoreCase && !flags.includes('i') ? `${flags}i` : flags;\n\n return new RegExp(data.source, clearFlags) as T;\n }\n\n return data;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content has the expected length.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected length of the clipboard content.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveContentLength(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: number,\n options: TimeoutMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toHaveContentLength';\n let pass: boolean;\n let actual: string | undefined;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, trim = false } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n\n actual = normalizeText(actual, { trim });\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toHaveLength(expected);\n\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),\n pass,\n name,\n expected,\n actual: actual?.length,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content matches the expected JSON value.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected JSON value.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveJSONContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: unknown,\n options: TimeoutMatcherOptions = {},\n) {\n const name = 'toHaveJSONContent';\n let pass: boolean;\n let actual: unknown;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000 } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.readJSON();\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n\n try {\n actual = await clipboard.read();\n } catch {\n actual = undefined;\n }\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toEqual(expected);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import { type ExpectMatcherState, expect, type MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type {\n IgnoreCaseMatcherOptions,\n TimeoutMatcherOptions,\n TrimMatcherOptions,\n} from './types.ts';\n\n/**\n * Asserts that the clipboard content matches the expected text value.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected text value.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveTextContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: string | RegExp,\n options: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toHaveTextContent';\n let pass: boolean;\n let actual: string | undefined;\n let normalizedActual: string | undefined;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, ignoreCase = false, trim = false } = options;\n\n const normalizedExpected = normalizeText(expected, { ignoreCase, trim });\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n\n normalizedActual = actual;\n normalizedActual = normalizeText(normalizedActual, { ignoreCase, trim });\n errorReason = null;\n\n return normalizedActual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n normalizedActual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n\n if (expected instanceof RegExp) {\n await expectation.toMatch(normalizedExpected as RegExp);\n } else {\n await expectation.toEqual(normalizedExpected);\n }\n\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content contains the expected JSON value.\n *\n * @this ExpectMatcherState\n * @param clipboard the clipboard utility instance\n * @param expected The expected JSON value\n * @param options matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toMatchJSONContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: unknown,\n options: TimeoutMatcherOptions = {},\n) {\n const name = 'toMatchJSONContent';\n let pass: boolean;\n let actual: unknown;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000 } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.readJSON();\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n\n try {\n actual = await clipboard.read();\n } catch {\n actual = undefined;\n }\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toMatchObject(expected as Record<string, unknown>);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import { toBeBlank } from './toBeBlank';\nimport { toHaveContentLength } from './toHaveContentLength.ts';\nimport { toHaveJSONContent } from './toHaveJSONContent';\nimport { toHaveTextContent } from './toHaveTextContent';\nimport { toMatchJSONContent } from './toMatchJSONContent.ts';\n\n/**\n * Export an object containing all the custom clipboard matchers for Playwright.\n */\nexport const clipboardMatchers = {\n toBeBlank,\n toHaveContentLength,\n toHaveJSONContent,\n toHaveTextContent,\n toMatchJSONContent,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAwE;;;ACajE,SAAS,gBAEd,MACA,UACA,QACA,OACA,cACc;AACd,QAAM,UAAU,GAAG,KAAK,MAAM,YAAY,MAAM,QAAW,QAAW,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC;AAAA;AAAA;AAE5F,MAAI,OAAO;AACT,WAAO,MAAM,GAAG,OAAO;AAAA,EAAkC,MAAM,OAAO;AAAA,EACxE;AAEA,MAAI,cAAc;AAChB,WAAO,MAAM,GAAG,OAAO,GAAG,YAAY;AAAA,EACxC;AAEA,SAAO,MACL,UACA,aAAa,KAAK,QAAQ,SAAS,E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AAAA,IACvC,SAAS,gBAAgB,KAAK,MAAM,MAAM,UAAU,QAAQ,WAAW;AAAA,IACvE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;;;AC5DO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["import_test","import_test","import_test","import_test"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as toBeBlank, a as toHaveContentLength, b as toHaveJSONContent, c as toHaveTextContent, d as toMatchJSONContent } from '../toBeBlank-uFClUdzK.cjs';
|
|
2
|
+
import '@playwright/test';
|
|
3
|
+
import '../clipboardHandler-CFIUvkc0.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Export an object containing all the custom clipboard matchers for Playwright.
|
|
7
|
+
*/
|
|
8
|
+
declare const clipboardMatchers: {
|
|
9
|
+
toBeBlank: typeof toBeBlank;
|
|
10
|
+
toHaveContentLength: typeof toHaveContentLength;
|
|
11
|
+
toHaveJSONContent: typeof toHaveJSONContent;
|
|
12
|
+
toHaveTextContent: typeof toHaveTextContent;
|
|
13
|
+
toMatchJSONContent: typeof toMatchJSONContent;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { clipboardMatchers };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as toBeBlank, a as toHaveContentLength, b as toHaveJSONContent, c as toHaveTextContent, d as toMatchJSONContent } from '../toBeBlank-wAm_5G4T.js';
|
|
2
|
+
import '@playwright/test';
|
|
3
|
+
import '../clipboardHandler-CFIUvkc0.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Export an object containing all the custom clipboard matchers for Playwright.
|
|
7
|
+
*/
|
|
8
|
+
declare const clipboardMatchers: {
|
|
9
|
+
toBeBlank: typeof toBeBlank;
|
|
10
|
+
toHaveContentLength: typeof toHaveContentLength;
|
|
11
|
+
toHaveJSONContent: typeof toHaveJSONContent;
|
|
12
|
+
toHaveTextContent: typeof toHaveTextContent;
|
|
13
|
+
toMatchJSONContent: typeof toMatchJSONContent;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { clipboardMatchers };
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// src/matchers/toBeBlank.ts
|
|
2
|
+
import { expect } from "@playwright/test";
|
|
3
|
+
|
|
4
|
+
// src/utils/matcherUtils.ts
|
|
5
|
+
function getErrorMessage(name, expected, actual, error, errorMessage) {
|
|
6
|
+
const message = `${this.utils.matcherHint(name, void 0, void 0, { isNot: this.isNot })}
|
|
7
|
+
|
|
8
|
+
`;
|
|
9
|
+
if (error) {
|
|
10
|
+
return () => `${message}An unexpected error occurred:
|
|
11
|
+
${error.message}`;
|
|
12
|
+
}
|
|
13
|
+
if (errorMessage) {
|
|
14
|
+
return () => `${message}${errorMessage}`;
|
|
15
|
+
}
|
|
16
|
+
return () => message + `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}
|
|
17
|
+
Received: ${this.utils.printReceived(actual)}`;
|
|
18
|
+
}
|
|
19
|
+
function normalizeText(data, options = {}) {
|
|
20
|
+
const { ignoreCase, trim } = options;
|
|
21
|
+
if (typeof data === "string") {
|
|
22
|
+
let result = data;
|
|
23
|
+
if (trim) result = result.trim();
|
|
24
|
+
if (ignoreCase) result = result.toLowerCase();
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
if (data instanceof RegExp) {
|
|
28
|
+
const flags = data.flags.replace(/[gy]/g, "");
|
|
29
|
+
const clearFlags = ignoreCase && !flags.includes("i") ? `${flags}i` : flags;
|
|
30
|
+
return new RegExp(data.source, clearFlags);
|
|
31
|
+
}
|
|
32
|
+
return data;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// src/matchers/toBeBlank.ts
|
|
36
|
+
async function toBeBlank(clipboard, options = {}) {
|
|
37
|
+
const name = "toBeBlank";
|
|
38
|
+
let pass;
|
|
39
|
+
let actual;
|
|
40
|
+
let normalizedActual;
|
|
41
|
+
const expected = "";
|
|
42
|
+
let errorReason = null;
|
|
43
|
+
const { timeout = 1e4, trim = false } = options;
|
|
44
|
+
const poll = expect.poll(
|
|
45
|
+
async () => {
|
|
46
|
+
try {
|
|
47
|
+
actual = await clipboard.read();
|
|
48
|
+
normalizedActual = actual;
|
|
49
|
+
normalizedActual = normalizeText(normalizedActual, { trim });
|
|
50
|
+
errorReason = null;
|
|
51
|
+
return normalizedActual;
|
|
52
|
+
} catch (error) {
|
|
53
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
54
|
+
actual = void 0;
|
|
55
|
+
normalizedActual = void 0;
|
|
56
|
+
throw errorReason;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{ timeout }
|
|
60
|
+
);
|
|
61
|
+
try {
|
|
62
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
63
|
+
await expectation.toEqual(expected);
|
|
64
|
+
pass = true;
|
|
65
|
+
} catch {
|
|
66
|
+
pass = false;
|
|
67
|
+
}
|
|
68
|
+
if (this.isNot) pass = !pass;
|
|
69
|
+
const matcherReturn = {
|
|
70
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
71
|
+
pass,
|
|
72
|
+
name,
|
|
73
|
+
expected,
|
|
74
|
+
actual
|
|
75
|
+
};
|
|
76
|
+
return matcherReturn;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/matchers/toHaveContentLength.ts
|
|
80
|
+
import { expect as expect2 } from "@playwright/test";
|
|
81
|
+
async function toHaveContentLength(clipboard, expected, options = {}) {
|
|
82
|
+
const name = "toHaveContentLength";
|
|
83
|
+
let pass;
|
|
84
|
+
let actual;
|
|
85
|
+
let errorReason = null;
|
|
86
|
+
const { timeout = 1e4, trim = false } = options;
|
|
87
|
+
const poll = expect2.poll(
|
|
88
|
+
async () => {
|
|
89
|
+
try {
|
|
90
|
+
actual = await clipboard.read();
|
|
91
|
+
actual = normalizeText(actual, { trim });
|
|
92
|
+
errorReason = null;
|
|
93
|
+
return actual;
|
|
94
|
+
} catch (error) {
|
|
95
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
96
|
+
actual = void 0;
|
|
97
|
+
throw errorReason;
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{ timeout }
|
|
101
|
+
);
|
|
102
|
+
try {
|
|
103
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
104
|
+
await expectation.toHaveLength(expected);
|
|
105
|
+
pass = true;
|
|
106
|
+
} catch {
|
|
107
|
+
pass = false;
|
|
108
|
+
}
|
|
109
|
+
if (this.isNot) pass = !pass;
|
|
110
|
+
const matcherReturn = {
|
|
111
|
+
message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),
|
|
112
|
+
pass,
|
|
113
|
+
name,
|
|
114
|
+
expected,
|
|
115
|
+
actual: actual?.length
|
|
116
|
+
};
|
|
117
|
+
return matcherReturn;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/matchers/toHaveJSONContent.ts
|
|
121
|
+
import { expect as expect3 } from "@playwright/test";
|
|
122
|
+
async function toHaveJSONContent(clipboard, expected, options = {}) {
|
|
123
|
+
const name = "toHaveJSONContent";
|
|
124
|
+
let pass;
|
|
125
|
+
let actual;
|
|
126
|
+
let errorReason = null;
|
|
127
|
+
const { timeout = 1e4 } = options;
|
|
128
|
+
const poll = expect3.poll(
|
|
129
|
+
async () => {
|
|
130
|
+
try {
|
|
131
|
+
actual = await clipboard.readJSON();
|
|
132
|
+
errorReason = null;
|
|
133
|
+
return actual;
|
|
134
|
+
} catch (error) {
|
|
135
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
136
|
+
try {
|
|
137
|
+
actual = await clipboard.read();
|
|
138
|
+
} catch {
|
|
139
|
+
actual = void 0;
|
|
140
|
+
}
|
|
141
|
+
throw errorReason;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{ timeout }
|
|
145
|
+
);
|
|
146
|
+
try {
|
|
147
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
148
|
+
await expectation.toEqual(expected);
|
|
149
|
+
pass = true;
|
|
150
|
+
} catch {
|
|
151
|
+
pass = false;
|
|
152
|
+
}
|
|
153
|
+
if (this.isNot) pass = !pass;
|
|
154
|
+
const matcherReturn = {
|
|
155
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
156
|
+
pass,
|
|
157
|
+
name,
|
|
158
|
+
expected,
|
|
159
|
+
actual
|
|
160
|
+
};
|
|
161
|
+
return matcherReturn;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/matchers/toHaveTextContent.ts
|
|
165
|
+
import { expect as expect4 } from "@playwright/test";
|
|
166
|
+
async function toHaveTextContent(clipboard, expected, options = {}) {
|
|
167
|
+
const name = "toHaveTextContent";
|
|
168
|
+
let pass;
|
|
169
|
+
let actual;
|
|
170
|
+
let normalizedActual;
|
|
171
|
+
let errorReason = null;
|
|
172
|
+
const { timeout = 1e4, ignoreCase = false, trim = false } = options;
|
|
173
|
+
const normalizedExpected = normalizeText(expected, { ignoreCase, trim });
|
|
174
|
+
const poll = expect4.poll(
|
|
175
|
+
async () => {
|
|
176
|
+
try {
|
|
177
|
+
actual = await clipboard.read();
|
|
178
|
+
normalizedActual = actual;
|
|
179
|
+
normalizedActual = normalizeText(normalizedActual, { ignoreCase, trim });
|
|
180
|
+
errorReason = null;
|
|
181
|
+
return normalizedActual;
|
|
182
|
+
} catch (error) {
|
|
183
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
184
|
+
actual = void 0;
|
|
185
|
+
normalizedActual = void 0;
|
|
186
|
+
throw errorReason;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{ timeout }
|
|
190
|
+
);
|
|
191
|
+
try {
|
|
192
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
193
|
+
if (expected instanceof RegExp) {
|
|
194
|
+
await expectation.toMatch(normalizedExpected);
|
|
195
|
+
} else {
|
|
196
|
+
await expectation.toEqual(normalizedExpected);
|
|
197
|
+
}
|
|
198
|
+
pass = true;
|
|
199
|
+
} catch {
|
|
200
|
+
pass = false;
|
|
201
|
+
}
|
|
202
|
+
if (this.isNot) pass = !pass;
|
|
203
|
+
const matcherReturn = {
|
|
204
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
205
|
+
pass,
|
|
206
|
+
name,
|
|
207
|
+
expected,
|
|
208
|
+
actual
|
|
209
|
+
};
|
|
210
|
+
return matcherReturn;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// src/matchers/toMatchJSONContent.ts
|
|
214
|
+
import { expect as expect5 } from "@playwright/test";
|
|
215
|
+
async function toMatchJSONContent(clipboard, expected, options = {}) {
|
|
216
|
+
const name = "toMatchJSONContent";
|
|
217
|
+
let pass;
|
|
218
|
+
let actual;
|
|
219
|
+
let errorReason = null;
|
|
220
|
+
const { timeout = 1e4 } = options;
|
|
221
|
+
const poll = expect5.poll(
|
|
222
|
+
async () => {
|
|
223
|
+
try {
|
|
224
|
+
actual = await clipboard.readJSON();
|
|
225
|
+
errorReason = null;
|
|
226
|
+
return actual;
|
|
227
|
+
} catch (error) {
|
|
228
|
+
errorReason = error instanceof Error ? error : new Error(String(error));
|
|
229
|
+
try {
|
|
230
|
+
actual = await clipboard.read();
|
|
231
|
+
} catch {
|
|
232
|
+
actual = void 0;
|
|
233
|
+
}
|
|
234
|
+
throw errorReason;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{ timeout }
|
|
238
|
+
);
|
|
239
|
+
try {
|
|
240
|
+
const expectation = this.isNot ? poll.not : poll;
|
|
241
|
+
await expectation.toMatchObject(expected);
|
|
242
|
+
pass = true;
|
|
243
|
+
} catch {
|
|
244
|
+
pass = false;
|
|
245
|
+
}
|
|
246
|
+
if (this.isNot) pass = !pass;
|
|
247
|
+
const matcherReturn = {
|
|
248
|
+
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
249
|
+
pass,
|
|
250
|
+
name,
|
|
251
|
+
expected,
|
|
252
|
+
actual
|
|
253
|
+
};
|
|
254
|
+
return matcherReturn;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/matchers/clipboardMatchers.ts
|
|
258
|
+
var clipboardMatchers = {
|
|
259
|
+
toBeBlank,
|
|
260
|
+
toHaveContentLength,
|
|
261
|
+
toHaveJSONContent,
|
|
262
|
+
toHaveTextContent,
|
|
263
|
+
toMatchJSONContent
|
|
264
|
+
};
|
|
265
|
+
export {
|
|
266
|
+
clipboardMatchers
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/matchers/toBeBlank.ts","../../src/utils/matcherUtils.ts","../../src/matchers/toHaveContentLength.ts","../../src/matchers/toHaveJSONContent.ts","../../src/matchers/toHaveTextContent.ts","../../src/matchers/toMatchJSONContent.ts","../../src/matchers/clipboardMatchers.ts"],"sourcesContent":["import { type ExpectMatcherState, expect, type MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content is blank (empty string).\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toBeBlank(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n options: TimeoutMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toBeBlank';\n let pass: boolean;\n let actual: string | undefined;\n let normalizedActual: string | undefined;\n const expected: string = '';\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, trim = false } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n normalizedActual = actual;\n normalizedActual = normalizeText(normalizedActual, { trim });\n errorReason = null;\n\n return normalizedActual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n normalizedActual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toEqual(expected);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState } from '@playwright/test';\n\n/**\n * Generates an error message for a custom matcher.\n *\n * @this ExpectMatcherState\n * @param name The name of the matcher.\n * @param expected The expected value.\n * @param actual The actual value.\n * @param error An optional error object.\n * @param errorMessage An optional error message string.\n * @returns A function that returns the error message string.\n */\nexport function getErrorMessage(\n this: ExpectMatcherState,\n name: string,\n expected: unknown,\n actual: unknown,\n error?: Error | null,\n errorMessage?: string | undefined | null,\n): () => string {\n const message = `${this.utils.matcherHint(name, undefined, undefined, { isNot: this.isNot })}\\n\\n`;\n\n if (error) {\n return () => `${message}An unexpected error occurred:\\n${error.message}`;\n }\n\n if (errorMessage) {\n return () => `${message}${errorMessage}`;\n }\n\n return () =>\n message +\n `Expected: ${this.isNot ? 'not ' : ''}${this.utils.printExpected(expected)}\\n` +\n `Received: ${this.utils.printReceived(actual)}`;\n}\n\nexport function normalizeText<T extends string | RegExp>(\n data: T,\n options: { ignoreCase?: boolean; trim?: boolean } = {},\n): T {\n const { ignoreCase, trim } = options;\n\n if (typeof data === 'string') {\n let result: string = data;\n\n if (trim) result = result.trim();\n\n if (ignoreCase) result = result.toLowerCase();\n\n return result as T;\n }\n\n if (data instanceof RegExp) {\n const flags = data.flags.replace(/[gy]/g, '');\n const clearFlags = ignoreCase && !flags.includes('i') ? `${flags}i` : flags;\n\n return new RegExp(data.source, clearFlags) as T;\n }\n\n return data;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content has the expected length.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected length of the clipboard content.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveContentLength(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: number,\n options: TimeoutMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toHaveContentLength';\n let pass: boolean;\n let actual: string | undefined;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, trim = false } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n\n actual = normalizeText(actual, { trim });\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toHaveLength(expected);\n\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),\n pass,\n name,\n expected,\n actual: actual?.length,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content matches the expected JSON value.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected JSON value.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveJSONContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: unknown,\n options: TimeoutMatcherOptions = {},\n) {\n const name = 'toHaveJSONContent';\n let pass: boolean;\n let actual: unknown;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000 } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.readJSON();\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n\n try {\n actual = await clipboard.read();\n } catch {\n actual = undefined;\n }\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toEqual(expected);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import { type ExpectMatcherState, expect, type MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage, normalizeText } from '../utils/matcherUtils.ts';\nimport type {\n IgnoreCaseMatcherOptions,\n TimeoutMatcherOptions,\n TrimMatcherOptions,\n} from './types.ts';\n\n/**\n * Asserts that the clipboard content matches the expected text value.\n *\n * @this ExpectMatcherState\n * @param clipboard The Clipboard utility instance.\n * @param expected The expected text value.\n * @param options Matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toHaveTextContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: string | RegExp,\n options: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions = {},\n) {\n const name = 'toHaveTextContent';\n let pass: boolean;\n let actual: string | undefined;\n let normalizedActual: string | undefined;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000, ignoreCase = false, trim = false } = options;\n\n const normalizedExpected = normalizeText(expected, { ignoreCase, trim });\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.read();\n\n normalizedActual = actual;\n normalizedActual = normalizeText(normalizedActual, { ignoreCase, trim });\n errorReason = null;\n\n return normalizedActual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n actual = undefined;\n normalizedActual = undefined;\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n\n if (expected instanceof RegExp) {\n await expectation.toMatch(normalizedExpected as RegExp);\n } else {\n await expectation.toEqual(normalizedExpected);\n }\n\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matcherUtils.ts';\nimport type { TimeoutMatcherOptions } from './types.ts';\n\n/**\n * Asserts that the clipboard content contains the expected JSON value.\n *\n * @this ExpectMatcherState\n * @param clipboard the clipboard utility instance\n * @param expected The expected JSON value\n * @param options matcher options.\n * @returns A Promise that resolves to a MatcherReturnType object.\n */\nexport async function toMatchJSONContent(\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n expected: unknown,\n options: TimeoutMatcherOptions = {},\n) {\n const name = 'toMatchJSONContent';\n let pass: boolean;\n let actual: unknown;\n let errorReason: Error | null = null;\n\n const { timeout = 10_000 } = options;\n\n const poll = expect.poll(\n async () => {\n try {\n actual = await clipboard.readJSON();\n errorReason = null;\n\n return actual;\n } catch (error) {\n errorReason = error instanceof Error ? error : new Error(String(error));\n\n try {\n actual = await clipboard.read();\n } catch {\n actual = undefined;\n }\n\n throw errorReason;\n }\n },\n { timeout },\n );\n\n try {\n const expectation = this.isNot ? poll.not : poll;\n await expectation.toMatchObject(expected as Record<string, unknown>);\n pass = true;\n } catch {\n pass = false;\n }\n\n if (this.isNot) pass = !pass;\n\n const matcherReturn: MatcherReturnType = {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n\n return matcherReturn;\n}\n","import { toBeBlank } from './toBeBlank';\nimport { toHaveContentLength } from './toHaveContentLength.ts';\nimport { toHaveJSONContent } from './toHaveJSONContent';\nimport { toHaveTextContent } from './toHaveTextContent';\nimport { toMatchJSONContent } from './toMatchJSONContent.ts';\n\n/**\n * Export an object containing all the custom clipboard matchers for Playwright.\n */\nexport const clipboardMatchers = {\n toBeBlank,\n toHaveContentLength,\n toHaveJSONContent,\n toHaveTextContent,\n toMatchJSONContent,\n};\n"],"mappings":";AAAA,SAAkC,cAAsC;;;ACajE,SAAS,gBAEd,MACA,UACA,QACA,OACA,cACc;AACd,QAAM,UAAU,GAAG,KAAK,MAAM,YAAY,MAAM,QAAW,QAAW,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC;AAAA;AAAA;AAE5F,MAAI,OAAO;AACT,WAAO,MAAM,GAAG,OAAO;AAAA,EAAkC,MAAM,OAAO;AAAA,EACxE;AAEA,MAAI,cAAc;AAChB,WAAO,MAAM,GAAG,OAAO,GAAG,YAAY;AAAA,EACxC;AAEA,SAAO,MACL,UACA,aAAa,KAAK,QAAQ,SAAS,EAAE,GAAG,KAAK,MAAM,cAAc,QAAQ,CAAC;AAAA,YAC7D,KAAK,MAAM,cAAc,MAAM,CAAC;AACjD;AAEO,SAAS,cACd,MACA,UAAoD,CAAC,GAClD;AACH,QAAM,EAAE,YAAY,KAAK,IAAI;AAE7B,MAAI,OAAO,SAAS,UAAU;AAC5B,QAAI,SAAiB;AAErB,QAAI,KAAM,UAAS,OAAO,KAAK;AAE/B,QAAI,WAAY,UAAS,OAAO,YAAY;AAE5C,WAAO;AAAA,EACT;AAEA,MAAI,gBAAgB,QAAQ;AAC1B,UAAM,QAAQ,KAAK,MAAM,QAAQ,SAAS,EAAE;AAC5C,UAAM,aAAa,cAAc,CAAC,MAAM,SAAS,GAAG,IAAI,GAAG,KAAK,MAAM;AAEtE,WAAO,IAAI,OAAO,KAAK,QAAQ,UAAU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