playwright-clipboard-testing 0.7.0 → 0.9.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 +9 -9
- package/dist/baseFixtures.d.ts +8 -0
- package/dist/baseFixtures.d.ts.map +1 -0
- package/dist/constants/constants.d.ts +8 -0
- package/dist/constants/constants.d.ts.map +1 -0
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +4 -51
- package/dist/constants/index.d.ts +4 -51
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/patterns.d.ts +42 -0
- package/dist/constants/patterns.d.ts.map +1 -0
- package/dist/fixtures/clipboardFixture.d.ts +12 -0
- package/dist/fixtures/clipboardFixture.d.ts.map +1 -0
- package/dist/fixtures/contextFixture.d.ts +10 -0
- package/dist/fixtures/contextFixture.d.ts.map +1 -0
- package/dist/fixtures/index.cjs +46 -13
- package/dist/fixtures/index.cjs.map +1 -1
- package/dist/fixtures/index.d.cts +13 -33
- package/dist/fixtures/index.d.ts +13 -33
- package/dist/fixtures/index.d.ts.map +1 -0
- package/dist/fixtures/index.js +46 -13
- package/dist/fixtures/index.js.map +1 -1
- package/dist/fixtures/types.d.ts +2 -0
- package/dist/fixtures/types.d.ts.map +1 -0
- package/dist/index.cjs +68 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -17
- package/dist/index.d.ts +2 -17
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +56 -26
- package/dist/index.js.map +1 -1
- package/dist/matchers/clipboardMatchers.d.ts +13 -0
- package/dist/matchers/clipboardMatchers.d.ts.map +1 -0
- package/dist/matchers/index.cjs +8 -11
- package/dist/matchers/index.cjs.map +1 -1
- package/dist/matchers/index.d.cts +3 -15
- package/dist/matchers/index.d.ts +3 -15
- package/dist/matchers/index.d.ts.map +1 -0
- package/dist/matchers/index.js +8 -11
- package/dist/matchers/index.js.map +1 -1
- package/dist/matchers/toBeBlank.d.ts +13 -0
- package/dist/matchers/toBeBlank.d.ts.map +1 -0
- package/dist/matchers/toHaveContentLength.d.ts +14 -0
- package/dist/matchers/toHaveContentLength.d.ts.map +1 -0
- package/dist/matchers/toHaveJSONContent.d.ts +14 -0
- package/dist/matchers/toHaveJSONContent.d.ts.map +1 -0
- package/dist/matchers/toHaveTextContent.d.ts +14 -0
- package/dist/matchers/toHaveTextContent.d.ts.map +1 -0
- package/dist/matchers/toMatchJSONContent.d.ts +14 -0
- package/dist/matchers/toMatchJSONContent.d.ts.map +1 -0
- package/dist/{toBeBlank-wAm_5G4T.d.ts → matchers/types.d.ts} +4 -62
- package/dist/matchers/types.d.ts.map +1 -0
- package/dist/{clipboardHandler-CFIUvkc0.d.cts → utils/clipboard/clipboardHandler.d.ts} +5 -6
- package/dist/utils/clipboard/clipboardHandler.d.ts.map +1 -0
- package/dist/utils/clipboard/runInStep.d.ts +2 -0
- package/dist/utils/clipboard/runInStep.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/matchers/getErrorMessage.d.ts +14 -0
- package/dist/utils/matchers/getErrorMessage.d.ts.map +1 -0
- package/dist/utils/matchers/normalizeText.d.ts +11 -0
- package/dist/utils/matchers/normalizeText.d.ts.map +1 -0
- package/dist/utils/tests/createFakeClipboard.d.ts +6 -0
- package/dist/utils/tests/createFakeClipboard.d.ts.map +1 -0
- package/dist/utils/tests/createMatcherState.d.ts +3 -0
- package/dist/utils/tests/createMatcherState.d.ts.map +1 -0
- package/package.json +16 -2
- package/dist/clipboardHandler-CFIUvkc0.d.ts +0 -51
- package/dist/toBeBlank-uFClUdzK.d.cts +0 -133
package/dist/fixtures/index.js
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
// src/utils/
|
|
1
|
+
// src/utils/clipboard/runInStep.ts
|
|
2
|
+
import { test } from "@playwright/test";
|
|
3
|
+
var isTestRunning = () => {
|
|
4
|
+
try {
|
|
5
|
+
return !!test.info();
|
|
6
|
+
} catch {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var runInStep = async (stepName, fn) => {
|
|
11
|
+
if (isTestRunning()) {
|
|
12
|
+
return await test.step(stepName, fn, { box: true });
|
|
13
|
+
} else {
|
|
14
|
+
return await fn();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// src/utils/clipboard/clipboardHandler.ts
|
|
2
19
|
var ClipboardHandler = class {
|
|
3
20
|
constructor(page) {
|
|
4
21
|
this.page = page;
|
|
5
22
|
}
|
|
6
23
|
page;
|
|
24
|
+
async _write(data) {
|
|
25
|
+
await this.page.evaluate((value) => navigator.clipboard.writeText(value), data);
|
|
26
|
+
}
|
|
27
|
+
async _read() {
|
|
28
|
+
return await this.page.evaluate(() => navigator.clipboard.readText());
|
|
29
|
+
}
|
|
7
30
|
/**
|
|
8
31
|
* Reads the current text content from the browser clipboard.
|
|
9
32
|
* If the content is a JSON-encoded string (e.g., has extra quotes),
|
|
@@ -12,7 +35,9 @@ var ClipboardHandler = class {
|
|
|
12
35
|
* @returns A promise that resolves to the clipboard string content.
|
|
13
36
|
*/
|
|
14
37
|
async read() {
|
|
15
|
-
return await
|
|
38
|
+
return await runInStep('Clipboard "read"', async () => {
|
|
39
|
+
return await this._read();
|
|
40
|
+
});
|
|
16
41
|
}
|
|
17
42
|
/**
|
|
18
43
|
* Reads the clipboard content and parses it as JSON.
|
|
@@ -23,21 +48,25 @@ var ClipboardHandler = class {
|
|
|
23
48
|
* @throws {Error} If the clipboard content is not a valid JSON string.
|
|
24
49
|
*/
|
|
25
50
|
async readJSON() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
return await runInStep('Clipboard "readJSON"', async () => {
|
|
52
|
+
const text = await this._read();
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(text);
|
|
55
|
+
} catch {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`[playwright-clipboard] Clipboard content is not a valid JSON: ${JSON.stringify(text)}`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
34
61
|
}
|
|
35
62
|
/**
|
|
36
63
|
* Writes the provided string data to the browser clipboard.
|
|
37
64
|
* @param data The data to write to the clipboard.
|
|
38
65
|
*/
|
|
39
66
|
async write(data) {
|
|
40
|
-
await
|
|
67
|
+
await runInStep('Clipboard "write"', async () => {
|
|
68
|
+
await this._write(data);
|
|
69
|
+
});
|
|
41
70
|
}
|
|
42
71
|
/**
|
|
43
72
|
* Writes the provided data to the browser clipboard as a JSON string.
|
|
@@ -55,14 +84,18 @@ var ClipboardHandler = class {
|
|
|
55
84
|
if (jsonString === void 0) {
|
|
56
85
|
throw new Error(`${errorMessage} (received undefined).`);
|
|
57
86
|
}
|
|
58
|
-
await
|
|
87
|
+
await runInStep('Clipboard "writeJSON"', async () => {
|
|
88
|
+
await this._write(jsonString);
|
|
89
|
+
});
|
|
59
90
|
}
|
|
60
91
|
/**
|
|
61
92
|
* Clears the browser clipboard by writing an empty string to it.
|
|
62
93
|
* This effectively removes any existing content from the clipboard.
|
|
63
94
|
*/
|
|
64
95
|
async clear() {
|
|
65
|
-
await
|
|
96
|
+
await runInStep('Clipboard "clear"', async () => {
|
|
97
|
+
await this._write("");
|
|
98
|
+
});
|
|
66
99
|
}
|
|
67
100
|
};
|
|
68
101
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/clipboardHandler.ts","../../src/fixtures/clipboardFixture.ts","../../src/fixtures/contextFixture.ts","../../src/fixtures/index.ts"],"sourcesContent":["/**\n * Playwright-compatible Clipboard utilities.\n *\n * Core functions for interacting with the browser clipboard within Playwright tests.\n * Provides wrappers for reading plain text and JSON.\n *\n * @remarks\n * These utilities require 'clipboard-read' and 'clipboard-write' permissions\n * to be granted in the browser context.\n */\n\nimport type { Page } from '@playwright/test';\n\nexport class ClipboardHandler {\n constructor(private readonly page: Page) {}\n\n /**\n * Reads the current text content from the browser clipboard.\n * If the content is a JSON-encoded string (e.g., has extra quotes),\n * it will be returned as is. Use readJSON for automatic parsing.\n *\n * @returns A promise that resolves to the clipboard string content.\n */\n async read(): Promise<string> {\n return await
|
|
1
|
+
{"version":3,"sources":["../../src/utils/clipboard/runInStep.ts","../../src/utils/clipboard/clipboardHandler.ts","../../src/fixtures/clipboardFixture.ts","../../src/fixtures/contextFixture.ts","../../src/fixtures/index.ts"],"sourcesContent":["import { test } from '@playwright/test';\n\nconst isTestRunning = () => {\n try {\n return !!test.info();\n } catch {\n return false;\n }\n};\n\nexport const runInStep = async <T>(stepName: string, fn: () => Promise<T>) => {\n if (isTestRunning()) {\n return await test.step(stepName, fn, { box: true });\n } else {\n return await fn();\n }\n};\n","/**\n * Playwright-compatible Clipboard utilities.\n *\n * Core functions for interacting with the browser clipboard within Playwright tests.\n * Provides wrappers for reading plain text and JSON.\n *\n * @remarks\n * These utilities require 'clipboard-read' and 'clipboard-write' permissions\n * to be granted in the browser context.\n */\n\nimport type { Page } from '@playwright/test';\nimport { runInStep } from './runInStep';\n\nexport class ClipboardHandler {\n constructor(private readonly page: Page) {}\n\n private async _write(data: string): Promise<void> {\n await this.page.evaluate((value) => navigator.clipboard.writeText(value), data);\n }\n\n private async _read(): Promise<string> {\n return await this.page.evaluate(() => navigator.clipboard.readText());\n }\n\n /**\n * Reads the current text content from the browser clipboard.\n * If the content is a JSON-encoded string (e.g., has extra quotes),\n * it will be returned as is. Use readJSON for automatic parsing.\n *\n * @returns A promise that resolves to the clipboard string content.\n */\n async read(): Promise<string> {\n return await runInStep('Clipboard \"read\"', async () => {\n return await this._read();\n });\n }\n\n /**\n * Reads the clipboard content and parses it as JSON.\n * If the content is a string literal (e.g., '\"value\"'), it returns the unwrapped string ('value').\n *\n * @template T - The expected type of the parsed JSON object.\n * @returns A promise that resolves to the parsed JSON object of type T.\n * @throws {Error} If the clipboard content is not a valid JSON string.\n */\n async readJSON<T = unknown>(): Promise<T> {\n return await runInStep('Clipboard \"readJSON\"', async () => {\n const text = await this._read();\n try {\n return JSON.parse(text);\n } catch {\n throw new Error(\n `[playwright-clipboard] Clipboard content is not a valid JSON: ${JSON.stringify(text)}`,\n );\n }\n });\n }\n\n /**\n * Writes the provided string data to the browser clipboard.\n * @param data The data to write to the clipboard.\n */\n async write(data: string): Promise<void> {\n await runInStep('Clipboard \"write\"', async () => {\n await this._write(data);\n });\n }\n\n /**\n * Writes the provided data to the browser clipboard as a JSON string.\n * @param data The data to write to the clipboard. It will be stringified as JSON.\n */\n async writeJSON<T = unknown>(data: T): Promise<void> {\n const errorMessage = '[playwright-clipboard] Provided data cannot be stringified to valid JSON';\n let jsonString: string | undefined;\n\n try {\n jsonString = JSON.stringify(data);\n } catch (error) {\n const message = error instanceof Error ? error : String(error);\n throw new Error(`${errorMessage}: ${message}`);\n }\n\n if (jsonString === undefined) {\n throw new Error(`${errorMessage} (received undefined).`);\n }\n\n await runInStep('Clipboard \"writeJSON\"', async () => {\n await this._write(jsonString);\n });\n }\n\n /**\n * Clears the browser clipboard by writing an empty string to it.\n * This effectively removes any existing content from the clipboard.\n */\n async clear(): Promise<void> {\n await runInStep('Clipboard \"clear\"', async () => {\n await this._write('');\n });\n }\n}\n","import type { Page, TestFixture } from '@playwright/test';\nimport { ClipboardHandler } from '../utils';\nimport type { BrowserName } from './types';\n\n/**\n * A fixture that provides an instance of the Clipboard utility for interacting with the system clipboard.\n * It allows reading from the clipboard during tests.\n */\nexport const clipboardFixture: TestFixture<\n ClipboardHandler,\n { page: Page; browserName: BrowserName }\n> = async ({ page, browserName }, use) => {\n if (browserName === 'webkit') {\n throw new Error(\n `[playwright-clipboard] Browser '${browserName}' is not supported. ` +\n 'Clipboard API testing is currently supported only in Chromium-based and Firefox browsers.\\n' +\n `Add test.skip(browserName === 'webkit', 'Clipboard API is only supported in Chromium and Firefox'); to your test body.`,\n );\n }\n\n const handler = new ClipboardHandler(page);\n await use(handler);\n};\n","import type { BrowserContext, TestFixture } from '@playwright/test';\nimport type { BrowserName } from './types';\n\n/**\n * A fixture that provides a BrowserContext with clipboard permissions granted for Chromium browsers.\n */\nexport const contextFixture: TestFixture<\n BrowserContext,\n { context: BrowserContext; browserName: BrowserName }\n> = async ({ context, browserName }, use) => {\n if (browserName === 'chromium') {\n await context.grantPermissions(['clipboard-read', 'clipboard-write']);\n }\n\n await use(context);\n};\n","import { ClipboardHandler } from '../utils';\nimport { clipboardFixture } from './clipboardFixture';\nimport { contextFixture } from './contextFixture';\n\n/**\n * A collection of fixtures related to clipboard testing, including the clipboard fixture and context fixture.\n * These fixtures can be used in Playwright tests to facilitate clipboard interactions and context management.\n */\nexport const clipboardFixtures = {\n context: contextFixture,\n clipboard: clipboardFixture,\n};\n\nexport type { BrowserName } from './types';\nexport { ClipboardHandler, clipboardFixture, contextFixture };\n"],"mappings":";AAAA,SAAS,YAAY;AAErB,IAAM,gBAAgB,MAAM;AAC1B,MAAI;AACF,WAAO,CAAC,CAAC,KAAK,KAAK;AAAA,EACrB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,IAAM,YAAY,OAAU,UAAkB,OAAyB;AAC5E,MAAI,cAAc,GAAG;AACnB,WAAO,MAAM,KAAK,KAAK,UAAU,IAAI,EAAE,KAAK,KAAK,CAAC;AAAA,EACpD,OAAO;AACL,WAAO,MAAM,GAAG;AAAA,EAClB;AACF;;;ACFO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,MAAY;AAAZ;AAAA,EAAa;AAAA,EAAb;AAAA,EAE7B,MAAc,OAAO,MAA6B;AAChD,UAAM,KAAK,KAAK,SAAS,CAAC,UAAU,UAAU,UAAU,UAAU,KAAK,GAAG,IAAI;AAAA,EAChF;AAAA,EAEA,MAAc,QAAyB;AACrC,WAAO,MAAM,KAAK,KAAK,SAAS,MAAM,UAAU,UAAU,SAAS,CAAC;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;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AE,MAAM,YAAY,GAAG,QAAQ;AACxC,MAAI,gBAAgB,UAAU;AAC5B,UAAM,IAAI;AAAA,MACR,mCAAmC,WAAW;AAAA;AAAA,IAGhD;AAAA,EACF;AAEA,QAAM,UAAU,IAAI,iBAAiB,IAAI;AACzC,QAAM,IAAI,OAAO;AACnB;;;AChBO,IAAM,iBAGT,OAAO,EAAE,SAAS,YAAY,GAAG,QAAQ;AAC3C,MAAI,gBAAgB,YAAY;AAC9B,UAAM,QAAQ,iBAAiB,CAAC,kBAAkB,iBAAiB,CAAC;AAAA,EACtE;AAEA,QAAM,IAAI,OAAO;AACnB;;;ACPO,IAAM,oBAAoB;AAAA,EAC/B,SAAS;AAAA,EACT,WAAW;AACb;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/fixtures/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -21,19 +21,42 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
expect: () => expect6,
|
|
24
|
-
test: () =>
|
|
24
|
+
test: () => test2
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
|
|
28
28
|
// src/baseFixtures.ts
|
|
29
|
-
var
|
|
29
|
+
var import_test7 = require("@playwright/test");
|
|
30
|
+
|
|
31
|
+
// src/utils/clipboard/runInStep.ts
|
|
32
|
+
var import_test = require("@playwright/test");
|
|
33
|
+
var isTestRunning = () => {
|
|
34
|
+
try {
|
|
35
|
+
return !!import_test.test.info();
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var runInStep = async (stepName, fn) => {
|
|
41
|
+
if (isTestRunning()) {
|
|
42
|
+
return await import_test.test.step(stepName, fn, { box: true });
|
|
43
|
+
} else {
|
|
44
|
+
return await fn();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
30
47
|
|
|
31
|
-
// src/utils/clipboardHandler.ts
|
|
48
|
+
// src/utils/clipboard/clipboardHandler.ts
|
|
32
49
|
var ClipboardHandler = class {
|
|
33
50
|
constructor(page) {
|
|
34
51
|
this.page = page;
|
|
35
52
|
}
|
|
36
53
|
page;
|
|
54
|
+
async _write(data) {
|
|
55
|
+
await this.page.evaluate((value) => navigator.clipboard.writeText(value), data);
|
|
56
|
+
}
|
|
57
|
+
async _read() {
|
|
58
|
+
return await this.page.evaluate(() => navigator.clipboard.readText());
|
|
59
|
+
}
|
|
37
60
|
/**
|
|
38
61
|
* Reads the current text content from the browser clipboard.
|
|
39
62
|
* If the content is a JSON-encoded string (e.g., has extra quotes),
|
|
@@ -42,7 +65,9 @@ var ClipboardHandler = class {
|
|
|
42
65
|
* @returns A promise that resolves to the clipboard string content.
|
|
43
66
|
*/
|
|
44
67
|
async read() {
|
|
45
|
-
return await
|
|
68
|
+
return await runInStep('Clipboard "read"', async () => {
|
|
69
|
+
return await this._read();
|
|
70
|
+
});
|
|
46
71
|
}
|
|
47
72
|
/**
|
|
48
73
|
* Reads the clipboard content and parses it as JSON.
|
|
@@ -53,21 +78,25 @@ var ClipboardHandler = class {
|
|
|
53
78
|
* @throws {Error} If the clipboard content is not a valid JSON string.
|
|
54
79
|
*/
|
|
55
80
|
async readJSON() {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
return await runInStep('Clipboard "readJSON"', async () => {
|
|
82
|
+
const text = await this._read();
|
|
83
|
+
try {
|
|
84
|
+
return JSON.parse(text);
|
|
85
|
+
} catch {
|
|
86
|
+
throw new Error(
|
|
87
|
+
`[playwright-clipboard] Clipboard content is not a valid JSON: ${JSON.stringify(text)}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
64
91
|
}
|
|
65
92
|
/**
|
|
66
93
|
* Writes the provided string data to the browser clipboard.
|
|
67
94
|
* @param data The data to write to the clipboard.
|
|
68
95
|
*/
|
|
69
96
|
async write(data) {
|
|
70
|
-
await
|
|
97
|
+
await runInStep('Clipboard "write"', async () => {
|
|
98
|
+
await this._write(data);
|
|
99
|
+
});
|
|
71
100
|
}
|
|
72
101
|
/**
|
|
73
102
|
* Writes the provided data to the browser clipboard as a JSON string.
|
|
@@ -85,14 +114,18 @@ var ClipboardHandler = class {
|
|
|
85
114
|
if (jsonString === void 0) {
|
|
86
115
|
throw new Error(`${errorMessage} (received undefined).`);
|
|
87
116
|
}
|
|
88
|
-
await
|
|
117
|
+
await runInStep('Clipboard "writeJSON"', async () => {
|
|
118
|
+
await this._write(jsonString);
|
|
119
|
+
});
|
|
89
120
|
}
|
|
90
121
|
/**
|
|
91
122
|
* Clears the browser clipboard by writing an empty string to it.
|
|
92
123
|
* This effectively removes any existing content from the clipboard.
|
|
93
124
|
*/
|
|
94
125
|
async clear() {
|
|
95
|
-
await
|
|
126
|
+
await runInStep('Clipboard "clear"', async () => {
|
|
127
|
+
await this._write("");
|
|
128
|
+
});
|
|
96
129
|
}
|
|
97
130
|
};
|
|
98
131
|
|
|
@@ -123,9 +156,9 @@ var clipboardFixtures = {
|
|
|
123
156
|
};
|
|
124
157
|
|
|
125
158
|
// src/matchers/toBeBlank.ts
|
|
126
|
-
var
|
|
159
|
+
var import_test2 = require("@playwright/test");
|
|
127
160
|
|
|
128
|
-
// src/utils/
|
|
161
|
+
// src/utils/matchers/getErrorMessage.ts
|
|
129
162
|
function getErrorMessage(name, expected, actual, error, errorMessage) {
|
|
130
163
|
const message = `${this.utils.matcherHint(name, void 0, void 0, { isNot: this.isNot })}
|
|
131
164
|
|
|
@@ -140,6 +173,8 @@ ${error.message}`;
|
|
|
140
173
|
return () => message + `Expected: ${this.isNot ? "not " : ""}${this.utils.printExpected(expected)}
|
|
141
174
|
Received: ${this.utils.printReceived(actual)}`;
|
|
142
175
|
}
|
|
176
|
+
|
|
177
|
+
// src/utils/matchers/normalizeText.ts
|
|
143
178
|
function normalizeText(data, options = {}) {
|
|
144
179
|
const { ignoreCase, trim } = options;
|
|
145
180
|
if (typeof data === "string") {
|
|
@@ -165,7 +200,7 @@ async function toBeBlank(clipboard, options = {}) {
|
|
|
165
200
|
const expected = "";
|
|
166
201
|
let errorReason = null;
|
|
167
202
|
const { timeout = 1e4, trim = false } = options;
|
|
168
|
-
const poll =
|
|
203
|
+
const poll = import_test2.expect.poll(
|
|
169
204
|
async () => {
|
|
170
205
|
try {
|
|
171
206
|
actual = await clipboard.read();
|
|
@@ -190,25 +225,24 @@ async function toBeBlank(clipboard, options = {}) {
|
|
|
190
225
|
pass = false;
|
|
191
226
|
}
|
|
192
227
|
if (this.isNot) pass = !pass;
|
|
193
|
-
|
|
228
|
+
return {
|
|
194
229
|
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
195
230
|
pass,
|
|
196
231
|
name,
|
|
197
232
|
expected,
|
|
198
233
|
actual
|
|
199
234
|
};
|
|
200
|
-
return matcherReturn;
|
|
201
235
|
}
|
|
202
236
|
|
|
203
237
|
// src/matchers/toHaveContentLength.ts
|
|
204
|
-
var
|
|
238
|
+
var import_test3 = require("@playwright/test");
|
|
205
239
|
async function toHaveContentLength(clipboard, expected, options = {}) {
|
|
206
240
|
const name = "toHaveContentLength";
|
|
207
241
|
let pass;
|
|
208
242
|
let actual;
|
|
209
243
|
let errorReason = null;
|
|
210
244
|
const { timeout = 1e4, trim = false } = options;
|
|
211
|
-
const poll =
|
|
245
|
+
const poll = import_test3.expect.poll(
|
|
212
246
|
async () => {
|
|
213
247
|
try {
|
|
214
248
|
actual = await clipboard.read();
|
|
@@ -231,25 +265,24 @@ async function toHaveContentLength(clipboard, expected, options = {}) {
|
|
|
231
265
|
pass = false;
|
|
232
266
|
}
|
|
233
267
|
if (this.isNot) pass = !pass;
|
|
234
|
-
|
|
268
|
+
return {
|
|
235
269
|
message: getErrorMessage.call(this, name, expected, actual?.length, errorReason),
|
|
236
270
|
pass,
|
|
237
271
|
name,
|
|
238
272
|
expected,
|
|
239
273
|
actual: actual?.length
|
|
240
274
|
};
|
|
241
|
-
return matcherReturn;
|
|
242
275
|
}
|
|
243
276
|
|
|
244
277
|
// src/matchers/toHaveJSONContent.ts
|
|
245
|
-
var
|
|
278
|
+
var import_test4 = require("@playwright/test");
|
|
246
279
|
async function toHaveJSONContent(clipboard, expected, options = {}) {
|
|
247
280
|
const name = "toHaveJSONContent";
|
|
248
281
|
let pass;
|
|
249
282
|
let actual;
|
|
250
283
|
let errorReason = null;
|
|
251
284
|
const { timeout = 1e4 } = options;
|
|
252
|
-
const poll =
|
|
285
|
+
const poll = import_test4.expect.poll(
|
|
253
286
|
async () => {
|
|
254
287
|
try {
|
|
255
288
|
actual = await clipboard.readJSON();
|
|
@@ -275,18 +308,17 @@ async function toHaveJSONContent(clipboard, expected, options = {}) {
|
|
|
275
308
|
pass = false;
|
|
276
309
|
}
|
|
277
310
|
if (this.isNot) pass = !pass;
|
|
278
|
-
|
|
311
|
+
return {
|
|
279
312
|
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
280
313
|
pass,
|
|
281
314
|
name,
|
|
282
315
|
expected,
|
|
283
316
|
actual
|
|
284
317
|
};
|
|
285
|
-
return matcherReturn;
|
|
286
318
|
}
|
|
287
319
|
|
|
288
320
|
// src/matchers/toHaveTextContent.ts
|
|
289
|
-
var
|
|
321
|
+
var import_test5 = require("@playwright/test");
|
|
290
322
|
async function toHaveTextContent(clipboard, expected, options = {}) {
|
|
291
323
|
const name = "toHaveTextContent";
|
|
292
324
|
let pass;
|
|
@@ -295,7 +327,7 @@ async function toHaveTextContent(clipboard, expected, options = {}) {
|
|
|
295
327
|
let errorReason = null;
|
|
296
328
|
const { timeout = 1e4, ignoreCase = false, trim = false } = options;
|
|
297
329
|
const normalizedExpected = normalizeText(expected, { ignoreCase, trim });
|
|
298
|
-
const poll =
|
|
330
|
+
const poll = import_test5.expect.poll(
|
|
299
331
|
async () => {
|
|
300
332
|
try {
|
|
301
333
|
actual = await clipboard.read();
|
|
@@ -324,25 +356,24 @@ async function toHaveTextContent(clipboard, expected, options = {}) {
|
|
|
324
356
|
pass = false;
|
|
325
357
|
}
|
|
326
358
|
if (this.isNot) pass = !pass;
|
|
327
|
-
|
|
359
|
+
return {
|
|
328
360
|
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
329
361
|
pass,
|
|
330
362
|
name,
|
|
331
363
|
expected,
|
|
332
364
|
actual
|
|
333
365
|
};
|
|
334
|
-
return matcherReturn;
|
|
335
366
|
}
|
|
336
367
|
|
|
337
368
|
// src/matchers/toMatchJSONContent.ts
|
|
338
|
-
var
|
|
369
|
+
var import_test6 = require("@playwright/test");
|
|
339
370
|
async function toMatchJSONContent(clipboard, expected, options = {}) {
|
|
340
371
|
const name = "toMatchJSONContent";
|
|
341
372
|
let pass;
|
|
342
373
|
let actual;
|
|
343
374
|
let errorReason = null;
|
|
344
375
|
const { timeout = 1e4 } = options;
|
|
345
|
-
const poll =
|
|
376
|
+
const poll = import_test6.expect.poll(
|
|
346
377
|
async () => {
|
|
347
378
|
try {
|
|
348
379
|
actual = await clipboard.readJSON();
|
|
@@ -368,14 +399,13 @@ async function toMatchJSONContent(clipboard, expected, options = {}) {
|
|
|
368
399
|
pass = false;
|
|
369
400
|
}
|
|
370
401
|
if (this.isNot) pass = !pass;
|
|
371
|
-
|
|
402
|
+
return {
|
|
372
403
|
message: getErrorMessage.call(this, name, expected, actual, errorReason),
|
|
373
404
|
pass,
|
|
374
405
|
name,
|
|
375
406
|
expected,
|
|
376
407
|
actual
|
|
377
408
|
};
|
|
378
|
-
return matcherReturn;
|
|
379
409
|
}
|
|
380
410
|
|
|
381
411
|
// src/matchers/clipboardMatchers.ts
|
|
@@ -388,8 +418,8 @@ var clipboardMatchers = {
|
|
|
388
418
|
};
|
|
389
419
|
|
|
390
420
|
// src/baseFixtures.ts
|
|
391
|
-
var
|
|
392
|
-
var expect6 =
|
|
421
|
+
var test2 = import_test7.test.extend(clipboardFixtures);
|
|
422
|
+
var expect6 = import_test7.expect.extend({ ...clipboardMatchers });
|
|
393
423
|
// Annotate the CommonJS export names for ESM import in node:
|
|
394
424
|
0 && (module.exports = {
|
|
395
425
|
expect,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/baseFixtures.ts","../src/utils/clipboardHandler.ts","../src/fixtures/clipboardFixture.ts","../src/fixtures/contextFixture.ts","../src/fixtures/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":["export { expect, test } from './baseFixtures.ts';\n","import { expect as baseExpect, test as baseTest } from '@playwright/test';\nimport { clipboardFixtures } from './fixtures';\nimport { clipboardMatchers } from './matchers';\nimport type { ClipboardHandler } from './utils';\n\nexport const test = baseTest.extend<{\n clipboard: ClipboardHandler;\n}>(clipboardFixtures);\n\nexport const expect = baseExpect.extend({ ...clipboardMatchers });\n","/**\n * Playwright-compatible Clipboard utilities.\n *\n * Core functions for interacting with the browser clipboard within Playwright tests.\n * Provides wrappers for reading plain text and JSON.\n *\n * @remarks\n * These utilities require 'clipboard-read' and 'clipboard-write' permissions\n * to be granted in the browser context.\n */\n\nimport type { Page } from '@playwright/test';\n\nexport class ClipboardHandler {\n constructor(private readonly page: Page) {}\n\n /**\n * Reads the current text content from the browser clipboard.\n * If the content is a JSON-encoded string (e.g., has extra quotes),\n * it will be returned as is. Use readJSON for automatic parsing.\n *\n * @returns A promise that resolves to the clipboard string content.\n */\n async read(): Promise<string> {\n return await this.page.evaluate(() => navigator.clipboard.readText());\n }\n\n /**\n * Reads the clipboard content and parses it as JSON.\n * If the content is a string literal (e.g., '\"value\"'), it returns the unwrapped string ('value').\n *\n * @template T - The expected type of the parsed JSON object.\n * @returns A promise that resolves to the parsed JSON object of type T.\n * @throws {Error} If the clipboard content is not a valid JSON string.\n */\n async readJSON<T = unknown>(): Promise<T> {\n const text = await this.read();\n try {\n return JSON.parse(text);\n } catch {\n throw new Error(\n `[playwright-clipboard] Clipboard content is not a valid JSON: ${JSON.stringify(text)}`,\n );\n }\n }\n\n /**\n * Writes the provided string data to the browser clipboard.\n * @param data The data to write to the clipboard.\n */\n async write(data: string): Promise<void> {\n await this.page.evaluate((value) => navigator.clipboard.writeText(value), data);\n }\n\n /**\n * Writes the provided data to the browser clipboard as a JSON string.\n * @param data The data to write to the clipboard. It will be stringified as JSON.\n */\n async writeJSON<T = unknown>(data: T): Promise<void> {\n const errorMessage = '[playwright-clipboard] Provided data cannot be stringified to valid JSON';\n let jsonString: string | undefined;\n\n try {\n jsonString = JSON.stringify(data);\n } catch (error) {\n const message = error instanceof Error ? error : String(error);\n throw new Error(`${errorMessage}: ${message}`);\n }\n\n if (jsonString === undefined) {\n throw new Error(`${errorMessage} (received undefined).`);\n }\n\n await this.write(jsonString);\n }\n\n /**\n * Clears the browser clipboard by writing an empty string to it.\n * This effectively removes any existing content from the clipboard.\n */\n async clear(): Promise<void> {\n await this.write('');\n }\n}\n","import type { Page, TestFixture } from '@playwright/test';\nimport { ClipboardHandler } from '../utils';\nimport type { BrowserName } from './types.ts';\n\n/**\n * A fixture that provides an instance of the Clipboard utility for interacting with the system clipboard.\n * It allows reading from the clipboard during tests.\n */\nexport const clipboardFixture: TestFixture<\n ClipboardHandler,\n { page: Page; browserName: BrowserName }\n> = async ({ page, browserName }, use) => {\n if (browserName === 'webkit') {\n throw new Error(\n `[playwright-clipboard] Browser '${browserName}' is not supported. ` +\n 'Clipboard API testing is currently supported only in Chromium-based and Firefox browsers.\\n' +\n `Add test.skip(browserName === 'webkit', 'Clipboard API is only supported in Chromium and Firefox'); to your test body.`,\n );\n }\n\n const handler = new ClipboardHandler(page);\n await use(handler);\n};\n","import type { BrowserContext, TestFixture } from '@playwright/test';\nimport type { BrowserName } from './types.ts';\n\n/**\n * A fixture that provides a BrowserContext with clipboard permissions granted for Chromium browsers.\n */\nexport const contextFixture: TestFixture<\n BrowserContext,\n { context: BrowserContext; browserName: BrowserName }\n> = async ({ context, browserName }, use) => {\n if (browserName === 'chromium') {\n await context.grantPermissions(['clipboard-read', 'clipboard-write']);\n }\n\n await use(context);\n};\n","import { ClipboardHandler } from '../utils';\nimport { clipboardFixture } from './clipboardFixture.ts';\nimport { contextFixture } from './contextFixture.ts';\n\n/**\n * A collection of fixtures related to clipboard testing, including the clipboard fixture and context fixture.\n * These fixtures can be used in Playwright tests to facilitate clipboard interactions and context management.\n */\nexport const clipboardFixtures = {\n context: contextFixture,\n clipboard: clipboardFixture,\n};\n\nexport { ClipboardHandler, clipboardFixture, contextFixture };\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,gBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,IAAAC,eAAuD;;;ACahD,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,MAAY;AAAZ;AAAA,EAAa;AAAA,EAAb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,MAAM,OAAwB;AAC5B,WAAO,MAAM,KAAK,KAAK,SAAS,MAAM,UAAU,UAAU,SAAS,CAAC;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAM,WAAoC;AACxC,UAAM,OAAO,MAAM,KAAK,KAAK;AAC7B,QAAI;AACF,aAAO,KAAK,MAAM,IAAI;AAAA,IACxB,QAAQ;AACN,YAAM,IAAI;AAAA,QACR,iEAAiE,KAAK,UAAU,IAAI,CAAC;AAAA,MACvF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAM,MAA6B;AACvC,UAAM,KAAK,KAAK,SAAS,CAAC,UAAU,UAAU,UAAU,UAAU,KAAK,GAAG,IAAI;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,UAAuB,MAAwB;AACnD,UAAM,eAAe;AACrB,QAAI;AAEJ,QAAI;AACF,mBAAa,KAAK,UAAU,IAAI;AAAA,IAClC,SAAS,OAAO;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AAM,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;;;AXVO,IAAM,OAAO,aAAAC,KAAS,OAE1B,iBAAiB;AAEb,IAAMC,UAAS,aAAAC,OAAW,OAAO,EAAE,GAAG,kBAAkB,CAAC;","names":["expect","import_test","import_test","import_test","import_test","import_test","baseTest","expect","baseExpect"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/baseFixtures.ts","../src/utils/clipboard/runInStep.ts","../src/utils/clipboard/clipboardHandler.ts","../src/fixtures/clipboardFixture.ts","../src/fixtures/contextFixture.ts","../src/fixtures/index.ts","../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":["export { expect, test } from './baseFixtures';\n","import { expect as baseExpect, test as baseTest } from '@playwright/test';\nimport { clipboardFixtures } from './fixtures';\nimport { clipboardMatchers } from './matchers';\nimport type { ClipboardHandler } from './utils';\n\nexport const test = baseTest.extend<{\n clipboard: ClipboardHandler;\n}>(clipboardFixtures);\n\nexport const expect = baseExpect.extend({ ...clipboardMatchers });\n","import { test } from '@playwright/test';\n\nconst isTestRunning = () => {\n try {\n return !!test.info();\n } catch {\n return false;\n }\n};\n\nexport const runInStep = async <T>(stepName: string, fn: () => Promise<T>) => {\n if (isTestRunning()) {\n return await test.step(stepName, fn, { box: true });\n } else {\n return await fn();\n }\n};\n","/**\n * Playwright-compatible Clipboard utilities.\n *\n * Core functions for interacting with the browser clipboard within Playwright tests.\n * Provides wrappers for reading plain text and JSON.\n *\n * @remarks\n * These utilities require 'clipboard-read' and 'clipboard-write' permissions\n * to be granted in the browser context.\n */\n\nimport type { Page } from '@playwright/test';\nimport { runInStep } from './runInStep';\n\nexport class ClipboardHandler {\n constructor(private readonly page: Page) {}\n\n private async _write(data: string): Promise<void> {\n await this.page.evaluate((value) => navigator.clipboard.writeText(value), data);\n }\n\n private async _read(): Promise<string> {\n return await this.page.evaluate(() => navigator.clipboard.readText());\n }\n\n /**\n * Reads the current text content from the browser clipboard.\n * If the content is a JSON-encoded string (e.g., has extra quotes),\n * it will be returned as is. Use readJSON for automatic parsing.\n *\n * @returns A promise that resolves to the clipboard string content.\n */\n async read(): Promise<string> {\n return await runInStep('Clipboard \"read\"', async () => {\n return await this._read();\n });\n }\n\n /**\n * Reads the clipboard content and parses it as JSON.\n * If the content is a string literal (e.g., '\"value\"'), it returns the unwrapped string ('value').\n *\n * @template T - The expected type of the parsed JSON object.\n * @returns A promise that resolves to the parsed JSON object of type T.\n * @throws {Error} If the clipboard content is not a valid JSON string.\n */\n async readJSON<T = unknown>(): Promise<T> {\n return await runInStep('Clipboard \"readJSON\"', async () => {\n const text = await this._read();\n try {\n return JSON.parse(text);\n } catch {\n throw new Error(\n `[playwright-clipboard] Clipboard content is not a valid JSON: ${JSON.stringify(text)}`,\n );\n }\n });\n }\n\n /**\n * Writes the provided string data to the browser clipboard.\n * @param data The data to write to the clipboard.\n */\n async write(data: string): Promise<void> {\n await runInStep('Clipboard \"write\"', async () => {\n await this._write(data);\n });\n }\n\n /**\n * Writes the provided data to the browser clipboard as a JSON string.\n * @param data The data to write to the clipboard. It will be stringified as JSON.\n */\n async writeJSON<T = unknown>(data: T): Promise<void> {\n const errorMessage = '[playwright-clipboard] Provided data cannot be stringified to valid JSON';\n let jsonString: string | undefined;\n\n try {\n jsonString = JSON.stringify(data);\n } catch (error) {\n const message = error instanceof Error ? error : String(error);\n throw new Error(`${errorMessage}: ${message}`);\n }\n\n if (jsonString === undefined) {\n throw new Error(`${errorMessage} (received undefined).`);\n }\n\n await runInStep('Clipboard \"writeJSON\"', async () => {\n await this._write(jsonString);\n });\n }\n\n /**\n * Clears the browser clipboard by writing an empty string to it.\n * This effectively removes any existing content from the clipboard.\n */\n async clear(): Promise<void> {\n await runInStep('Clipboard \"clear\"', async () => {\n await this._write('');\n });\n }\n}\n","import type { Page, TestFixture } from '@playwright/test';\nimport { ClipboardHandler } from '../utils';\nimport type { BrowserName } from './types';\n\n/**\n * A fixture that provides an instance of the Clipboard utility for interacting with the system clipboard.\n * It allows reading from the clipboard during tests.\n */\nexport const clipboardFixture: TestFixture<\n ClipboardHandler,\n { page: Page; browserName: BrowserName }\n> = async ({ page, browserName }, use) => {\n if (browserName === 'webkit') {\n throw new Error(\n `[playwright-clipboard] Browser '${browserName}' is not supported. ` +\n 'Clipboard API testing is currently supported only in Chromium-based and Firefox browsers.\\n' +\n `Add test.skip(browserName === 'webkit', 'Clipboard API is only supported in Chromium and Firefox'); to your test body.`,\n );\n }\n\n const handler = new ClipboardHandler(page);\n await use(handler);\n};\n","import type { BrowserContext, TestFixture } from '@playwright/test';\nimport type { BrowserName } from './types';\n\n/**\n * A fixture that provides a BrowserContext with clipboard permissions granted for Chromium browsers.\n */\nexport const contextFixture: TestFixture<\n BrowserContext,\n { context: BrowserContext; browserName: BrowserName }\n> = async ({ context, browserName }, use) => {\n if (browserName === 'chromium') {\n await context.grantPermissions(['clipboard-read', 'clipboard-write']);\n }\n\n await use(context);\n};\n","import { ClipboardHandler } from '../utils';\nimport { clipboardFixture } from './clipboardFixture';\nimport { contextFixture } from './contextFixture';\n\n/**\n * A collection of fixtures related to clipboard testing, including the clipboard fixture and context fixture.\n * These fixtures can be used in Playwright tests to facilitate clipboard interactions and context management.\n */\nexport const clipboardFixtures = {\n context: contextFixture,\n clipboard: clipboardFixture,\n};\n\nexport type { BrowserName } from './types';\nexport { ClipboardHandler, clipboardFixture, contextFixture };\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 { 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, MatcherReturnType } from '@playwright/test';\nimport type { ClipboardHandler } from '../utils';\nimport { toBeBlank } from './toBeBlank';\nimport { toHaveContentLength } from './toHaveContentLength';\nimport { toHaveJSONContent } from './toHaveJSONContent';\nimport { toHaveTextContent } from './toHaveTextContent';\nimport { toMatchJSONContent } from './toMatchJSONContent';\n\ntype PlaywrightMatcher = (\n this: ExpectMatcherState,\n clipboard: ClipboardHandler,\n // biome-ignore lint/suspicious/noExplicitAny: Playwright matchers accept arbitrary receiver and arguments\n ...args: any[]\n) => Promise<MatcherReturnType>;\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":";;;;;;;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AQ;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;;;ACjDO,IAAM,oBAAuD;AAAA,EAClE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AbnBO,IAAMC,QAAO,aAAAC,KAAS,OAE1B,iBAAiB;AAEb,IAAMC,UAAS,aAAAC,OAAW,OAAO,EAAE,GAAG,kBAAkB,CAAC;","names":["expect","test","import_test","import_test","import_test","import_test","import_test","import_test","test","baseTest","expect","baseExpect"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { C as ClipboardHandler } from './clipboardHandler-CFIUvkc0.cjs';
|
|
4
|
-
import '@playwright/test';
|
|
5
|
-
|
|
6
|
-
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & {
|
|
7
|
-
clipboard: ClipboardHandler;
|
|
8
|
-
}, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
9
|
-
declare const expect: playwright_test.Expect<{
|
|
10
|
-
toBeBlank: typeof toBeBlank;
|
|
11
|
-
toHaveContentLength: typeof toHaveContentLength;
|
|
12
|
-
toHaveJSONContent: typeof toHaveJSONContent;
|
|
13
|
-
toHaveTextContent: typeof toHaveTextContent;
|
|
14
|
-
toMatchJSONContent: typeof toMatchJSONContent;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
export { expect, test };
|
|
1
|
+
export { expect, test } from './baseFixtures';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { C as ClipboardHandler } from './clipboardHandler-CFIUvkc0.js';
|
|
4
|
-
import '@playwright/test';
|
|
5
|
-
|
|
6
|
-
declare const test: playwright_test.TestType<playwright_test.PlaywrightTestArgs & playwright_test.PlaywrightTestOptions & {
|
|
7
|
-
clipboard: ClipboardHandler;
|
|
8
|
-
}, playwright_test.PlaywrightWorkerArgs & playwright_test.PlaywrightWorkerOptions>;
|
|
9
|
-
declare const expect: playwright_test.Expect<{
|
|
10
|
-
toBeBlank: typeof toBeBlank;
|
|
11
|
-
toHaveContentLength: typeof toHaveContentLength;
|
|
12
|
-
toHaveJSONContent: typeof toHaveJSONContent;
|
|
13
|
-
toHaveTextContent: typeof toHaveTextContent;
|
|
14
|
-
toMatchJSONContent: typeof toMatchJSONContent;
|
|
15
|
-
}>;
|
|
16
|
-
|
|
17
|
-
export { expect, test };
|
|
1
|
+
export { expect, test } from './baseFixtures';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC"}
|