@civitas-cerebrum/element-interactions 0.1.1

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.
@@ -0,0 +1,576 @@
1
+ import { Page, Response } from '@playwright/test';
2
+ import { ElementRepository } from '@civitas-cerebrum/element-repository';
3
+ import { EmailCredentials, EmailSendOptions, EmailReceiveOptions, ReceivedEmail, EmailMarkAction, EmailFilter } from '@civitas-cerebrum/email-client';
4
+ import { DropdownSelectOptions, TextVerifyOptions, CountVerifyOptions, DragAndDropOptions, ListedElementMatch, VerifyListedOptions, GetListedDataOptions, FillFormValue, GetAllOptions, ScreenshotOptions } from '../enum/Options';
5
+ /**
6
+ * The `Steps` class serves as a unified Facade for test orchestration.
7
+ * It combines element acquisition (via `@civitas-cerebrum/element-repository`) with
8
+ * Playwright interactions, navigation, and verifications to keep test files clean,
9
+ * readable, and free of raw locators.
10
+ */
11
+ export declare class Steps {
12
+ private page;
13
+ private repo;
14
+ private interact;
15
+ private navigate;
16
+ private extract;
17
+ private verify;
18
+ private utils;
19
+ private email;
20
+ /**
21
+ * Initializes the Steps class with the required Playwright page and element repository.
22
+ * @param page - The current Playwright Page object.
23
+ * @param repo - An initialized instance of `ElementRepository` containing your locators.
24
+ * @param timeout - Optional global timeout override (in milliseconds).
25
+ * @param emailCredentials - Optional email credentials to enable the email sub-API.
26
+ */
27
+ constructor(page: Page, repo: ElementRepository, timeout?: number, emailCredentials?: EmailCredentials);
28
+ /**
29
+ * Navigates the browser to the specified URL.
30
+ * @param url - The URL or path to navigate to (e.g. `'/dashboard'` or `'https://example.com'`).
31
+ */
32
+ navigateTo(url: string): Promise<void>;
33
+ /**
34
+ * Refreshes (reloads) the current page.
35
+ */
36
+ refresh(): Promise<void>;
37
+ /**
38
+ * Navigates the browser history backwards or forwards.
39
+ * @param direction - The direction to navigate: `'back'` or `'forward'`.
40
+ */
41
+ backOrForward(direction: 'back' | 'forward'): Promise<void>;
42
+ /**
43
+ * Sets the browser viewport to the specified dimensions.
44
+ * @param width - The viewport width in pixels.
45
+ * @param height - The viewport height in pixels.
46
+ */
47
+ setViewport(width: number, height: number): Promise<void>;
48
+ /**
49
+ * Executes an action that opens a new browser tab/window, waits for it to load,
50
+ * and returns the new Page object.
51
+ * @param action - An async function that triggers the new tab (e.g. a click).
52
+ * @returns The newly opened Page object.
53
+ */
54
+ switchToNewTab(action: () => Promise<void>): Promise<Page>;
55
+ /**
56
+ * Closes the specified tab (or the current page's tab) and returns the remaining page.
57
+ * @param targetPage - The page to close. Defaults to the current page.
58
+ * @returns The page that received focus after closing.
59
+ */
60
+ closeTab(targetPage?: Page): Promise<Page>;
61
+ /**
62
+ * Returns the number of open tabs/pages in the current browser context.
63
+ * @returns The count of open pages.
64
+ */
65
+ getTabCount(): number;
66
+ /**
67
+ * Clicks on an element identified by page and element name from the repository.
68
+ * The element is scrolled into view before clicking.
69
+ * @param pageName - The page name as defined in `page-repository.json`.
70
+ * @param elementName - The element name as defined under the given page.
71
+ */
72
+ click(pageName: string, elementName: string): Promise<void>;
73
+ /**
74
+ * Clicks on an element without scrolling it into view first.
75
+ * Useful for elements in fixed or sticky positions (e.g. headers, floating buttons).
76
+ * @param pageName - The page name as defined in `page-repository.json`.
77
+ * @param elementName - The element name as defined under the given page.
78
+ */
79
+ clickWithoutScrolling(pageName: string, elementName: string): Promise<void>;
80
+ /**
81
+ * Clicks a random visible element from a group of elements matching the locator.
82
+ * Useful for lists, grids, or repeated components where any item is acceptable.
83
+ * @param pageName - The page name as defined in `page-repository.json`.
84
+ * @param elementName - The element name as defined under the given page.
85
+ * @throws Error if no visible element is found for the given locator.
86
+ */
87
+ clickRandom(pageName: string, elementName: string): Promise<void>;
88
+ /**
89
+ * Clicks on an element only if it is present in the DOM.
90
+ * Does nothing if the element is not found — no error is thrown.
91
+ * Useful for dismissing optional modals, banners, or cookie notices.
92
+ * @param pageName - The page name as defined in `page-repository.json`.
93
+ * @param elementName - The element name as defined under the given page.
94
+ */
95
+ clickIfPresent(pageName: string, elementName: string): Promise<boolean>;
96
+ /**
97
+ * Right-clicks on an element identified by page and element name from the repository.
98
+ * Triggers the browser's context menu event on the element.
99
+ * @param pageName - The page name as defined in `page-repository.json`.
100
+ * @param elementName - The element name as defined under the given page.
101
+ */
102
+ rightClick(pageName: string, elementName: string): Promise<void>;
103
+ /**
104
+ * Double-clicks on an element identified by page and element name from the repository.
105
+ * @param pageName - The page name as defined in `page-repository.json`.
106
+ * @param elementName - The element name as defined under the given page.
107
+ */
108
+ doubleClick(pageName: string, elementName: string): Promise<void>;
109
+ /**
110
+ * Checks a checkbox or radio button. Idempotent — does nothing if already checked.
111
+ * @param pageName - The page name as defined in `page-repository.json`.
112
+ * @param elementName - The element name as defined under the given page.
113
+ */
114
+ check(pageName: string, elementName: string): Promise<void>;
115
+ /**
116
+ * Unchecks a checkbox. Idempotent — does nothing if already unchecked.
117
+ * @param pageName - The page name as defined in `page-repository.json`.
118
+ * @param elementName - The element name as defined under the given page.
119
+ */
120
+ uncheck(pageName: string, elementName: string): Promise<void>;
121
+ /**
122
+ * Hovers over an element, triggering any hover-based UI effects (tooltips, menus, etc.).
123
+ * @param pageName - The page name as defined in `page-repository.json`.
124
+ * @param elementName - The element name as defined under the given page.
125
+ */
126
+ hover(pageName: string, elementName: string): Promise<void>;
127
+ /**
128
+ * Scrolls the specified element into the visible viewport.
129
+ * @param pageName - The page name as defined in `page-repository.json`.
130
+ * @param elementName - The element name as defined under the given page.
131
+ */
132
+ scrollIntoView(pageName: string, elementName: string): Promise<void>;
133
+ /**
134
+ * Clears the input field and fills it with the specified text.
135
+ * @param pageName - The page name as defined in `page-repository.json`.
136
+ * @param elementName - The element name as defined under the given page.
137
+ * @param text - The text to fill into the input field.
138
+ */
139
+ fill(pageName: string, elementName: string, text: string): Promise<void>;
140
+ /**
141
+ * Uploads a file to a file input element.
142
+ * @param pageName - The page name as defined in `page-repository.json`.
143
+ * @param elementName - The element name as defined under the given page.
144
+ * @param filePath - The path to the file to upload (e.g. `'tests/fixtures/file.pdf'`).
145
+ */
146
+ uploadFile(pageName: string, elementName: string, filePath: string): Promise<void>;
147
+ /**
148
+ * Selects an option from a `<select>` dropdown element.
149
+ * By default, a random option is selected. Use the `options` parameter
150
+ * to select by value, index, or explicitly random.
151
+ * @param pageName - The page name as defined in `page-repository.json`.
152
+ * @param elementName - The element name as defined under the given page.
153
+ * @param options - Optional selection strategy (random, by value, or by index).
154
+ * @returns The value of the selected option.
155
+ */
156
+ selectDropdown(pageName: string, elementName: string, options?: DropdownSelectOptions): Promise<string>;
157
+ /**
158
+ * Performs a drag-and-drop action on an element.
159
+ * The target can be specified as another locator or as x/y pixel offsets.
160
+ * @param pageName - The page name as defined in `page-repository.json`.
161
+ * @param elementName - The element name as defined under the given page.
162
+ * @param options - Drag target: either `{ target: Locator }` or `{ xOffset, yOffset }`.
163
+ */
164
+ dragAndDrop(pageName: string, elementName: string, options: DragAndDropOptions): Promise<void>;
165
+ /**
166
+ * Performs a drag-and-drop action on a specific element within a list,
167
+ * identified by its visible text content.
168
+ * @param pageName - The page name as defined in `page-repository.json`.
169
+ * @param elementName - The element name as defined under the given page.
170
+ * @param elementText - The visible text of the specific list item to drag.
171
+ * @param options - Drag target: either `{ target: Locator }` or `{ xOffset, yOffset }`.
172
+ * @throws Error if no element with the specified text is found.
173
+ */
174
+ dragAndDropListedElement(pageName: string, elementName: string, elementText: string, options: DragAndDropOptions): Promise<void>;
175
+ /**
176
+ * Sets the value of a range/slider input element.
177
+ * @param pageName - The page name as defined in `page-repository.json`.
178
+ * @param elementName - The element name as defined under the given page.
179
+ * @param value - The numeric value to set on the slider.
180
+ */
181
+ setSliderValue(pageName: string, elementName: string, value: number): Promise<void>;
182
+ /**
183
+ * Presses a keyboard key at the page level (not bound to a specific element).
184
+ * Useful for keyboard shortcuts like Escape, Enter, Tab, or combos like 'Control+A'.
185
+ * @param key - The key to press (e.g. `'Escape'`, `'Enter'`, `'Tab'`, `'Control+A'`).
186
+ */
187
+ pressKey(key: string): Promise<void>;
188
+ /**
189
+ * Retrieves the visible text content of an element.
190
+ * @param pageName - The page name as defined in `page-repository.json`.
191
+ * @param elementName - The element name as defined under the given page.
192
+ * @returns The text content of the element, or `null` if unavailable.
193
+ */
194
+ getText(pageName: string, elementName: string): Promise<string | null>;
195
+ /**
196
+ * Retrieves the value of a specific HTML attribute from an element.
197
+ * @param pageName - The page name as defined in `page-repository.json`.
198
+ * @param elementName - The element name as defined under the given page.
199
+ * @param attributeName - The name of the attribute to retrieve (e.g. `'href'`, `'src'`, `'data-id'`).
200
+ * @returns The attribute value, or `null` if the attribute does not exist.
201
+ */
202
+ getAttribute(pageName: string, elementName: string, attributeName: string): Promise<string | null>;
203
+ /**
204
+ * Asserts that the element is present and visible in the DOM.
205
+ * @param pageName - The page name as defined in `page-repository.json`.
206
+ * @param elementName - The element name as defined under the given page.
207
+ */
208
+ verifyPresence(pageName: string, elementName: string): Promise<void>;
209
+ /**
210
+ * Asserts that the element is not present in the DOM.
211
+ * Uses the raw selector string rather than a locator to avoid waiting for an element that should not exist.
212
+ * @param pageName - The page name as defined in `page-repository.json`.
213
+ * @param elementName - The element name as defined under the given page.
214
+ */
215
+ verifyAbsence(pageName: string, elementName: string): Promise<void>;
216
+ /**
217
+ * Asserts that an element's text content matches the expected value.
218
+ * Can also verify that the text is simply not empty.
219
+ * @param pageName - The page name as defined in `page-repository.json`.
220
+ * @param elementName - The element name as defined under the given page.
221
+ * @param expectedText - The exact text to match against. Omit when using `{ notEmpty: true }`.
222
+ * @param options - Optional verification options (e.g. `{ notEmpty: true }` to only check non-emptiness).
223
+ */
224
+ verifyText(pageName: string, elementName: string, expectedText?: string, options?: TextVerifyOptions): Promise<void>;
225
+ /**
226
+ * Asserts the number of elements matching the locator satisfies the given condition.
227
+ * Supports exact count, greaterThan, and lessThan comparisons.
228
+ * @param pageName - The page name as defined in `page-repository.json`.
229
+ * @param elementName - The element name as defined under the given page.
230
+ * @param options - Count condition: `{ exact: number }`, `{ greaterThan: number }`, or `{ lessThan: number }`.
231
+ */
232
+ verifyCount(pageName: string, elementName: string, options: CountVerifyOptions): Promise<void>;
233
+ /**
234
+ * Asserts that all image elements matching the locator have loaded successfully
235
+ * (i.e. their `naturalWidth` is greater than 0).
236
+ * @param pageName - The page name as defined in `page-repository.json`.
237
+ * @param elementName - The element name as defined under the given page.
238
+ * @param scroll - Whether to scroll each image into view before checking. Defaults to `true`.
239
+ */
240
+ verifyImages(pageName: string, elementName: string, scroll?: boolean): Promise<void>;
241
+ /**
242
+ * Asserts that an element's text content contains the specified substring.
243
+ * @param pageName - The page name as defined in `page-repository.json`.
244
+ * @param elementName - The element name as defined under the given page.
245
+ * @param expectedText - The substring expected to be found within the element's text.
246
+ */
247
+ verifyTextContains(pageName: string, elementName: string, expectedText: string): Promise<void>;
248
+ /**
249
+ * Asserts that an element is in the specified state.
250
+ * @param pageName - The page name as defined in `page-repository.json`.
251
+ * @param elementName - The element name as defined under the given page.
252
+ * @param state - The expected state: `'enabled'`, `'disabled'`, `'editable'`, `'checked'`,
253
+ * `'focused'`, `'visible'`, `'hidden'`, `'attached'`, or `'inViewport'`.
254
+ * @param timeout - Optional timeout in milliseconds, overrides the default ELEMENT_TIMEOUT.
255
+ */
256
+ verifyState(pageName: string, elementName: string, state: 'enabled' | 'disabled' | 'editable' | 'checked' | 'focused' | 'visible' | 'hidden' | 'attached' | 'inViewport', timeout?: number): Promise<void>;
257
+ /**
258
+ * Asserts that an element has a specific HTML attribute with the expected value.
259
+ * @param pageName - The page name as defined in `page-repository.json`.
260
+ * @param elementName - The element name as defined under the given page.
261
+ * @param attributeName - The name of the HTML attribute to check (e.g. `'class'`, `'href'`, `'data-status'`).
262
+ * @param expectedValue - The expected value of the attribute.
263
+ */
264
+ verifyAttribute(pageName: string, elementName: string, attributeName: string, expectedValue: string): Promise<void>;
265
+ /**
266
+ * Asserts that the current page URL contains the specified substring.
267
+ * Useful for verifying navigation outcomes without matching the full URL.
268
+ * @param text - The substring expected to be found in the current URL (e.g. `'/dashboard'`).
269
+ */
270
+ verifyUrlContains(text: string): Promise<void>;
271
+ /**
272
+ * Asserts that an input, textarea, or select element has the expected value.
273
+ * Unlike `verifyText` which checks `textContent`, this checks the `value` property.
274
+ * @param pageName - The page name as defined in `page-repository.json`.
275
+ * @param elementName - The element name as defined under the given page.
276
+ * @param expectedValue - The expected value of the input.
277
+ */
278
+ verifyInputValue(pageName: string, elementName: string, expectedValue: string): Promise<void>;
279
+ /**
280
+ * Asserts the number of open browser tabs/pages matches the expected count.
281
+ * @param expectedCount - The expected number of open tabs.
282
+ */
283
+ verifyTabCount(expectedCount: number): Promise<void>;
284
+ /**
285
+ * Clicks a specific element within a list (e.g. a table row, card, or list item)
286
+ * identified by its visible text or an HTML attribute. Optionally drills into a
287
+ * child element before clicking.
288
+ *
289
+ * The base locator is resolved from the repository using `pageName` and `elementName`,
290
+ * then filtered using the criteria in `options` to find the exact match.
291
+ *
292
+ * @param pageName - The page name as defined in `page-repository.json`.
293
+ * @param elementName - The element name as defined under the given page (should resolve to a list of elements).
294
+ * @param options - Match criteria: provide `text` to match by visible text, or `attribute` to match by an HTML
295
+ * attribute name-value pair. Optionally include `child` (a CSS selector string or a `{ pageName, elementName }`
296
+ * page-repository reference) to target a sub-element within the matched item.
297
+ * @throws Error if neither `text` nor `attribute` is provided, or if no matching element is found.
298
+ */
299
+ clickListedElement(pageName: string, elementName: string, options: ListedElementMatch): Promise<void>;
300
+ /**
301
+ * Verifies a specific element within a list by checking its text content or an HTML attribute.
302
+ * The element is first located by matching visible text or an attribute from the list,
303
+ * then the assertion is performed on the resolved (and optionally child-targeted) element.
304
+ *
305
+ * Verification behavior is determined by the `options` fields:
306
+ * - `expectedText` — asserts that the resolved element's text content matches this value.
307
+ * - `expected` — asserts that the resolved element has the specified attribute name-value pair.
308
+ * - If neither is provided, the method asserts that the matched element is visible.
309
+ *
310
+ * @param pageName - The page name as defined in `page-repository.json`.
311
+ * @param elementName - The element name as defined under the given page (should resolve to a list of elements).
312
+ * @param options - Match and assertion criteria. Must include `text` or `attribute` for identification.
313
+ * Optionally include `child` to drill into a sub-element, and `expectedText` or `expected` for the assertion.
314
+ * @throws Error if neither `text` nor `attribute` is provided, if the element is not found,
315
+ * or if the assertion fails.
316
+ */
317
+ verifyListedElement(pageName: string, elementName: string, options: VerifyListedOptions): Promise<void>;
318
+ /**
319
+ * Extracts data from a specific element within a list — either its text content
320
+ * or the value of a specified HTML attribute.
321
+ *
322
+ * The element is first located by matching visible text or an attribute from the list,
323
+ * then data is extracted from the resolved (and optionally child-targeted) element.
324
+ *
325
+ * @param pageName - The page name as defined in `page-repository.json`.
326
+ * @param elementName - The element name as defined under the given page (should resolve to a list of elements).
327
+ * @param options - Match and extraction criteria. Must include `text` or `attribute` for identification.
328
+ * Optionally include `child` to drill into a sub-element. If `extractAttribute` is set, that attribute's
329
+ * value is returned; otherwise the element's text content is returned.
330
+ * @returns The extracted text content or attribute value, or `null` if unavailable.
331
+ * @throws Error if neither `text` nor `attribute` is provided, or if the element is not found.
332
+ */
333
+ getListedElementData(pageName: string, elementName: string, options: GetListedDataOptions): Promise<string | null>;
334
+ /**
335
+ * Waits for an element to reach the specified state before proceeding.
336
+ * Useful for synchronizing tests with dynamic page content.
337
+ * @param pageName - The page name as defined in `page-repository.json`.
338
+ * @param elementName - The element name as defined under the given page.
339
+ * @param state - The desired state to wait for: `'visible'` (default), `'attached'`, `'hidden'`, or `'detached'`.
340
+ */
341
+ waitForState(pageName: string, elementName: string, state?: 'visible' | 'attached' | 'hidden' | 'detached'): Promise<void>;
342
+ /**
343
+ * Types text into an input field one character at a time with a delay between keystrokes.
344
+ * Useful for inputs with debounced search, autocomplete, or real-time validation
345
+ * that require realistic keystroke timing.
346
+ * @param pageName - The page name as defined in `page-repository.json`.
347
+ * @param elementName - The element name as defined under the given page.
348
+ * @param text - The text to type character by character.
349
+ * @param delay - The delay in milliseconds between each keystroke. Defaults to `100`.
350
+ */
351
+ typeSequentially(pageName: string, elementName: string, text: string, delay?: number): Promise<void>;
352
+ /**
353
+ * Fills multiple form fields on the same page in a single call.
354
+ * Each key in the `fields` map is an `elementName` from the repository.
355
+ * String values are filled into text inputs; `DropdownSelectOptions` values
356
+ * trigger a dropdown selection.
357
+ *
358
+ * @param pageName - The page name as defined in `page-repository.json`.
359
+ * @param fields - A map of `elementName` → value. Use a string for text inputs
360
+ * or a `DropdownSelectOptions` object for `<select>` elements.
361
+ *
362
+ * @example
363
+ * ```ts
364
+ * await steps.fillForm('FormsPage', {
365
+ * nameInput: 'John Doe',
366
+ * emailInput: 'john@example.com',
367
+ * genderDropdown: { type: DropdownSelectType.VALUE, value: 'male' }
368
+ * });
369
+ * ```
370
+ */
371
+ fillForm(pageName: string, fields: Record<string, FillFormValue>): Promise<void>;
372
+ /**
373
+ * Waits until there are no in-flight network requests for at least 500ms.
374
+ * Useful after actions that trigger background API calls, lazy loading, or analytics.
375
+ */
376
+ waitForNetworkIdle(): Promise<void>;
377
+ /**
378
+ * Executes an action and waits for a matching network response to complete.
379
+ * The response is captured concurrently with the action to avoid race conditions.
380
+ * @param urlPattern - A string substring or RegExp to match against the response URL.
381
+ * @param action - An async function that triggers the network request (e.g. a form submit or click).
382
+ * @returns The captured Playwright Response object.
383
+ */
384
+ waitForResponse(urlPattern: string | RegExp, action: () => Promise<void>): Promise<Response>;
385
+ /**
386
+ * Retries an action until a verification passes, or until the maximum number of
387
+ * attempts is reached. Useful for interactions with elements that may take multiple
388
+ * attempts to succeed (e.g. flaky modals, race conditions with animations).
389
+ *
390
+ * @param action - An async function performing the interaction (e.g. a click).
391
+ * @param verification - An async function performing the assertion. Must throw on failure.
392
+ * @param maxRetries - Maximum number of retry attempts. Defaults to `3`.
393
+ * @param delayMs - Milliseconds to wait between retry attempts. Defaults to `1000`.
394
+ * @throws The last verification error if all retries are exhausted.
395
+ */
396
+ retryUntil(action: () => Promise<void>, verification: () => Promise<void>, maxRetries?: number, delayMs?: number): Promise<void>;
397
+ /**
398
+ * Clears the value of an input or textarea element without filling it with new text.
399
+ * @param pageName - The page name as defined in `page-repository.json`.
400
+ * @param elementName - The element name as defined under the given page.
401
+ */
402
+ clearInput(pageName: string, elementName: string): Promise<void>;
403
+ /**
404
+ * Selects multiple options from a `<select multiple>` element by their `value` attributes.
405
+ * @param pageName - The page name as defined in `page-repository.json`.
406
+ * @param elementName - The element name as defined under the given page.
407
+ * @param values - An array of `value` attribute strings to select simultaneously.
408
+ * @returns An array of the actually selected `value` strings.
409
+ */
410
+ selectMultiple(pageName: string, elementName: string, values: string[]): Promise<string[]>;
411
+ /**
412
+ * Waits for an element to reach a specific state, then clicks it.
413
+ * Useful when an element exists in the DOM but is not yet interactive
414
+ * (e.g. waiting for `'attached'` before clicking a lazily rendered button).
415
+ * @param pageName - The page name as defined in `page-repository.json`.
416
+ * @param elementName - The element name as defined under the given page.
417
+ * @param state - The state to wait for before clicking. Defaults to `'visible'`.
418
+ */
419
+ waitAndClick(pageName: string, elementName: string, state?: 'visible' | 'attached' | 'hidden' | 'detached'): Promise<void>;
420
+ /**
421
+ * Clicks the element at a specific zero-based index from all elements matching the locator.
422
+ * Use this when elements cannot be distinguished by text or attributes and index is
423
+ * the only reliable identifier.
424
+ * @param pageName - The page name as defined in `page-repository.json`.
425
+ * @param elementName - The element name as defined under the given page.
426
+ * @param index - The zero-based index of the element to click.
427
+ * @throws Error if no element exists at the specified index.
428
+ */
429
+ clickNth(pageName: string, elementName: string, index: number): Promise<void>;
430
+ /**
431
+ * Extracts text content or attribute values from all elements matching the locator.
432
+ * Optionally drills into a child element within each match before extracting.
433
+ *
434
+ * @param pageName - The page name as defined in `page-repository.json`.
435
+ * @param elementName - The element name as defined under the given page.
436
+ * @param options - Optional extraction configuration. Use `child` to drill into a sub-element,
437
+ * and `extractAttribute` to extract an attribute instead of text content.
438
+ * @returns An array of extracted strings. Null attribute values are filtered out.
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * // Get all name-column texts from table rows
443
+ * const names = await steps.getAll('TablePage', 'rows', { child: 'td:nth-child(2)' });
444
+ *
445
+ * // Get all href attributes from links
446
+ * const hrefs = await steps.getAll('LinksPage', 'links', { extractAttribute: 'href' });
447
+ * ```
448
+ */
449
+ getAll(pageName: string, elementName: string, options?: GetAllOptions): Promise<string[]>;
450
+ /**
451
+ * Returns the number of DOM elements matching the locator.
452
+ * Unlike `verifyCount` which asserts, this returns the count for use in test logic.
453
+ * @param pageName - The page name as defined in `page-repository.json`.
454
+ * @param elementName - The element name as defined under the given page.
455
+ * @returns The count of matching elements.
456
+ */
457
+ getCount(pageName: string, elementName: string): Promise<number>;
458
+ /**
459
+ * Retrieves the current value of an input, textarea, or select element.
460
+ * Unlike `getText` which reads `textContent`, this reads the `value` property.
461
+ * @param pageName - The page name as defined in `page-repository.json`.
462
+ * @param elementName - The element name as defined under the given page.
463
+ * @returns The current value of the input.
464
+ */
465
+ getInputValue(pageName: string, elementName: string): Promise<string>;
466
+ /**
467
+ * Retrieves a computed CSS property value from an element.
468
+ * @param pageName - The page name as defined in `page-repository.json`.
469
+ * @param elementName - The element name as defined under the given page.
470
+ * @param property - The CSS property name (e.g. `'color'`, `'font-size'`, `'display'`).
471
+ * @returns The computed value as a string (e.g. `'rgb(255, 0, 0)'`, `'16px'`, `'block'`).
472
+ */
473
+ getCssProperty(pageName: string, elementName: string, property: string): Promise<string>;
474
+ /**
475
+ * Asserts that the text contents of all elements matching the locator appear
476
+ * in the exact order specified. Each element's text is compared against the
477
+ * corresponding entry in the array.
478
+ * @param pageName - The page name as defined in `page-repository.json`.
479
+ * @param elementName - The element name as defined under the given page.
480
+ * @param expectedTexts - The expected text values in their expected order.
481
+ */
482
+ verifyOrder(pageName: string, elementName: string, expectedTexts: string[]): Promise<void>;
483
+ /**
484
+ * Asserts that a computed CSS property of an element matches the expected value.
485
+ * Values are in their computed form (e.g. `'rgb(255, 0, 0)'` not `'red'`).
486
+ * @param pageName - The page name as defined in `page-repository.json`.
487
+ * @param elementName - The element name as defined under the given page.
488
+ * @param property - The CSS property name (e.g. `'color'`, `'font-size'`, `'display'`).
489
+ * @param expectedValue - The expected computed value.
490
+ */
491
+ verifyCssProperty(pageName: string, elementName: string, property: string, expectedValue: string): Promise<void>;
492
+ /**
493
+ * Asserts that the text contents of all elements matching the locator are sorted
494
+ * in the specified direction using locale-aware string comparison.
495
+ * @param pageName - The page name as defined in `page-repository.json`.
496
+ * @param elementName - The element name as defined under the given page.
497
+ * @param direction - `'asc'` for ascending (A→Z) or `'desc'` for descending (Z→A).
498
+ */
499
+ verifyListOrder(pageName: string, elementName: string, direction: 'asc' | 'desc'): Promise<void>;
500
+ /**
501
+ * Captures a screenshot of the full page or a specific element.
502
+ *
503
+ * @param pageNameOrOptions - Either a page name string (for element screenshots)
504
+ * or `ScreenshotOptions` (for page screenshots), or omitted entirely for a default page screenshot.
505
+ * @param elementName - The element name (required when first arg is a page name).
506
+ * @param options - Optional screenshot configuration.
507
+ * @returns The screenshot image as a Buffer.
508
+ *
509
+ * @example
510
+ * ```ts
511
+ * // Full page screenshot
512
+ * await steps.screenshot();
513
+ * await steps.screenshot({ fullPage: true, path: 'full-page.png' });
514
+ *
515
+ * // Element screenshot
516
+ * await steps.screenshot('PageName', 'elementName');
517
+ * await steps.screenshot('PageName', 'elementName', { path: 'element.png' });
518
+ * ```
519
+ */
520
+ screenshot(pageNameOrOptions?: string | ScreenshotOptions, elementName?: string, options?: ScreenshotOptions): Promise<Buffer>;
521
+ /**
522
+ * Sends an email using the configured SMTP credentials.
523
+ * @param options - The email configuration (to, subject, text, html, or htmlFile).
524
+ */
525
+ sendEmail(options: EmailSendOptions): Promise<void>;
526
+ /**
527
+ * Polls the inbox and returns the latest email matching the provided filters.
528
+ * @param options - The receive options, including mandatory filters.
529
+ * @returns The matched email, including its downloaded file path and content.
530
+ */
531
+ receiveEmail(options: EmailReceiveOptions): Promise<ReceivedEmail>;
532
+ /**
533
+ * Polls the inbox and returns all emails matching the provided filters.
534
+ * @param options - The receive options, including mandatory filters.
535
+ * @returns An array of matched emails.
536
+ */
537
+ receiveAllEmails(options: EmailReceiveOptions): Promise<ReceivedEmail[]>;
538
+ /**
539
+ * Deletes emails from the inbox. If filters are provided, only matching emails are deleted.
540
+ * Otherwise, the entire inbox is cleared.
541
+ * @param options - Optional receive options containing filters to target specific emails.
542
+ */
543
+ cleanEmails(options?: EmailReceiveOptions): Promise<number>;
544
+ /**
545
+ * Marks emails in the mailbox with a specific action (READ, UNREAD, FLAGGED, UNFLAGGED, or ARCHIVED).
546
+ * @param action - The marking action to apply (e.g., EmailMarkAction.READ, EmailMarkAction.FLAGGED, etc.).
547
+ * @param options - Optional options to target specific emails with filters.
548
+ * @returns The number of emails successfully marked.
549
+ *
550
+ * @example
551
+ * ```ts
552
+ * // Mark all OTP emails as read
553
+ * await steps.markEmail('markEmailsAsRead', EmailMarkAction.READ, {
554
+ * filters: [{ type: EmailFilterType.SUBJECT, value: 'OTP' }]
555
+ * });
556
+ *
557
+ * // Mark all emails as unread
558
+ * await steps.markEmail('markEmailsAsUnread', EmailMarkAction.UNREAD);
559
+ *
560
+ * // Mark specific emails as flagged
561
+ * await steps.markEmail('flagImportantEmails', EmailMarkAction.FLAGGED, {
562
+ * filters: [{ type: EmailFilterType.FROM, value: 'noreply@example.com' }]
563
+ * });
564
+ *
565
+ * // Archive emails matching a filter
566
+ * await steps.markEmail('archiveEmails', EmailMarkAction.ARCHIVED, {
567
+ * filters: [{ type: EmailFilterType.SUBJECT, value: 'Report' }]
568
+ * });
569
+ * ```
570
+ */
571
+ markEmail(action: EmailMarkAction | string[], options?: {
572
+ filters?: EmailFilter[];
573
+ folder?: string;
574
+ archiveFolder?: string;
575
+ }): Promise<number>;
576
+ }