playwright-cucumber-ts-steps 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +270 -244
  2. package/dist/backend/actions/formTable.js +34 -0
  3. package/dist/backend/actions/index.js +5 -0
  4. package/dist/backend/actions/interactions.js +23 -0
  5. package/dist/backend/actions/navigation.js +19 -0
  6. package/dist/backend/api/assertions.js +26 -0
  7. package/dist/backend/api/index.js +5 -0
  8. package/dist/backend/api/mock.js +75 -0
  9. package/dist/backend/api/requests.js +86 -0
  10. package/dist/backend/api/state.js +15 -0
  11. package/dist/backend/assertions/expectVisible.js +8 -0
  12. package/dist/backend/assertions/index.js +5 -0
  13. package/dist/backend/assertions/pageState.js +25 -0
  14. package/dist/backend/assertions/text.js +20 -0
  15. package/dist/backend/assertions/visibility.js +20 -0
  16. package/dist/backend/auth/index.js +71 -0
  17. package/dist/backend/db/index.js +6 -0
  18. package/dist/backend/db/state.js +24 -0
  19. package/dist/backend/db/steps.js +43 -0
  20. package/dist/backend/elements/alerts.js +21 -0
  21. package/dist/backend/elements/forms.js +59 -0
  22. package/dist/backend/elements/frames.js +25 -0
  23. package/dist/backend/elements/index.js +5 -0
  24. package/dist/core/registry.js +20 -0
  25. package/dist/core/runner.js +151 -0
  26. package/dist/index.js +10 -0
  27. package/dist/reporting/index.js +43 -0
  28. package/package.json +19 -101
  29. package/LICENSE +0 -21
  30. package/lib/actions/clickSteps.d.ts +0 -251
  31. package/lib/actions/clickSteps.js +0 -415
  32. package/lib/actions/cookieSteps.d.ts +0 -18
  33. package/lib/actions/cookieSteps.js +0 -93
  34. package/lib/actions/debugSteps.d.ts +0 -14
  35. package/lib/actions/debugSteps.js +0 -23
  36. package/lib/actions/elementFindSteps.d.ts +0 -668
  37. package/lib/actions/elementFindSteps.js +0 -931
  38. package/lib/actions/fillFormSteps.d.ts +0 -69
  39. package/lib/actions/fillFormSteps.js +0 -237
  40. package/lib/actions/index.d.ts +0 -11
  41. package/lib/actions/index.js +0 -28
  42. package/lib/actions/inputSteps.d.ts +0 -218
  43. package/lib/actions/inputSteps.js +0 -343
  44. package/lib/actions/interceptionSteps.d.ts +0 -169
  45. package/lib/actions/interceptionSteps.js +0 -291
  46. package/lib/actions/miscSteps.d.ts +0 -645
  47. package/lib/actions/miscSteps.js +0 -1061
  48. package/lib/actions/mouseSteps.d.ts +0 -143
  49. package/lib/actions/mouseSteps.js +0 -234
  50. package/lib/actions/scrollSteps.d.ts +0 -82
  51. package/lib/actions/scrollSteps.js +0 -123
  52. package/lib/actions/storageSteps.d.ts +0 -174
  53. package/lib/actions/storageSteps.js +0 -292
  54. package/lib/assertions/buttonAndTextVisibilitySteps.d.ts +0 -245
  55. package/lib/assertions/buttonAndTextVisibilitySteps.js +0 -401
  56. package/lib/assertions/cookieSteps.d.ts +0 -75
  57. package/lib/assertions/cookieSteps.js +0 -113
  58. package/lib/assertions/elementSteps.d.ts +0 -264
  59. package/lib/assertions/elementSteps.js +0 -388
  60. package/lib/assertions/formInputSteps.d.ts +0 -248
  61. package/lib/assertions/formInputSteps.js +0 -350
  62. package/lib/assertions/index.d.ts +0 -10
  63. package/lib/assertions/index.js +0 -27
  64. package/lib/assertions/interceptionRequestsSteps.d.ts +0 -353
  65. package/lib/assertions/interceptionRequestsSteps.js +0 -593
  66. package/lib/assertions/locationSteps.d.ts +0 -217
  67. package/lib/assertions/locationSteps.js +0 -310
  68. package/lib/assertions/roleTestIdSteps.d.ts +0 -159
  69. package/lib/assertions/roleTestIdSteps.js +0 -221
  70. package/lib/assertions/semanticSteps.d.ts +0 -176
  71. package/lib/assertions/semanticSteps.js +0 -252
  72. package/lib/assertions/storageSteps.d.ts +0 -149
  73. package/lib/assertions/storageSteps.js +0 -210
  74. package/lib/assertions/visualSteps.d.ts +0 -74
  75. package/lib/assertions/visualSteps.js +0 -209
  76. package/lib/custom_setups/loginHooks.d.ts +0 -1
  77. package/lib/custom_setups/loginHooks.js +0 -130
  78. package/lib/helpers/checkPeerDeps.d.ts +0 -1
  79. package/lib/helpers/checkPeerDeps.js +0 -19
  80. package/lib/helpers/compareSnapshots.d.ts +0 -6
  81. package/lib/helpers/compareSnapshots.js +0 -20
  82. package/lib/helpers/hooks.d.ts +0 -1
  83. package/lib/helpers/hooks.js +0 -210
  84. package/lib/helpers/utils/fakerUtils.d.ts +0 -1
  85. package/lib/helpers/utils/fakerUtils.js +0 -60
  86. package/lib/helpers/utils/index.d.ts +0 -4
  87. package/lib/helpers/utils/index.js +0 -20
  88. package/lib/helpers/utils/optionsUtils.d.ts +0 -24
  89. package/lib/helpers/utils/optionsUtils.js +0 -88
  90. package/lib/helpers/utils/resolveUtils.d.ts +0 -6
  91. package/lib/helpers/utils/resolveUtils.js +0 -72
  92. package/lib/helpers/utils/sessionUtils.d.ts +0 -3
  93. package/lib/helpers/utils/sessionUtils.js +0 -40
  94. package/lib/helpers/world.d.ts +0 -34
  95. package/lib/helpers/world.js +0 -110
  96. package/lib/iframes/frames.d.ts +0 -1
  97. package/lib/iframes/frames.js +0 -11
  98. package/lib/index.d.ts +0 -10
  99. package/lib/index.js +0 -28
  100. package/lib/register.d.ts +0 -1
  101. package/lib/register.js +0 -6
  102. package/src/actions/clickSteps.ts +0 -429
  103. package/src/actions/cookieSteps.ts +0 -95
  104. package/src/actions/debugSteps.ts +0 -21
  105. package/src/actions/elementFindSteps.ts +0 -961
  106. package/src/actions/fillFormSteps.ts +0 -270
  107. package/src/actions/index.ts +0 -12
  108. package/src/actions/inputSteps.ts +0 -354
  109. package/src/actions/interceptionSteps.ts +0 -325
  110. package/src/actions/miscSteps.ts +0 -1144
  111. package/src/actions/mouseSteps.ts +0 -256
  112. package/src/actions/scrollSteps.ts +0 -122
  113. package/src/actions/storageSteps.ts +0 -308
  114. package/src/assertions/buttonAndTextVisibilitySteps.ts +0 -436
  115. package/src/assertions/cookieSteps.ts +0 -131
  116. package/src/assertions/elementSteps.ts +0 -432
  117. package/src/assertions/formInputSteps.ts +0 -377
  118. package/src/assertions/index.ts +0 -11
  119. package/src/assertions/interceptionRequestsSteps.ts +0 -640
  120. package/src/assertions/locationSteps.ts +0 -315
  121. package/src/assertions/roleTestIdSteps.ts +0 -254
  122. package/src/assertions/semanticSteps.ts +0 -267
  123. package/src/assertions/storageSteps.ts +0 -250
  124. package/src/assertions/visualSteps.ts +0 -275
  125. package/src/custom_setups/loginHooks.ts +0 -154
  126. package/src/helpers/checkPeerDeps.ts +0 -19
  127. package/src/helpers/compareSnapshots.ts +0 -35
  128. package/src/helpers/hooks.ts +0 -212
  129. package/src/helpers/utils/fakerUtils.ts +0 -64
  130. package/src/helpers/utils/index.ts +0 -4
  131. package/src/helpers/utils/optionsUtils.ts +0 -104
  132. package/src/helpers/utils/resolveUtils.ts +0 -74
  133. package/src/helpers/utils/sessionUtils.ts +0 -36
  134. package/src/helpers/world.ts +0 -119
  135. package/src/iframes/frames.ts +0 -15
  136. package/src/index.ts +0 -18
  137. package/src/register.ts +0 -4
@@ -1,645 +0,0 @@
1
- import type { DataTable } from "@cucumber/cucumber";
2
- import { CustomWorld } from "../helpers/world";
3
- /**
4
- * Enables fake timers for the current page, fixing the time at the moment this step is executed.
5
- * This is useful for testing time-dependent UI components without actual time passing.
6
- *
7
- * ```gherkin
8
- * When I use fake timers
9
- * ```
10
- *
11
- * @example
12
- * When I use fake timers
13
- * And I go to "/countdown-page"
14
- * When I advance timers by 1000 milliseconds
15
- * Then I should see text "9 seconds remaining"
16
- *
17
- * @remarks
18
- * This step uses Playwright's `page.clock.setFixedTime()` to control the browser's internal
19
- * clock. All subsequent time-related operations (like `setTimeout`, `setInterval`, `Date.now()`)
20
- * will operate based on this fixed time. Use {@link When_I_advance_timers_by_milliseconds | "When I advance timers by X milliseconds"}
21
- * or {@link When_I_advance_timers_by_seconds | "When I advance timers by X seconds"} to progress time.
22
- * To revert, use {@link When_I_use_real_timers | "When I use real timers"}.
23
- * @category Timer Steps
24
- */
25
- export declare function When_I_use_fake_timers(this: CustomWorld): Promise<void>;
26
- /**
27
- * Restores real timers for the current page, releasing control over the browser's internal clock.
28
- *
29
- * ```gherkin
30
- * When I use real timers
31
- * ```
32
- *
33
- * @example
34
- * When I use fake timers
35
- * When I advance timers by 10 seconds
36
- * When I use real timers
37
- *
38
- * @remarks
39
- * This step uses Playwright's `page.clock.useRealTimers()`. After this step, `setTimeout`, `setInterval`,
40
- * and other time-related functions will behave normally, using the system's real time.
41
- * @category Timer Steps
42
- */
43
- export declare function When_I_use_real_timers(this: CustomWorld): Promise<void>;
44
- export declare function When_I_advance_timers_by_milliseconds(this: CustomWorld, ms: number): Promise<void>;
45
- /**
46
- * Advances fake timers by the given number of seconds. Requires fake timers to be enabled.
47
- *
48
- * ```gherkin
49
- * When I advance timers by {int} seconds
50
- * ```
51
- *
52
- * @param seconds - The number of seconds to advance the fake clock by.
53
- *
54
- * @example
55
- * When I use fake timers
56
- * When I advance timers by 2 seconds
57
- *
58
- * @remarks
59
- * This step converts seconds to milliseconds and uses Playwright's `page.clock.tick()`.
60
- * It will only have an effect if {@link When_I_use_fake_timers | "When I use fake timers"}
61
- * has been called previously. If real timers are active, a warning will be logged.
62
- * @category Timer Steps
63
- */
64
- export declare function When_I_advance_timers_by_seconds(this: CustomWorld, seconds: number): Promise<void>;
65
- /**
66
- * Waits for the given number of seconds using `setTimeout`. This is a real-time wait.
67
- *
68
- * ```gherkin
69
- * When I wait {int} second[s]
70
- * ```
71
- *
72
- * @param seconds - The number of seconds to wait.
73
- *
74
- * @example
75
- * When I wait 3 seconds
76
- *
77
- * @remarks
78
- * This step pauses test execution for the specified duration using Node.js `setTimeout`.
79
- * It's generally preferred to use explicit waits for element conditions (e.g., `toBeVisible`)
80
- * over arbitrary waits, but this can be useful for debugging or waiting for external factors.
81
- * @category General Action Steps
82
- */
83
- export declare function When_I_wait_seconds(seconds: number): Promise<void>;
84
- /**
85
- * Waits for the given number of milliseconds using `setTimeout`. This is a real-time wait.
86
- *
87
- * ```gherkin
88
- * When I wait {int} millisecond[s]
89
- * ```
90
- *
91
- * @param ms - The number of milliseconds to wait.
92
- *
93
- * @example
94
- * When I wait 500 milliseconds
95
- *
96
- * @remarks
97
- * This step pauses test execution for the specified duration using Node.js `setTimeout`.
98
- * It's generally preferred to use explicit waits for element conditions (e.g., `toBeVisible`)
99
- * over arbitrary waits, but this can be useful for debugging or waiting for external factors.
100
- * @category General Action Steps
101
- */
102
- export declare function When_I_wait_milliseconds(this: CustomWorld, ms: number): Promise<void>;
103
- /**
104
- * Sets the default step timeout for all subsequent Cucumber steps.
105
- * This can override the global timeout set in `cucumber.js` configuration.
106
- *
107
- * ```gherkin
108
- * When I set step timeout to {int} ms
109
- * ```
110
- *
111
- * @param timeoutMs - The new default timeout in milliseconds.
112
- *
113
- * @example
114
- * When I set step timeout to 10000 ms
115
- * And I find element by selector "#slow-loading-element"
116
- *
117
- * @remarks
118
- * This step uses Cucumber's `setDefaultTimeout()` function. It applies to all following
119
- * steps within the same test run. Use with caution as setting very high timeouts can
120
- * hide performance issues.
121
- * @category Configuration Steps
122
- */
123
- export declare function When_I_set_step_timeout_to(this: CustomWorld, timeoutMs: number): void;
124
- /**
125
- * Triggers a generic DOM event of the given type on the element matching the provided selector.
126
- *
127
- * ```gherkin
128
- * When I trigger {string} event on {string}
129
- * ```
130
- *
131
- * @param eventType - The type of DOM event to trigger (e.g., "change", "input", "focus").
132
- * @param selector - The CSS selector of the element to trigger the event on.
133
- *
134
- * @example
135
- * When I trigger "change" event on ".my-input"
136
- *
137
- * @remarks
138
- * This step uses Playwright's `locator.evaluate()` to dispatch a new `Event` directly
139
- * on the DOM element. It can be useful for simulating browser-level events that
140
- * might not be covered by Playwright's high-level actions (like `fill` for `input` events).
141
- * @category Event Steps
142
- */
143
- export declare function When_I_trigger_event_on_selector(this: CustomWorld, eventType: string, selector: string): Promise<void>;
144
- /**
145
- * Triggers a generic DOM event of the given type on the previously selected element.
146
- *
147
- * ```gherkin
148
- * When I trigger event {string}
149
- * ```
150
- *
151
- * @param eventName - The name of the event to dispatch (e.g., "change", "input", "blur").
152
- *
153
- * @example
154
- * When I find element by selector ".my-input"
155
- * And I trigger event "change"
156
- *
157
- * @remarks
158
- * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
159
- * It uses Playwright's `locator.dispatchEvent()` to dispatch the specified event.
160
- * @category Event Steps
161
- */
162
- export declare function When_I_trigger_event(this: CustomWorld, eventName: string): Promise<void>;
163
- /**
164
- * Removes focus from the previously selected element.
165
- *
166
- * ```gherkin
167
- * When I blur
168
- * ```
169
- *
170
- * @example
171
- * When I find element by selector "input[name='username']"
172
- * And I blur
173
- *
174
- * @remarks
175
- * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
176
- * It uses `locator.evaluate()` to call the DOM `blur()` method on the element,
177
- * simulating a loss of focus.
178
- * @category Event Steps
179
- */
180
- export declare function When_I_blur(this: CustomWorld): Promise<void>;
181
- /**
182
- * Focuses the previously selected element.
183
- *
184
- * ```gherkin
185
- * When I focus
186
- * ```
187
- *
188
- * @example
189
- * When I find element by selector "input[name='search']"
190
- * And I focus
191
- *
192
- * @remarks
193
- * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
194
- * It uses Playwright's `locator.focus()` to bring the element into focus, simulating
195
- * a user tabbing to or clicking on the element.
196
- * @category Event Steps
197
- */
198
- export declare function When_I_focus(this: CustomWorld): Promise<void>;
199
- /**
200
- * Logs a message to the test output (stdout/console).
201
- *
202
- * ```gherkin
203
- * When I log {string}
204
- * ```
205
- *
206
- * @param message - The string message to log.
207
- *
208
- * @example
209
- * When I log "Test scenario started"
210
- *
211
- * @remarks
212
- * This step is useful for injecting debugging or informative messages directly
213
- * into the Cucumber test report or console output during test execution.
214
- * @category Debugging Steps
215
- */
216
- export declare function When_I_log(this: CustomWorld, message: string): Promise<void>;
217
- /**
218
- * Triggers a debugger statement, pausing test execution if a debugger is attached.
219
- *
220
- * ```gherkin
221
- * When I debug
222
- * ```
223
- *
224
- * @example
225
- * When I find element by selector "#problematic-button"
226
- * And I debug
227
- * When I click current element
228
- *
229
- * @remarks
230
- * This step is extremely useful for interactive debugging. When executed with a debugger
231
- * (e.g., VS Code debugger attached to your Node.js process), it will pause execution
232
- * at this point, allowing you to inspect the browser state, variables, etc.
233
- * @category Debugging Steps
234
- */
235
- export declare function When_I_debug(): Promise<void>;
236
- /**
237
- * Takes a full-page screenshot of the current page and saves it with the given name.
238
- * The screenshot will be saved in the `e2e/screenshots/` directory (relative to your project root).
239
- *
240
- * ```gherkin
241
- * When I screenshot {string}
242
- * ```
243
- *
244
- * @param name - The desired filename for the screenshot (without extension).
245
- *
246
- * @example
247
- * When I screenshot "dashboard-view"
248
- *
249
- * @remarks
250
- * This step creates a PNG image. The `fullPage: true` option ensures that the
251
- * entire scrollable height of the page is captured.
252
- * @category Screenshot Steps
253
- */
254
- export declare function When_I_screenshot_named(this: CustomWorld, name: string): Promise<void>;
255
- /**
256
- * Takes a full-page screenshot of the current page and saves it with a timestamped filename.
257
- * The screenshot will be saved in the `screenshots/` directory (relative to your project root).
258
- *
259
- * ```gherkin
260
- * When I screenshot
261
- * ```
262
- *
263
- * @example
264
- * When I screenshot
265
- *
266
- * @remarks
267
- * This step is useful for quick visual debugging or capturing the state of the UI at
268
- * various points in the test without needing to manually name each file.
269
- * The filename will be in the format `screenshots/screenshot-TIMESTAMP.png`.
270
- * @category Screenshot Steps
271
- */
272
- export declare function When_I_screenshot(this: CustomWorld): Promise<void>;
273
- /**
274
- * Navigates the browser to the given URL or an aliased URL.
275
- * If a relative path is provided (starts with `/`), it will be prepended with `process.env.BASE_URL`.
276
- *
277
- * ```gherkin
278
- * When I visit {string}
279
- * ```
280
- *
281
- * @param urlOrAlias - The URL to visit, or an alias (prefixed with `@`) pointing to a URL.
282
- *
283
- * @example
284
- * When I visit "/dashboard"
285
- * When I visit "https://www.example.com"
286
- * Given I store "https://my.app.com/profile" as "profilePageUrl"
287
- * When I visit "@profilePageUrl"
288
- *
289
- * @remarks
290
- * This step uses Playwright's `page.goto()`. Ensure `BASE_URL` environment variable is set
291
- * if you are using relative paths.
292
- * @category Page Navigation Steps
293
- */
294
- export declare function When_I_visit(this: CustomWorld, urlOrAlias: string): Promise<void>;
295
- /**
296
- * Reloads the current page.
297
- *
298
- * ```gherkin
299
- * When I reload the page
300
- * ```
301
- *
302
- * @example
303
- * When I reload the page
304
- *
305
- * @remarks
306
- * This step is equivalent to hitting the browser's reload button.
307
- * It uses Playwright's `page.reload()`.
308
- * @category Page Navigation Steps
309
- */
310
- export declare function When_I_reload_the_page(this: CustomWorld): Promise<void>;
311
- /**
312
- * Navigates back in the browser's history.
313
- *
314
- * ```gherkin
315
- * When I go back
316
- * ```
317
- *
318
- * @example
319
- * Given I visit "/page1"
320
- * And I visit "/page2"
321
- * When I go back
322
- * Then I should be on "/page1"
323
- *
324
- * @remarks
325
- * This step is equivalent to hitting the browser's back button.
326
- * It uses Playwright's `page.goBack()`.
327
- * @category Page Navigation Steps
328
- */
329
- export declare function When_I_go_back(this: CustomWorld): Promise<void>;
330
- /**
331
- * Navigates forward in the browser's history.
332
- *
333
- * ```gherkin
334
- * When I go forward
335
- * ```
336
- *
337
- * @example
338
- * Given I visit "/page1"
339
- * And I visit "/page2"
340
- * When I go back
341
- * When I go forward
342
- * Then I should be on "/page2"
343
- *
344
- * @remarks
345
- * This step is equivalent to hitting the browser's forward button.
346
- * It uses Playwright's `page.goForward()`.
347
- * @category Page Navigation Steps
348
- */
349
- export declare function When_I_go_forward(this: CustomWorld): Promise<void>;
350
- /**
351
- * Pauses the test execution in debug mode.
352
- * This is useful for inspecting the browser state interactively during test runs.
353
- *
354
- * ```gherkin
355
- * When I pause
356
- * ```
357
- *
358
- * @example
359
- * When I perform an action
360
- * And I pause
361
- * Then I assert something visually
362
- *
363
- * @remarks
364
- * When running tests in debug mode (e.g., with `npx playwright test --debug`),
365
- * this step will open Playwright's inspector, allowing you to step through
366
- * actions, inspect elements, and troubleshoot. The test will resume when you
367
- * continue from the inspector.
368
- * @category Debugging Steps
369
- */
370
- export declare function When_I_pause(this: CustomWorld): Promise<void>;
371
- /**
372
- * Stores a new date calculated by offsetting an existing aliased date by a given amount and unit.
373
- *
374
- * ```gherkin
375
- * When I store {string} {int} {word} {word} as "{word}"
376
- * ```
377
- *
378
- * @param baseAlias - The alias of an existing date string in `this.data` (e.g., "today").
379
- * @param amount - The numerical amount to offset by (e.g., 2, 5).
380
- * @param unit - The unit of time (e.g., "days", "months", "hours").
381
- * @param direction - Whether to offset "before" or "after" the base date.
382
- * @param newAlias - The alias under which to store the newly calculated date.
383
- *
384
- * @example
385
- * Given I store "2024-01-15" as "invoiceDate"
386
- * When I store "invoiceDate" 30 days after as "dueDate"
387
- * Then the value of alias "dueDate" should be "2024-02-14"
388
- *
389
- * @remarks
390
- * This step uses the `dayjs` library for date manipulation. The `baseAlias` must
391
- * point to a valid date string that `dayjs` can parse. The `unit` must be one of:
392
- * "second", "minute", "hour", "day", "week", "month", "year" (plural forms also supported).
393
- * The new date is stored in `this.data` in "YYYY-MM-DD" format.
394
- * @category Data Manipulation Steps
395
- */
396
- export declare function When_I_store_date_offset(this: CustomWorld, baseAlias: string, amount: number, unit: string, direction: string, // "before" or "after"
397
- newAlias: string): Promise<void>;
398
- /**
399
- * Switches the current Playwright context to an iframe located by a CSS selector.
400
- * The step waits for the iframe's `body` element to be visible before proceeding.
401
- *
402
- * ```gherkin
403
- * When I switch to iframe with selector {string}
404
- * ```
405
- *
406
- * @param selector - The CSS selector for the iframe element (e.g., "#my-iframe", "iframe[name='chatFrame']").
407
- *
408
- * @example
409
- * When I switch to iframe with selector "#payment-form-iframe"
410
- * And I find element by placeholder text "Card Number"
411
- * And I type "1234..."
412
- *
413
- * @remarks
414
- * Once inside an iframe, all subsequent element finding and interaction steps will
415
- * target elements within that iframe. To exit the iframe context, use
416
- * {@link When_I_exit_iframe | "When I exit iframe"}.
417
- * @category IFrame Steps
418
- */
419
- export declare function When_I_switch_to_iframe_with_selector(this: CustomWorld, selector: string): Promise<void>;
420
- /**
421
- * Switches the current Playwright context to an iframe located by its title attribute.
422
- *
423
- * ```gherkin
424
- * When I switch to iframe with title {string}
425
- * ```
426
- *
427
- * @param title - The title of the iframe to switch to.
428
- *
429
- * @example
430
- * When I switch to iframe with title "My Iframe"
431
- * And I find element by label text "Card Holder"
432
- *
433
- * @remarks
434
- * This step iterates through all frames on the page to find one whose title matches
435
- * (case-insensitively, partially matched with `includes`). Once found, subsequent
436
- * element operations will target elements within this iframe. To exit, use
437
- * {@link When_I_exit_iframe | "When I exit iframe"}.
438
- * @category IFrame Steps
439
- */
440
- export declare function When_I_switch_to_iframe_with_title(this: CustomWorld, title: string): Promise<void>;
441
- /**
442
- * Switches the current Playwright context to an iframe located by a CSS selector,
443
- * and then waits for specific text to become visible inside that iframe.
444
- *
445
- * ```gherkin
446
- * When I switch to iframe with selector {string} and wait for text {string}
447
- * ```
448
- *
449
- * @param selector - The CSS selector for the iframe element.
450
- * @param expectedText - The text string to wait for inside the iframe.
451
- *
452
- * @example
453
- * When I switch to iframe with selector "#dynamic-content-iframe" and wait for text "Content Loaded"
454
- *
455
- * @remarks
456
- * This step combines switching into an iframe with a wait condition, which is
457
- * useful for dynamic iframe content. The `expectedText` must be present
458
- * and visible inside the iframe. To exit the iframe context, use
459
- * {@link When_I_exit_iframe | "When I exit iframe"}.
460
- * @category IFrame Steps
461
- */
462
- export declare function When_I_switch_to_iframe_with_selector_and_wait_for_text(this: CustomWorld, selector: string, expectedText: string): Promise<void>;
463
- /**
464
- * Exits the current iframe context, returning the Playwright context to the main page.
465
- * All subsequent element finding and interaction steps will operate on the main page.
466
- *
467
- * ```gherkin
468
- * When I exit iframe
469
- * ```
470
- *
471
- * @example
472
- * When I switch to iframe with selector "#my-iframe"
473
- * And I fill "my data"
474
- * When I exit iframe
475
- * And I click "Main Page Button"
476
- *
477
- * @remarks
478
- * This step is crucial for navigating back to the main document after interacting
479
- * with elements inside an iframe. It sets `this.frame` back to `undefined` (or the main page locator).
480
- * @category IFrame Steps
481
- */
482
- export declare function When_I_exit_iframe(this: CustomWorld): void;
483
- /**
484
- * Performs a specified action (e.g., click, hover, check, uncheck, focus, blur)
485
- * on a subset of the previously stored elements (first N, last N, or random N).
486
- *
487
- * ```gherkin
488
- * When I {word} the {word} {int}
489
- * ```
490
- *
491
- * @param action - The action to perform (e.g., "click", "hover", "check", "uncheck", "focus", "blur", "fill").
492
- * @param mode - The selection mode: "first", "last", or "random".
493
- * @param count - The number of elements to apply the action to.
494
- * @param table - (Optional) A Cucumber DataTable for action-specific options (e.g., `ClickOptions`).
495
- *
496
- * @example
497
- * Given I find elements by selector ".item-checkbox"
498
- * When I check the first 2
499
- * When I hover the last 3
500
- *
501
- * @remarks
502
- * This step requires that `this.elements` (a Playwright `Locator` that points to multiple
503
- * elements) has been populated by a preceding step (e.g., `When I find elements by selector`).
504
- * The `action` must be one of the supported actions. The `count` specifies how many of
505
- * the matched elements to target.
506
- * @category Multi-Element Action Steps
507
- */
508
- export declare function When_I_perform_action_on_subset_of_elements(this: CustomWorld, action: string, mode: string, count: number, table?: DataTable): Promise<void>;
509
- /**
510
- * Performs a specified action (e.g., click, hover, check, uncheck, focus, blur)
511
- * on the Nth element of the previously stored elements collection.
512
- *
513
- * ```gherkin
514
- * When I {word} the {int}(?:st|nd|rd|th) element
515
- * ```
516
- *
517
- * @param action - The action to perform (e.g., "click", "hover", "check", "uncheck", "focus", "blur", "fill").
518
- * @param nth - The 1-based index of the element to target (e.g., 1 for 1st, 2 for 2nd).
519
- * @param table - (Optional) A Cucumber DataTable for action-specific options.
520
- *
521
- * @example
522
- * Given I find elements by selector ".product-card"
523
- * When I click the 2nd element
524
- * When I fill the 1st element
525
- *
526
- * @remarks
527
- * This step requires that `this.elements` has been populated by a preceding step.
528
- * It targets a single element at a specific 1-based ordinal position within that collection.
529
- * The `action` must be one of the supported actions.
530
- * @category Multi-Element Action Steps
531
- */
532
- export declare function When_I_perform_action_on_nth_element(this: CustomWorld, action: string, nth: number, table?: DataTable): Promise<void>;
533
- /**
534
- * Presses a specific key on the previously selected element.
535
- *
536
- * ```gherkin
537
- * When I press key {string}
538
- * ```
539
- *
540
- * @param key - The key to press (e.g., "Enter", "Escape", "ArrowDown", "Tab").
541
- *
542
- * @example
543
- * When I find element by selector "input[name='email']"
544
- * And I type "my query"
545
- * When I press key "Enter"
546
- *
547
- * @remarks
548
- * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
549
- * It first focuses the element and then simulates a key press.
550
- * This is useful for triggering keyboard shortcuts or submitting forms via "Enter".
551
- * @category Keyboard Interaction Steps
552
- */
553
- export declare function When_I_press_key(this: CustomWorld, key: string): Promise<void>;
554
- /**
555
- * Sets the browser viewport to emulate a specific Playwright device profile and orientation.
556
- * This will close the current browser context and open a new one with the specified device settings.
557
- *
558
- * ```gherkin
559
- * When I set viewport to {string}
560
- * When I set viewport to {string} and {string}
561
- * ```
562
- *
563
- * @param deviceInput - The name of the Playwright device (e.g., "iPhone 12", "iPad", "Desktop Chrome").
564
- * @param orientation - (Optional) The orientation, either "landscape" or "portrait" (default if not specified).
565
- *
566
- * @example
567
- * When I set viewport to "iPhone 12"
568
- * When I set viewport to "iPad" and "landscape"
569
- *
570
- * @remarks
571
- * This step creates a *new* browser context and page, so any previous page state or
572
- * setup (like routes, localStorage) will be reset.
573
- * The `deviceInput` is normalized to match Playwright's `devices` object keys.
574
- * @category Browser Context Steps
575
- */
576
- export declare function When_I_set_viewport_to_device(this: CustomWorld, deviceInput: string, orientation?: string): Promise<void>;
577
- /**
578
- * Sets the viewport to the given width and height in pixels.
579
- * This will close the current browser context and open a new one with the specified dimensions.
580
- *
581
- * ```gherkin
582
- * When I set viewport to {int}px by {int}px
583
- * ```
584
- *
585
- * @param width - The desired viewport width in pixels.
586
- * @param height - The desired viewport height in pixels.
587
- *
588
- * @example
589
- * When I set viewport to 1280px by 720px
590
- *
591
- * @remarks
592
- * This step creates a *new* browser context and page, so any previous page state or
593
- * setup (like routes, localStorage) will be reset.
594
- * @category Browser Context Steps
595
- */
596
- export declare function When_I_set_viewport_to_dimensions(this: CustomWorld, width: number, height: number): Promise<void>;
597
- /**
598
- * Sets a specific Playwright page configuration property to the given value.
599
- * This can be used to dynamically change page-level settings during a test.
600
- *
601
- * ```gherkin
602
- * When I set Playwright config {word} to {string}
603
- * ```
604
- *
605
- * @param key - The name of the Playwright `Page` property to set (e.g., "userAgent", "defaultTimeout").
606
- * @param value - The string value to set the property to. Note: All values are treated as strings.
607
- *
608
- * @example
609
- * When I set Playwright config "userAgent" to "MyCustomAgent"
610
- *
611
- * @remarks
612
- * This step directly assigns a value to a property on the `this.page` object.
613
- * It's important to know which properties are settable and what their expected
614
- * types are. Using incorrect keys or values may lead to unexpected behavior or errors.
615
- * Not all Playwright page properties are designed to be set this way after page creation.
616
- * @category Configuration Steps
617
- */
618
- export declare function When_I_set_playwright_page_config_key(this: CustomWorld, key: string, value: string): Promise<void>;
619
- /**
620
- * Sets multiple Playwright page configuration properties using a data table.
621
- *
622
- * ```gherkin
623
- * When I set Playwright config
624
- * | key | value |
625
- * | userAgent | MyAgent |
626
- * | defaultTimeout | 5000 |
627
- * ```
628
- *
629
- * @param table - A Cucumber DataTable with two columns: `key` (the property name)
630
- * and `value` (the string value to set).
631
- *
632
- * @example
633
- * When I set Playwright config
634
- * | key | value |
635
- * | userAgent | TestBot |
636
- * | defaultTimeout | 10000 |
637
- *
638
- * @remarks
639
- * Similar to the single-key version, this step dynamically assigns values to
640
- * properties on the `this.page` object. All values from the data table are
641
- * treated as strings. Use with caution, understanding which properties can
642
- * be dynamically set.
643
- * @category Configuration Steps
644
- */
645
- export declare function When_I_set_playwright_page_config_from_table(this: CustomWorld, table: DataTable): Promise<void>;