@umbraco/playwright-testhelpers 17.0.18 → 17.1.0-beta
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 +139 -29
- package/dist/lib/helpers/BasePage.d.ts +447 -0
- package/dist/lib/helpers/BasePage.js +543 -0
- package/dist/lib/helpers/BasePage.js.map +1 -0
- package/dist/lib/helpers/ConstantHelper.d.ts +17 -0
- package/dist/lib/helpers/ConstantHelper.js +17 -0
- package/dist/lib/helpers/ConstantHelper.js.map +1 -1
- package/dist/lib/helpers/ContentRenderUiHelper.js +3 -3
- package/dist/lib/helpers/ContentRenderUiHelper.js.map +1 -1
- package/dist/lib/helpers/ContentUiHelper.js +312 -442
- package/dist/lib/helpers/ContentUiHelper.js.map +1 -1
- package/dist/lib/helpers/CurrentUserProfileUiHelper.js +4 -10
- package/dist/lib/helpers/CurrentUserProfileUiHelper.js.map +1 -1
- package/dist/lib/helpers/DataTypeUiHelper.js +189 -328
- package/dist/lib/helpers/DataTypeUiHelper.js.map +1 -1
- package/dist/lib/helpers/DictionaryUiHelper.js +16 -21
- package/dist/lib/helpers/DictionaryUiHelper.js.map +1 -1
- package/dist/lib/helpers/DocumentBlueprintUiHelper.js +7 -8
- package/dist/lib/helpers/DocumentBlueprintUiHelper.js.map +1 -1
- package/dist/lib/helpers/DocumentTypeUiHelper.js +18 -33
- package/dist/lib/helpers/DocumentTypeUiHelper.js.map +1 -1
- package/dist/lib/helpers/ExamineManagementUiHelper.js +4 -4
- package/dist/lib/helpers/ExamineManagementUiHelper.js.map +1 -1
- package/dist/lib/helpers/FormsUiHelper.js +119 -158
- package/dist/lib/helpers/FormsUiHelper.js.map +1 -1
- package/dist/lib/helpers/HealthCheckUiHelper.js +3 -3
- package/dist/lib/helpers/HealthCheckUiHelper.js.map +1 -1
- package/dist/lib/helpers/LanguageUiHelper.js +15 -17
- package/dist/lib/helpers/LanguageUiHelper.js.map +1 -1
- package/dist/lib/helpers/LogViewerUiHelper.js +20 -29
- package/dist/lib/helpers/LogViewerUiHelper.js.map +1 -1
- package/dist/lib/helpers/LoginUiHelper.js +5 -7
- package/dist/lib/helpers/LoginUiHelper.js.map +1 -1
- package/dist/lib/helpers/MediaTypeUiHelper.js +11 -17
- package/dist/lib/helpers/MediaTypeUiHelper.js.map +1 -1
- package/dist/lib/helpers/MediaUiHelper.js +34 -43
- package/dist/lib/helpers/MediaUiHelper.js.map +1 -1
- package/dist/lib/helpers/MemberGroupUiHelper.js +12 -15
- package/dist/lib/helpers/MemberGroupUiHelper.js.map +1 -1
- package/dist/lib/helpers/MemberTypeUiHelper.js +2 -3
- package/dist/lib/helpers/MemberTypeUiHelper.js.map +1 -1
- package/dist/lib/helpers/MemberUiHelper.js +24 -42
- package/dist/lib/helpers/MemberUiHelper.js.map +1 -1
- package/dist/lib/helpers/ModelsBuilderUiHelper.js +2 -3
- package/dist/lib/helpers/ModelsBuilderUiHelper.js.map +1 -1
- package/dist/lib/helpers/PackageUiHelper.js +29 -34
- package/dist/lib/helpers/PackageUiHelper.js.map +1 -1
- package/dist/lib/helpers/PartialViewUiHelper.js +13 -15
- package/dist/lib/helpers/PartialViewUiHelper.js.map +1 -1
- package/dist/lib/helpers/ProfilingUiHelper.js +2 -4
- package/dist/lib/helpers/ProfilingUiHelper.js.map +1 -1
- package/dist/lib/helpers/PublishedStatusUiHelper.js +6 -6
- package/dist/lib/helpers/PublishedStatusUiHelper.js.map +1 -1
- package/dist/lib/helpers/RedirectManagementUiHelper.js +7 -12
- package/dist/lib/helpers/RedirectManagementUiHelper.js.map +1 -1
- package/dist/lib/helpers/RelationTypeUiHelper.js +12 -14
- package/dist/lib/helpers/RelationTypeUiHelper.js.map +1 -1
- package/dist/lib/helpers/ScriptUiHelper.js +8 -11
- package/dist/lib/helpers/ScriptUiHelper.js.map +1 -1
- package/dist/lib/helpers/StylesheetUiHelper.js +8 -12
- package/dist/lib/helpers/StylesheetUiHelper.js.map +1 -1
- package/dist/lib/helpers/TelemetryDataUiHelper.js +2 -3
- package/dist/lib/helpers/TelemetryDataUiHelper.js.map +1 -1
- package/dist/lib/helpers/TemplateUiHelper.js +17 -22
- package/dist/lib/helpers/TemplateUiHelper.js.map +1 -1
- package/dist/lib/helpers/UiBaseLocators.d.ts +230 -228
- package/dist/lib/helpers/UiBaseLocators.js +832 -869
- package/dist/lib/helpers/UiBaseLocators.js.map +1 -1
- package/dist/lib/helpers/UserGroupUiHelper.js +27 -44
- package/dist/lib/helpers/UserGroupUiHelper.js.map +1 -1
- package/dist/lib/helpers/UserUiHelper.js +42 -45
- package/dist/lib/helpers/UserUiHelper.js.map +1 -1
- package/dist/lib/helpers/WebhookUiHelper.js +11 -27
- package/dist/lib/helpers/WebhookUiHelper.js.map +1 -1
- package/dist/lib/helpers/WelcomeDashboardUiHelper.js +1 -1
- package/dist/lib/helpers/WelcomeDashboardUiHelper.js.map +1 -1
- package/dist/lib/helpers/differentAppSettingsHelpers/ExternalLoginUiHelpers.js +4 -9
- package/dist/lib/helpers/differentAppSettingsHelpers/ExternalLoginUiHelpers.js.map +1 -1
- package/dist/lib/helpers/differentAppSettingsHelpers/InstallUiHelper.js +6 -11
- package/dist/lib/helpers/differentAppSettingsHelpers/InstallUiHelper.js.map +1 -1
- package/dist/lib/helpers/index.d.ts +1 -0
- package/dist/lib/helpers/index.js +3 -1
- package/dist/lib/helpers/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -3
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BasePage = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
/**
|
|
6
|
+
* Base page class providing common UI interaction methods.
|
|
7
|
+
* All methods follow best practices for reliability:
|
|
8
|
+
* - click: Always checks element visibility before clicking
|
|
9
|
+
* - enterText: Always clears before filling text
|
|
10
|
+
* - select: Waits for element visibility before selecting
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* class MyPage extends BasePage {
|
|
15
|
+
* readonly submitBtn: Locator;
|
|
16
|
+
*
|
|
17
|
+
* constructor(page: Page) {
|
|
18
|
+
* super(page);
|
|
19
|
+
* this.submitBtn = page.getByRole('button', { name: 'Submit' });
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* async submit() {
|
|
23
|
+
* await this.click(this.submitBtn);
|
|
24
|
+
* }
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
class BasePage {
|
|
29
|
+
page;
|
|
30
|
+
constructor(page) {
|
|
31
|
+
this.page = page;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clicks an element after verifying it is visible.
|
|
35
|
+
* @param locator - The element to click
|
|
36
|
+
* @param options - Optional click configuration
|
|
37
|
+
*/
|
|
38
|
+
async click(locator, options) {
|
|
39
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
40
|
+
await locator.click({ force: options?.force });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Double-clicks an element after verifying it is visible.
|
|
44
|
+
* @param locator - The element to double-click
|
|
45
|
+
* @param options - Optional configuration
|
|
46
|
+
*/
|
|
47
|
+
async doubleClick(locator, options) {
|
|
48
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
49
|
+
await locator.dblclick({ force: options?.force });
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Right-clicks an element after verifying it is visible.
|
|
53
|
+
* @param locator - The element to right-click
|
|
54
|
+
* @param options - Optional configuration
|
|
55
|
+
*/
|
|
56
|
+
async rightClick(locator, options) {
|
|
57
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
58
|
+
await locator.click({ button: 'right', force: options?.force });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Clicks an element using JavaScript (bypasses actionability checks).
|
|
62
|
+
* Use when standard click doesn't work due to overlapping elements.
|
|
63
|
+
* @param locator - The element to click
|
|
64
|
+
*/
|
|
65
|
+
async forceClick(locator) {
|
|
66
|
+
await locator.evaluate((el) => el.click());
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Enters text into an input field after clearing it.
|
|
70
|
+
* Verifies element visibility before interaction.
|
|
71
|
+
* @param locator - The input element
|
|
72
|
+
* @param text - The text to enter
|
|
73
|
+
* @param options - Optional configuration
|
|
74
|
+
*/
|
|
75
|
+
async enterText(locator, text, options) {
|
|
76
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
77
|
+
if (options?.clearFirst !== false) {
|
|
78
|
+
await locator.clear();
|
|
79
|
+
}
|
|
80
|
+
await locator.fill(text);
|
|
81
|
+
if (options?.verify) {
|
|
82
|
+
await (0, test_1.expect)(locator).toHaveValue(text);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Types text character by character (simulates real typing).
|
|
87
|
+
* Useful when fill() doesn't trigger necessary events.
|
|
88
|
+
* @param locator - The input element
|
|
89
|
+
* @param text - The text to type
|
|
90
|
+
* @param options - Optional configuration
|
|
91
|
+
*/
|
|
92
|
+
async typeText(locator, text, options) {
|
|
93
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
94
|
+
if (options?.clearFirst !== false) {
|
|
95
|
+
await locator.clear();
|
|
96
|
+
}
|
|
97
|
+
await locator.pressSequentially(text, { delay: options?.delay ?? 50 });
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Clears an input field.
|
|
101
|
+
* @param locator - The input element to clear
|
|
102
|
+
*/
|
|
103
|
+
async clearText(locator, options) {
|
|
104
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
105
|
+
await locator.clear();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Presses a keyboard key while focused on an element.
|
|
109
|
+
* @param locator - The element to focus
|
|
110
|
+
* @param key - The key to press (e.g., 'Enter', 'Tab', 'Escape')
|
|
111
|
+
*/
|
|
112
|
+
async pressKey(locator, key, options) {
|
|
113
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
114
|
+
await locator.press(key);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Selects an option from a dropdown by value.
|
|
118
|
+
* @param locator - The select element
|
|
119
|
+
* @param value - The option value to select
|
|
120
|
+
*/
|
|
121
|
+
async selectByValue(locator, value, options) {
|
|
122
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
123
|
+
await locator.selectOption({ value });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Selects an option from a dropdown by visible text.
|
|
127
|
+
* @param locator - The select element
|
|
128
|
+
* @param text - The option text to select
|
|
129
|
+
*/
|
|
130
|
+
async selectByText(locator, text, options) {
|
|
131
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
132
|
+
await locator.selectOption({ label: text });
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Selects an option from a dropdown by index.
|
|
136
|
+
* @param locator - The select element
|
|
137
|
+
* @param index - The option index to select (0-based)
|
|
138
|
+
*/
|
|
139
|
+
async selectByIndex(locator, index, options) {
|
|
140
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
141
|
+
await locator.selectOption({ index });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Selects multiple options from a multi-select dropdown.
|
|
145
|
+
* @param locator - The select element
|
|
146
|
+
* @param values - Array of option values to select
|
|
147
|
+
*/
|
|
148
|
+
async selectMultiple(locator, values, options) {
|
|
149
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
150
|
+
await locator.selectOption(values);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Checks a checkbox if it's not already checked.
|
|
154
|
+
* @param locator - The checkbox element
|
|
155
|
+
*/
|
|
156
|
+
async check(locator, options) {
|
|
157
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
158
|
+
await locator.check({ force: options?.force });
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Unchecks a checkbox if it's currently checked.
|
|
162
|
+
* @param locator - The checkbox element
|
|
163
|
+
*/
|
|
164
|
+
async uncheck(locator, options) {
|
|
165
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
166
|
+
await locator.uncheck({ force: options?.force });
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Sets a checkbox to a specific state.
|
|
170
|
+
* @param locator - The checkbox element
|
|
171
|
+
* @param checked - Whether the checkbox should be checked
|
|
172
|
+
*/
|
|
173
|
+
async setChecked(locator, checked, options) {
|
|
174
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
175
|
+
await locator.setChecked(checked, { force: options?.force });
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Hovers over an element.
|
|
179
|
+
* @param locator - The element to hover over
|
|
180
|
+
*/
|
|
181
|
+
async hover(locator, options) {
|
|
182
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
183
|
+
await locator.hover({ force: options?.force });
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Focuses on an element.
|
|
187
|
+
* @param locator - The element to focus
|
|
188
|
+
*/
|
|
189
|
+
async focus(locator, options) {
|
|
190
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
191
|
+
await locator.focus();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Hovers over one element and clicks another (for menus that appear on hover).
|
|
195
|
+
* @param hoverLocator - The element to hover over
|
|
196
|
+
* @param clickLocator - The element to click after hover
|
|
197
|
+
*/
|
|
198
|
+
async hoverAndClick(hoverLocator, clickLocator, options) {
|
|
199
|
+
await (0, test_1.expect)(hoverLocator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
200
|
+
await hoverLocator.hover();
|
|
201
|
+
await (0, test_1.expect)(clickLocator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
202
|
+
await clickLocator.click({ force: options?.force });
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Waits for an element to be visible.
|
|
206
|
+
* @param locator - The element to wait for
|
|
207
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
208
|
+
*/
|
|
209
|
+
async waitForVisible(locator, timeout) {
|
|
210
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: timeout ?? 5000 });
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Waits for an element to be hidden.
|
|
214
|
+
* @param locator - The element to wait for
|
|
215
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
216
|
+
*/
|
|
217
|
+
async waitForHidden(locator, timeout) {
|
|
218
|
+
await (0, test_1.expect)(locator).toBeHidden({ timeout: timeout ?? 5000 });
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Waits for an element to be attached to the DOM.
|
|
222
|
+
* @param locator - The element to wait for
|
|
223
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
224
|
+
*/
|
|
225
|
+
async waitForAttached(locator, timeout) {
|
|
226
|
+
await locator.waitFor({ state: 'attached', timeout: timeout ?? 5000 });
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Waits for an element to be detached from the DOM.
|
|
230
|
+
* @param locator - The element to wait for
|
|
231
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
232
|
+
*/
|
|
233
|
+
async waitForDetached(locator, timeout) {
|
|
234
|
+
await locator.waitFor({ state: 'detached', timeout: timeout ?? 5000 });
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Waits for the page to finish loading (network idle).
|
|
238
|
+
*/
|
|
239
|
+
async waitForPageLoad() {
|
|
240
|
+
await this.page.waitForLoadState('networkidle');
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Waits for the DOM to be fully loaded.
|
|
244
|
+
*/
|
|
245
|
+
async waitForDOMContentLoaded() {
|
|
246
|
+
await this.page.waitForLoadState('domcontentloaded');
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Waits for all network requests to complete.
|
|
250
|
+
*/
|
|
251
|
+
async waitForLoadState() {
|
|
252
|
+
await this.page.waitForLoadState();
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Waits for an element to be enabled.
|
|
256
|
+
* @param locator - The element to wait for
|
|
257
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
258
|
+
*/
|
|
259
|
+
async waitForEnabled(locator, timeout) {
|
|
260
|
+
await (0, test_1.expect)(locator).toBeEnabled({ timeout: timeout ?? 5000 });
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Waits for an element to be disabled.
|
|
264
|
+
* @param locator - The element to wait for
|
|
265
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
266
|
+
*/
|
|
267
|
+
async waitForDisabled(locator, timeout) {
|
|
268
|
+
await (0, test_1.expect)(locator).toBeDisabled({ timeout: timeout ?? 5000 });
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Waits for an element to contain specific text.
|
|
272
|
+
* @param locator - The element to wait for
|
|
273
|
+
* @param text - The text to wait for
|
|
274
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
275
|
+
*/
|
|
276
|
+
async waitForText(locator, text, timeout) {
|
|
277
|
+
await (0, test_1.expect)(locator).toContainText(text, { timeout: timeout ?? 5000 });
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Waits for an input to have a specific value.
|
|
281
|
+
* @param locator - The input element to wait for
|
|
282
|
+
* @param value - The value to wait for
|
|
283
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
284
|
+
*/
|
|
285
|
+
async waitForValue(locator, value, timeout) {
|
|
286
|
+
await (0, test_1.expect)(locator).toHaveValue(value, { timeout: timeout ?? 5000 });
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Waits for an element to have a specific attribute value.
|
|
290
|
+
* @param locator - The element to wait for
|
|
291
|
+
* @param name - The attribute name
|
|
292
|
+
* @param value - The expected attribute value
|
|
293
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
294
|
+
*/
|
|
295
|
+
async waitForAttribute(locator, name, value, timeout) {
|
|
296
|
+
await (0, test_1.expect)(locator).toHaveAttribute(name, value, { timeout: timeout ?? 5000 });
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Waits for an element to have a specific CSS class.
|
|
300
|
+
* @param locator - The element to wait for
|
|
301
|
+
* @param className - The CSS class to wait for
|
|
302
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
303
|
+
*/
|
|
304
|
+
async waitForClass(locator, className, timeout) {
|
|
305
|
+
await (0, test_1.expect)(locator).toHaveClass(className, { timeout: timeout ?? 5000 });
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Waits for an element to be editable.
|
|
309
|
+
* @param locator - The element to wait for
|
|
310
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
311
|
+
*/
|
|
312
|
+
async waitForEditable(locator, timeout) {
|
|
313
|
+
await (0, test_1.expect)(locator).toBeEditable({ timeout: timeout ?? 5000 });
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Waits for an element to be checked.
|
|
317
|
+
* @param locator - The checkbox/radio element to wait for
|
|
318
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
319
|
+
*/
|
|
320
|
+
async waitForChecked(locator, timeout) {
|
|
321
|
+
await (0, test_1.expect)(locator).toBeChecked({ timeout: timeout ?? 5000 });
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Waits for an element to be unchecked.
|
|
325
|
+
* @param locator - The checkbox/radio element to wait for
|
|
326
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
327
|
+
*/
|
|
328
|
+
async waitForUnchecked(locator, timeout) {
|
|
329
|
+
await (0, test_1.expect)(locator).not.toBeChecked({ timeout: timeout ?? 5000 });
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Waits for a specific URL or URL pattern.
|
|
333
|
+
* @param url - The URL string or regex pattern to wait for
|
|
334
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
335
|
+
*/
|
|
336
|
+
async waitForURL(url, timeout) {
|
|
337
|
+
await this.page.waitForURL(url, { timeout: timeout ?? 30000 });
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Waits for a navigation to complete.
|
|
341
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
342
|
+
*/
|
|
343
|
+
async waitForNavigation(timeout) {
|
|
344
|
+
await this.page.waitForLoadState('load', { timeout: timeout ?? 30000 });
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Waits for a specific time (use sparingly, prefer explicit waits).
|
|
348
|
+
* @param milliseconds - Time to wait in milliseconds
|
|
349
|
+
*/
|
|
350
|
+
async waitForTimeout(milliseconds) {
|
|
351
|
+
await this.page.waitForTimeout(milliseconds);
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Waits for a network request to a specific URL.
|
|
355
|
+
* @param urlOrPredicate - URL string, regex, or predicate function
|
|
356
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
357
|
+
*/
|
|
358
|
+
async waitForRequest(urlOrPredicate, timeout) {
|
|
359
|
+
return await this.page.waitForRequest(urlOrPredicate, { timeout: timeout ?? 30000 });
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Waits for a network response from a specific URL.
|
|
363
|
+
* @param urlOrPredicate - URL string, regex, or predicate function
|
|
364
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
365
|
+
*/
|
|
366
|
+
async waitForResponse(urlOrPredicate, timeout) {
|
|
367
|
+
return await this.page.waitForResponse(urlOrPredicate, { timeout: timeout ?? 30000 });
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Waits for an element to be focused.
|
|
371
|
+
* @param locator - The element to wait for
|
|
372
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
373
|
+
*/
|
|
374
|
+
async waitForFocused(locator, timeout) {
|
|
375
|
+
await (0, test_1.expect)(locator).toBeFocused({ timeout: timeout ?? 5000 });
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Waits for an element to be empty (no text content).
|
|
379
|
+
* @param locator - The element to wait for
|
|
380
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
381
|
+
*/
|
|
382
|
+
async waitForEmpty(locator, timeout) {
|
|
383
|
+
await (0, test_1.expect)(locator).toBeEmpty({ timeout: timeout ?? 5000 });
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Waits for a function to return true.
|
|
387
|
+
* @param predicate - Function that returns a boolean or Promise<boolean>
|
|
388
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
389
|
+
*/
|
|
390
|
+
async waitForFunction(predicate, timeout) {
|
|
391
|
+
await this.page.waitForFunction(predicate, { timeout: timeout ?? 30000 });
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Waits for an element to have a specific CSS property value.
|
|
395
|
+
* @param locator - The element to wait for
|
|
396
|
+
* @param property - The CSS property name
|
|
397
|
+
* @param value - The expected CSS property value
|
|
398
|
+
* @param timeout - Maximum time to wait in milliseconds
|
|
399
|
+
*/
|
|
400
|
+
async waitForCSS(locator, property, value, timeout) {
|
|
401
|
+
await (0, test_1.expect)(locator).toHaveCSS(property, value, { timeout: timeout ?? 5000 });
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Asserts that an element is visible.
|
|
405
|
+
* @param locator - The element to check
|
|
406
|
+
* @param isVisible - Whether the element should be visible (default: true)
|
|
407
|
+
*/
|
|
408
|
+
async isVisible(locator, isVisible = true, timeout) {
|
|
409
|
+
await (0, test_1.expect)(locator).toBeVisible({ visible: isVisible, timeout: timeout ?? 5000 });
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Asserts that an element is enabled.
|
|
413
|
+
* @param locator - The element to check
|
|
414
|
+
*/
|
|
415
|
+
async isEnabled(locator, timeout) {
|
|
416
|
+
await (0, test_1.expect)(locator).toBeEnabled({ timeout: timeout ?? 5000 });
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Asserts that an element is disabled.
|
|
420
|
+
* @param locator - The element to check
|
|
421
|
+
*/
|
|
422
|
+
async isDisabled(locator, timeout) {
|
|
423
|
+
await (0, test_1.expect)(locator).toBeDisabled({ timeout: timeout ?? 5000 });
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Asserts that an element contains specific text.
|
|
427
|
+
* @param locator - The element to check
|
|
428
|
+
* @param text - The text to look for
|
|
429
|
+
*/
|
|
430
|
+
async containsText(locator, text, timeout) {
|
|
431
|
+
await (0, test_1.expect)(locator).toContainText(text, { timeout: timeout ?? 5000 });
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Asserts that an element has specific text.
|
|
435
|
+
* @param locator - The element to check
|
|
436
|
+
* @param text - The exact text expected
|
|
437
|
+
*/
|
|
438
|
+
async hasText(locator, text, timeout) {
|
|
439
|
+
await (0, test_1.expect)(locator).toHaveText(text, { timeout: timeout ?? 5000 });
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Asserts that an input has a specific value.
|
|
443
|
+
* @param locator - The input element to check
|
|
444
|
+
* @param value - The expected value
|
|
445
|
+
*/
|
|
446
|
+
async hasValue(locator, value, timeout) {
|
|
447
|
+
await (0, test_1.expect)(locator).toHaveValue(value, { timeout: timeout ?? 5000 });
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Asserts that an element has a specific attribute value.
|
|
451
|
+
* @param locator - The element to check
|
|
452
|
+
* @param name - The attribute name
|
|
453
|
+
* @param value - The expected attribute value
|
|
454
|
+
*/
|
|
455
|
+
async hasAttribute(locator, name, value, timeout) {
|
|
456
|
+
await (0, test_1.expect)(locator).toHaveAttribute(name, value, { timeout: timeout ?? 5000 });
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Asserts that a specific number of elements exist.
|
|
460
|
+
* @param locator - The locator to count
|
|
461
|
+
* @param count - The expected count
|
|
462
|
+
*/
|
|
463
|
+
async hasCount(locator, count, timeout) {
|
|
464
|
+
await (0, test_1.expect)(locator).toHaveCount(count, { timeout: timeout ?? 5000 });
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Gets the text content of an element.
|
|
468
|
+
* @param locator - The element to get text from
|
|
469
|
+
* @returns The text content
|
|
470
|
+
*/
|
|
471
|
+
async getText(locator, options) {
|
|
472
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
473
|
+
return await locator.textContent() ?? '';
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Gets the value of an input element.
|
|
477
|
+
* @param locator - The input element
|
|
478
|
+
* @returns The input value
|
|
479
|
+
*/
|
|
480
|
+
async getValue(locator, options) {
|
|
481
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
482
|
+
return await locator.inputValue();
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Gets an attribute value from an element.
|
|
486
|
+
* @param locator - The element
|
|
487
|
+
* @param attributeName - The attribute name
|
|
488
|
+
* @returns The attribute value or null
|
|
489
|
+
*/
|
|
490
|
+
async getAttribute(locator, attributeName, options) {
|
|
491
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
492
|
+
return await locator.getAttribute(attributeName);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Checks if an element is currently visible.
|
|
496
|
+
* @param locator - The element to check
|
|
497
|
+
* @returns True if visible, false otherwise
|
|
498
|
+
*/
|
|
499
|
+
async checkIsVisible(locator) {
|
|
500
|
+
return await locator.isVisible();
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Checks if a checkbox is checked.
|
|
504
|
+
* @param locator - The checkbox element
|
|
505
|
+
* @returns True if checked, false otherwise
|
|
506
|
+
*/
|
|
507
|
+
async isChecked(locator) {
|
|
508
|
+
return await locator.isChecked();
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Scrolls an element into view.
|
|
512
|
+
* @param locator - The element to scroll to
|
|
513
|
+
*/
|
|
514
|
+
async scrollIntoView(locator, options) {
|
|
515
|
+
await (0, test_1.expect)(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });
|
|
516
|
+
await locator.scrollIntoViewIfNeeded();
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Sets files on a file input element.
|
|
520
|
+
* @param locator - The file input element
|
|
521
|
+
* @param filePath - Path to the file(s) to set
|
|
522
|
+
*/
|
|
523
|
+
async setInputFiles(locator, filePath) {
|
|
524
|
+
await locator.setInputFiles(filePath);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Clears files from a file input.
|
|
528
|
+
* @param locator - The file input element
|
|
529
|
+
*/
|
|
530
|
+
async clearInputFiles(locator) {
|
|
531
|
+
await locator.setInputFiles([]);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Drags an element and drops it on another element.
|
|
535
|
+
* @param source - The element to drag
|
|
536
|
+
* @param target - The element to drop on
|
|
537
|
+
*/
|
|
538
|
+
async dragTo(source, target, options) {
|
|
539
|
+
await source.dragTo(target, options);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
exports.BasePage = BasePage;
|
|
543
|
+
//# source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B;QAC/D,MAAM,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,eAAe,CAAC,OAAgB;QACpC,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,MAAe,EACf,MAAe,EACf,OAAkG;QAElG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CAEF;AA/kBD,4BA+kBC","sourcesContent":["import {expect, Locator, Page} from \"@playwright/test\";\n\n/**\n * Base page class providing common UI interaction methods.\n * All methods follow best practices for reliability:\n * - click: Always checks element visibility before clicking\n * - enterText: Always clears before filling text\n * - select: Waits for element visibility before selecting\n *\n * @example\n * ```typescript\n * class MyPage extends BasePage {\n * readonly submitBtn: Locator;\n *\n * constructor(page: Page) {\n * super(page);\n * this.submitBtn = page.getByRole('button', { name: 'Submit' });\n * }\n *\n * async submit() {\n * await this.click(this.submitBtn);\n * }\n * }\n * ```\n */\nexport class BasePage {\n readonly page: Page;\n\n constructor(page: Page) {\n this.page = page;\n }\n\n /**\n * Clicks an element after verifying it is visible.\n * @param locator - The element to click\n * @param options - Optional click configuration\n */\n async click(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.click({ force: options?.force });\n }\n\n /**\n * Double-clicks an element after verifying it is visible.\n * @param locator - The element to double-click\n * @param options - Optional configuration\n */\n async doubleClick(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.dblclick({ force: options?.force });\n }\n\n /**\n * Right-clicks an element after verifying it is visible.\n * @param locator - The element to right-click\n * @param options - Optional configuration\n */\n async rightClick(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.click({ button: 'right', force: options?.force });\n }\n\n /**\n * Clicks an element using JavaScript (bypasses actionability checks).\n * Use when standard click doesn't work due to overlapping elements.\n * @param locator - The element to click\n */\n async forceClick(locator: Locator): Promise<void> {\n await locator.evaluate((el: HTMLElement) => el.click());\n }\n\n /**\n * Enters text into an input field after clearing it.\n * Verifies element visibility before interaction.\n * @param locator - The input element\n * @param text - The text to enter\n * @param options - Optional configuration\n */\n async enterText(\n locator: Locator,\n text: string,\n options?: { clearFirst?: boolean; verify?: boolean; timeout?: number }\n ): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n if (options?.clearFirst !== false) {\n await locator.clear();\n }\n await locator.fill(text);\n if (options?.verify) {\n await expect(locator).toHaveValue(text);\n }\n }\n\n /**\n * Types text character by character (simulates real typing).\n * Useful when fill() doesn't trigger necessary events.\n * @param locator - The input element\n * @param text - The text to type\n * @param options - Optional configuration\n */\n async typeText(\n locator: Locator,\n text: string,\n options?: { clearFirst?: boolean; delay?: number; timeout?: number }\n ): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n if (options?.clearFirst !== false) {\n await locator.clear();\n }\n await locator.pressSequentially(text, { delay: options?.delay ?? 50 });\n }\n\n /**\n * Clears an input field.\n * @param locator - The input element to clear\n */\n async clearText(locator: Locator, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.clear();\n }\n\n /**\n * Presses a keyboard key while focused on an element.\n * @param locator - The element to focus\n * @param key - The key to press (e.g., 'Enter', 'Tab', 'Escape')\n */\n async pressKey(locator: Locator, key: string, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.press(key);\n }\n\n /**\n * Selects an option from a dropdown by value.\n * @param locator - The select element\n * @param value - The option value to select\n */\n async selectByValue(locator: Locator, value: string, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.selectOption({ value });\n }\n\n /**\n * Selects an option from a dropdown by visible text.\n * @param locator - The select element\n * @param text - The option text to select\n */\n async selectByText(locator: Locator, text: string, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.selectOption({ label: text });\n }\n\n /**\n * Selects an option from a dropdown by index.\n * @param locator - The select element\n * @param index - The option index to select (0-based)\n */\n async selectByIndex(locator: Locator, index: number, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.selectOption({ index });\n }\n\n /**\n * Selects multiple options from a multi-select dropdown.\n * @param locator - The select element\n * @param values - Array of option values to select\n */\n async selectMultiple(locator: Locator, values: string[], options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.selectOption(values);\n }\n\n /**\n * Checks a checkbox if it's not already checked.\n * @param locator - The checkbox element\n */\n async check(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.check({ force: options?.force });\n }\n\n /**\n * Unchecks a checkbox if it's currently checked.\n * @param locator - The checkbox element\n */\n async uncheck(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.uncheck({ force: options?.force });\n }\n\n /**\n * Sets a checkbox to a specific state.\n * @param locator - The checkbox element\n * @param checked - Whether the checkbox should be checked\n */\n async setChecked(locator: Locator, checked: boolean, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.setChecked(checked, { force: options?.force });\n }\n\n /**\n * Hovers over an element.\n * @param locator - The element to hover over\n */\n async hover(locator: Locator, options?: { force?: boolean; timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.hover({ force: options?.force });\n }\n\n /**\n * Focuses on an element.\n * @param locator - The element to focus\n */\n async focus(locator: Locator, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.focus();\n }\n\n /**\n * Hovers over one element and clicks another (for menus that appear on hover).\n * @param hoverLocator - The element to hover over\n * @param clickLocator - The element to click after hover\n */\n async hoverAndClick(\n hoverLocator: Locator,\n clickLocator: Locator,\n options?: { force?: boolean; timeout?: number }\n ): Promise<void> {\n await expect(hoverLocator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await hoverLocator.hover();\n await expect(clickLocator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await clickLocator.click({ force: options?.force });\n }\n\n /**\n * Waits for an element to be visible.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForVisible(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeVisible({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be hidden.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForHidden(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeHidden({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be attached to the DOM.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForAttached(locator: Locator, timeout?: number): Promise<void> {\n await locator.waitFor({ state: 'attached', timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be detached from the DOM.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForDetached(locator: Locator, timeout?: number): Promise<void> {\n await locator.waitFor({ state: 'detached', timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for the page to finish loading (network idle).\n */\n async waitForPageLoad(): Promise<void> {\n await this.page.waitForLoadState('networkidle');\n }\n\n /**\n * Waits for the DOM to be fully loaded.\n */\n async waitForDOMContentLoaded(): Promise<void> {\n await this.page.waitForLoadState('domcontentloaded');\n }\n\n /**\n * Waits for all network requests to complete.\n */\n async waitForLoadState(): Promise<void> {\n await this.page.waitForLoadState();\n }\n\n /**\n * Waits for an element to be enabled.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForEnabled(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeEnabled({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be disabled.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForDisabled(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeDisabled({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to contain specific text.\n * @param locator - The element to wait for\n * @param text - The text to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForText(locator: Locator, text: string, timeout?: number): Promise<void> {\n await expect(locator).toContainText(text, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an input to have a specific value.\n * @param locator - The input element to wait for\n * @param value - The value to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForValue(locator: Locator, value: string, timeout?: number): Promise<void> {\n await expect(locator).toHaveValue(value, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to have a specific attribute value.\n * @param locator - The element to wait for\n * @param name - The attribute name\n * @param value - The expected attribute value\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForAttribute(locator: Locator, name: string, value: string | RegExp, timeout?: number): Promise<void> {\n await expect(locator).toHaveAttribute(name, value, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to have a specific CSS class.\n * @param locator - The element to wait for\n * @param className - The CSS class to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForClass(locator: Locator, className: string | RegExp, timeout?: number): Promise<void> {\n await expect(locator).toHaveClass(className, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be editable.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForEditable(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeEditable({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be checked.\n * @param locator - The checkbox/radio element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForChecked(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeChecked({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be unchecked.\n * @param locator - The checkbox/radio element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForUnchecked(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).not.toBeChecked({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for a specific URL or URL pattern.\n * @param url - The URL string or regex pattern to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForURL(url: string | RegExp, timeout?: number): Promise<void> {\n await this.page.waitForURL(url, { timeout: timeout ?? 30000 });\n }\n\n /**\n * Waits for a navigation to complete.\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForNavigation(timeout?: number): Promise<void> {\n await this.page.waitForLoadState('load', { timeout: timeout ?? 30000 });\n }\n\n /**\n * Waits for a specific time (use sparingly, prefer explicit waits).\n * @param milliseconds - Time to wait in milliseconds\n */\n async waitForTimeout(milliseconds: number): Promise<void> {\n await this.page.waitForTimeout(milliseconds);\n }\n\n /**\n * Waits for a network request to a specific URL.\n * @param urlOrPredicate - URL string, regex, or predicate function\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForRequest(urlOrPredicate: string | RegExp | ((request: any) => boolean), timeout?: number): Promise<any> {\n return await this.page.waitForRequest(urlOrPredicate, { timeout: timeout ?? 30000 });\n }\n\n /**\n * Waits for a network response from a specific URL.\n * @param urlOrPredicate - URL string, regex, or predicate function\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForResponse(urlOrPredicate: string | RegExp | ((response: any) => boolean), timeout?: number): Promise<any> {\n return await this.page.waitForResponse(urlOrPredicate, { timeout: timeout ?? 30000 });\n }\n\n /**\n * Waits for an element to be focused.\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForFocused(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeFocused({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for an element to be empty (no text content).\n * @param locator - The element to wait for\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForEmpty(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeEmpty({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Waits for a function to return true.\n * @param predicate - Function that returns a boolean or Promise<boolean>\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForFunction(predicate: () => boolean | Promise<boolean>, timeout?: number): Promise<void> {\n await this.page.waitForFunction(predicate, { timeout: timeout ?? 30000 });\n }\n\n /**\n * Waits for an element to have a specific CSS property value.\n * @param locator - The element to wait for\n * @param property - The CSS property name\n * @param value - The expected CSS property value\n * @param timeout - Maximum time to wait in milliseconds\n */\n async waitForCSS(locator: Locator, property: string, value: string | RegExp, timeout?: number): Promise<void> {\n await expect(locator).toHaveCSS(property, value, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element is visible.\n * @param locator - The element to check\n * @param isVisible - Whether the element should be visible (default: true)\n */\n async isVisible(locator: Locator, isVisible: boolean = true, timeout?: number): Promise<void> {\n await expect(locator).toBeVisible({ visible: isVisible, timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element is enabled.\n * @param locator - The element to check\n */\n async isEnabled(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeEnabled({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element is disabled.\n * @param locator - The element to check\n */\n async isDisabled(locator: Locator, timeout?: number): Promise<void> {\n await expect(locator).toBeDisabled({ timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element contains specific text.\n * @param locator - The element to check\n * @param text - The text to look for\n */\n async containsText(locator: Locator, text: string, timeout?: number): Promise<void> {\n await expect(locator).toContainText(text, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element has specific text.\n * @param locator - The element to check\n * @param text - The exact text expected\n */\n async hasText(locator: Locator, text: string, timeout?: number): Promise<void> {\n await expect(locator).toHaveText(text, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an input has a specific value.\n * @param locator - The input element to check\n * @param value - The expected value\n */\n async hasValue(locator: Locator, value: string, timeout?: number): Promise<void> {\n await expect(locator).toHaveValue(value, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that an element has a specific attribute value.\n * @param locator - The element to check\n * @param name - The attribute name\n * @param value - The expected attribute value\n */\n async hasAttribute(locator: Locator, name: string, value: string, timeout?: number): Promise<void> {\n await expect(locator).toHaveAttribute(name, value, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Asserts that a specific number of elements exist.\n * @param locator - The locator to count\n * @param count - The expected count\n */\n async hasCount(locator: Locator, count: number, timeout?: number): Promise<void> {\n await expect(locator).toHaveCount(count, { timeout: timeout ?? 5000 });\n }\n\n /**\n * Gets the text content of an element.\n * @param locator - The element to get text from\n * @returns The text content\n */\n async getText(locator: Locator, options?: { timeout?: number }): Promise<string> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n return await locator.textContent() ?? '';\n }\n\n /**\n * Gets the value of an input element.\n * @param locator - The input element\n * @returns The input value\n */\n async getValue(locator: Locator, options?: { timeout?: number }): Promise<string> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n return await locator.inputValue();\n }\n\n /**\n * Gets an attribute value from an element.\n * @param locator - The element\n * @param attributeName - The attribute name\n * @returns The attribute value or null\n */\n async getAttribute(locator: Locator, attributeName: string, options?: { timeout?: number }): Promise<string | null> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n return await locator.getAttribute(attributeName);\n }\n\n /**\n * Checks if an element is currently visible.\n * @param locator - The element to check\n * @returns True if visible, false otherwise\n */\n async checkIsVisible(locator: Locator): Promise<boolean> {\n return await locator.isVisible();\n }\n\n /**\n * Checks if a checkbox is checked.\n * @param locator - The checkbox element\n * @returns True if checked, false otherwise\n */\n async isChecked(locator: Locator): Promise<boolean> {\n return await locator.isChecked();\n }\n\n /**\n * Scrolls an element into view.\n * @param locator - The element to scroll to\n */\n async scrollIntoView(locator: Locator, options?: { timeout?: number }): Promise<void> {\n await expect(locator).toBeVisible({ timeout: options?.timeout ?? 5000 });\n await locator.scrollIntoViewIfNeeded();\n }\n\n /**\n * Sets files on a file input element.\n * @param locator - The file input element\n * @param filePath - Path to the file(s) to set\n */\n async setInputFiles(locator: Locator, filePath: string | string[]): Promise<void> {\n await locator.setInputFiles(filePath);\n }\n\n /**\n * Clears files from a file input.\n * @param locator - The file input element\n */\n async clearInputFiles(locator: Locator): Promise<void> {\n await locator.setInputFiles([]);\n }\n\n /**\n * Drags an element and drops it on another element.\n * @param source - The element to drag\n * @param target - The element to drop on\n */\n async dragTo(\n source: Locator,\n target: Locator,\n options?: { sourcePosition?: { x: number; y: number }; targetPosition?: { x: number; y: number } }\n ): Promise<void> {\n await source.dragTo(target, options);\n }\n\n}\n"]}
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
export declare class ConstantHelper {
|
|
2
|
+
static readonly timeout: {
|
|
3
|
+
short: number;
|
|
4
|
+
medium: number;
|
|
5
|
+
long: number;
|
|
6
|
+
veryLong: number;
|
|
7
|
+
navigation: number;
|
|
8
|
+
pageLoad: number;
|
|
9
|
+
};
|
|
10
|
+
static readonly wait: {
|
|
11
|
+
minimal: number;
|
|
12
|
+
short: number;
|
|
13
|
+
medium: number;
|
|
14
|
+
long: number;
|
|
15
|
+
animation: number;
|
|
16
|
+
debounce: number;
|
|
17
|
+
networkIdle: number;
|
|
18
|
+
};
|
|
2
19
|
static readonly sections: {
|
|
3
20
|
content: string;
|
|
4
21
|
media: string;
|
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConstantHelper = void 0;
|
|
4
4
|
class ConstantHelper {
|
|
5
|
+
static timeout = {
|
|
6
|
+
short: 1000,
|
|
7
|
+
medium: 5000,
|
|
8
|
+
long: 10000,
|
|
9
|
+
veryLong: 30000,
|
|
10
|
+
navigation: 30000,
|
|
11
|
+
pageLoad: 60000
|
|
12
|
+
};
|
|
13
|
+
static wait = {
|
|
14
|
+
minimal: 100,
|
|
15
|
+
short: 500,
|
|
16
|
+
medium: 1000,
|
|
17
|
+
long: 2000,
|
|
18
|
+
animation: 300,
|
|
19
|
+
debounce: 400,
|
|
20
|
+
networkIdle: 5000
|
|
21
|
+
};
|
|
5
22
|
static sections = {
|
|
6
23
|
content: "Content",
|
|
7
24
|
media: "Media",
|