playwright-cucumber-ts-steps 0.1.7 → 1.0.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.
Files changed (79) hide show
  1. package/README.md +21 -11
  2. package/lib/actions/clickSteps.d.ts +251 -1
  3. package/lib/actions/clickSteps.js +297 -47
  4. package/lib/actions/cookieSteps.d.ts +18 -1
  5. package/lib/actions/cookieSteps.js +65 -0
  6. package/lib/actions/debugSteps.d.ts +14 -1
  7. package/lib/actions/debugSteps.js +18 -3
  8. package/lib/actions/elementFindSteps.d.ts +668 -1
  9. package/lib/actions/elementFindSteps.js +808 -94
  10. package/lib/actions/fillFormSteps.d.ts +69 -1
  11. package/lib/actions/fillFormSteps.js +178 -71
  12. package/lib/actions/index.d.ts +11 -0
  13. package/lib/actions/index.js +28 -0
  14. package/lib/actions/inputSteps.d.ts +218 -1
  15. package/lib/actions/inputSteps.js +303 -57
  16. package/lib/actions/interceptionSteps.d.ts +169 -1
  17. package/lib/actions/interceptionSteps.js +258 -38
  18. package/lib/actions/miscSteps.d.ts +645 -1
  19. package/lib/actions/miscSteps.js +898 -157
  20. package/lib/actions/mouseSteps.d.ts +143 -1
  21. package/lib/actions/mouseSteps.js +200 -32
  22. package/lib/actions/scrollSteps.d.ts +82 -1
  23. package/lib/actions/scrollSteps.js +116 -16
  24. package/lib/actions/storageSteps.d.ts +174 -1
  25. package/lib/actions/storageSteps.js +253 -33
  26. package/lib/assertions/buttonAndTextVisibilitySteps.d.ts +245 -1
  27. package/lib/assertions/buttonAndTextVisibilitySteps.js +342 -91
  28. package/lib/assertions/cookieSteps.d.ts +75 -1
  29. package/lib/assertions/cookieSteps.js +97 -29
  30. package/lib/assertions/elementSteps.d.ts +264 -1
  31. package/lib/assertions/elementSteps.js +376 -78
  32. package/lib/assertions/formInputSteps.d.ts +248 -1
  33. package/lib/assertions/formInputSteps.js +342 -79
  34. package/lib/assertions/index.d.ts +10 -0
  35. package/lib/assertions/index.js +27 -0
  36. package/lib/assertions/interceptionRequestsSteps.d.ts +353 -1
  37. package/lib/assertions/interceptionRequestsSteps.js +569 -177
  38. package/lib/assertions/locationSteps.d.ts +217 -1
  39. package/lib/assertions/locationSteps.js +287 -64
  40. package/lib/assertions/roleTestIdSteps.d.ts +159 -1
  41. package/lib/assertions/roleTestIdSteps.js +217 -22
  42. package/lib/assertions/semanticSteps.d.ts +176 -1
  43. package/lib/assertions/semanticSteps.js +245 -60
  44. package/lib/assertions/storageSteps.d.ts +149 -1
  45. package/lib/assertions/storageSteps.js +201 -65
  46. package/lib/assertions/visualSteps.d.ts +74 -1
  47. package/lib/assertions/visualSteps.js +178 -45
  48. package/lib/custom_setups/loginHooks.js +19 -2
  49. package/lib/helpers/world.d.ts +3 -0
  50. package/lib/helpers/world.js +11 -5
  51. package/lib/index.d.ts +3 -21
  52. package/lib/index.js +3 -23
  53. package/package.json +9 -2
  54. package/src/actions/clickSteps.ts +364 -142
  55. package/src/actions/cookieSteps.ts +66 -0
  56. package/src/actions/debugSteps.ts +17 -3
  57. package/src/actions/elementFindSteps.ts +822 -117
  58. package/src/actions/fillFormSteps.ts +234 -177
  59. package/src/actions/index.ts +12 -0
  60. package/src/actions/inputSteps.ts +318 -82
  61. package/src/actions/interceptionSteps.ts +295 -57
  62. package/src/actions/miscSteps.ts +984 -254
  63. package/src/actions/mouseSteps.ts +212 -55
  64. package/src/actions/scrollSteps.ts +114 -16
  65. package/src/actions/storageSteps.ts +267 -42
  66. package/src/assertions/buttonAndTextVisibilitySteps.ts +353 -95
  67. package/src/assertions/cookieSteps.ts +115 -36
  68. package/src/assertions/elementSteps.ts +414 -85
  69. package/src/assertions/formInputSteps.ts +375 -108
  70. package/src/assertions/index.ts +11 -0
  71. package/src/assertions/interceptionRequestsSteps.ts +619 -195
  72. package/src/assertions/locationSteps.ts +280 -64
  73. package/src/assertions/roleTestIdSteps.ts +244 -26
  74. package/src/assertions/semanticSteps.ts +257 -69
  75. package/src/assertions/storageSteps.ts +234 -73
  76. package/src/assertions/visualSteps.ts +245 -68
  77. package/src/custom_setups/loginHooks.ts +21 -2
  78. package/src/helpers/world.ts +30 -4
  79. package/src/index.ts +4 -25
@@ -1 +1,245 @@
1
- export {};
1
+ import type { CustomWorld } from "../helpers/world";
2
+ /**
3
+ * Asserts that the previously stored collection of elements has an exact expected count.
4
+ *
5
+ * ```gherkin
6
+ * Then I count {int} elements
7
+ * ```
8
+ *
9
+ * @param expectedCount - The expected number of elements in the collection.
10
+ *
11
+ * @example
12
+ * Given I find elements by selector ".list-item"
13
+ * Then I count 5 elements
14
+ *
15
+ * @remarks
16
+ * This step requires a preceding step that populates {@link CustomWorld.elements | this.elements}
17
+ * (e.g., "When I find elements by selector"). It then asserts that the number of
18
+ * elements in that collection matches `expectedCount`. It also waits for `networkidle`
19
+ * to ensure all elements that might affect the count have loaded.
20
+ * @category Assertion Steps
21
+ */
22
+ export declare function Then_I_count_elements(this: CustomWorld, expectedCount: number): Promise<void>;
23
+ /**
24
+ * Asserts that a button with the given text (or text from an alias) is visible on the page.
25
+ * The text matching is case-insensitive and can be partial.
26
+ *
27
+ * ```gherkin
28
+ * Then I see button {string}
29
+ * ```
30
+ *
31
+ * @param rawText - The text of the button, or an alias prefixed with "@" (e.g., "Submit", "@submitButtonLabel").
32
+ *
33
+ * @example
34
+ * Then I see button "Sign In"
35
+ * Then I see button "@myLoginButton"
36
+ *
37
+ * @remarks
38
+ * This step uses `page.getByRole("button", { name: ..., exact: false })`.
39
+ * It waits for the page to be network idle and then asserts that the button is visible.
40
+ * @category Assertion Steps
41
+ */
42
+ export declare function Then_I_see_button(this: CustomWorld, rawText: string): Promise<void>;
43
+ /**
44
+ * Asserts that a button with the given text (or text from an alias) is NOT visible on the page.
45
+ * The text matching is case-insensitive and can be partial.
46
+ *
47
+ * ```gherkin
48
+ * Then I do not see button {string}
49
+ * ```
50
+ *
51
+ * @param rawText - The text of the button, or an alias prefixed with "@".
52
+ *
53
+ * @example
54
+ * Then I do not see button "Delete Account"
55
+ * Then I do not see button "@hiddenAdminButton"
56
+ *
57
+ * @remarks
58
+ * This step checks for the absence of a visible button. It first waits for the page
59
+ * to be network idle, then finds potential buttons by role and name. If any matching
60
+ * button is found and is visible, the step will fail.
61
+ * @category Assertion Steps
62
+ */
63
+ export declare function Then_I_do_not_see_button(this: CustomWorld, rawText: string): Promise<void>;
64
+ /**
65
+ * Asserts that specific text is visible on the current page or within the current frame/scope.
66
+ *
67
+ * ```gherkin
68
+ * Then I see text {string}
69
+ * ```
70
+ *
71
+ * @param expectedText - The text string expected to be visible.
72
+ *
73
+ * @example
74
+ * Then I see text "Welcome to your Dashboard"
75
+ *
76
+ * @remarks
77
+ * This step uses `locator.waitFor({ state: "visible" })` to ensure the text is present
78
+ * and displayed within the current Playwright scope (main page or active iframe).
79
+ * Text matching is a substring match by default.
80
+ * @category Assertion Steps
81
+ */
82
+ export declare function Then_I_see_text(this: CustomWorld, expectedText: string): Promise<void>;
83
+ /**
84
+ * Asserts that the exact visible text is present on the page.
85
+ * This is similar to "I see text", but emphasizes "visible" for clarity.
86
+ *
87
+ * ```gherkin
88
+ * Then I see visible text {string}
89
+ * ```
90
+ *
91
+ * @param text - The exact text string expected to be visible.
92
+ *
93
+ * @example
94
+ * Then I see visible text "Dashboard"
95
+ *
96
+ * @remarks
97
+ * This step uses `:text-is()` pseudo-class for exact text matching and `isVisible()`
98
+ * to confirm presence. It also waits for `networkidle` beforehand.
99
+ * Consider consolidating with `Then I see text {string}` if you prefer `toBeVisible`
100
+ * which handles exact matching via options or `text-is` more flexibly.
101
+ * @category Assertion Steps
102
+ */
103
+ export declare function Then_I_see_visible_text(this: CustomWorld, text: string): Promise<void>;
104
+ /**
105
+ * Asserts that specific exact visible text is NOT present on the page.
106
+ *
107
+ * ```gherkin
108
+ * Then I do not see visible text {string}
109
+ * ```
110
+ *
111
+ * @param text - The exact text string expected NOT to be visible.
112
+ *
113
+ * @example
114
+ * Then I do not see visible text "Logout"
115
+ *
116
+ * @remarks
117
+ * This step uses `:text-is()` for exact text matching. It asserts that no element
118
+ * with this exact text is visible.
119
+ * @category Assertion Steps
120
+ */
121
+ export declare function Then_I_do_not_see_visible_text(this: CustomWorld, text: string): Promise<void>;
122
+ /**
123
+ * Asserts that the previously selected element has a specific input value.
124
+ *
125
+ * ```gherkin
126
+ * Then I see value {string}
127
+ * ```
128
+ *
129
+ * @param expectedValue - The expected exact value of the input or textarea.
130
+ *
131
+ * @example
132
+ * When I find element by selector "input[name='email']"
133
+ * Then I see value "test@example.com"
134
+ *
135
+ * @remarks
136
+ * This step requires a preceding step that sets the {@link CustomWorld.element | current element}
137
+ * to an input, textarea, or other element that has an input value.
138
+ * It uses Playwright's `locator.inputValue()`.
139
+ * @category Assertion Steps
140
+ */
141
+ export declare function Then_I_see_value(this: CustomWorld, expectedValue: string): Promise<void>;
142
+ /**
143
+ * Asserts that the previously selected element does NOT have a specific input value.
144
+ *
145
+ * ```gherkin
146
+ * Then I do not see value {string}
147
+ * ```
148
+ *
149
+ * @param unwantedValue - The value that is expected NOT to be present in the input or textarea.
150
+ *
151
+ * @example
152
+ * When I find element by selector "input[name='password']"
153
+ * Then I do not see value "admin123"
154
+ *
155
+ * @remarks
156
+ * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
157
+ * It asserts that the element's current input value does not match `unwantedValue`.
158
+ * @category Assertion Steps
159
+ */
160
+ export declare function Then_I_do_not_see_value(this: CustomWorld, unwantedValue: string): Promise<void>;
161
+ /**
162
+ * Asserts that specific text is NOT present on the page. This checks for complete absence,
163
+ * not just visibility.
164
+ *
165
+ * ```gherkin
166
+ * Then I do not see text {string}
167
+ * ```
168
+ *
169
+ * @param unexpectedText - The text string that is expected NOT to be found on the page.
170
+ *
171
+ * @example
172
+ * Then I do not see text "Error Message"
173
+ *
174
+ * @remarks
175
+ * This step uses `page.getByText` with `exact: true` and then asserts that the count
176
+ * of matching elements is 0. This confirms the text is entirely absent from the DOM.
177
+ * @category Assertion Steps
178
+ */
179
+ export declare function Then_I_do_not_see_text(this: CustomWorld, unexpectedText: string): Promise<void>;
180
+ /**
181
+ * Asserts that the previously selected element contains the given text,
182
+ * which can be a literal string, an alias, or a Faker.js expression.
183
+ *
184
+ * ```gherkin
185
+ * Then I see {string} in the element
186
+ * ```
187
+ *
188
+ * @param expected - The text string, alias (prefixed with "@"), or Faker.js expression expected to be contained within the element's text content.
189
+ *
190
+ * @example
191
+ * When I find element by selector "#welcome-message"
192
+ * Then I see "Welcome, John Doe!" in the element
193
+ * Given I store "user.name" as "loggedInUserName"
194
+ * When I find element by selector "#user-profile-name"
195
+ * Then I see "@loggedInUserName" in the element
196
+ * Then I see "Hello, {{person.firstName}}!" in the element
197
+ *
198
+ * @remarks
199
+ * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
200
+ * It resolves aliases and Faker expressions before comparing the `textContent` of the element.
201
+ * It uses `expect(textContent).toContain(expected)` for partial matching.
202
+ * @category Assertion Steps
203
+ */
204
+ export declare function Then_I_see_text_in_the_element(this: CustomWorld, expected: string): Promise<void>;
205
+ /**
206
+ * Asserts that the previously selected element contains the value retrieved from a specific alias.
207
+ *
208
+ * ```gherkin
209
+ * Then I see @{word} in the element
210
+ * ```
211
+ *
212
+ * @param alias - The alias name from which to retrieve the expected text value.
213
+ *
214
+ * @example
215
+ * Given I store "Generated Name" as "tempName"
216
+ * When I find element by selector "#display-name"
217
+ * Then I see @tempName in the element
218
+ *
219
+ * @remarks
220
+ * This step requires a preceding step that sets the {@link CustomWorld.element | current element}.
221
+ * It fetches the value from `this.data[alias]` and then asserts that the element's
222
+ * `textContent` (trimmed) contains this stored value. This is a specialized version of
223
+ * `Then I see {string} in the element` specifically for aliases.
224
+ * @category Assertion Steps
225
+ */
226
+ export declare function Then_I_see_alias_in_the_element(this: CustomWorld, alias: string): Promise<void>;
227
+ /**
228
+ * Asserts that a button with the given text (or text from an alias) is disabled.
229
+ *
230
+ * ```gherkin
231
+ * Then I see button {string} is disabled
232
+ * ```
233
+ *
234
+ * @param rawText - The text of the button, or an alias prefixed with "@".
235
+ *
236
+ * @example
237
+ * Then I see button "Submit" is disabled
238
+ * Then I see button "@checkoutButton" is disabled
239
+ *
240
+ * @remarks
241
+ * This step first locates the button by its role and name, asserts it's visible,
242
+ * and then checks its disabled state using Playwright's `isDisabled()` method.
243
+ * @category Assertion Steps
244
+ */
245
+ export declare function Then_I_see_button_is_disabled(this: CustomWorld, rawText: string): Promise<void>;