transit-core-taf 1.0.25 → 1.0.26

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.
@@ -49,7 +49,7 @@ export declare class BasePageActions {
49
49
  * Clears the value of an input element.
50
50
  * @param element The locator of the input element.
51
51
  */
52
- clearInput(element: Locator): Promise<void>;
52
+ clearInput(locator: Locator): Promise<void>;
53
53
  /**
54
54
  * Types a text into an element slowly, with a specified delay between keystrokes.
55
55
  * @param element The locator of the element to type into.
@@ -83,7 +83,11 @@ export declare class BasePageActions {
83
83
  * @param element The locator of the select element.
84
84
  * @param value The value of the option to select.
85
85
  */
86
- selectOption(element: Locator, value: string): Promise<void>;
86
+ selectOption(locator: Locator, value: string | {
87
+ label?: string;
88
+ index?: number;
89
+ value?: string;
90
+ }): Promise<void>;
87
91
  /**
88
92
  * Retrieves the text content of an element by its ID.
89
93
  *
@@ -171,6 +175,24 @@ export declare class BasePageActions {
171
175
  * @param y - The y-coordinate for the click.
172
176
  * @param options - Optional click options like button or clickCount.
173
177
  */
178
+ /**
179
+ * Checks a checkbox or radio button.
180
+ * @param {Locator} locator - The Playwright locator for the element.
181
+ * @returns {Promise<void>}
182
+ */
183
+ check(locator: Locator): Promise<void>;
184
+ /**
185
+ * Unchecks a checkbox.
186
+ * @param {Locator} locator - The Playwright locator for the element.
187
+ * @returns {Promise<void>}
188
+ */
189
+ uncheck(locator: Locator): Promise<void>;
190
+ /**
191
+ * Simulates pressing the Enter key on a given element.
192
+ * @param {Locator} locator - The Playwright locator for the element.
193
+ * @returns {Promise<void>}
194
+ */
195
+ pressEnter(locator: Locator): Promise<void>;
174
196
  mouseClickAt(x: number, y: number, options?: {
175
197
  button?: 'left' | 'right' | 'middle';
176
198
  clickCount?: number;
@@ -95,8 +95,10 @@ class BasePageActions {
95
95
  * Clears the value of an input element.
96
96
  * @param element The locator of the input element.
97
97
  */
98
- async clearInput(element) {
99
- await element.fill('');
98
+ async clearInput(locator) {
99
+ await locator.waitFor({ state: 'visible' });
100
+ await locator.clear();
101
+ this.logger.info(`Cleared input for element with locator: ${locator}`);
100
102
  }
101
103
  /**
102
104
  * Types a text into an element slowly, with a specified delay between keystrokes.
@@ -146,8 +148,10 @@ class BasePageActions {
146
148
  * @param element The locator of the select element.
147
149
  * @param value The value of the option to select.
148
150
  */
149
- async selectOption(element, value) {
150
- await element.selectOption(value);
151
+ async selectOption(locator, value) {
152
+ await locator.waitFor({ state: 'visible' });
153
+ await locator.selectOption(value);
154
+ this.logger.info(`Selected option in element with locator: ${locator}`);
151
155
  }
152
156
  /**
153
157
  * Retrieves the text content of an element by its ID.
@@ -281,6 +285,36 @@ class BasePageActions {
281
285
  * @param y - The y-coordinate for the click.
282
286
  * @param options - Optional click options like button or clickCount.
283
287
  */
288
+ /**
289
+ * Checks a checkbox or radio button.
290
+ * @param {Locator} locator - The Playwright locator for the element.
291
+ * @returns {Promise<void>}
292
+ */
293
+ async check(locator) {
294
+ await locator.waitFor({ state: 'visible' });
295
+ await locator.check();
296
+ this.logger.info(`Checked element with locator: ${locator}`);
297
+ }
298
+ /**
299
+ * Unchecks a checkbox.
300
+ * @param {Locator} locator - The Playwright locator for the element.
301
+ * @returns {Promise<void>}
302
+ */
303
+ async uncheck(locator) {
304
+ await locator.waitFor({ state: 'visible' });
305
+ await locator.uncheck();
306
+ this.logger.info(`Unchecked element with locator: ${locator}`);
307
+ }
308
+ /**
309
+ * Simulates pressing the Enter key on a given element.
310
+ * @param {Locator} locator - The Playwright locator for the element.
311
+ * @returns {Promise<void>}
312
+ */
313
+ async pressEnter(locator) {
314
+ await locator.waitFor({ state: 'visible' });
315
+ await locator.press('Enter');
316
+ this.logger.info(`Pressed Enter on element with locator: ${locator}`);
317
+ }
284
318
  async mouseClickAt(x, y, options = {}) {
285
319
  await this.page.mouse.click(x, y, options);
286
320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "transit-core-taf",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "description": "Transit Core Automation Framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",