@vickbk/tests 0.0.0-stage → 0.2.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/CHANGELOG.md +39 -0
- package/LICENSE +21 -0
- package/README.md +225 -2
- package/dist/console-Cf1taTRK.mjs +39 -0
- package/dist/console-Cf1taTRK.mjs.map +1 -0
- package/dist/dom-DeHbD1ni.mjs +459 -0
- package/dist/dom-DeHbD1ni.mjs.map +1 -0
- package/dist/index-CKsosUpb.d.mts +249 -0
- package/dist/index-CKsosUpb.d.mts.map +1 -0
- package/dist/index-DtGBqDev.d.mts +25 -0
- package/dist/index-DtGBqDev.d.mts.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/pattern-to-regex-BrMJtzu8.cjs +19 -0
- package/dist/pattern-to-regex-BrMJtzu8.cjs.map +1 -0
- package/dist/pattern-to-regex-CO5Y0oDU.mjs +14 -0
- package/dist/pattern-to-regex-CO5Y0oDU.mjs.map +1 -0
- package/dist/playwright.cjs +327 -0
- package/dist/playwright.cjs.map +1 -0
- package/dist/playwright.d.cts +254 -0
- package/dist/playwright.d.cts.map +1 -0
- package/dist/playwright.d.mts +254 -0
- package/dist/playwright.d.mts.map +1 -0
- package/dist/playwright.mjs +308 -0
- package/dist/playwright.mjs.map +1 -0
- package/dist/promises.cjs +45 -0
- package/dist/promises.cjs.map +1 -0
- package/dist/promises.d.cts +34 -0
- package/dist/promises.d.cts.map +1 -0
- package/dist/promises.d.mts +34 -0
- package/dist/promises.d.mts.map +1 -0
- package/dist/promises.mjs +43 -0
- package/dist/promises.mjs.map +1 -0
- package/dist/react.cjs +173 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +17 -0
- package/dist/react.d.cts.map +1 -0
- package/dist/react.d.mts +17 -0
- package/dist/react.d.mts.map +1 -0
- package/dist/react.mjs +170 -0
- package/dist/react.mjs.map +1 -0
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/types-BlSFP07Z.d.cts +8 -0
- package/dist/types-BlSFP07Z.d.cts.map +1 -0
- package/dist/types-BlSFP07Z.d.mts +8 -0
- package/dist/types-BlSFP07Z.d.mts.map +1 -0
- package/dist/vitest/console.d.mts +2 -0
- package/dist/vitest/console.mjs +1 -0
- package/dist/vitest/dom.d.mts +2 -0
- package/dist/vitest/dom.mjs +1 -0
- package/dist/vitest.d.mts +49 -0
- package/dist/vitest.d.mts.map +1 -0
- package/dist/vitest.mjs +57 -0
- package/dist/vitest.mjs.map +1 -0
- package/package.json +165 -3
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
|
+
const require_pattern_to_regex = require("./pattern-to-regex-BrMJtzu8.cjs");
|
|
4
|
+
let _playwright_test = require("@playwright/test");
|
|
5
|
+
_playwright_test = require_rolldown_runtime.__toESM(_playwright_test, 1);
|
|
6
|
+
//#region src/features/playwright/modules/assertions/utils/isChecked.ts
|
|
7
|
+
/**
|
|
8
|
+
* Asserts that the element selected by the CSS selector is checked.
|
|
9
|
+
*
|
|
10
|
+
* @param page The Playwright page to search.
|
|
11
|
+
* @param selector CSS selector for a checkbox or radio input.
|
|
12
|
+
* @returns The checked locator.
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const checkbox = await isChecked(page, "#terms");
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
async function isChecked(page, selector) {
|
|
19
|
+
const locator = page.locator(selector);
|
|
20
|
+
await (0, _playwright_test.expect)(locator).toBeChecked();
|
|
21
|
+
return locator;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/features/playwright/modules/assertions/utils/isNotChecked.ts
|
|
25
|
+
/**
|
|
26
|
+
* Asserts that the element selected by the CSS selector is not checked.
|
|
27
|
+
*
|
|
28
|
+
* @param page The Playwright page to search.
|
|
29
|
+
* @param selector CSS selector for a checkbox or radio input.
|
|
30
|
+
* @returns The unchecked locator.
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const checkbox = await isNotChecked(page, "#terms");
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
async function isNotChecked(page, selector) {
|
|
37
|
+
const locator = page.locator(selector);
|
|
38
|
+
await (0, _playwright_test.expect)(locator).not.toBeChecked();
|
|
39
|
+
return locator;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/features/playwright/modules/assertions/utils/getMatcher.ts
|
|
43
|
+
function getMatcher(page, ...textes) {
|
|
44
|
+
return textes.map((text) => {
|
|
45
|
+
if (Array.isArray(text)) {
|
|
46
|
+
const [matcher, nth] = text;
|
|
47
|
+
return (0, _playwright_test.expect)(page.getByText(require_pattern_to_regex.patternToRegex(matcher)).nth(nth));
|
|
48
|
+
}
|
|
49
|
+
return (0, _playwright_test.expect)(page.getByText(text));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/features/playwright/modules/assertions/utils/shouldNotSee.ts
|
|
54
|
+
/**
|
|
55
|
+
* Asserts that each text matcher is not visible on the page.
|
|
56
|
+
*
|
|
57
|
+
* @param page The Playwright page to inspect.
|
|
58
|
+
* @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.
|
|
59
|
+
* @returns A promise that resolves when every matching element is not visible.
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await shouldNotSee(page, "Error message");
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
async function shouldNotSee(page, ...textes) {
|
|
66
|
+
const matchers = getMatcher(page, ...textes);
|
|
67
|
+
for (let i = 0; i < matchers.length; i++) await matchers[i].not.toBeVisible();
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region src/features/playwright/modules/assertions/utils/shouldSee.ts
|
|
71
|
+
/**
|
|
72
|
+
* Asserts that each text matcher is visible on the page.
|
|
73
|
+
*
|
|
74
|
+
* @param page The Playwright page to inspect.
|
|
75
|
+
* @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.
|
|
76
|
+
* @returns A promise that resolves when every matching element is visible.
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* await shouldSee(page, "Welcome", [/Saved/i, 0]);
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
async function shouldSee(page, ...textes) {
|
|
83
|
+
const matchers = getMatcher(page, ...textes);
|
|
84
|
+
for (let i = 0; i < matchers.length; i++) await matchers[i].toBeVisible();
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/features/playwright/modules/interactions/utils/clickBodyCorner.ts
|
|
88
|
+
/**
|
|
89
|
+
* Clicks the top-left corner of the page body.
|
|
90
|
+
*
|
|
91
|
+
* @param page The Playwright page to interact with.
|
|
92
|
+
* @returns A promise that resolves after the click.
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* await clickBodyCorner(page);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
async function clickBodyCorner(page) {
|
|
99
|
+
await page.locator("body").click({ position: {
|
|
100
|
+
x: 0,
|
|
101
|
+
y: 0
|
|
102
|
+
} });
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/features/playwright/shared/locators/utils/getLocatorByText.ts
|
|
106
|
+
/**
|
|
107
|
+
* Locates elements matching a selector and text pattern.
|
|
108
|
+
*
|
|
109
|
+
* @param page The Playwright page to search.
|
|
110
|
+
* @param locator Selector paired with text that the element must contain.
|
|
111
|
+
* @returns A locator matching the selector and text.
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* const save = getLocatorByText(page, ["button", "Save"]);
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
function getLocatorByText(page, [locator, hasText]) {
|
|
118
|
+
return page.locator(locator, { hasText });
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/features/playwright/shared/locators/utils/getButton.ts
|
|
122
|
+
/**
|
|
123
|
+
* Locates a button by its contained text.
|
|
124
|
+
*
|
|
125
|
+
* @param page The Playwright page to search.
|
|
126
|
+
* @param hasText Text or regular expression contained by the button.
|
|
127
|
+
* @returns A locator for the matching button.
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const saveButton = getButton(page, "Save");
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
function getButton(page, hasText) {
|
|
134
|
+
return getLocatorByText(page, ["button", hasText]);
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/features/playwright/shared/locators/utils/getLabel.ts
|
|
138
|
+
/**
|
|
139
|
+
* Locates a label by its contained text.
|
|
140
|
+
*
|
|
141
|
+
* @param page The Playwright page to search.
|
|
142
|
+
* @param hasText Text or regular expression contained by the label.
|
|
143
|
+
* @returns A locator for the matching label.
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const emailLabel = getLabel(page, "Email");
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
function getLabel(page, hasText) {
|
|
150
|
+
return getLocatorByText(page, ["label", hasText]);
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/features/playwright/shared/locators/utils/getLink.ts
|
|
154
|
+
/**
|
|
155
|
+
* Locates a link by its accessible name.
|
|
156
|
+
*
|
|
157
|
+
* @param page The Playwright page to search.
|
|
158
|
+
* @param hasText Text or regular expression matching the link's accessible name.
|
|
159
|
+
* @returns A locator for the matching link.
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const documentationLink = getLink(page, "Documentation");
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
function getLink(page, hasText) {
|
|
166
|
+
return page.getByRole("link", { name: hasText });
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
//#region src/features/playwright/modules/interactions/utils/clickButton.ts
|
|
170
|
+
/**
|
|
171
|
+
* Clicks a button matching the supplied text.
|
|
172
|
+
*
|
|
173
|
+
* @param page The Playwright page to search.
|
|
174
|
+
* @param hasText Text or regular expression contained by the button.
|
|
175
|
+
* @returns A promise that resolves after the button is clicked.
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* await clickButton(page, "Save");
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
async function clickButton(page, hasText) {
|
|
182
|
+
await getButton(page, hasText).click();
|
|
183
|
+
}
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/features/playwright/modules/interactions/utils/clickLabelInput.ts
|
|
186
|
+
/**
|
|
187
|
+
* Clicks the label matching the supplied text.
|
|
188
|
+
*
|
|
189
|
+
* @param page The Playwright page to search.
|
|
190
|
+
* @param labelText Text or regular expression contained by the label.
|
|
191
|
+
* @returns A promise that resolves after the label is clicked.
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* await clickLabelInput(page, "Subscribe");
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
async function clickLabelInput(page, labelText) {
|
|
198
|
+
await getLabel(page, labelText).click();
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/features/playwright/modules/interactions/utils/clickLink.ts
|
|
202
|
+
/**
|
|
203
|
+
* Clicks a link matching the supplied accessible name.
|
|
204
|
+
*
|
|
205
|
+
* @param page The Playwright page to search.
|
|
206
|
+
* @param hasText Text or regular expression matching the link name.
|
|
207
|
+
* @returns A promise that resolves after the link is clicked.
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* await clickLink(page, "Documentation");
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
async function clickLink(page, hasText) {
|
|
214
|
+
await getLink(page, hasText).click();
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/features/playwright/modules/interactions/utils/clickMultipleLabelInputs.ts
|
|
218
|
+
/**
|
|
219
|
+
* Clicks each matching label in the supplied order.
|
|
220
|
+
*
|
|
221
|
+
* @param page The Playwright page to search.
|
|
222
|
+
* @param labelTexts Text or regular expressions for the labels to click.
|
|
223
|
+
* @returns A promise that resolves after all labels are clicked.
|
|
224
|
+
* @example
|
|
225
|
+
* ```ts
|
|
226
|
+
* await clickMultipleLabelInputs(page, ["Email", "Subscribe"]);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
async function clickMultipleLabelInputs(page, labelTexts) {
|
|
230
|
+
for (const labelText of labelTexts) await clickLabelInput(page, labelText);
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/features/playwright/modules/interactions/utils/fillLocatorWith.ts
|
|
234
|
+
/**
|
|
235
|
+
* Clicks a locator and fills it with the supplied value.
|
|
236
|
+
*
|
|
237
|
+
* @param locator The input-like locator to fill.
|
|
238
|
+
* @param value The value to enter.
|
|
239
|
+
* @returns A promise that resolves after the locator is filled.
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* await fillLocatorWith(page.getByLabel("Email"), "user@example.com");
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
async function fillLocatorWith(locator, value) {
|
|
246
|
+
await locator.click();
|
|
247
|
+
await locator.fill(value);
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/features/playwright/modules/interactions/utils/setLocatorValue.ts
|
|
251
|
+
/**
|
|
252
|
+
* Clicks the label matching the pattern and fills it with the supplied value.
|
|
253
|
+
*
|
|
254
|
+
* @param page The Playwright page to search.
|
|
255
|
+
* @param locatorAndValue Label text or pattern paired with the value to fill.
|
|
256
|
+
* @returns A promise that resolves after the matching label is filled.
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* await setLocatorValue(page, ["Email", "user@example.com"]);
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
async function setLocatorValue(page, [locator, value]) {
|
|
263
|
+
const element = page.locator("label", { hasText: require_pattern_to_regex.patternToRegex(locator) });
|
|
264
|
+
await element.click();
|
|
265
|
+
await element.fill(value);
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/features/playwright/modules/interactions/utils/setValueForLocators.ts
|
|
269
|
+
/**
|
|
270
|
+
* Sets values for a sequence of label/value pairs in order.
|
|
271
|
+
*
|
|
272
|
+
* @param page The Playwright page to search.
|
|
273
|
+
* @param locatorsAndValues Label text or pattern paired with its value.
|
|
274
|
+
* @returns A promise that resolves after all values are set.
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* await setValueForLocators(page, [
|
|
278
|
+
* ["Email", "user@example.com"],
|
|
279
|
+
* ["Name", "Alex"],
|
|
280
|
+
* ]);
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
async function setValueForLocators(page, locatorsAndValues) {
|
|
284
|
+
for (const locatorAndValue of locatorsAndValues) await setLocatorValue(page, locatorAndValue);
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/features/playwright/modules/runners/utils/runSimilarTests.ts
|
|
288
|
+
/**
|
|
289
|
+
* Registers tests that share the same page navigation and setup.
|
|
290
|
+
*
|
|
291
|
+
* @param tests Tuples of test names followed by page callbacks.
|
|
292
|
+
* @returns Nothing; registers one Playwright test for each tuple.
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* runSimilarTests([
|
|
296
|
+
* ["shows the home page", async (page) => {
|
|
297
|
+
* await page.getByRole("heading", { name: "Home" }).waitFor();
|
|
298
|
+
* }],
|
|
299
|
+
* ]);
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
function runSimilarTests(...tests) {
|
|
303
|
+
tests.forEach(([testName, ...testFunctions]) => (0, _playwright_test.default)(testName, async ({ page }) => {
|
|
304
|
+
await page.goto("/");
|
|
305
|
+
for (const testFunction of testFunctions) await testFunction(page);
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
//#endregion
|
|
309
|
+
exports.clickBodyCorner = clickBodyCorner;
|
|
310
|
+
exports.clickButton = clickButton;
|
|
311
|
+
exports.clickLabelInput = clickLabelInput;
|
|
312
|
+
exports.clickLink = clickLink;
|
|
313
|
+
exports.clickMultipleLabelInputs = clickMultipleLabelInputs;
|
|
314
|
+
exports.fillLocatorWith = fillLocatorWith;
|
|
315
|
+
exports.getButton = getButton;
|
|
316
|
+
exports.getLabel = getLabel;
|
|
317
|
+
exports.getLink = getLink;
|
|
318
|
+
exports.getLocatorByText = getLocatorByText;
|
|
319
|
+
exports.isChecked = isChecked;
|
|
320
|
+
exports.isNotChecked = isNotChecked;
|
|
321
|
+
exports.runSimilarTests = runSimilarTests;
|
|
322
|
+
exports.setLocatorValue = setLocatorValue;
|
|
323
|
+
exports.setValueForLocators = setValueForLocators;
|
|
324
|
+
exports.shouldNotSee = shouldNotSee;
|
|
325
|
+
exports.shouldSee = shouldSee;
|
|
326
|
+
|
|
327
|
+
//# sourceMappingURL=playwright.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.cjs","names":["expect","expect","expect","patternToRegex","patternToRegex","test"],"sources":["../src/features/playwright/modules/assertions/utils/isChecked.ts","../src/features/playwright/modules/assertions/utils/isNotChecked.ts","../src/features/playwright/modules/assertions/utils/getMatcher.ts","../src/features/playwright/modules/assertions/utils/shouldNotSee.ts","../src/features/playwright/modules/assertions/utils/shouldSee.ts","../src/features/playwright/modules/interactions/utils/clickBodyCorner.ts","../src/features/playwright/shared/locators/utils/getLocatorByText.ts","../src/features/playwright/shared/locators/utils/getButton.ts","../src/features/playwright/shared/locators/utils/getLabel.ts","../src/features/playwright/shared/locators/utils/getLink.ts","../src/features/playwright/modules/interactions/utils/clickButton.ts","../src/features/playwright/modules/interactions/utils/clickLabelInput.ts","../src/features/playwright/modules/interactions/utils/clickLink.ts","../src/features/playwright/modules/interactions/utils/clickMultipleLabelInputs.ts","../src/features/playwright/modules/interactions/utils/fillLocatorWith.ts","../src/features/playwright/modules/interactions/utils/setLocatorValue.ts","../src/features/playwright/modules/interactions/utils/setValueForLocators.ts","../src/features/playwright/modules/runners/utils/runSimilarTests.ts"],"sourcesContent":["import type { Locator, Page } from \"@playwright/test\";\nimport { expect } from \"@playwright/test\";\n\n/**\n * Asserts that the element selected by the CSS selector is checked.\n *\n * @param page The Playwright page to search.\n * @param selector CSS selector for a checkbox or radio input.\n * @returns The checked locator.\n * @example\n * ```ts\n * const checkbox = await isChecked(page, \"#terms\");\n * ```\n */\nexport async function isChecked(\n page: Page,\n selector: string,\n): Promise<Locator> {\n const locator = page.locator(selector);\n await expect(locator).toBeChecked();\n return locator;\n}\n","import type { Locator, Page } from \"@playwright/test\";\nimport { expect } from \"@playwright/test\";\n\n/**\n * Asserts that the element selected by the CSS selector is not checked.\n *\n * @param page The Playwright page to search.\n * @param selector CSS selector for a checkbox or radio input.\n * @returns The unchecked locator.\n * @example\n * ```ts\n * const checkbox = await isNotChecked(page, \"#terms\");\n * ```\n */\nexport async function isNotChecked(\n page: Page,\n selector: string,\n): Promise<Locator> {\n const locator = page.locator(selector);\n await expect(locator).not.toBeChecked();\n return locator;\n}\n","import { patternToRegex } from \"@/shared/regex\";\nimport { expect, type Locator, type Page } from \"@playwright/test\";\nimport { TEXT_MATCHER } from \"../types\";\n\nexport function getMatcher(\n page: Page,\n ...textes: TEXT_MATCHER[]\n): ReturnType<typeof expect<Locator>>[] {\n return textes.map((text) => {\n if (Array.isArray(text)) {\n const [matcher, nth] = text;\n return expect(page.getByText(patternToRegex(matcher)).nth(nth));\n }\n return expect(page.getByText(text));\n });\n}\n","import type { Page } from \"@playwright/test\";\nimport type { TEXT_MATCHER } from \"../types\";\nimport { getMatcher } from \"./getMatcher\";\n\n/**\n * Asserts that each text matcher is not visible on the page.\n *\n * @param page The Playwright page to inspect.\n * @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.\n * @returns A promise that resolves when every matching element is not visible.\n * @example\n * ```ts\n * await shouldNotSee(page, \"Error message\");\n * ```\n */\nexport async function shouldNotSee(page: Page, ...textes: TEXT_MATCHER[]) {\n const matchers = getMatcher(page, ...textes);\n for (let i = 0; i < matchers.length; i++) {\n await matchers[i].not.toBeVisible();\n }\n}\n","import type { Page } from \"@playwright/test\";\nimport type { TEXT_MATCHER } from \"../types\";\nimport { getMatcher } from \"./getMatcher\";\n\n/**\n * Asserts that each text matcher is visible on the page.\n *\n * @param page The Playwright page to inspect.\n * @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.\n * @returns A promise that resolves when every matching element is visible.\n * @example\n * ```ts\n * await shouldSee(page, \"Welcome\", [/Saved/i, 0]);\n * ```\n */\nexport async function shouldSee(page: Page, ...textes: TEXT_MATCHER[]) {\n const matchers = getMatcher(page, ...textes);\n for (let i = 0; i < matchers.length; i++) {\n await matchers[i].toBeVisible();\n }\n}\n","import type { Page } from \"@playwright/test\";\n\n/**\n * Clicks the top-left corner of the page body.\n *\n * @param page The Playwright page to interact with.\n * @returns A promise that resolves after the click.\n * @example\n * ```ts\n * await clickBodyCorner(page);\n * ```\n */\nexport async function clickBodyCorner(page: Page) {\n await page.locator(\"body\").click({ position: { x: 0, y: 0 } });\n}\n","import type { Page } from \"@playwright/test\";\nimport type { LocatorWithText } from \"../types\";\n\n/**\n * Locates elements matching a selector and text pattern.\n *\n * @param page The Playwright page to search.\n * @param locator Selector paired with text that the element must contain.\n * @returns A locator matching the selector and text.\n * @example\n * ```ts\n * const save = getLocatorByText(page, [\"button\", \"Save\"]);\n * ```\n */\nexport function getLocatorByText(\n page: Page,\n [locator, hasText]: LocatorWithText,\n) {\n return page.locator(locator, { hasText });\n}\n","import { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\nimport { getLocatorByText } from \"./getLocatorByText\";\n\n/**\n * Locates a button by its contained text.\n *\n * @param page The Playwright page to search.\n * @param hasText Text or regular expression contained by the button.\n * @returns A locator for the matching button.\n * @example\n * ```ts\n * const saveButton = getButton(page, \"Save\");\n * ```\n */\nexport function getButton(page: Page, hasText: TEXT_PATTERN) {\n return getLocatorByText(page, [\"button\", hasText]);\n}\n","import { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\nimport { getLocatorByText } from \"./getLocatorByText\";\n\n/**\n * Locates a label by its contained text.\n *\n * @param page The Playwright page to search.\n * @param hasText Text or regular expression contained by the label.\n * @returns A locator for the matching label.\n * @example\n * ```ts\n * const emailLabel = getLabel(page, \"Email\");\n * ```\n */\nexport function getLabel(page: Page, hasText: TEXT_PATTERN) {\n return getLocatorByText(page, [\"label\", hasText]);\n}\n","import { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\n\n/**\n * Locates a link by its accessible name.\n *\n * @param page The Playwright page to search.\n * @param hasText Text or regular expression matching the link's accessible name.\n * @returns A locator for the matching link.\n * @example\n * ```ts\n * const documentationLink = getLink(page, \"Documentation\");\n * ```\n */\nexport function getLink(page: Page, hasText: TEXT_PATTERN) {\n return page.getByRole(\"link\", { name: hasText });\n}\n","import { getButton } from \"@/features/playwright/shared/locators\";\nimport { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\n\n/**\n * Clicks a button matching the supplied text.\n *\n * @param page The Playwright page to search.\n * @param hasText Text or regular expression contained by the button.\n * @returns A promise that resolves after the button is clicked.\n * @example\n * ```ts\n * await clickButton(page, \"Save\");\n * ```\n */\nexport async function clickButton(page: Page, hasText: TEXT_PATTERN) {\n await getButton(page, hasText).click();\n}\n","import { getLabel } from \"@/features/playwright/shared/locators\";\nimport { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\n\n/**\n * Clicks the label matching the supplied text.\n *\n * @param page The Playwright page to search.\n * @param labelText Text or regular expression contained by the label.\n * @returns A promise that resolves after the label is clicked.\n * @example\n * ```ts\n * await clickLabelInput(page, \"Subscribe\");\n * ```\n */\nexport async function clickLabelInput(page: Page, labelText: TEXT_PATTERN) {\n await getLabel(page, labelText).click();\n}\n","import { getLink } from \"@/features/playwright/shared/locators\";\nimport { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\n\n/**\n * Clicks a link matching the supplied accessible name.\n *\n * @param page The Playwright page to search.\n * @param hasText Text or regular expression matching the link name.\n * @returns A promise that resolves after the link is clicked.\n * @example\n * ```ts\n * await clickLink(page, \"Documentation\");\n * ```\n */\nexport async function clickLink(page: Page, hasText: TEXT_PATTERN) {\n await getLink(page, hasText).click();\n}\n","import { TEXT_PATTERN } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\nimport { clickLabelInput } from \"./clickLabelInput\";\n\n/**\n * Clicks each matching label in the supplied order.\n *\n * @param page The Playwright page to search.\n * @param labelTexts Text or regular expressions for the labels to click.\n * @returns A promise that resolves after all labels are clicked.\n * @example\n * ```ts\n * await clickMultipleLabelInputs(page, [\"Email\", \"Subscribe\"]);\n * ```\n */\nexport async function clickMultipleLabelInputs(\n page: Page,\n labelTexts: TEXT_PATTERN[],\n) {\n for (const labelText of labelTexts) {\n await clickLabelInput(page, labelText);\n }\n}\n","import type { Locator } from \"@playwright/test\";\n\n/**\n * Clicks a locator and fills it with the supplied value.\n *\n * @param locator The input-like locator to fill.\n * @param value The value to enter.\n * @returns A promise that resolves after the locator is filled.\n * @example\n * ```ts\n * await fillLocatorWith(page.getByLabel(\"Email\"), \"user@example.com\");\n * ```\n */\nexport async function fillLocatorWith(locator: Locator, value: string) {\n await locator.click();\n await locator.fill(value);\n}\n","import { type LABEL_LOCATOR, patternToRegex } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\n\n/**\n * Clicks the label matching the pattern and fills it with the supplied value.\n *\n * @param page The Playwright page to search.\n * @param locatorAndValue Label text or pattern paired with the value to fill.\n * @returns A promise that resolves after the matching label is filled.\n * @example\n * ```ts\n * await setLocatorValue(page, [\"Email\", \"user@example.com\"]);\n * ```\n */\nexport async function setLocatorValue(\n page: Page,\n [locator, value]: LABEL_LOCATOR,\n) {\n const element = page.locator(\"label\", { hasText: patternToRegex(locator) });\n await element.click();\n await element.fill(value);\n}\n","import { LABEL_LOCATOR } from \"@/shared/regex\";\nimport type { Page } from \"@playwright/test\";\nimport { setLocatorValue } from \"./setLocatorValue\";\n\n/**\n * Sets values for a sequence of label/value pairs in order.\n *\n * @param page The Playwright page to search.\n * @param locatorsAndValues Label text or pattern paired with its value.\n * @returns A promise that resolves after all values are set.\n * @example\n * ```ts\n * await setValueForLocators(page, [\n * [\"Email\", \"user@example.com\"],\n * [\"Name\", \"Alex\"],\n * ]);\n * ```\n */\nexport async function setValueForLocators(\n page: Page,\n locatorsAndValues: LABEL_LOCATOR[],\n) {\n for (const locatorAndValue of locatorsAndValues) {\n await setLocatorValue(page, locatorAndValue);\n }\n}\n","import test from \"@playwright/test\";\nimport type { SimpleTest } from \"../types\";\n\n/**\n * Registers tests that share the same page navigation and setup.\n *\n * @param tests Tuples of test names followed by page callbacks.\n * @returns Nothing; registers one Playwright test for each tuple.\n * @example\n * ```ts\n * runSimilarTests([\n * [\"shows the home page\", async (page) => {\n * await page.getByRole(\"heading\", { name: \"Home\" }).waitFor();\n * }],\n * ]);\n * ```\n */\nexport function runSimilarTests(...tests: SimpleTest[]) {\n tests.forEach(([testName, ...testFunctions]) =>\n test(testName, async ({ page }) => {\n await page.goto(\"/\");\n for (const testFunction of testFunctions) await testFunction(page);\n }),\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { i as TEXT_WITH_NTH, n as TEXT_MATCHER, r as TEXT_PATTERN, t as LABEL_LOCATOR } from "./types-BlSFP07Z.cjs";
|
|
2
|
+
import { Locator, Page } from "@playwright/test";
|
|
3
|
+
//#region src/features/playwright/modules/assertions/utils/isChecked.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Asserts that the element selected by the CSS selector is checked.
|
|
6
|
+
*
|
|
7
|
+
* @param page The Playwright page to search.
|
|
8
|
+
* @param selector CSS selector for a checkbox or radio input.
|
|
9
|
+
* @returns The checked locator.
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const checkbox = await isChecked(page, "#terms");
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function isChecked(page: Page, selector: string): Promise<Locator>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/features/playwright/modules/assertions/utils/isNotChecked.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Asserts that the element selected by the CSS selector is not checked.
|
|
20
|
+
*
|
|
21
|
+
* @param page The Playwright page to search.
|
|
22
|
+
* @param selector CSS selector for a checkbox or radio input.
|
|
23
|
+
* @returns The unchecked locator.
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const checkbox = await isNotChecked(page, "#terms");
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function isNotChecked(page: Page, selector: string): Promise<Locator>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/features/playwright/modules/assertions/utils/shouldNotSee.d.ts
|
|
32
|
+
/**
|
|
33
|
+
* Asserts that each text matcher is not visible on the page.
|
|
34
|
+
*
|
|
35
|
+
* @param page The Playwright page to inspect.
|
|
36
|
+
* @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.
|
|
37
|
+
* @returns A promise that resolves when every matching element is not visible.
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* await shouldNotSee(page, "Error message");
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function shouldNotSee(page: Page, ...textes: TEXT_MATCHER[]): Promise<void>;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/features/playwright/modules/assertions/utils/shouldSee.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Asserts that each text matcher is visible on the page.
|
|
48
|
+
*
|
|
49
|
+
* @param page The Playwright page to inspect.
|
|
50
|
+
* @param textes Text strings, regular expressions, or `[matcher, occurrenceIndex]` pairs.
|
|
51
|
+
* @returns A promise that resolves when every matching element is visible.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* await shouldSee(page, "Welcome", [/Saved/i, 0]);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function shouldSee(page: Page, ...textes: TEXT_MATCHER[]): Promise<void>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/features/playwright/modules/interactions/utils/clickBodyCorner.d.ts
|
|
60
|
+
/**
|
|
61
|
+
* Clicks the top-left corner of the page body.
|
|
62
|
+
*
|
|
63
|
+
* @param page The Playwright page to interact with.
|
|
64
|
+
* @returns A promise that resolves after the click.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* await clickBodyCorner(page);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function clickBodyCorner(page: Page): Promise<void>;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/features/playwright/modules/interactions/utils/clickButton.d.ts
|
|
73
|
+
/**
|
|
74
|
+
* Clicks a button matching the supplied text.
|
|
75
|
+
*
|
|
76
|
+
* @param page The Playwright page to search.
|
|
77
|
+
* @param hasText Text or regular expression contained by the button.
|
|
78
|
+
* @returns A promise that resolves after the button is clicked.
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* await clickButton(page, "Save");
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function clickButton(page: Page, hasText: TEXT_PATTERN): Promise<void>;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/features/playwright/modules/interactions/utils/clickLabelInput.d.ts
|
|
87
|
+
/**
|
|
88
|
+
* Clicks the label matching the supplied text.
|
|
89
|
+
*
|
|
90
|
+
* @param page The Playwright page to search.
|
|
91
|
+
* @param labelText Text or regular expression contained by the label.
|
|
92
|
+
* @returns A promise that resolves after the label is clicked.
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* await clickLabelInput(page, "Subscribe");
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function clickLabelInput(page: Page, labelText: TEXT_PATTERN): Promise<void>;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/features/playwright/modules/interactions/utils/clickLink.d.ts
|
|
101
|
+
/**
|
|
102
|
+
* Clicks a link matching the supplied accessible name.
|
|
103
|
+
*
|
|
104
|
+
* @param page The Playwright page to search.
|
|
105
|
+
* @param hasText Text or regular expression matching the link name.
|
|
106
|
+
* @returns A promise that resolves after the link is clicked.
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* await clickLink(page, "Documentation");
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export declare function clickLink(page: Page, hasText: TEXT_PATTERN): Promise<void>;
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/features/playwright/modules/interactions/utils/clickMultipleLabelInputs.d.ts
|
|
115
|
+
/**
|
|
116
|
+
* Clicks each matching label in the supplied order.
|
|
117
|
+
*
|
|
118
|
+
* @param page The Playwright page to search.
|
|
119
|
+
* @param labelTexts Text or regular expressions for the labels to click.
|
|
120
|
+
* @returns A promise that resolves after all labels are clicked.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* await clickMultipleLabelInputs(page, ["Email", "Subscribe"]);
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function clickMultipleLabelInputs(page: Page, labelTexts: TEXT_PATTERN[]): Promise<void>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/features/playwright/modules/interactions/utils/fillLocatorWith.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Clicks a locator and fills it with the supplied value.
|
|
131
|
+
*
|
|
132
|
+
* @param locator The input-like locator to fill.
|
|
133
|
+
* @param value The value to enter.
|
|
134
|
+
* @returns A promise that resolves after the locator is filled.
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* await fillLocatorWith(page.getByLabel("Email"), "user@example.com");
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function fillLocatorWith(locator: Locator, value: string): Promise<void>;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/features/playwright/modules/interactions/utils/setLocatorValue.d.ts
|
|
143
|
+
/**
|
|
144
|
+
* Clicks the label matching the pattern and fills it with the supplied value.
|
|
145
|
+
*
|
|
146
|
+
* @param page The Playwright page to search.
|
|
147
|
+
* @param locatorAndValue Label text or pattern paired with the value to fill.
|
|
148
|
+
* @returns A promise that resolves after the matching label is filled.
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* await setLocatorValue(page, ["Email", "user@example.com"]);
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function setLocatorValue(page: Page, [locator, value]: LABEL_LOCATOR): Promise<void>;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/features/playwright/modules/interactions/utils/setValueForLocators.d.ts
|
|
157
|
+
/**
|
|
158
|
+
* Sets values for a sequence of label/value pairs in order.
|
|
159
|
+
*
|
|
160
|
+
* @param page The Playwright page to search.
|
|
161
|
+
* @param locatorsAndValues Label text or pattern paired with its value.
|
|
162
|
+
* @returns A promise that resolves after all values are set.
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* await setValueForLocators(page, [
|
|
166
|
+
* ["Email", "user@example.com"],
|
|
167
|
+
* ["Name", "Alex"],
|
|
168
|
+
* ]);
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
export declare function setValueForLocators(page: Page, locatorsAndValues: LABEL_LOCATOR[]): Promise<void>;
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/features/playwright/modules/runners/types.d.ts
|
|
174
|
+
type TestRunner = (page: Page) => void | Promise<void>;
|
|
175
|
+
type SimpleTest = [string, ...TestRunner[]];
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/features/playwright/modules/runners/utils/runSimilarTests.d.ts
|
|
178
|
+
/**
|
|
179
|
+
* Registers tests that share the same page navigation and setup.
|
|
180
|
+
*
|
|
181
|
+
* @param tests Tuples of test names followed by page callbacks.
|
|
182
|
+
* @returns Nothing; registers one Playwright test for each tuple.
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* runSimilarTests([
|
|
186
|
+
* ["shows the home page", async (page) => {
|
|
187
|
+
* await page.getByRole("heading", { name: "Home" }).waitFor();
|
|
188
|
+
* }],
|
|
189
|
+
* ]);
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export declare function runSimilarTests(...tests: SimpleTest[]): void;
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/features/playwright/shared/locators/utils/getButton.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* Locates a button by its contained text.
|
|
197
|
+
*
|
|
198
|
+
* @param page The Playwright page to search.
|
|
199
|
+
* @param hasText Text or regular expression contained by the button.
|
|
200
|
+
* @returns A locator for the matching button.
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const saveButton = getButton(page, "Save");
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
export declare function getButton(page: Page, hasText: TEXT_PATTERN): import("@playwright/test").Locator;
|
|
207
|
+
//#endregion
|
|
208
|
+
//#region src/features/playwright/shared/locators/utils/getLabel.d.ts
|
|
209
|
+
/**
|
|
210
|
+
* Locates a label by its contained text.
|
|
211
|
+
*
|
|
212
|
+
* @param page The Playwright page to search.
|
|
213
|
+
* @param hasText Text or regular expression contained by the label.
|
|
214
|
+
* @returns A locator for the matching label.
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const emailLabel = getLabel(page, "Email");
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
export declare function getLabel(page: Page, hasText: TEXT_PATTERN): import("@playwright/test").Locator;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/features/playwright/shared/locators/utils/getLink.d.ts
|
|
223
|
+
/**
|
|
224
|
+
* Locates a link by its accessible name.
|
|
225
|
+
*
|
|
226
|
+
* @param page The Playwright page to search.
|
|
227
|
+
* @param hasText Text or regular expression matching the link's accessible name.
|
|
228
|
+
* @returns A locator for the matching link.
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const documentationLink = getLink(page, "Documentation");
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export declare function getLink(page: Page, hasText: TEXT_PATTERN): import("@playwright/test").Locator;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/features/playwright/shared/locators/types.d.ts
|
|
237
|
+
type LocatorWithText = [string, TEXT_PATTERN];
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/features/playwright/shared/locators/utils/getLocatorByText.d.ts
|
|
240
|
+
/**
|
|
241
|
+
* Locates elements matching a selector and text pattern.
|
|
242
|
+
*
|
|
243
|
+
* @param page The Playwright page to search.
|
|
244
|
+
* @param locator Selector paired with text that the element must contain.
|
|
245
|
+
* @returns A locator matching the selector and text.
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const save = getLocatorByText(page, ["button", "Save"]);
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export declare function getLocatorByText(page: Page, [locator, hasText]: LocatorWithText): import("@playwright/test").Locator;
|
|
252
|
+
//#endregion
|
|
253
|
+
export type { LABEL_LOCATOR, LocatorWithText, SimpleTest, TEXT_MATCHER, TEXT_PATTERN, TEXT_WITH_NTH, TestRunner };
|
|
254
|
+
//# sourceMappingURL=playwright.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright.d.cts","names":[],"sources":["../src/features/playwright/modules/assertions/utils/isChecked.ts","../src/features/playwright/modules/assertions/utils/isNotChecked.ts","../src/features/playwright/modules/assertions/utils/shouldNotSee.ts","../src/features/playwright/modules/assertions/utils/shouldSee.ts","../src/features/playwright/modules/interactions/utils/clickBodyCorner.ts","../src/features/playwright/modules/interactions/utils/clickButton.ts","../src/features/playwright/modules/interactions/utils/clickLabelInput.ts","../src/features/playwright/modules/interactions/utils/clickLink.ts","../src/features/playwright/modules/interactions/utils/clickMultipleLabelInputs.ts","../src/features/playwright/modules/interactions/utils/fillLocatorWith.ts","../src/features/playwright/modules/interactions/utils/setLocatorValue.ts","../src/features/playwright/modules/interactions/utils/setValueForLocators.ts","../src/features/playwright/modules/runners/types.ts","../src/features/playwright/modules/runners/utils/runSimilarTests.ts","../src/features/playwright/shared/locators/utils/getButton.ts","../src/features/playwright/shared/locators/utils/getLabel.ts","../src/features/playwright/shared/locators/utils/getLink.ts","../src/features/playwright/shared/locators/types.ts","../src/features/playwright/shared/locators/utils/getLocatorByText.ts"],"mappings":";;;;;;;;;;;;;;wBAcsB,UACpB,MAAM,MACN,mBACC,QAAQ;;;;;;;;;;;;;;wBCHW,aACpB,MAAM,MACN,mBACC,QAAQ;;;;;;;;;;;;;;wBCFW,aAAa,MAAM,SAAS,QAAQ,iBAAc;;;;;;;;;;;;;;wBCAlD,UAAU,MAAM,SAAS,QAAQ,iBAAc;;;;;;;;;;;;;wBCH/C,gBAAgB,MAAM,OAAI;;;;;;;;;;;;;;wBCG1B,YAAY,MAAM,MAAM,SAAS,eAAY;;;;;;;;;;;;;;wBCA7C,gBAAgB,MAAM,MAAM,WAAW,eAAY;;;;;;;;;;;;;;wBCAnD,UAAU,MAAM,MAAM,SAAS,eAAY;;;;;;;;;;;;;;wBCA3C,yBACpB,MAAM,MACN,YAAY,iBAAc;;;;;;;;;;;;;;wBCJN,gBAAgB,SAAS,SAAS,gBAAa;;;;;;;;;;;;;;wBCC/C,gBACpB,MAAM,OACL,SAAS,QAAQ,gBAAa;;;;;;;;;;;;;;;;;wBCEX,oBACpB,MAAM,MACN,mBAAmB,kBAAe;;;KClBxB,cAAc,MAAM,gBAAgB;KACpC,yBAAyB;;;;;;;;;;;;;;;;;wBCcrB,mBAAmB,OAAO;;;;;;;;;;;;;;wBCF1B,UAAU,MAAM,MAAM,SAAS,0CAAY;;;;;;;;;;;;;;wBCA3C,SAAS,MAAM,MAAM,SAAS,0CAAY;;;;;;;;;;;;;;wBCD1C,QAAQ,MAAM,MAAM,SAAS,0CAAY;;;KCZ7C,2BAA2B;;;;;;;;;;;;;;wBCYvB,iBACd,MAAM,OACL,SAAS,UAAU,6CAAe"}
|