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,159 @@
1
- export {};
1
+ import { CustomWorld } from "../helpers/world";
2
+ /**
3
+ * Asserts that an element with the given ARIA role and exact accessible name is visible on the page.
4
+ *
5
+ * ```gherkin
6
+ * Then I see role {string} with name {string}
7
+ * ```
8
+ *
9
+ * @param role - The ARIA role of the element (e.g., "button", "heading", "textbox").
10
+ * @param name - The exact accessible name of the element (e.g., button text, label text).
11
+ *
12
+ * @example
13
+ * Then I see role "button" with name "Submit"
14
+ * Then I see role "heading" with name "Welcome"
15
+ *
16
+ * @remarks
17
+ * This step uses Playwright's `page.getByRole()` with `exact: true` for precise matching.
18
+ * It asserts that the matched element is visible in the viewport.
19
+ * @category Role-Based Assertion Steps
20
+ */
21
+ export declare function Then_I_see_role_with_name(this: CustomWorld, role: string, name: string): Promise<void>;
22
+ /**
23
+ * Asserts that an element with the given ARIA role and exact accessible name does NOT exist in the DOM.
24
+ *
25
+ * ```gherkin
26
+ * Then I do not see role {string} with name {string}
27
+ * ```
28
+ *
29
+ * @param role - The ARIA role of the element.
30
+ * @param name - The exact accessible name of the element.
31
+ *
32
+ * @example
33
+ * Then I do not see role "button" with name "Cancel"
34
+ * Then I do not see role "alert" with name "Error message"
35
+ *
36
+ * @remarks
37
+ * This step uses Playwright's `page.getByRole()` with `exact: true` and asserts that
38
+ * no such element exists in the DOM (i.e., its count is 0).
39
+ * @category Role-Based Assertion Steps
40
+ */
41
+ export declare function Then_I_do_not_see_role_with_name(this: CustomWorld, role: string, name: string): Promise<void>;
42
+ /**
43
+ * Asserts that an element with the given `data-testid` attribute (or configured test ID) is visible on the page.
44
+ *
45
+ * ```gherkin
46
+ * Then I see testid {string}
47
+ * ```
48
+ *
49
+ * @param testId - The value of the `data-testid` attribute.
50
+ *
51
+ * @example
52
+ * Then I see testid "main-content"
53
+ * Then I see testid "user-profile-section"
54
+ *
55
+ * @remarks
56
+ * This step uses Playwright's `page.getByTestId()` and asserts that the matched element is visible.
57
+ * @category Test ID-Based Assertion Steps
58
+ */
59
+ export declare function Then_I_see_testid(this: CustomWorld, testId: string): Promise<void>;
60
+ /**
61
+ * Asserts that an element with the given `data-testid` attribute (or configured test ID) does NOT exist in the DOM.
62
+ *
63
+ * ```gherkin
64
+ * Then I do not see testid {string}
65
+ * ```
66
+ *
67
+ * @param testId - The value of the `data-testid` attribute.
68
+ *
69
+ * @example
70
+ * Then I do not see testid "sidebar"
71
+ * Then I do not see testid "legacy-component"
72
+ *
73
+ * @remarks
74
+ * This step uses Playwright's `page.getByTestId()` and asserts that no such element exists (i.e., its count is 0).
75
+ * @category Test ID-Based Assertion Steps
76
+ */
77
+ export declare function Then_I_do_not_see_testid(this: CustomWorld, testId: string): Promise<void>;
78
+ /**
79
+ * Asserts that an element identified by its `data-testid` has a specific attribute with an exact expected value.
80
+ *
81
+ * ```gherkin
82
+ * Then I see testid {string} has attribute {string} with value {string}
83
+ * ```
84
+ *
85
+ * @param testId - The value of the `data-testid` attribute.
86
+ * @param attr - The name of the attribute (e.g., "data-state", "aria-expanded").
87
+ * @param value - The exact expected value of the attribute.
88
+ *
89
+ * @example
90
+ * Then I see testid "main-content" has attribute "data-state" with value "active"
91
+ * Then I see testid "toggle-button" has attribute "aria-pressed" with value "true"
92
+ *
93
+ * @remarks
94
+ * This step uses Playwright's `page.getByTestId()` to find the element and then
95
+ * `expect(locator).toHaveAttribute()` for the assertion.
96
+ * @category Test ID-Based Attribute Assertion Steps
97
+ */
98
+ export declare function Then_I_see_testid_has_attribute_with_value(this: CustomWorld, testId: string, attr: string, value: string): Promise<void>;
99
+ /**
100
+ * Asserts that an element identified by its `data-testid` has a specific attribute, regardless of its value.
101
+ *
102
+ * ```gherkin
103
+ * Then I see testid {string} has attribute {string}
104
+ * ```
105
+ *
106
+ * @param testId - The value of the `data-testid` attribute.
107
+ * @param attr - The name of the attribute expected to exist (e.g., "data-custom-id", "disabled").
108
+ *
109
+ * @example
110
+ * Then I see testid "main-content" has attribute "data-state"
111
+ * Then I see testid "submit-button" has attribute "disabled"
112
+ *
113
+ * @remarks
114
+ * This step uses Playwright's `page.getByTestId()` to find the element, then retrieves
115
+ * the attribute's value and asserts that it is not `null` (meaning the attribute is present).
116
+ * @category Test ID-Based Attribute Assertion Steps
117
+ */
118
+ export declare function Then_I_see_testid_has_attribute(this: CustomWorld, testId: string, attr: string): Promise<void>;
119
+ /**
120
+ * Asserts that an element identified by its `data-testid` does NOT have a specific attribute.
121
+ *
122
+ * ```gherkin
123
+ * Then I see testid {string} does not have attribute {string}
124
+ * ```
125
+ *
126
+ * @param testId - The value of the `data-testid` attribute.
127
+ * @param attr - The name of the attribute expected NOT to exist.
128
+ *
129
+ * @example
130
+ * Then I see testid "main-content" does not have attribute "data-state"
131
+ * Then I see testid "enabled-button" does not have attribute "disabled"
132
+ *
133
+ * @remarks
134
+ * This step uses Playwright's `page.getByTestId()` to find the element, then retrieves
135
+ * the attribute's value and asserts that it is `null` (meaning the attribute is not present).
136
+ * @category Test ID-Based Attribute Assertion Steps
137
+ */
138
+ export declare function Then_I_see_testid_does_not_have_attribute(this: CustomWorld, testId: string, attr: string): Promise<void>;
139
+ /**
140
+ * Asserts that an element identified by its `data-testid` has a specific attribute whose value contains a given substring.
141
+ *
142
+ * ```gherkin
143
+ * Then I see testid {string} attribute {string} contains {string}
144
+ * ```
145
+ *
146
+ * @param testId - The value of the `data-testid` attribute.
147
+ * @param attr - The name of the attribute to check (e.g., "class", "aria-label").
148
+ * @param part - The substring expected to be contained within the attribute's value.
149
+ *
150
+ * @example
151
+ * Then I see testid "main-content" attribute "class" contains "active"
152
+ * Then I see testid "search-input" attribute "aria-label" contains "search product"
153
+ *
154
+ * @remarks
155
+ * This step uses Playwright's `page.getByTestId()` to find the element and then
156
+ * `expect(locator).toHaveAttribute()` with a regular expression for the contains check.
157
+ * @category Test ID-Based Attribute Assertion Steps
158
+ */
159
+ export declare function Then_I_see_testid_attribute_contains(this: CustomWorld, testId: string, attr: string, part: string): Promise<void>;
@@ -1,26 +1,221 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Then_I_see_role_with_name = Then_I_see_role_with_name;
4
+ exports.Then_I_do_not_see_role_with_name = Then_I_do_not_see_role_with_name;
5
+ exports.Then_I_see_testid = Then_I_see_testid;
6
+ exports.Then_I_do_not_see_testid = Then_I_do_not_see_testid;
7
+ exports.Then_I_see_testid_has_attribute_with_value = Then_I_see_testid_has_attribute_with_value;
8
+ exports.Then_I_see_testid_has_attribute = Then_I_see_testid_has_attribute;
9
+ exports.Then_I_see_testid_does_not_have_attribute = Then_I_see_testid_does_not_have_attribute;
10
+ exports.Then_I_see_testid_attribute_contains = Then_I_see_testid_attribute_contains;
3
11
  const cucumber_1 = require("@cucumber/cucumber");
4
12
  const test_1 = require("@playwright/test");
5
- //
6
- // 🧩 ROLE-BASED ELEMENTS
7
- //
8
- (0, cucumber_1.Then)(/^I see role "(.*)" with name "(.*)"$/, async function (role, name) {
9
- const el = this.page.getByRole(role, { name, exact: true });
10
- await (0, test_1.expect)(el).toBeVisible();
11
- });
12
- (0, cucumber_1.Then)(/^I do not see role "(.*)" with name "(.*)"$/, async function (role, name) {
13
- const el = this.page.getByRole(role, { name, exact: true });
14
- await (0, test_1.expect)(el).toHaveCount(0);
15
- });
16
- //
17
- // 🏷️ TEST ID-BASED ELEMENTS
18
- //
19
- (0, cucumber_1.Then)(/^I see testid "(.*)"$/, async function (testId) {
20
- const el = this.page.getByTestId(testId);
21
- await (0, test_1.expect)(el).toBeVisible();
22
- });
23
- (0, cucumber_1.Then)(/^I do not see testid "(.*)"$/, async function (testId) {
24
- const el = this.page.getByTestId(testId);
25
- await (0, test_1.expect)(el).toHaveCount(0);
26
- });
13
+ // ===================================================================================
14
+ // ASSERTIONS: ROLE-BASED ELEMENTS
15
+ // ===================================================================================
16
+ /**
17
+ * Asserts that an element with the given ARIA role and exact accessible name is visible on the page.
18
+ *
19
+ * ```gherkin
20
+ * Then I see role {string} with name {string}
21
+ * ```
22
+ *
23
+ * @param role - The ARIA role of the element (e.g., "button", "heading", "textbox").
24
+ * @param name - The exact accessible name of the element (e.g., button text, label text).
25
+ *
26
+ * @example
27
+ * Then I see role "button" with name "Submit"
28
+ * Then I see role "heading" with name "Welcome"
29
+ *
30
+ * @remarks
31
+ * This step uses Playwright's `page.getByRole()` with `exact: true` for precise matching.
32
+ * It asserts that the matched element is visible in the viewport.
33
+ * @category Role-Based Assertion Steps
34
+ */
35
+ async function Then_I_see_role_with_name(role, name) {
36
+ const locator = this.page.getByRole(role, { name, exact: true });
37
+ await (0, test_1.expect)(locator).toBeVisible({ timeout: 5000 });
38
+ this.log?.(`✅ Verified role "${role}" with name "${name}" is visible.`);
39
+ }
40
+ (0, cucumber_1.Then)(/^I see role "(.*)" with name "(.*)"$/, Then_I_see_role_with_name);
41
+ /**
42
+ * Asserts that an element with the given ARIA role and exact accessible name does NOT exist in the DOM.
43
+ *
44
+ * ```gherkin
45
+ * Then I do not see role {string} with name {string}
46
+ * ```
47
+ *
48
+ * @param role - The ARIA role of the element.
49
+ * @param name - The exact accessible name of the element.
50
+ *
51
+ * @example
52
+ * Then I do not see role "button" with name "Cancel"
53
+ * Then I do not see role "alert" with name "Error message"
54
+ *
55
+ * @remarks
56
+ * This step uses Playwright's `page.getByRole()` with `exact: true` and asserts that
57
+ * no such element exists in the DOM (i.e., its count is 0).
58
+ * @category Role-Based Assertion Steps
59
+ */
60
+ async function Then_I_do_not_see_role_with_name(role, name) {
61
+ const locator = this.page.getByRole(role, { name, exact: true });
62
+ await (0, test_1.expect)(locator).toHaveCount(0, { timeout: 5000 });
63
+ this.log?.(`✅ Verified role "${role}" with name "${name}" does NOT exist.`);
64
+ }
65
+ (0, cucumber_1.Then)(/^I do not see role "(.*)" with name "(.*)"$/, Then_I_do_not_see_role_with_name);
66
+ // ===================================================================================
67
+ // ASSERTIONS: TEST ID-BASED ELEMENTS
68
+ // ===================================================================================
69
+ /**
70
+ * Asserts that an element with the given `data-testid` attribute (or configured test ID) is visible on the page.
71
+ *
72
+ * ```gherkin
73
+ * Then I see testid {string}
74
+ * ```
75
+ *
76
+ * @param testId - The value of the `data-testid` attribute.
77
+ *
78
+ * @example
79
+ * Then I see testid "main-content"
80
+ * Then I see testid "user-profile-section"
81
+ *
82
+ * @remarks
83
+ * This step uses Playwright's `page.getByTestId()` and asserts that the matched element is visible.
84
+ * @category Test ID-Based Assertion Steps
85
+ */
86
+ async function Then_I_see_testid(testId) {
87
+ const locator = this.page.getByTestId(testId);
88
+ await (0, test_1.expect)(locator).toBeVisible({ timeout: 5000 });
89
+ this.log?.(`✅ Verified test ID "${testId}" is visible.`);
90
+ }
91
+ (0, cucumber_1.Then)(/^I see testid "(.*)"$/, Then_I_see_testid);
92
+ /**
93
+ * Asserts that an element with the given `data-testid` attribute (or configured test ID) does NOT exist in the DOM.
94
+ *
95
+ * ```gherkin
96
+ * Then I do not see testid {string}
97
+ * ```
98
+ *
99
+ * @param testId - The value of the `data-testid` attribute.
100
+ *
101
+ * @example
102
+ * Then I do not see testid "sidebar"
103
+ * Then I do not see testid "legacy-component"
104
+ *
105
+ * @remarks
106
+ * This step uses Playwright's `page.getByTestId()` and asserts that no such element exists (i.e., its count is 0).
107
+ * @category Test ID-Based Assertion Steps
108
+ */
109
+ async function Then_I_do_not_see_testid(testId) {
110
+ const locator = this.page.getByTestId(testId);
111
+ await (0, test_1.expect)(locator).toHaveCount(0, { timeout: 5000 });
112
+ this.log?.(`✅ Verified test ID "${testId}" does NOT exist.`);
113
+ }
114
+ (0, cucumber_1.Then)(/^I do not see testid "(.*)"$/, Then_I_do_not_see_testid);
115
+ // ===================================================================================
116
+ // ASSERTIONS: ATTRIBUTE-BASED ASSERTIONS (on Test ID elements)
117
+ // ===================================================================================
118
+ /**
119
+ * Asserts that an element identified by its `data-testid` has a specific attribute with an exact expected value.
120
+ *
121
+ * ```gherkin
122
+ * Then I see testid {string} has attribute {string} with value {string}
123
+ * ```
124
+ *
125
+ * @param testId - The value of the `data-testid` attribute.
126
+ * @param attr - The name of the attribute (e.g., "data-state", "aria-expanded").
127
+ * @param value - The exact expected value of the attribute.
128
+ *
129
+ * @example
130
+ * Then I see testid "main-content" has attribute "data-state" with value "active"
131
+ * Then I see testid "toggle-button" has attribute "aria-pressed" with value "true"
132
+ *
133
+ * @remarks
134
+ * This step uses Playwright's `page.getByTestId()` to find the element and then
135
+ * `expect(locator).toHaveAttribute()` for the assertion.
136
+ * @category Test ID-Based Attribute Assertion Steps
137
+ */
138
+ async function Then_I_see_testid_has_attribute_with_value(testId, attr, value) {
139
+ const locator = this.page.getByTestId(testId);
140
+ await (0, test_1.expect)(locator).toHaveAttribute(attr, value, { timeout: 5000 });
141
+ this.log?.(`✅ Verified test ID "${testId}" has attribute "${attr}" with value "${value}".`);
142
+ }
143
+ (0, cucumber_1.Then)(/^I see testid "(.*)" has attribute "(.*)" with value "(.*)"$/, Then_I_see_testid_has_attribute_with_value);
144
+ /**
145
+ * Asserts that an element identified by its `data-testid` has a specific attribute, regardless of its value.
146
+ *
147
+ * ```gherkin
148
+ * Then I see testid {string} has attribute {string}
149
+ * ```
150
+ *
151
+ * @param testId - The value of the `data-testid` attribute.
152
+ * @param attr - The name of the attribute expected to exist (e.g., "data-custom-id", "disabled").
153
+ *
154
+ * @example
155
+ * Then I see testid "main-content" has attribute "data-state"
156
+ * Then I see testid "submit-button" has attribute "disabled"
157
+ *
158
+ * @remarks
159
+ * This step uses Playwright's `page.getByTestId()` to find the element, then retrieves
160
+ * the attribute's value and asserts that it is not `null` (meaning the attribute is present).
161
+ * @category Test ID-Based Attribute Assertion Steps
162
+ */
163
+ async function Then_I_see_testid_has_attribute(testId, attr) {
164
+ const locator = this.page.getByTestId(testId);
165
+ const attrValue = await locator.getAttribute(attr, { timeout: 5000 });
166
+ (0, test_1.expect)(attrValue).not.toBeNull();
167
+ this.log?.(`✅ Verified test ID "${testId}" has attribute "${attr}".`);
168
+ }
169
+ (0, cucumber_1.Then)(/^I see testid "(.*)" has attribute "(.*)"$/, Then_I_see_testid_has_attribute);
170
+ /**
171
+ * Asserts that an element identified by its `data-testid` does NOT have a specific attribute.
172
+ *
173
+ * ```gherkin
174
+ * Then I see testid {string} does not have attribute {string}
175
+ * ```
176
+ *
177
+ * @param testId - The value of the `data-testid` attribute.
178
+ * @param attr - The name of the attribute expected NOT to exist.
179
+ *
180
+ * @example
181
+ * Then I see testid "main-content" does not have attribute "data-state"
182
+ * Then I see testid "enabled-button" does not have attribute "disabled"
183
+ *
184
+ * @remarks
185
+ * This step uses Playwright's `page.getByTestId()` to find the element, then retrieves
186
+ * the attribute's value and asserts that it is `null` (meaning the attribute is not present).
187
+ * @category Test ID-Based Attribute Assertion Steps
188
+ */
189
+ async function Then_I_see_testid_does_not_have_attribute(testId, attr) {
190
+ const locator = this.page.getByTestId(testId);
191
+ const attrValue = await locator.getAttribute(attr, { timeout: 5000 });
192
+ (0, test_1.expect)(attrValue).toBeNull();
193
+ this.log?.(`✅ Verified test ID "${testId}" does NOT have attribute "${attr}".`);
194
+ }
195
+ (0, cucumber_1.Then)(/^I see testid "(.*)" does not have attribute "(.*)"$/, Then_I_see_testid_does_not_have_attribute);
196
+ /**
197
+ * Asserts that an element identified by its `data-testid` has a specific attribute whose value contains a given substring.
198
+ *
199
+ * ```gherkin
200
+ * Then I see testid {string} attribute {string} contains {string}
201
+ * ```
202
+ *
203
+ * @param testId - The value of the `data-testid` attribute.
204
+ * @param attr - The name of the attribute to check (e.g., "class", "aria-label").
205
+ * @param part - The substring expected to be contained within the attribute's value.
206
+ *
207
+ * @example
208
+ * Then I see testid "main-content" attribute "class" contains "active"
209
+ * Then I see testid "search-input" attribute "aria-label" contains "search product"
210
+ *
211
+ * @remarks
212
+ * This step uses Playwright's `page.getByTestId()` to find the element and then
213
+ * `expect(locator).toHaveAttribute()` with a regular expression for the contains check.
214
+ * @category Test ID-Based Attribute Assertion Steps
215
+ */
216
+ async function Then_I_see_testid_attribute_contains(testId, attr, part) {
217
+ const locator = this.page.getByTestId(testId);
218
+ await (0, test_1.expect)(locator).toHaveAttribute(attr, new RegExp(part), { timeout: 5000 });
219
+ this.log?.(`✅ Verified test ID "${testId}" attribute "${attr}" contains "${part}".`);
220
+ }
221
+ (0, cucumber_1.Then)(/^I see testid "(.*)" attribute "(.*)" contains "(.*)"$/, Then_I_see_testid_attribute_contains);
@@ -1 +1,176 @@
1
- export {};
1
+ import { DataTable } from "@cucumber/cucumber";
2
+ import type { CustomWorld } from "../helpers/world";
3
+ /**
4
+ * Asserts that a heading element (h1-h6) containing the given text is visible on the page.
5
+ *
6
+ * ```gherkin
7
+ * Then I see heading {string}
8
+ * ```
9
+ *
10
+ * @param text - The text content expected within the heading.
11
+ *
12
+ * @example
13
+ * Then I see heading "Welcome to your account"
14
+ *
15
+ * @remarks
16
+ * This step searches for any HTML heading tag (`<h1>` through `<h6>`) that contains the specified text.
17
+ * It uses Playwright's `expect().toBeVisible()` to confirm both existence and visibility, which
18
+ * includes automatic waiting.
19
+ * @category Heading Assertion Steps
20
+ */
21
+ export declare function Then_I_see_heading(this: CustomWorld, text: string): Promise<void>;
22
+ /**
23
+ * Asserts that a heading element (h1-h6) containing the given text is NOT visible on the page.
24
+ *
25
+ * ```gherkin
26
+ * Then I do not see heading {string}
27
+ * ```
28
+ *
29
+ * @param text - The text content expected NOT to be visible within a heading.
30
+ *
31
+ * @example
32
+ * Then I do not see heading "Hidden Section"
33
+ *
34
+ * @remarks
35
+ * This step searches for any HTML heading tag (`<h1>` through `<h6>`) that contains the specified text.
36
+ * It uses Playwright's `expect().not.toBeVisible()` to confirm both absence and non-visibility,
37
+ * which includes automatic waiting.
38
+ * @category Heading Assertion Steps
39
+ */
40
+ export declare function Then_I_do_not_see_heading(this: CustomWorld, text: string): Promise<void>;
41
+ /**
42
+ * Asserts that a `<label>` element with the given text is visible on the page.
43
+ *
44
+ * ```gherkin
45
+ * Then I see label {string}
46
+ * ```
47
+ *
48
+ * @param text - The text content of the label expected to be visible.
49
+ *
50
+ * @example
51
+ * Then I see label "Username"
52
+ * Then I see label "I agree to the terms and conditions"
53
+ *
54
+ * @remarks
55
+ * This step uses Playwright's `page.getByLabel()` which is designed to find labels
56
+ * and implicitly connected form controls. It then uses `expect().toBeVisible()`
57
+ * to confirm visibility.
58
+ * @category Label Assertion Steps
59
+ */
60
+ export declare function Then_I_see_label(this: CustomWorld, text: string): Promise<void>;
61
+ /**
62
+ * Asserts that a `<label>` element with the given text is NOT visible on the page.
63
+ *
64
+ * ```gherkin
65
+ * Then I do not see label {string}
66
+ * ```
67
+ *
68
+ * @param text - The text content of the label expected NOT to be visible.
69
+ *
70
+ * @example
71
+ * Then I do not see label "Old Feature Toggle"
72
+ *
73
+ * @remarks
74
+ * This step uses Playwright's `page.getByLabel()` and then `expect().not.toBeVisible()`
75
+ * to confirm its non-visibility.
76
+ * @category Label Assertion Steps
77
+ */
78
+ export declare function Then_I_do_not_see_label(this: CustomWorld, text: string): Promise<void>;
79
+ /**
80
+ * Asserts that a link (`<a>` tag) with the given accessible name (text content) is visible on the page.
81
+ *
82
+ * ```gherkin
83
+ * Then I see link {string}
84
+ * ```
85
+ *
86
+ * @param text - The accessible name (text) of the link expected to be visible.
87
+ *
88
+ * @example
89
+ * Then I see link "Home"
90
+ * Then I see link "View Details"
91
+ *
92
+ * @remarks
93
+ * This step uses Playwright's `page.getByRole("link", { name: text })` for robust
94
+ * link finding based on accessible name, then `expect().toBeVisible()` for visibility.
95
+ * @category Link Assertion Steps
96
+ */
97
+ export declare function Then_I_see_link(this: CustomWorld, text: string): Promise<void>;
98
+ /**
99
+ * Asserts that a link (`<a>` tag) with the given accessible name (text content) is NOT visible on the page.
100
+ *
101
+ * ```gherkin
102
+ * Then I do not see link {string}
103
+ * ```
104
+ *
105
+ * @param text - The accessible name (text) of the link expected NOT to be visible.
106
+ *
107
+ * @example
108
+ * Then I do not see link "Admin Panel"
109
+ *
110
+ * @remarks
111
+ * This step uses Playwright's `page.getByRole("link", { name: text })` and then
112
+ * `expect().not.toBeVisible()` to confirm its non-visibility.
113
+ * @category Link Assertion Steps
114
+ */
115
+ export declare function Then_I_do_not_see_link(this: CustomWorld, text: string): Promise<void>;
116
+ /**
117
+ * Asserts that the number of elements found by the {@link CustomWorld.currentLocator | currentLocator}
118
+ * matches the expected count. If no `currentLocator` is set, it defaults to counting all elements (`*`).
119
+ *
120
+ * ```gherkin
121
+ * Then I count {int} element
122
+ * ```
123
+ *
124
+ * @param expectedCount - The expected number of elements.
125
+ *
126
+ * @example
127
+ * When I find elements by selector ".product-item"
128
+ * Then I count 10 element
129
+ *
130
+ * @remarks
131
+ * This step is designed to follow a "find elements" step that sets `this.currentLocator`
132
+ * or `this.elements` (if `this.elements` is the intended source, you might prefer a
133
+ * step like `Then I count {int} elements` which specifically targets `this.elements`).
134
+ * The current implementation uses `this.currentLocator` or defaults to `this.page.locator("*")`.
135
+ * @category Count Assertion Steps
136
+ */
137
+ export declare function Then_I_count_current_locator_elements(this: CustomWorld, expectedCount: number): Promise<void>;
138
+ /**
139
+ * Asserts that the current document title exactly matches the expected string.
140
+ *
141
+ * ```gherkin
142
+ * Then I see document title {string}
143
+ * ```
144
+ *
145
+ * @param expectedTitle - The exact title string expected for the document.
146
+ * @param table - (Optional) A Cucumber DataTable for Playwright `ExpectOptions` (e.g., `timeout`).
147
+ *
148
+ * @example
149
+ * Then I see document title "My Application Dashboard"
150
+ *
151
+ * @remarks
152
+ * This step uses Playwright's `expect(page).toHaveTitle()` for robust assertion,
153
+ * including automatic waiting for the title to become correct.
154
+ * @category Page State Assertion Steps
155
+ */
156
+ export declare function Then_I_see_document_title(this: CustomWorld, expectedTitle: string, table?: DataTable): Promise<void>;
157
+ /**
158
+ * Asserts that the current document title contains the expected substring (case-insensitive).
159
+ *
160
+ * ```gherkin
161
+ * Then I see document title contains {string}
162
+ * ```
163
+ *
164
+ * @param substring - The substring expected to be contained within the document title.
165
+ * @param table - (Optional) A Cucumber DataTable for Playwright `ExpectOptions`.
166
+ *
167
+ * @example
168
+ * Then I see document title contains "App Name"
169
+ * Then I see document title contains "Dashboard"
170
+ *
171
+ * @remarks
172
+ * This step uses Playwright's `expect(page).toHaveTitle()` with a case-insensitive regular
173
+ * expression for partial matching, ensuring automatic waiting.
174
+ * @category Page State Assertion Steps
175
+ */
176
+ export declare function Then_I_see_document_title_contains(this: CustomWorld, substring: string, table?: DataTable): Promise<void>;