@auto-wiz/playwright 1.3.0 → 1.3.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.
- package/dist/runner.d.ts +4 -0
- package/dist/runner.js +10 -1
- package/package.json +2 -2
package/dist/runner.d.ts
CHANGED
|
@@ -3,5 +3,9 @@ import { Page } from "playwright";
|
|
|
3
3
|
export declare class PlaywrightFlowRunner implements FlowRunner<Page> {
|
|
4
4
|
run(flow: Flow, page: Page, options?: RunnerOptions): Promise<RunResult>;
|
|
5
5
|
runStep(step: Step, page: Page, options?: RunnerOptions): Promise<ExecutionResult>;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve placeholders in text (e.g., {{username}} → variables.username)
|
|
8
|
+
*/
|
|
9
|
+
private resolveText;
|
|
6
10
|
private resolveLocator;
|
|
7
11
|
}
|
package/dist/runner.js
CHANGED
|
@@ -76,7 +76,8 @@ class PlaywrightFlowRunner {
|
|
|
76
76
|
}
|
|
77
77
|
case "type": {
|
|
78
78
|
const locator = await this.resolveLocator(page, step, timeout);
|
|
79
|
-
const
|
|
79
|
+
const rawText = step.text || step.originalText || "";
|
|
80
|
+
const text = this.resolveText(rawText, options.variables);
|
|
80
81
|
await locator.fill(text, { timeout });
|
|
81
82
|
if (step.submit) {
|
|
82
83
|
await locator.press("Enter");
|
|
@@ -251,6 +252,14 @@ class PlaywrightFlowRunner {
|
|
|
251
252
|
return { success: false, error: error.message };
|
|
252
253
|
}
|
|
253
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Resolve placeholders in text (e.g., {{username}} → variables.username)
|
|
257
|
+
*/
|
|
258
|
+
resolveText(text, variables) {
|
|
259
|
+
if (!variables || !text)
|
|
260
|
+
return text;
|
|
261
|
+
return text.replace(/\{\{(\w+)\}\}/g, (_, key) => variables[key] ?? "");
|
|
262
|
+
}
|
|
254
263
|
async resolveLocator(page, step, timeout) {
|
|
255
264
|
if (!("locator" in step) || !step.locator) {
|
|
256
265
|
throw new Error(`Step ${step.type} requires a locator`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auto-wiz/playwright",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "JaeSang",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"typescript": "^5.0.0",
|
|
33
33
|
"@types/node": "^20.0.0",
|
|
34
|
-
"@auto-wiz/core": "1.2.
|
|
34
|
+
"@auto-wiz/core": "1.2.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc"
|