pw-element-interactions 0.0.6 → 0.0.8
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.
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { DateUtilities } from './utils/DateUtilities';
|
|
|
7
7
|
export { Utils } from './utils/ElementUtilities';
|
|
8
8
|
export { ElementInteractions } from './interactions/facade/ElementInteractions';
|
|
9
9
|
export { Steps } from './steps/CommonSteps';
|
|
10
|
+
export { baseFixture } from './fixture/BaseFixture';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Steps = exports.ElementInteractions = exports.Utils = exports.DateUtilities = exports.Extractions = exports.Interactions = exports.Verifications = exports.Navigation = void 0;
|
|
17
|
+
exports.baseFixture = exports.Steps = exports.ElementInteractions = exports.Utils = exports.DateUtilities = exports.Extractions = exports.Interactions = exports.Verifications = exports.Navigation = void 0;
|
|
18
18
|
// Enums
|
|
19
19
|
__exportStar(require("./enum/Options"), exports);
|
|
20
20
|
// Supporting Action Classes
|
|
@@ -37,3 +37,6 @@ Object.defineProperty(exports, "ElementInteractions", { enumerable: true, get: f
|
|
|
37
37
|
// Test Steps Facade
|
|
38
38
|
var CommonSteps_1 = require("./steps/CommonSteps");
|
|
39
39
|
Object.defineProperty(exports, "Steps", { enumerable: true, get: function () { return CommonSteps_1.Steps; } });
|
|
40
|
+
// Test Fixture
|
|
41
|
+
var BaseFixture_1 = require("./fixture/BaseFixture");
|
|
42
|
+
Object.defineProperty(exports, "baseFixture", { enumerable: true, get: function () { return BaseFixture_1.baseFixture; } });
|
|
@@ -83,4 +83,13 @@ export declare class Interactions {
|
|
|
83
83
|
* @returns A promise that resolves to the matched Playwright Locator, or null if not found.
|
|
84
84
|
*/
|
|
85
85
|
getByText(baseLocator: Locator, pageName: string, elementName: string, desiredText: string, strict?: boolean): Promise<ReturnType<Page['locator']> | null>;
|
|
86
|
+
/**
|
|
87
|
+
* Types into the target element character by character with a specified delay.
|
|
88
|
+
* Use this for OTP inputs, search-as-you-type fields, or when `fill()`
|
|
89
|
+
* doesn't trigger necessary keyboard events (like 'keyup' or 'keydown').
|
|
90
|
+
* @param locator - The Playwright Locator pointing to the input element.
|
|
91
|
+
* @param text - The string of text to type sequentially.
|
|
92
|
+
* @param delay - Time in milliseconds to wait between key presses. Defaults to 100ms.
|
|
93
|
+
*/
|
|
94
|
+
typeSequentially(locator: Locator, text: string, delay?: number): Promise<void>;
|
|
86
95
|
}
|
|
@@ -196,5 +196,21 @@ class Interactions {
|
|
|
196
196
|
}
|
|
197
197
|
return locator;
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Types into the target element character by character with a specified delay.
|
|
201
|
+
* Use this for OTP inputs, search-as-you-type fields, or when `fill()`
|
|
202
|
+
* doesn't trigger necessary keyboard events (like 'keyup' or 'keydown').
|
|
203
|
+
* @param locator - The Playwright Locator pointing to the input element.
|
|
204
|
+
* @param text - The string of text to type sequentially.
|
|
205
|
+
* @param delay - Time in milliseconds to wait between key presses. Defaults to 100ms.
|
|
206
|
+
*/
|
|
207
|
+
async typeSequentially(locator, text, delay = 100) {
|
|
208
|
+
await this.utils.waitForState(locator, 'visible');
|
|
209
|
+
console.log(`[Action] -> Typing "${text}" sequentially with a ${delay}ms delay.`);
|
|
210
|
+
await locator.pressSequentially(text, {
|
|
211
|
+
delay,
|
|
212
|
+
timeout: this.ELEMENT_TIMEOUT
|
|
213
|
+
});
|
|
214
|
+
}
|
|
199
215
|
}
|
|
200
216
|
exports.Interactions = Interactions;
|
|
@@ -183,4 +183,13 @@ export declare class Steps {
|
|
|
183
183
|
* @param state - The state to wait for: 'visible' | 'attached' | 'hidden' | 'detached'. Defaults to 'visible'.
|
|
184
184
|
*/
|
|
185
185
|
waitForState(pageName: string, elementName: string, state?: 'visible' | 'attached' | 'hidden' | 'detached'): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Types text into a specific element character by character with a delay.
|
|
188
|
+
* Ideal for OTP inputs, search bars, or fields with sensitive 'keyup' listeners.
|
|
189
|
+
* @param pageName - The page or component grouping name in your repository.
|
|
190
|
+
* @param elementName - The specific element name in your repository.
|
|
191
|
+
* @param text - The string to type sequentially.
|
|
192
|
+
* @param delay - Optional delay between key presses in milliseconds (defaults to 100).
|
|
193
|
+
*/
|
|
194
|
+
typeSequentially(pageName: string, elementName: string, text: string, delay?: number): Promise<void>;
|
|
186
195
|
}
|
|
@@ -298,5 +298,18 @@ class Steps {
|
|
|
298
298
|
const locator = await this.repo.get(this.page, pageName, elementName);
|
|
299
299
|
await this.utils.waitForState(locator, state);
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Types text into a specific element character by character with a delay.
|
|
303
|
+
* Ideal for OTP inputs, search bars, or fields with sensitive 'keyup' listeners.
|
|
304
|
+
* @param pageName - The page or component grouping name in your repository.
|
|
305
|
+
* @param elementName - The specific element name in your repository.
|
|
306
|
+
* @param text - The string to type sequentially.
|
|
307
|
+
* @param delay - Optional delay between key presses in milliseconds (defaults to 100).
|
|
308
|
+
*/
|
|
309
|
+
async typeSequentially(pageName, elementName, text, delay = 100) {
|
|
310
|
+
console.log(`[Step] -> Typing "${text}" sequentially into '${elementName}' in '${pageName}' (Delay: ${delay}ms)`);
|
|
311
|
+
const locator = await this.repo.get(this.page, pageName, elementName);
|
|
312
|
+
await this.interact.typeSequentially(locator, text, delay);
|
|
313
|
+
}
|
|
301
314
|
}
|
|
302
315
|
exports.Steps = Steps;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pw-element-interactions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A robust, readable interaction and assertion Facade for Playwright. Abstract away boilerplate into semantic, English-like methods, making your test automation framework cleaner, easier to maintain, and accessible to non-developers.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,4 +45,4 @@
|
|
|
45
45
|
},
|
|
46
46
|
"author": "Umut Ay Bora",
|
|
47
47
|
"license": "MIT"
|
|
48
|
-
}
|
|
48
|
+
}
|