@auto-wiz/playwright 1.3.0 → 1.3.2
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 +15 -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
|
@@ -33,6 +33,10 @@ class PlaywrightFlowRunner {
|
|
|
33
33
|
}
|
|
34
34
|
for (const [index, step] of flow.steps.entries()) {
|
|
35
35
|
try {
|
|
36
|
+
// Step delay for debugging
|
|
37
|
+
if (options.stepDelay && index > 0) {
|
|
38
|
+
await page.waitForTimeout(options.stepDelay);
|
|
39
|
+
}
|
|
36
40
|
const result = await this.runStep(step, page, options);
|
|
37
41
|
if (!result.success) {
|
|
38
42
|
// Playwright usually throws, but if we catch it:
|
|
@@ -76,7 +80,9 @@ class PlaywrightFlowRunner {
|
|
|
76
80
|
}
|
|
77
81
|
case "type": {
|
|
78
82
|
const locator = await this.resolveLocator(page, step, timeout);
|
|
79
|
-
|
|
83
|
+
// originalText가 실제 값, text는 마스킹된 값
|
|
84
|
+
const rawText = step.originalText || step.text || "";
|
|
85
|
+
const text = this.resolveText(rawText, options.variables);
|
|
80
86
|
await locator.fill(text, { timeout });
|
|
81
87
|
if (step.submit) {
|
|
82
88
|
await locator.press("Enter");
|
|
@@ -251,6 +257,14 @@ class PlaywrightFlowRunner {
|
|
|
251
257
|
return { success: false, error: error.message };
|
|
252
258
|
}
|
|
253
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Resolve placeholders in text (e.g., {{username}} → variables.username)
|
|
262
|
+
*/
|
|
263
|
+
resolveText(text, variables) {
|
|
264
|
+
if (!variables || !text)
|
|
265
|
+
return text;
|
|
266
|
+
return text.replace(/\{\{(\w+)\}\}/g, (_, key) => variables[key] ?? "");
|
|
267
|
+
}
|
|
254
268
|
async resolveLocator(page, step, timeout) {
|
|
255
269
|
if (!("locator" in step) || !step.locator) {
|
|
256
270
|
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.2",
|
|
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.2"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc"
|