playwright-clipboard-testing 0.6.0 → 0.8.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.
Files changed (68) hide show
  1. package/dist/baseFixtures.d.ts +8 -0
  2. package/dist/baseFixtures.d.ts.map +1 -0
  3. package/dist/constants/constants.d.ts +8 -0
  4. package/dist/constants/constants.d.ts.map +1 -0
  5. package/dist/constants/index.cjs.map +1 -1
  6. package/dist/constants/index.d.cts +4 -51
  7. package/dist/constants/index.d.ts +4 -51
  8. package/dist/constants/index.d.ts.map +1 -0
  9. package/dist/constants/patterns.d.ts +42 -0
  10. package/dist/constants/patterns.d.ts.map +1 -0
  11. package/dist/fixtures/clipboardFixture.d.ts +12 -0
  12. package/dist/fixtures/clipboardFixture.d.ts.map +1 -0
  13. package/dist/fixtures/contextFixture.d.ts +10 -0
  14. package/dist/fixtures/contextFixture.d.ts.map +1 -0
  15. package/dist/fixtures/index.cjs +46 -13
  16. package/dist/fixtures/index.cjs.map +1 -1
  17. package/dist/fixtures/index.d.cts +12 -33
  18. package/dist/fixtures/index.d.ts +12 -33
  19. package/dist/fixtures/index.d.ts.map +1 -0
  20. package/dist/fixtures/index.js +46 -13
  21. package/dist/fixtures/index.js.map +1 -1
  22. package/dist/fixtures/types.d.ts +2 -0
  23. package/dist/fixtures/types.d.ts.map +1 -0
  24. package/dist/index.cjs +68 -38
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +2 -17
  27. package/dist/index.d.ts +2 -17
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +56 -26
  30. package/dist/index.js.map +1 -1
  31. package/dist/matchers/clipboardMatchers.d.ts +12 -0
  32. package/dist/matchers/clipboardMatchers.d.ts.map +1 -0
  33. package/dist/matchers/index.cjs +20 -13
  34. package/dist/matchers/index.cjs.map +1 -1
  35. package/dist/matchers/index.d.cts +8 -15
  36. package/dist/matchers/index.d.ts +8 -15
  37. package/dist/matchers/index.d.ts.map +1 -0
  38. package/dist/matchers/index.js +14 -12
  39. package/dist/matchers/index.js.map +1 -1
  40. package/dist/matchers/toBeBlank.d.ts +13 -0
  41. package/dist/matchers/toBeBlank.d.ts.map +1 -0
  42. package/dist/matchers/toHaveContentLength.d.ts +14 -0
  43. package/dist/matchers/toHaveContentLength.d.ts.map +1 -0
  44. package/dist/matchers/toHaveJSONContent.d.ts +14 -0
  45. package/dist/matchers/toHaveJSONContent.d.ts.map +1 -0
  46. package/dist/matchers/toHaveTextContent.d.ts +14 -0
  47. package/dist/matchers/toHaveTextContent.d.ts.map +1 -0
  48. package/dist/matchers/toMatchJSONContent.d.ts +14 -0
  49. package/dist/matchers/toMatchJSONContent.d.ts.map +1 -0
  50. package/dist/{toBeBlank-wAm_5G4T.d.ts → matchers/types.d.ts} +4 -62
  51. package/dist/matchers/types.d.ts.map +1 -0
  52. package/dist/{clipboardHandler-CFIUvkc0.d.cts → utils/clipboard/clipboardHandler.d.ts} +5 -6
  53. package/dist/utils/clipboard/clipboardHandler.d.ts.map +1 -0
  54. package/dist/utils/clipboard/runInStep.d.ts +2 -0
  55. package/dist/utils/clipboard/runInStep.d.ts.map +1 -0
  56. package/dist/utils/index.d.ts +3 -0
  57. package/dist/utils/index.d.ts.map +1 -0
  58. package/dist/utils/matchers/getErrorMessage.d.ts +14 -0
  59. package/dist/utils/matchers/getErrorMessage.d.ts.map +1 -0
  60. package/dist/utils/matchers/normalizeText.d.ts +11 -0
  61. package/dist/utils/matchers/normalizeText.d.ts.map +1 -0
  62. package/dist/utils/tests/createFakeClipboard.d.ts +6 -0
  63. package/dist/utils/tests/createFakeClipboard.d.ts.map +1 -0
  64. package/dist/utils/tests/createMatcherState.d.ts +3 -0
  65. package/dist/utils/tests/createMatcherState.d.ts.map +1 -0
  66. package/package.json +17 -2
  67. package/dist/clipboardHandler-CFIUvkc0.d.ts +0 -51
  68. package/dist/toBeBlank-uFClUdzK.d.cts +0 -133
@@ -1,7 +1,7 @@
1
1
  // src/matchers/toBeBlank.ts
2
2
  import { expect } from "@playwright/test";
3
3
 
4
- // src/utils/matcherUtils.ts
4
+ // src/utils/matchers/getErrorMessage.ts
5
5
  function getErrorMessage(name, expected, actual, error, errorMessage) {
6
6
  const message = `${this.utils.matcherHint(name, void 0, void 0, { isNot: this.isNot })}
7
7
 
@@ -16,6 +16,8 @@ ${error.message}`;
16
16
  return () => message + `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}
17
17
  Received: ${this.utils.printReceived(actual)}`;
18
18
  }
19
+
20
+ // src/utils/matchers/normalizeText.ts
19
21
  function normalizeText(data, options = {}) {
20
22
  const { ignoreCase, trim } = options;
21
23
  if (typeof data === "string") {
@@ -66,14 +68,13 @@ async function toBeBlank(clipboard, options = {}) {
66
68
  pass = false;
67
69
  }
68
70
  if (this.isNot) pass = !pass;
69
- const matcherReturn = {
71
+ return {
70
72
  message: getErrorMessage.call(this, name, expected, actual, errorReason),
71
73
  pass,
72
74
  name,
73
75
  expected,
74
76
  actual
75
77
  };
76
- return matcherReturn;
77
78
  }
78
79
 
79
80
  // src/matchers/toHaveContentLength.ts
@@ -107,14 +108,13 @@ async function toHaveContentLength(clipboard, expected, options = {}) {
107
108
  pass = false;
108
109
  }
109
110
  if (this.isNot) pass = !pass;
110
- const matcherReturn = {
111
+ return {
111
112
  message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),
112
113
  pass,
113
114
  name,
114
115
  expected,
115
116
  actual: actual?.length
116
117
  };
117
- return matcherReturn;
118
118
  }
119
119
 
120
120
  // src/matchers/toHaveJSONContent.ts
@@ -151,14 +151,13 @@ async function toHaveJSONContent(clipboard, expected, options = {}) {
151
151
  pass = false;
152
152
  }
153
153
  if (this.isNot) pass = !pass;
154
- const matcherReturn = {
154
+ return {
155
155
  message: getErrorMessage.call(this, name, expected, actual, errorReason),
156
156
  pass,
157
157
  name,
158
158
  expected,
159
159
  actual
160
160
  };
161
- return matcherReturn;
162
161
  }
163
162
 
164
163
  // src/matchers/toHaveTextContent.ts
@@ -200,14 +199,13 @@ async function toHaveTextContent(clipboard, expected, options = {}) {
200
199
  pass = false;
201
200
  }
202
201
  if (this.isNot) pass = !pass;
203
- const matcherReturn = {
202
+ return {
204
203
  message: getErrorMessage.call(this, name, expected, actual, errorReason),
205
204
  pass,
206
205
  name,
207
206
  expected,
208
207
  actual
209
208
  };
210
- return matcherReturn;
211
209
  }
212
210
 
213
211
  // src/matchers/toMatchJSONContent.ts
@@ -244,14 +242,13 @@ async function toMatchJSONContent(clipboard, expected, options = {}) {
244
242
  pass = false;
245
243
  }
246
244
  if (this.isNot) pass = !pass;
247
- const matcherReturn = {
245
+ return {
248
246
  message: getErrorMessage.call(this, name, expected, actual, errorReason),
249
247
  pass,
250
248
  name,
251
249
  expected,
252
250
  actual
253
251
  };
254
- return matcherReturn;
255
252
  }
256
253
 
257
254
  // src/matchers/clipboardMatchers.ts
@@ -263,6 +260,11 @@ var clipboardMatchers = {
263
260
  toMatchJSONContent
264
261
  };
265
262
  export {
266
- clipboardMatchers
263
+ clipboardMatchers,
264
+ toBeBlank,
265
+ toHaveContentLength,
266
+ toHaveJSONContent,
267
+ toHaveTextContent,
268
+ toMatchJSONContent
267
269
  };
268
270
  //# sourceMappingURL=index.js.map
@@ -1 +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,K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;;AC5DO,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["expect","expect","expect","expect","expect","expect","expect","expect"]}
1
+ {"version":3,"sources":["../../src/matchers/toBeBlank.ts","../../src/utils/matchers/getErrorMessage.ts","../../src/utils/matchers/normalizeText.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 } from '../utils/matchers/getErrorMessage';\nimport { normalizeText } from '../utils/matchers/normalizeText';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types';\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): Promise<MatcherReturnType> {\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 return {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\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","/**\n * Normalizes a string or RegExp by applying the specified options.\n *\n * @param data The string or RegExp to normalize.\n * @param options The options to apply during normalization.\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 } from '../utils/matchers/getErrorMessage';\nimport { normalizeText } from '../utils/matchers/normalizeText';\nimport type { TimeoutMatcherOptions, TrimMatcherOptions } from './types';\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): Promise<MatcherReturnType> {\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 return {\n message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),\n pass,\n name,\n expected,\n actual: actual?.length,\n };\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matchers/getErrorMessage';\nimport type { TimeoutMatcherOptions } from './types';\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): Promise<MatcherReturnType> {\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 return {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n}\n","import { type ExpectMatcherState, expect, type MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matchers/getErrorMessage';\nimport { normalizeText } from '../utils/matchers/normalizeText';\nimport type { IgnoreCaseMatcherOptions, TimeoutMatcherOptions, TrimMatcherOptions } from './types';\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): Promise<MatcherReturnType> {\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 return {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n}\n","import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';\nimport { expect } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { getErrorMessage } from '../utils/matchers/getErrorMessage';\nimport type { TimeoutMatcherOptions } from './types';\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): Promise<MatcherReturnType> {\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 return {\n message: getErrorMessage.call(this, name, expected, actual, errorReason),\n pass,\n name,\n expected,\n actual,\n };\n}\n","import type { ExpectMatcherState } from '@playwright/test';\nimport { toBeBlank } from './toBeBlank';\nimport { toHaveContentLength } from './toHaveContentLength';\nimport { toHaveJSONContent } from './toHaveJSONContent';\nimport { toHaveTextContent } from './toHaveTextContent';\nimport { toMatchJSONContent } from './toMatchJSONContent';\n\ntype PlaywrightMatcher = (this: ExpectMatcherState, receiver: any, ...args: any[]) => any;\n\n/**\n * Export an object containing all the custom clipboard matchers for Playwright.\n */\nexport const clipboardMatchers: Record<string, PlaywrightMatcher> = {\n toBeBlank,\n toHaveContentLength,\n toHaveJSONContent,\n toHaveTextContent,\n toMatchJSONContent,\n};\n\n/**\n * Export the type of the clipboard matchers for TypeScript.\n */\nexport type ClipboardMatchers = typeof clipboardMatchers;\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;;;AC7BO,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;AAAA,EAC3C;AAEA,SAAO;AACT;;;AFhBA,eAAsB,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J,MAAI;AACJ,MAAI,cAA4B;AAEhC,QAAM,EAAE,UAAU,IAAO,IAAI;AAE7B,QAAM,OAAOC,QAAO;AAAA,IAClB,YAAY;AACV,UAAI;AACF,iBAAS,MAAM,UAAU,SAAS;AAClC,sBAAc;AAEd,eAAO;AAAA,MACT,SAAS,OAAO;AACd,sBAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;AAEtE,YAAI;AACF,mBAAS,MAAM,UAAU,KAAK;AAAA,QAChC,QAAQ;AACN,mBAAS;AAAA,QACX;AAEA,cAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,EAAE,QAAQ;AAAA,EACZ;AAEA,MAAI;AACF,UAAM,cAAc,KAAK,QAAQ,KAAK,MAAM;AAC5C,UAAM,YAAY,cAAc,QAAmC;AACnE,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,MAAI,KAAK,MAAO,QAAO,CAAC;AAExB,SAAO;AAAA,IACL,SAAS,gBAAgB,KAAK,MAAM,MAAM,UAAU,QAAQ,WAAW;AAAA,IACvE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACvDO,IAAM,oBAAuD;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["expect","expect","expect","expect","expect","expect","expect","expect"]}
@@ -0,0 +1,13 @@
1
+ import { type ExpectMatcherState, type MatcherReturnType } from '@playwright/test';
2
+ import type { ClipboardHandler } from '../utils';
3
+ import type { TimeoutMatcherOptions, TrimMatcherOptions } from './types';
4
+ /**
5
+ * Asserts that the clipboard content is blank (empty string).
6
+ *
7
+ * @this ExpectMatcherState
8
+ * @param clipboard The Clipboard utility instance.
9
+ * @param options Matcher options.
10
+ * @returns A Promise that resolves to a MatcherReturnType object.
11
+ */
12
+ export declare function toBeBlank(this: ExpectMatcherState, clipboard: ClipboardHandler, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
13
+ //# sourceMappingURL=toBeBlank.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toBeBlank.d.ts","sourceRoot":"","sources":["../../src/matchers/toBeBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAU,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,gBAAgB,EAC3B,OAAO,GAAE,qBAAqB,GAAG,kBAAuB,GACvD,OAAO,CAAC,iBAAiB,CAAC,CA+C5B"}
@@ -0,0 +1,14 @@
1
+ import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
+ import type { ClipboardHandler } from '../utils';
3
+ import type { TimeoutMatcherOptions, TrimMatcherOptions } from './types';
4
+ /**
5
+ * Asserts that the clipboard content has the expected length.
6
+ *
7
+ * @this ExpectMatcherState
8
+ * @param clipboard The Clipboard utility instance.
9
+ * @param expected The expected length of the clipboard content.
10
+ * @param options Matcher options.
11
+ * @returns A Promise that resolves to a MatcherReturnType object.
12
+ */
13
+ export declare function toHaveContentLength(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: number, options?: TimeoutMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
14
+ //# sourceMappingURL=toHaveContentLength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toHaveContentLength.d.ts","sourceRoot":"","sources":["../../src/matchers/toHaveContentLength.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,qBAAqB,GAAG,kBAAuB,GACvD,OAAO,CAAC,iBAAiB,CAAC,CA6C5B"}
@@ -0,0 +1,14 @@
1
+ import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
+ import type { ClipboardHandler } from '../utils';
3
+ import type { TimeoutMatcherOptions } from './types';
4
+ /**
5
+ * Asserts that the clipboard content matches the expected JSON value.
6
+ *
7
+ * @this ExpectMatcherState
8
+ * @param clipboard The Clipboard utility instance.
9
+ * @param expected The expected JSON value.
10
+ * @param options Matcher options.
11
+ * @returns A Promise that resolves to a MatcherReturnType object.
12
+ */
13
+ export declare function toHaveJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
14
+ //# sourceMappingURL=toHaveJSONContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toHaveJSONContent.d.ts","sourceRoot":"","sources":["../../src/matchers/toHaveJSONContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CA+C5B"}
@@ -0,0 +1,14 @@
1
+ import { type ExpectMatcherState, type MatcherReturnType } from '@playwright/test';
2
+ import type { ClipboardHandler } from '../utils';
3
+ import type { IgnoreCaseMatcherOptions, TimeoutMatcherOptions, TrimMatcherOptions } from './types';
4
+ /**
5
+ * Asserts that the clipboard content matches the expected text value.
6
+ *
7
+ * @this ExpectMatcherState
8
+ * @param clipboard The Clipboard utility instance.
9
+ * @param expected The expected text value.
10
+ * @param options Matcher options.
11
+ * @returns A Promise that resolves to a MatcherReturnType object.
12
+ */
13
+ export declare function toHaveTextContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: string | RegExp, options?: TimeoutMatcherOptions & IgnoreCaseMatcherOptions & TrimMatcherOptions): Promise<MatcherReturnType>;
14
+ //# sourceMappingURL=toHaveTextContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toHaveTextContent.d.ts","sourceRoot":"","sources":["../../src/matchers/toHaveTextContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAU,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,KAAK,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,OAAO,GAAE,qBAAqB,GAAG,wBAAwB,GAAG,kBAAuB,GAClF,OAAO,CAAC,iBAAiB,CAAC,CAuD5B"}
@@ -0,0 +1,14 @@
1
+ import type { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
+ import type { ClipboardHandler } from '../utils';
3
+ import type { TimeoutMatcherOptions } from './types';
4
+ /**
5
+ * Asserts that the clipboard content contains the expected JSON value.
6
+ *
7
+ * @this ExpectMatcherState
8
+ * @param clipboard the clipboard utility instance
9
+ * @param expected The expected JSON value
10
+ * @param options matcher options.
11
+ * @returns A Promise that resolves to a MatcherReturnType object.
12
+ */
13
+ export declare function toMatchJSONContent(this: ExpectMatcherState, clipboard: ClipboardHandler, expected: unknown, options?: TimeoutMatcherOptions): Promise<MatcherReturnType>;
14
+ //# sourceMappingURL=toMatchJSONContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toMatchJSONContent.d.ts","sourceRoot":"","sources":["../../src/matchers/toMatchJSONContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,OAAO,EACjB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CA+C5B"}
@@ -1,13 +1,10 @@
1
- import { ExpectMatcherState, MatcherReturnType } from '@playwright/test';
2
- import { C as ClipboardHandler } from './clipboardHandler-CFIUvkc0.js';
3
-
4
- type TimeoutMatcherOptions = {
1
+ export type TimeoutMatcherOptions = {
5
2
  timeout?: number;
6
3
  };
7
- type IgnoreCaseMatcherOptions = {
4
+ export type IgnoreCaseMatcherOptions = {
8
5
  ignoreCase?: boolean;
9
6
  };
10
- type TrimMatcherOptions = {
7
+ export type TrimMatcherOptions = {
11
8
  trim?: boolean;
12
9
  };
13
10
  declare global {
@@ -75,59 +72,4 @@ declare global {
75
72
  }
76
73
  }
77
74
  }
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 };
75
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/matchers/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,cAAc,CAAC;QACvB,UAAU,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO;YAC/B;;;;;;;;;eASG;YACH,SAAS,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAE5E;;;;;;;;;;eAUG;YACH,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAAG,kBAAkB,GACnD,OAAO,CAAC,CAAC,CAAC,CAAC;YAEd;;;;;;;;;;eAUG;YACH,iBAAiB,CACf,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,OAAO,CAAC,EAAE,qBAAqB,GAAG,wBAAwB,GAAG,kBAAkB,GAC9E,OAAO,CAAC,CAAC,CAAC,CAAC;YAEd;;;;;;;;;;eAUG;YACH,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAElF;;;;;;;;;;eAUG;YACH,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SACpF;KACF;CACF"}
@@ -1,5 +1,3 @@
1
- import { Page } from '@playwright/test';
2
-
3
1
  /**
4
2
  * Playwright-compatible Clipboard utilities.
5
3
  *
@@ -10,10 +8,12 @@ import { Page } from '@playwright/test';
10
8
  * These utilities require 'clipboard-read' and 'clipboard-write' permissions
11
9
  * to be granted in the browser context.
12
10
  */
13
-
14
- declare class ClipboardHandler {
11
+ import type { Page } from '@playwright/test';
12
+ export declare class ClipboardHandler {
15
13
  private readonly page;
16
14
  constructor(page: Page);
15
+ private _write;
16
+ private _read;
17
17
  /**
18
18
  * Reads the current text content from the browser clipboard.
19
19
  * If the content is a JSON-encoded string (e.g., has extra quotes),
@@ -47,5 +47,4 @@ declare class ClipboardHandler {
47
47
  */
48
48
  clear(): Promise<void>;
49
49
  }
50
-
51
- export { ClipboardHandler as C };
50
+ //# sourceMappingURL=clipboardHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clipboardHandler.d.ts","sourceRoot":"","sources":["../../../src/utils/clipboard/clipboardHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;YAEzB,MAAM;YAIN,KAAK;IAInB;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAM7B;;;;;;;OAOG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;IAazC;;;OAGG;IACG,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC;;;OAGG;IACG,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBpD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B"}
@@ -0,0 +1,2 @@
1
+ export declare const runInStep: <T>(stepName: string, fn: () => Promise<T>) => Promise<T>;
2
+ //# sourceMappingURL=runInStep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runInStep.d.ts","sourceRoot":"","sources":["../../../src/utils/clipboard/runInStep.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,UAAU,MAAM,EAAE,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,eAMxE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { ClipboardHandler } from './clipboard/clipboardHandler';
2
+ export { ClipboardHandler };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ExpectMatcherState } from '@playwright/test';
2
+ /**
3
+ * Generates an error message for a custom matcher.
4
+ *
5
+ * @this ExpectMatcherState
6
+ * @param name The name of the matcher.
7
+ * @param expected The expected value.
8
+ * @param actual The actual value.
9
+ * @param error An optional error object.
10
+ * @param errorMessage An optional error message string.
11
+ * @returns A function that returns the error message string.
12
+ */
13
+ export declare function getErrorMessage(this: ExpectMatcherState, name: string, expected: unknown, actual: unknown, error?: Error | null, errorMessage?: string | undefined | null): () => string;
14
+ //# sourceMappingURL=getErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/utils/matchers/getErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,kBAAkB,EACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,OAAO,EACf,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,EACpB,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GACvC,MAAM,MAAM,CAed"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Normalizes a string or RegExp by applying the specified options.
3
+ *
4
+ * @param data The string or RegExp to normalize.
5
+ * @param options The options to apply during normalization.
6
+ */
7
+ export declare function normalizeText<T extends string | RegExp>(data: T, options?: {
8
+ ignoreCase?: boolean;
9
+ trim?: boolean;
10
+ }): T;
11
+ //# sourceMappingURL=normalizeText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeText.d.ts","sourceRoot":"","sources":["../../../src/utils/matchers/normalizeText.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EACrD,IAAI,EAAE,CAAC,EACP,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GACrD,CAAC,CAqBH"}
@@ -0,0 +1,6 @@
1
+ import type { ClipboardHandler } from '../index';
2
+ export declare const createFakeClipboard: (overrides?: {
3
+ read?: string;
4
+ readJSON?: unknown;
5
+ }) => ClipboardHandler;
6
+ //# sourceMappingURL=createFakeClipboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createFakeClipboard.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/createFakeClipboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,eAAO,MAAM,mBAAmB,GAC9B,YAAW;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KACpD,gBAmBF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ExpectMatcherState } from '@playwright/test';
2
+ export declare const createMatcherState: (isNot?: boolean) => ExpectMatcherState;
3
+ //# sourceMappingURL=createMatcherState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMatcherState.d.ts","sourceRoot":"","sources":["../../../src/utils/tests/createMatcherState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,GAAI,eAAa,KAAG,kBASlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-clipboard-testing",
3
- "version": "0.6.0",
3
+ "version": "0.8.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",
@@ -26,6 +26,19 @@
26
26
  "main": "./dist/index.cjs",
27
27
  "module": "./dist/index.js",
28
28
  "types": "./dist/index.d.ts",
29
+ "typesVersions": {
30
+ "*": {
31
+ "constants": [
32
+ "./dist/constants/index.d.ts"
33
+ ],
34
+ "fixtures": [
35
+ "./dist/fixtures/index.d.ts"
36
+ ],
37
+ "matchers": [
38
+ "./dist/matchers/index.d.ts"
39
+ ]
40
+ }
41
+ },
29
42
  "exports": {
30
43
  ".": {
31
44
  "types": {
@@ -68,7 +81,8 @@
68
81
  },
69
82
  "sideEffects": false,
70
83
  "scripts": {
71
- "build": "tsup",
84
+ "prepack": "npm run build",
85
+ "build": "tsup && tsc -p tsconfig.build.json && node -e \"fs.cpSync('dist/index.d.ts', 'dist/index.d.cts'); fs.cpSync('dist/constants/index.d.ts', 'dist/constants/index.d.cts'); fs.cpSync('dist/fixtures/index.d.ts', 'dist/fixtures/index.d.cts'); fs.cpSync('dist/matchers/index.d.ts', 'dist/matchers/index.d.cts');\"",
72
86
  "dev": "tsup --watch",
73
87
  "lint": "biome check .",
74
88
  "lint:fix": "biome check --write .",
@@ -84,6 +98,7 @@
84
98
  },
85
99
  "devDependencies": {
86
100
  "@biomejs/biome": "2.5.10",
101
+ "@microsoft/api-extractor": "^7.59.2",
87
102
  "@playwright/test": "^1.63.0",
88
103
  "@types/node": "^26.4.1",
89
104
  "serve": "^14.2.6",
@@ -1,51 +0,0 @@
1
- import { Page } from '@playwright/test';
2
-
3
- /**
4
- * Playwright-compatible Clipboard utilities.
5
- *
6
- * Core functions for interacting with the browser clipboard within Playwright tests.
7
- * Provides wrappers for reading plain text and JSON.
8
- *
9
- * @remarks
10
- * These utilities require 'clipboard-read' and 'clipboard-write' permissions
11
- * to be granted in the browser context.
12
- */
13
-
14
- declare class ClipboardHandler {
15
- private readonly page;
16
- constructor(page: Page);
17
- /**
18
- * Reads the current text content from the browser clipboard.
19
- * If the content is a JSON-encoded string (e.g., has extra quotes),
20
- * it will be returned as is. Use readJSON for automatic parsing.
21
- *
22
- * @returns A promise that resolves to the clipboard string content.
23
- */
24
- read(): Promise<string>;
25
- /**
26
- * Reads the clipboard content and parses it as JSON.
27
- * If the content is a string literal (e.g., '"value"'), it returns the unwrapped string ('value').
28
- *
29
- * @template T - The expected type of the parsed JSON object.
30
- * @returns A promise that resolves to the parsed JSON object of type T.
31
- * @throws {Error} If the clipboard content is not a valid JSON string.
32
- */
33
- readJSON<T = unknown>(): Promise<T>;
34
- /**
35
- * Writes the provided string data to the browser clipboard.
36
- * @param data The data to write to the clipboard.
37
- */
38
- write(data: string): Promise<void>;
39
- /**
40
- * Writes the provided data to the browser clipboard as a JSON string.
41
- * @param data The data to write to the clipboard. It will be stringified as JSON.
42
- */
43
- writeJSON<T = unknown>(data: T): Promise<void>;
44
- /**
45
- * Clears the browser clipboard by writing an empty string to it.
46
- * This effectively removes any existing content from the clipboard.
47
- */
48
- clear(): Promise<void>;
49
- }
50
-
51
- export { ClipboardHandler as C };