playwright-cucumber-ts-steps 1.1.8 → 1.1.9

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 (77) hide show
  1. package/LICENSE +21 -0
  2. package/dist/backend/actions/click.d.ts +132 -1
  3. package/dist/backend/actions/click.d.ts.map +1 -1
  4. package/dist/backend/actions/click.js +122 -53
  5. package/dist/backend/actions/find.d.ts +243 -1
  6. package/dist/backend/actions/find.d.ts.map +1 -1
  7. package/dist/backend/actions/find.js +196 -72
  8. package/dist/backend/actions/form.d.ts +37 -1
  9. package/dist/backend/actions/form.d.ts.map +1 -1
  10. package/dist/backend/actions/form.js +55 -3
  11. package/dist/backend/actions/formTable.d.ts +25 -1
  12. package/dist/backend/actions/formTable.d.ts.map +1 -1
  13. package/dist/backend/actions/formTable.js +27 -5
  14. package/dist/backend/actions/frames.d.ts +53 -1
  15. package/dist/backend/actions/frames.d.ts.map +1 -1
  16. package/dist/backend/actions/frames.js +48 -11
  17. package/dist/backend/actions/inputs.d.ts +139 -1
  18. package/dist/backend/actions/inputs.d.ts.map +1 -1
  19. package/dist/backend/actions/inputs.js +113 -43
  20. package/dist/backend/actions/interactions.d.ts +61 -1
  21. package/dist/backend/actions/interactions.d.ts.map +1 -1
  22. package/dist/backend/actions/interactions.js +65 -10
  23. package/dist/backend/actions/keyboard.d.ts +70 -1
  24. package/dist/backend/actions/keyboard.d.ts.map +1 -1
  25. package/dist/backend/actions/keyboard.js +59 -23
  26. package/dist/backend/actions/misc.d.ts +134 -1
  27. package/dist/backend/actions/misc.d.ts.map +1 -1
  28. package/dist/backend/actions/misc.js +106 -42
  29. package/dist/backend/actions/mobile.d.ts +74 -1
  30. package/dist/backend/actions/mobile.d.ts.map +1 -1
  31. package/dist/backend/actions/mobile.js +74 -13
  32. package/dist/backend/actions/mouse.d.ts +79 -1
  33. package/dist/backend/actions/mouse.d.ts.map +1 -1
  34. package/dist/backend/actions/mouse.js +66 -21
  35. package/dist/backend/actions/navigation.d.ts +48 -1
  36. package/dist/backend/actions/navigation.d.ts.map +1 -1
  37. package/dist/backend/actions/navigation.js +42 -15
  38. package/dist/backend/actions/waits.d.ts +55 -1
  39. package/dist/backend/actions/waits.d.ts.map +1 -1
  40. package/dist/backend/actions/waits.js +49 -17
  41. package/dist/backend/api/assertions.d.ts +32 -1
  42. package/dist/backend/api/assertions.d.ts.map +1 -1
  43. package/dist/backend/api/assertions.js +37 -9
  44. package/dist/backend/api/mock.d.ts +34 -1
  45. package/dist/backend/api/mock.d.ts.map +1 -1
  46. package/dist/backend/api/mock.js +37 -10
  47. package/dist/backend/api/network.d.ts +60 -1
  48. package/dist/backend/api/network.d.ts.map +1 -1
  49. package/dist/backend/api/network.js +53 -21
  50. package/dist/backend/api/requests.d.ts +43 -1
  51. package/dist/backend/api/requests.d.ts.map +1 -1
  52. package/dist/backend/api/requests.js +49 -17
  53. package/dist/backend/assertions/pageState.d.ts +40 -1
  54. package/dist/backend/assertions/pageState.d.ts.map +1 -1
  55. package/dist/backend/assertions/pageState.js +33 -12
  56. package/dist/backend/assertions/text.d.ts +46 -1
  57. package/dist/backend/assertions/text.d.ts.map +1 -1
  58. package/dist/backend/assertions/text.js +51 -8
  59. package/dist/backend/assertions/visibility.d.ts +102 -1
  60. package/dist/backend/assertions/visibility.d.ts.map +1 -1
  61. package/dist/backend/assertions/visibility.js +86 -36
  62. package/dist/backend/auth/index.js +2 -2
  63. package/dist/backend/db/steps.d.ts +35 -1
  64. package/dist/backend/db/steps.d.ts.map +1 -1
  65. package/dist/backend/db/steps.js +48 -15
  66. package/dist/backend/elements/alerts.d.ts +35 -1
  67. package/dist/backend/elements/alerts.d.ts.map +1 -1
  68. package/dist/backend/elements/alerts.js +39 -6
  69. package/dist/backend/elements/forms.d.ts +44 -1
  70. package/dist/backend/elements/forms.d.ts.map +1 -1
  71. package/dist/backend/elements/forms.js +50 -11
  72. package/dist/backend/elements/frames.d.ts +36 -1
  73. package/dist/backend/elements/frames.d.ts.map +1 -1
  74. package/dist/backend/elements/frames.js +43 -13
  75. package/dist/core/runner.d.ts.map +1 -1
  76. package/dist/core/runner.js +3 -4
  77. package/package.json +52 -12
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chetachi (Paschal) Enyimiri
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,2 +1,133 @@
1
- export {};
1
+ /**
2
+ * Clicks on the currently stored (active) element.
3
+ *
4
+ * ```gherkin
5
+ * When I click
6
+ * ```
7
+ */
8
+ export declare const ClickStoredElement: void;
9
+ /**
10
+ * Clicks on an element matching the given CSS/XPath selector.
11
+ *
12
+ * ```gherkin
13
+ * When I click on element {string}
14
+ * ```
15
+ *
16
+ * @param selector - The CSS or XPath selector of the element.
17
+ */
18
+ export declare const ClickElementBySelector: void;
19
+ /**
20
+ * Clicks on a button role element with the specified label.
21
+ *
22
+ * ```gherkin
23
+ * When I click on button {string}
24
+ * ```
25
+ *
26
+ * @param label - The visible text or accessible name of the button.
27
+ */
28
+ export declare const ClickButtonByLabel: void;
29
+ /**
30
+ * Clicks on a link role element with the specified text.
31
+ *
32
+ * ```gherkin
33
+ * When I click on link {string}
34
+ * ```
35
+ *
36
+ * @param text - The visible text of the link.
37
+ */
38
+ export declare const ClickLinkByText: void;
39
+ /**
40
+ * Clicks on a form label element.
41
+ *
42
+ * ```gherkin
43
+ * When I click on label {string}
44
+ * ```
45
+ *
46
+ * @param labelText - The text content of the label element.
47
+ */
48
+ export declare const ClickLabelByText: void;
49
+ /**
50
+ * Clicks on the first visible element containing the specified text (partial match).
51
+ *
52
+ * ```gherkin
53
+ * When I click on text {string}
54
+ * ```
55
+ *
56
+ * @param rawText - The text to look for. Use "@alias" to reference a stored variable.
57
+ */
58
+ export declare const ClickByText: void;
59
+ /**
60
+ * Clicks on an element containing the EXACT specified text.
61
+ *
62
+ * ```gherkin
63
+ * When I click on exact text {string}
64
+ * ```
65
+ *
66
+ * @param exactText - The exact text content to match.
67
+ */
68
+ export declare const ClickByExactText: void;
69
+ /**
70
+ * Clicks on a selector provided via Regex match.
71
+ *
72
+ * ```gherkin
73
+ * I click on selector "#btn-id"
74
+ * ```
75
+ */
76
+ export declare const ClickByRegexSelector: void;
77
+ /**
78
+ * Iterates through ALL currently stored active elements and clicks them one by one.
79
+ *
80
+ * ```gherkin
81
+ * When I click all
82
+ * ```
83
+ */
84
+ export declare const ClickAllStoredElements: void;
85
+ /**
86
+ * Double-clicks on the currently stored (active) element.
87
+ *
88
+ * ```gherkin
89
+ * When I double click
90
+ * ```
91
+ */
92
+ export declare const DoubleClickStoredElement: void;
93
+ /**
94
+ * Double-clicks on the first element containing the specified text.
95
+ *
96
+ * ```gherkin
97
+ * When I double click on text {string}
98
+ * ```
99
+ */
100
+ export declare const DoubleClickByText: void;
101
+ /**
102
+ * Double-clicks at specific X, Y coordinates on the page.
103
+ *
104
+ * ```gherkin
105
+ * When I double click position {int} {int}
106
+ * ```
107
+ */
108
+ export declare const DoubleClickPosition: void;
109
+ /**
110
+ * Right-clicks (Context Click) on the currently stored element.
111
+ *
112
+ * ```gherkin
113
+ * When I right click
114
+ * ```
115
+ */
116
+ export declare const RightClickStoredElement: void;
117
+ /**
118
+ * Right-clicks on the first element containing the specified text.
119
+ *
120
+ * ```gherkin
121
+ * When I right click on text {string}
122
+ * ```
123
+ */
124
+ export declare const RightClickByText: void;
125
+ /**
126
+ * Right-clicks at specific X, Y coordinates on the page.
127
+ *
128
+ * ```gherkin
129
+ * When I right click position {int} {int}
130
+ * ```
131
+ */
132
+ export declare const RightClickPosition: void;
2
133
  //# sourceMappingURL=click.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/click.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/click.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,MAK7B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,MASlC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAM7B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,MAM1B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,MAS5B,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,MAoBtB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,MAW5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,MAQhC,CAAC;AAMF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,MAcjC,CAAC;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,MAKnC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,MAQ7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAO/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,MAKlC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,MAQ5B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,MAO9B,CAAC"}
@@ -1,22 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RightClickPosition = exports.RightClickByText = exports.RightClickStoredElement = exports.DoubleClickPosition = exports.DoubleClickByText = exports.DoubleClickStoredElement = exports.ClickAllStoredElements = exports.ClickByRegexSelector = exports.ClickByExactText = exports.ClickByText = exports.ClickLabelByText = exports.ClickLinkByText = exports.ClickButtonByLabel = exports.ClickElementBySelector = exports.ClickStoredElement = void 0;
3
4
  const registry_1 = require("../../core/registry");
4
5
  const state_1 = require("../utils/state");
6
+ // ==================================================
7
+ // 1. STANDARD CLICKS
8
+ // ==================================================
5
9
  /**
6
- * Clicks on the previously stored element.
7
- * Pattern: When I click
10
+ * Clicks on the currently stored (active) element.
11
+ *
12
+ * ```gherkin
13
+ * When I click
14
+ * ```
8
15
  */
9
- (0, registry_1.Step)("I click", async (page, table) => {
16
+ exports.ClickStoredElement = (0, registry_1.Step)("I click", async (page, table) => {
10
17
  const options = (0, state_1.parseClickOptions)(table);
11
18
  const element = (0, state_1.getActiveElement)(page);
12
19
  await element.click(options);
13
20
  console.log("🖱️ Clicked on stored element");
14
21
  });
15
22
  /**
16
- * Clicks on an element matching the given selector.
17
- * Pattern: When I click on element {string}
23
+ * Clicks on an element matching the given CSS/XPath selector.
24
+ *
25
+ * ```gherkin
26
+ * When I click on element {string}
27
+ * ```
28
+ *
29
+ * @param selector - The CSS or XPath selector of the element.
18
30
  */
19
- (0, registry_1.Step)("I click on element {string}", async (page, selector, table) => {
31
+ exports.ClickElementBySelector = (0, registry_1.Step)("I click on element {string}", async (page, selector, table) => {
20
32
  const options = (0, state_1.parseClickOptions)(table);
21
33
  const element = page.locator(selector);
22
34
  await element.click(options);
@@ -24,10 +36,15 @@ const state_1 = require("../utils/state");
24
36
  console.log(`🖱️ Clicked on element "${selector}"`);
25
37
  });
26
38
  /**
27
- * Clicks on a button with the given label.
28
- * Pattern: When I click on button {string}
39
+ * Clicks on a button role element with the specified label.
40
+ *
41
+ * ```gherkin
42
+ * When I click on button {string}
43
+ * ```
44
+ *
45
+ * @param label - The visible text or accessible name of the button.
29
46
  */
30
- (0, registry_1.Step)("I click on button {string}", async (page, label, table) => {
47
+ exports.ClickButtonByLabel = (0, registry_1.Step)("I click on button {string}", async (page, label, table) => {
31
48
  const options = (0, state_1.parseClickOptions)(table);
32
49
  const button = page.getByRole("button", { name: label });
33
50
  await button.click(options);
@@ -35,10 +52,15 @@ const state_1 = require("../utils/state");
35
52
  console.log(`🖱️ Clicked on button "${label}"`);
36
53
  });
37
54
  /**
38
- * Clicks on a link with the given text.
39
- * Pattern: When I click on link {string}
55
+ * Clicks on a link role element with the specified text.
56
+ *
57
+ * ```gherkin
58
+ * When I click on link {string}
59
+ * ```
60
+ *
61
+ * @param text - The visible text of the link.
40
62
  */
41
- (0, registry_1.Step)("I click on link {string}", async (page, text, table) => {
63
+ exports.ClickLinkByText = (0, registry_1.Step)("I click on link {string}", async (page, text, table) => {
42
64
  const options = (0, state_1.parseClickOptions)(table);
43
65
  const link = page.getByRole("link", { name: text });
44
66
  await link.click(options);
@@ -46,22 +68,34 @@ const state_1 = require("../utils/state");
46
68
  console.log(`✅ Clicked on link "${text}"`);
47
69
  });
48
70
  /**
49
- * Clicks on a label with the given text.
50
- * Pattern: When I click on label {string}
71
+ * Clicks on a form label element.
72
+ *
73
+ * ```gherkin
74
+ * When I click on label {string}
75
+ * ```
76
+ *
77
+ * @param labelText - The text content of the label element.
51
78
  */
52
- (0, registry_1.Step)("I click on label {string}", async (page, labelText, table) => {
79
+ exports.ClickLabelByText = (0, registry_1.Step)("I click on label {string}", async (page, labelText, table) => {
53
80
  const options = (0, state_1.parseClickOptions)(table);
54
81
  const label = page.getByLabel(labelText);
55
82
  await label.click(options);
56
83
  (0, state_1.setActiveElement)(page, label);
57
84
  console.log(`🏷️ Clicked on label "${labelText}"`);
58
85
  });
86
+ // ==================================================
87
+ // 2. TEXT-BASED CLICKS
88
+ // ==================================================
59
89
  /**
60
- * Clicks on an element containing the given text (fuzzy match).
61
- * Supports aliasing with @alias.
62
- * Pattern: When I click on text {string}
90
+ * Clicks on the first visible element containing the specified text (partial match).
91
+ *
92
+ * ```gherkin
93
+ * When I click on text {string}
94
+ * ```
95
+ *
96
+ * @param rawText - The text to look for. Use "@alias" to reference a stored variable.
63
97
  */
64
- (0, registry_1.Step)("I click on text {string}", async (page, rawText, table) => {
98
+ exports.ClickByText = (0, registry_1.Step)("I click on text {string}", async (page, rawText, table) => {
65
99
  const options = (0, state_1.parseClickOptions)(table);
66
100
  let text = rawText;
67
101
  // Handle Alias (e.g., "@username")
@@ -80,10 +114,15 @@ const state_1 = require("../utils/state");
80
114
  console.log(`🖱️ Clicked on text "${text}"`);
81
115
  });
82
116
  /**
83
- * Clicks on an element containing the exact given text.
84
- * Pattern: When I click on exact text {string}
117
+ * Clicks on an element containing the EXACT specified text.
118
+ *
119
+ * ```gherkin
120
+ * When I click on exact text {string}
121
+ * ```
122
+ *
123
+ * @param exactText - The exact text content to match.
85
124
  */
86
- (0, registry_1.Step)("I click on exact text {string}", async (page, exactText, table) => {
125
+ exports.ClickByExactText = (0, registry_1.Step)("I click on exact text {string}", async (page, exactText, table) => {
87
126
  const options = (0, state_1.parseClickOptions)(table);
88
127
  const locator = page.getByText(exactText, { exact: true });
89
128
  await locator.waitFor({ state: "visible", timeout: 5000 });
@@ -92,10 +131,29 @@ const state_1 = require("../utils/state");
92
131
  console.log(`🖱️ Clicked on exact text "${exactText}"`);
93
132
  });
94
133
  /**
95
- * Clicks all previously stored elements.
96
- * Pattern: When I click all
134
+ * Clicks on a selector provided via Regex match.
135
+ *
136
+ * ```gherkin
137
+ * I click on selector "#btn-id"
138
+ * ```
97
139
  */
98
- (0, registry_1.Step)("I click all", async (page, table) => {
140
+ exports.ClickByRegexSelector = (0, registry_1.Step)(/^I click on selector "([^"]+)"$/, async (page, selector) => {
141
+ const locator = page.locator(selector);
142
+ await locator.click();
143
+ (0, state_1.setActiveElement)(page, locator);
144
+ console.log(`🖱️ Clicked on selector: ${selector}`);
145
+ });
146
+ // ==================================================
147
+ // 3. BULK CLICKS
148
+ // ==================================================
149
+ /**
150
+ * Iterates through ALL currently stored active elements and clicks them one by one.
151
+ *
152
+ * ```gherkin
153
+ * When I click all
154
+ * ```
155
+ */
156
+ exports.ClickAllStoredElements = (0, registry_1.Step)("I click all", async (page, table) => {
99
157
  const options = (0, state_1.parseClickOptions)(table);
100
158
  const elements = (0, state_1.getActiveElements)(page);
101
159
  const count = await elements.count();
@@ -109,71 +167,82 @@ const state_1 = require("../utils/state");
109
167
  }
110
168
  console.log(`✅ Clicked all ${count} elements.`);
111
169
  });
170
+ // ==================================================
171
+ // 4. MOUSE INTERACTIONS (Double & Right Click)
172
+ // ==================================================
112
173
  /**
113
- * Double-clicks on the previously stored element.
114
- * Pattern: When I double click
174
+ * Double-clicks on the currently stored (active) element.
175
+ *
176
+ * ```gherkin
177
+ * When I double click
178
+ * ```
115
179
  */
116
- (0, registry_1.Step)("I double click", async (page, table) => {
180
+ exports.DoubleClickStoredElement = (0, registry_1.Step)("I double click", async (page, table) => {
117
181
  const options = (0, state_1.parseClickOptions)(table);
118
182
  const element = (0, state_1.getActiveElement)(page);
119
183
  await element.dblclick(options);
120
184
  console.log("🖱️ Double-clicked on stored element");
121
185
  });
122
186
  /**
123
- * Double-clicks on an element containing the given text.
124
- * Pattern: When I double click on text {string}
187
+ * Double-clicks on the first element containing the specified text.
188
+ *
189
+ * ```gherkin
190
+ * When I double click on text {string}
191
+ * ```
125
192
  */
126
- (0, registry_1.Step)("I double click on text {string}", async (page, text, table) => {
193
+ exports.DoubleClickByText = (0, registry_1.Step)("I double click on text {string}", async (page, text, table) => {
127
194
  const options = (0, state_1.parseClickOptions)(table);
128
195
  const element = page.getByText(text).first();
129
196
  await element.dblclick(options);
130
197
  console.log(`🖱️ Double-clicked on text "${text}"`);
131
198
  });
132
199
  /**
133
- * Double-clicks at the given page coordinates.
134
- * Pattern: When I double click position {int} {int}
200
+ * Double-clicks at specific X, Y coordinates on the page.
201
+ *
202
+ * ```gherkin
203
+ * When I double click position {int} {int}
204
+ * ```
135
205
  */
136
- (0, registry_1.Step)("I double click position {int} {int}", async (page, x, y, table) => {
206
+ exports.DoubleClickPosition = (0, registry_1.Step)("I double click position {int} {int}", async (page, x, y, table) => {
137
207
  const options = (0, state_1.parseClickOptions)(table);
138
208
  await page.mouse.dblclick(x, y, options);
139
209
  console.log(`🖱️ Double-clicked at (${x}, ${y})`);
140
210
  });
141
211
  /**
142
- * Right-clicks on the previously stored element.
143
- * Pattern: When I right click
212
+ * Right-clicks (Context Click) on the currently stored element.
213
+ *
214
+ * ```gherkin
215
+ * When I right click
216
+ * ```
144
217
  */
145
- (0, registry_1.Step)("I right click", async (page, table) => {
218
+ exports.RightClickStoredElement = (0, registry_1.Step)("I right click", async (page, table) => {
146
219
  const options = (0, state_1.parseClickOptions)(table);
147
220
  const element = (0, state_1.getActiveElement)(page);
148
221
  await element.click({ button: "right", ...options });
149
222
  console.log("🖱️ Right-clicked on stored element");
150
223
  });
151
224
  /**
152
- * Right-clicks on an element containing the given text.
153
- * Pattern: When I right click on text {string}
225
+ * Right-clicks on the first element containing the specified text.
226
+ *
227
+ * ```gherkin
228
+ * When I right click on text {string}
229
+ * ```
154
230
  */
155
- (0, registry_1.Step)("I right click on text {string}", async (page, text, table) => {
231
+ exports.RightClickByText = (0, registry_1.Step)("I right click on text {string}", async (page, text, table) => {
156
232
  const options = (0, state_1.parseClickOptions)(table);
157
233
  const element = page.getByText(text).first();
158
234
  await element.click({ button: "right", ...options });
159
235
  console.log(`🖱️ Right-clicked on text "${text}"`);
160
236
  });
161
237
  /**
162
- * Right-clicks at the given page coordinates.
163
- * Pattern: When I right click position {int} {int}
238
+ * Right-clicks at specific X, Y coordinates on the page.
239
+ *
240
+ * ```gherkin
241
+ * When I right click position {int} {int}
242
+ * ```
164
243
  */
165
- (0, registry_1.Step)("I right click position {int} {int}", async (page, x, y, table) => {
244
+ exports.RightClickPosition = (0, registry_1.Step)("I right click position {int} {int}", async (page, x, y, table) => {
166
245
  const options = (0, state_1.parseClickOptions)(table);
167
246
  await page.mouse.click(x, y, { button: "right", ...options });
168
247
  console.log(`🖱️ Right-clicked at (${x}, ${y})`);
169
248
  });
170
- /**
171
- * Clicks on an element matching the given selector (Regex Version).
172
- * Pattern: I click on selector "..."
173
- */
174
- (0, registry_1.Step)(/^I click on selector "([^"]+)"$/, async (page, selector) => {
175
- const locator = page.locator(selector);
176
- await locator.click();
177
- (0, state_1.setActiveElement)(page, locator);
178
- console.log(`🖱️ Clicked on selector: ${selector}`);
179
- });
@@ -1,2 +1,244 @@
1
- export {};
1
+ /**
2
+ * Finds a single element using a CSS or XPath selector.
3
+ * Asserts that exactly one element is found.
4
+ *
5
+ * ```gherkin
6
+ * When I find element by selector ".nav-bar"
7
+ * ```
8
+ *
9
+ * @param selector - The CSS or XPath selector string.
10
+ */
11
+ export declare const FindElementBySelector: void;
12
+ /**
13
+ * Finds an element containing the exact text provided.
14
+ *
15
+ * ```gherkin
16
+ * When I find element by text "Submit Order"
17
+ * ```
18
+ *
19
+ * @param text - The exact text content to match.
20
+ */
21
+ export declare const FindElementByText: void;
22
+ /**
23
+ * Finds an element by its `title` attribute.
24
+ *
25
+ * ```gherkin
26
+ * When I find element by title "Close Modal"
27
+ * ```
28
+ *
29
+ * @param title - The value of the title attribute.
30
+ */
31
+ export declare const FindElementByTitle: void;
32
+ /**
33
+ * Finds an element by its test ID (usually `data-testid`).
34
+ *
35
+ * ```gherkin
36
+ * When I find element by testid "login-form"
37
+ * ```
38
+ *
39
+ * @param testid - The data-testid attribute value.
40
+ */
41
+ export declare const FindElementByTestId: void;
42
+ /**
43
+ * Finds an element by its ARIA role.
44
+ *
45
+ * ```gherkin
46
+ * When I find element by role "button"
47
+ * ```
48
+ *
49
+ * @param role - The ARIA role (e.g., "button", "link", "heading").
50
+ */
51
+ export declare const FindElementByRole: void;
52
+ /**
53
+ * Finds an input element by its placeholder text.
54
+ *
55
+ * ```gherkin
56
+ * When I find element by placeholder text "Enter your email"
57
+ * ```
58
+ *
59
+ * @param text - The placeholder text value.
60
+ */
61
+ export declare const FindElementByPlaceholder: void;
62
+ /**
63
+ * Finds a form control associated with a specific label text.
64
+ *
65
+ * ```gherkin
66
+ * When I find element by label text "Password"
67
+ * ```
68
+ *
69
+ * @param label - The visible text of the label.
70
+ */
71
+ export declare const FindElementByLabel: void;
72
+ /**
73
+ * Finds an element (usually an image) by its alt text.
74
+ *
75
+ * ```gherkin
76
+ * When I find element by alt text "Company Logo"
77
+ * ```
78
+ *
79
+ * @param alt - The value of the alt attribute.
80
+ */
81
+ export declare const FindElementByAltText: void;
82
+ /**
83
+ * Finds a specific link by its visible text.
84
+ * If multiple links match, selects the first one.
85
+ *
86
+ * ```gherkin
87
+ * When I find link by text "Read More"
88
+ * ```
89
+ *
90
+ * @param text - The visible text of the link.
91
+ */
92
+ export declare const FindLinkByText: void;
93
+ /**
94
+ * Finds a heading (h1-h6) by its text content.
95
+ * If multiple headings match, selects the first one.
96
+ *
97
+ * ```gherkin
98
+ * When I find heading by text "Dashboard"
99
+ * ```
100
+ *
101
+ * @param text - The text content of the heading.
102
+ */
103
+ export declare const FindHeadingByText: void;
104
+ /**
105
+ * Finds an element by its `name` attribute.
106
+ * Useful for form fields not easily accessible by label.
107
+ *
108
+ * ```gherkin
109
+ * When I find element by name "csrf_token"
110
+ * ```
111
+ *
112
+ * @param name - The value of the name attribute.
113
+ */
114
+ export declare const FindElementByName: void;
115
+ /**
116
+ * Finds all elements matching a CSS selector and stores them as a list.
117
+ *
118
+ * ```gherkin
119
+ * When I find elements by selector "ul > li"
120
+ * ```
121
+ *
122
+ * @param selector - The CSS selector.
123
+ */
124
+ export declare const FindElementsBySelector: void;
125
+ /**
126
+ * Finds all headings matching specific text.
127
+ *
128
+ * ```gherkin
129
+ * When I find headings by text "Article Title"
130
+ * ```
131
+ *
132
+ * @param text - The text to match headings against.
133
+ */
134
+ export declare const FindHeadingsByText: void;
135
+ /**
136
+ * Finds all buttons matching specific text.
137
+ * Supports variable aliasing (e.g., "@buttonName").
138
+ *
139
+ * ```gherkin
140
+ * When I find buttons by text "Add to Cart"
141
+ * ```
142
+ *
143
+ * @param text - The button text or an alias (e.g., "@myBtn").
144
+ */
145
+ export declare const FindButtonsByText: void;
146
+ /**
147
+ * Selects the first element from the currently stored list of elements.
148
+ *
149
+ * ```gherkin
150
+ * When I get first element
151
+ * ```
152
+ */
153
+ export declare const GetFirstElement: void;
154
+ /**
155
+ * Selects the last element from the currently stored list of elements.
156
+ *
157
+ * ```gherkin
158
+ * When I get last element
159
+ * ```
160
+ */
161
+ export declare const GetLastElement: void;
162
+ /**
163
+ * Selects the nth element from the currently stored list.
164
+ * Uses 1-based indexing (e.g., 1st, 2nd, 3rd).
165
+ *
166
+ * ```gherkin
167
+ * When I get 2nd element
168
+ * When I get 10th element
169
+ * ```
170
+ *
171
+ * @param indexStr - The number captured from the regex (e.g., "2").
172
+ */
173
+ export declare const GetNthElement: void;
174
+ /**
175
+ * Selects the element that currently has browser focus.
176
+ *
177
+ * ```gherkin
178
+ * When I get focused element
179
+ * ```
180
+ */
181
+ export declare const GetFocusedElement: void;
182
+ /**
183
+ * Finds an input field by its ID attribute.
184
+ *
185
+ * ```gherkin
186
+ * When I find input by ID "user_email"
187
+ * ```
188
+ *
189
+ * @param id - The ID string.
190
+ */
191
+ export declare const FindInputById: void;
192
+ /**
193
+ * Finds an input field by its name attribute.
194
+ *
195
+ * ```gherkin
196
+ * When I find input by name "password"
197
+ * ```
198
+ *
199
+ * @param name - The name attribute value.
200
+ */
201
+ export declare const FindInputByName: void;
202
+ /**
203
+ * Finds an input field by its placeholder text.
204
+ *
205
+ * ```gherkin
206
+ * When I find input by placeholder text "Search products..."
207
+ * ```
208
+ *
209
+ * @param placeholder - The placeholder text.
210
+ */
211
+ export declare const FindInputByPlaceholder: void;
212
+ /**
213
+ * Finds an input field that currently has a specific value.
214
+ * Supports variable aliasing (e.g., "@storedValue").
215
+ *
216
+ * ```gherkin
217
+ * When I find input by display value "John"
218
+ * ```
219
+ *
220
+ * @param value - The value to match.
221
+ */
222
+ export declare const FindInputByValue: void;
223
+ /**
224
+ * Finds a textarea associated with a specific label.
225
+ * Fallback mechanism attempts to find the textarea via label if the standard getByLabel returns a generic element.
226
+ *
227
+ * ```gherkin
228
+ * When I find textarea by label text "Description"
229
+ * ```
230
+ *
231
+ * @param label - The visible text of the label.
232
+ */
233
+ export declare const FindTextareaByLabel: void;
234
+ /**
235
+ * Reads the text content of the currently active element and stores it in a variable.
236
+ *
237
+ * ```gherkin
238
+ * When I store element text as "confirmationCode"
239
+ * ```
240
+ *
241
+ * @param alias - The name of the variable to store the text in (without "@").
242
+ */
243
+ export declare const StoreElementText: void;
2
244
  //# sourceMappingURL=find.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/find.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/backend/actions/find.ts"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,MAQjC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,MAK5B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAK7B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,MAQ/B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,MAK5B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,MAQpC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAQ9B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,MAQhC,CAAC;AAMF;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,MAMzB,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,MAI5B,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,MAM5B,CAAC;AAMH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,MAQlC,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,MAI7B,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,MAc5B,CAAC;AAMH;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,MAK1B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,MAKzB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,MAgBzB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,MAK5B,CAAC;AAMH;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,MAIxB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,MAI1B,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,MAOlC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,MAiB5B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,MAe/B,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,MAO3B,CAAC"}