@empiricalrun/playwright-utils 0.23.0 → 0.23.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/CHANGELOG.md +13 -0
- package/package.json +3 -3
- package/bundled/test-gen/actions/assert.d.ts +0 -4
- package/bundled/test-gen/actions/assert.d.ts.map +0 -1
- package/bundled/test-gen/actions/assert.js +0 -50
- package/bundled/test-gen/actions/click.d.ts +0 -4
- package/bundled/test-gen/actions/click.d.ts.map +0 -1
- package/bundled/test-gen/actions/click.js +0 -51
- package/bundled/test-gen/actions/constants/index.d.ts +0 -2
- package/bundled/test-gen/actions/constants/index.d.ts.map +0 -1
- package/bundled/test-gen/actions/constants/index.js +0 -4
- package/bundled/test-gen/actions/done.d.ts +0 -4
- package/bundled/test-gen/actions/done.d.ts.map +0 -1
- package/bundled/test-gen/actions/done.js +0 -30
- package/bundled/test-gen/actions/fill.d.ts +0 -4
- package/bundled/test-gen/actions/fill.d.ts.map +0 -1
- package/bundled/test-gen/actions/fill.js +0 -82
- package/bundled/test-gen/actions/goto.d.ts +0 -4
- package/bundled/test-gen/actions/goto.d.ts.map +0 -1
- package/bundled/test-gen/actions/goto.js +0 -47
- package/bundled/test-gen/actions/hover.d.ts +0 -4
- package/bundled/test-gen/actions/hover.d.ts.map +0 -1
- package/bundled/test-gen/actions/hover.js +0 -51
- package/bundled/test-gen/actions/index.d.ts +0 -30
- package/bundled/test-gen/actions/index.d.ts.map +0 -1
- package/bundled/test-gen/actions/index.js +0 -159
- package/bundled/test-gen/actions/next-task.d.ts +0 -53
- package/bundled/test-gen/actions/next-task.d.ts.map +0 -1
- package/bundled/test-gen/actions/next-task.js +0 -58
- package/bundled/test-gen/actions/press.d.ts +0 -4
- package/bundled/test-gen/actions/press.d.ts.map +0 -1
- package/bundled/test-gen/actions/press.js +0 -56
- package/bundled/test-gen/actions/skill.d.ts +0 -21
- package/bundled/test-gen/actions/skill.d.ts.map +0 -1
- package/bundled/test-gen/actions/skill.js +0 -127
- package/bundled/test-gen/actions/text-content.d.ts +0 -4
- package/bundled/test-gen/actions/text-content.d.ts.map +0 -1
- package/bundled/test-gen/actions/text-content.js +0 -58
- package/bundled/test-gen/actions/utils/index.d.ts +0 -10
- package/bundled/test-gen/actions/utils/index.d.ts.map +0 -1
- package/bundled/test-gen/actions/utils/index.js +0 -109
- package/bundled/test-gen/agent/browsing/index.d.ts +0 -15
- package/bundled/test-gen/agent/browsing/index.d.ts.map +0 -1
- package/bundled/test-gen/agent/browsing/index.js +0 -68
- package/bundled/test-gen/agent/browsing/run.d.ts +0 -19
- package/bundled/test-gen/agent/browsing/run.d.ts.map +0 -1
- package/bundled/test-gen/agent/browsing/run.js +0 -88
- package/bundled/test-gen/agent/browsing/utils.d.ts +0 -41
- package/bundled/test-gen/agent/browsing/utils.d.ts.map +0 -1
- package/bundled/test-gen/agent/browsing/utils.js +0 -406
- package/bundled/test-gen/agent/codegen/create-test-block.d.ts +0 -9
- package/bundled/test-gen/agent/codegen/create-test-block.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/create-test-block.js +0 -63
- package/bundled/test-gen/agent/codegen/fix-ts-errors.d.ts +0 -13
- package/bundled/test-gen/agent/codegen/fix-ts-errors.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/fix-ts-errors.js +0 -80
- package/bundled/test-gen/agent/codegen/generate-code-apply-changes.d.ts +0 -13
- package/bundled/test-gen/agent/codegen/generate-code-apply-changes.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/generate-code-apply-changes.js +0 -381
- package/bundled/test-gen/agent/codegen/lexical-scoped-vars.d.ts +0 -9
- package/bundled/test-gen/agent/codegen/lexical-scoped-vars.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/lexical-scoped-vars.js +0 -56
- package/bundled/test-gen/agent/codegen/repo-edit.d.ts +0 -23
- package/bundled/test-gen/agent/codegen/repo-edit.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/repo-edit.js +0 -86
- package/bundled/test-gen/agent/codegen/run.d.ts +0 -16
- package/bundled/test-gen/agent/codegen/run.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/run.js +0 -119
- package/bundled/test-gen/agent/codegen/skills-retriever.d.ts +0 -26
- package/bundled/test-gen/agent/codegen/skills-retriever.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/skills-retriever.js +0 -93
- package/bundled/test-gen/agent/codegen/test-update-feedback.d.ts +0 -12
- package/bundled/test-gen/agent/codegen/test-update-feedback.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/test-update-feedback.js +0 -50
- package/bundled/test-gen/agent/codegen/types.d.ts +0 -25
- package/bundled/test-gen/agent/codegen/types.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/types.js +0 -8
- package/bundled/test-gen/agent/codegen/update-flow.d.ts +0 -34
- package/bundled/test-gen/agent/codegen/update-flow.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/update-flow.js +0 -300
- package/bundled/test-gen/agent/codegen/use-skill.d.ts +0 -11
- package/bundled/test-gen/agent/codegen/use-skill.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/use-skill.js +0 -54
- package/bundled/test-gen/agent/codegen/utils.d.ts +0 -126
- package/bundled/test-gen/agent/codegen/utils.d.ts.map +0 -1
- package/bundled/test-gen/agent/codegen/utils.js +0 -416
- package/bundled/test-gen/agent/diagnosis-agent/index.d.ts +0 -18
- package/bundled/test-gen/agent/diagnosis-agent/index.d.ts.map +0 -1
- package/bundled/test-gen/agent/diagnosis-agent/index.js +0 -105
- package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.d.ts +0 -9
- package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.d.ts.map +0 -1
- package/bundled/test-gen/agent/diagnosis-agent/strict-mode-violation.js +0 -31
- package/bundled/test-gen/agent/enrich-prompt/index.d.ts +0 -12
- package/bundled/test-gen/agent/enrich-prompt/index.d.ts.map +0 -1
- package/bundled/test-gen/agent/enrich-prompt/index.js +0 -81
- package/bundled/test-gen/agent/enrich-prompt/utils.d.ts +0 -6
- package/bundled/test-gen/agent/enrich-prompt/utils.d.ts.map +0 -1
- package/bundled/test-gen/agent/enrich-prompt/utils.js +0 -12
- package/bundled/test-gen/agent/infer-agent/index.d.ts +0 -10
- package/bundled/test-gen/agent/infer-agent/index.d.ts.map +0 -1
- package/bundled/test-gen/agent/infer-agent/index.js +0 -70
- package/bundled/test-gen/agent/master/action-tool-calls.d.ts +0 -42
- package/bundled/test-gen/agent/master/action-tool-calls.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/action-tool-calls.js +0 -87
- package/bundled/test-gen/agent/master/browser-tests/fixtures.d.ts +0 -9
- package/bundled/test-gen/agent/master/browser-tests/fixtures.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/browser-tests/fixtures.js +0 -33
- package/bundled/test-gen/agent/master/browser-tests/index.spec.d.ts +0 -2
- package/bundled/test-gen/agent/master/browser-tests/index.spec.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/browser-tests/index.spec.js +0 -113
- package/bundled/test-gen/agent/master/browser-tests/skills.spec.d.ts +0 -2
- package/bundled/test-gen/agent/master/browser-tests/skills.spec.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/browser-tests/skills.spec.js +0 -109
- package/bundled/test-gen/agent/master/element-annotation.d.ts +0 -30
- package/bundled/test-gen/agent/master/element-annotation.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/element-annotation.js +0 -195
- package/bundled/test-gen/agent/master/execute-browser-action.d.ts +0 -24
- package/bundled/test-gen/agent/master/execute-browser-action.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/execute-browser-action.js +0 -124
- package/bundled/test-gen/agent/master/execute-skill-action.d.ts +0 -11
- package/bundled/test-gen/agent/master/execute-skill-action.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/execute-skill-action.js +0 -25
- package/bundled/test-gen/agent/master/icon-descriptor/index.d.ts +0 -22
- package/bundled/test-gen/agent/master/icon-descriptor/index.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/icon-descriptor/index.js +0 -250
- package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.d.ts +0 -2
- package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/icon-descriptor/normalize-svg.js +0 -248
- package/bundled/test-gen/agent/master/next-action.d.ts +0 -22
- package/bundled/test-gen/agent/master/next-action.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/next-action.js +0 -104
- package/bundled/test-gen/agent/master/planner.d.ts +0 -15
- package/bundled/test-gen/agent/master/planner.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/planner.js +0 -144
- package/bundled/test-gen/agent/master/run.d.ts +0 -15
- package/bundled/test-gen/agent/master/run.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/run.js +0 -274
- package/bundled/test-gen/agent/master/scroller.d.ts +0 -15
- package/bundled/test-gen/agent/master/scroller.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/scroller.js +0 -375
- package/bundled/test-gen/agent/master/with-hints.d.ts +0 -17
- package/bundled/test-gen/agent/master/with-hints.d.ts.map +0 -1
- package/bundled/test-gen/agent/master/with-hints.js +0 -102
- package/bundled/test-gen/agent/planner/run-time-planner.d.ts +0 -15
- package/bundled/test-gen/agent/planner/run-time-planner.d.ts.map +0 -1
- package/bundled/test-gen/agent/planner/run-time-planner.js +0 -100
- package/bundled/test-gen/agent/planner/run.d.ts +0 -7
- package/bundled/test-gen/agent/planner/run.d.ts.map +0 -1
- package/bundled/test-gen/agent/planner/run.js +0 -127
- package/bundled/test-gen/agent/utils.d.ts +0 -2
- package/bundled/test-gen/agent/utils.d.ts.map +0 -1
- package/bundled/test-gen/agent/utils.js +0 -12
- package/bundled/test-gen/bin/index.d.ts +0 -3
- package/bundled/test-gen/bin/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/index.js +0 -212
- package/bundled/test-gen/bin/logger/index.d.ts +0 -14
- package/bundled/test-gen/bin/logger/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/logger/index.js +0 -57
- package/bundled/test-gen/bin/utils/context.d.ts +0 -13
- package/bundled/test-gen/bin/utils/context.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/context.js +0 -67
- package/bundled/test-gen/bin/utils/fs/index.d.ts +0 -6
- package/bundled/test-gen/bin/utils/fs/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/fs/index.js +0 -63
- package/bundled/test-gen/bin/utils/index.d.ts +0 -9
- package/bundled/test-gen/bin/utils/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/index.js +0 -64
- package/bundled/test-gen/bin/utils/platform/web/index.d.ts +0 -78
- package/bundled/test-gen/bin/utils/platform/web/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/platform/web/index.js +0 -544
- package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.d.ts +0 -2
- package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/platform/web/test-files/ts-path-import-validate.js +0 -7
- package/bundled/test-gen/bin/utils/scenarios/index.d.ts +0 -6
- package/bundled/test-gen/bin/utils/scenarios/index.d.ts.map +0 -1
- package/bundled/test-gen/bin/utils/scenarios/index.js +0 -57
- package/bundled/test-gen/browser-injected-scripts/annotate-elements.js +0 -615
- package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.d.ts +0 -2
- package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.d.ts.map +0 -1
- package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.js +0 -207
- package/bundled/test-gen/browser-injected-scripts/annotate-elements.spec.ts +0 -332
- package/bundled/test-gen/constants/index.d.ts +0 -7
- package/bundled/test-gen/constants/index.d.ts.map +0 -1
- package/bundled/test-gen/constants/index.js +0 -18
- package/bundled/test-gen/errors/index.d.ts +0 -5
- package/bundled/test-gen/errors/index.d.ts.map +0 -1
- package/bundled/test-gen/errors/index.js +0 -9
- package/bundled/test-gen/evals/add-scenario-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/add-scenario-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/add-scenario-agent.evals.js +0 -44
- package/bundled/test-gen/evals/append-create-test-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/append-create-test-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/append-create-test-agent.evals.js +0 -117
- package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/fetch-pom-skills-agent.evals.js +0 -36
- package/bundled/test-gen/evals/infer-master-or-code-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/infer-master-or-code-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/infer-master-or-code-agent.evals.js +0 -22
- package/bundled/test-gen/evals/master-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/master-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/master-agent.evals.js +0 -35
- package/bundled/test-gen/evals/type.d.ts +0 -12
- package/bundled/test-gen/evals/type.d.ts.map +0 -1
- package/bundled/test-gen/evals/type.js +0 -2
- package/bundled/test-gen/evals/update-scenario-agent.evals.d.ts +0 -4
- package/bundled/test-gen/evals/update-scenario-agent.evals.d.ts.map +0 -1
- package/bundled/test-gen/evals/update-scenario-agent.evals.js +0 -47
- package/bundled/test-gen/file/client.d.ts +0 -14
- package/bundled/test-gen/file/client.d.ts.map +0 -1
- package/bundled/test-gen/file/client.js +0 -48
- package/bundled/test-gen/file/server.d.ts +0 -13
- package/bundled/test-gen/file/server.d.ts.map +0 -1
- package/bundled/test-gen/file/server.js +0 -52
- package/bundled/test-gen/human-in-the-loop/cli.d.ts +0 -2
- package/bundled/test-gen/human-in-the-loop/cli.d.ts.map +0 -1
- package/bundled/test-gen/human-in-the-loop/cli.js +0 -24
- package/bundled/test-gen/human-in-the-loop/index.d.ts +0 -12
- package/bundled/test-gen/human-in-the-loop/index.d.ts.map +0 -1
- package/bundled/test-gen/human-in-the-loop/index.js +0 -30
- package/bundled/test-gen/human-in-the-loop/ipc.d.ts +0 -4
- package/bundled/test-gen/human-in-the-loop/ipc.d.ts.map +0 -1
- package/bundled/test-gen/human-in-the-loop/ipc.js +0 -47
- package/bundled/test-gen/index.d.ts +0 -4
- package/bundled/test-gen/index.d.ts.map +0 -1
- package/bundled/test-gen/index.js +0 -55
- package/bundled/test-gen/package.json +0 -106
- package/bundled/test-gen/page/index.d.ts +0 -11
- package/bundled/test-gen/page/index.d.ts.map +0 -1
- package/bundled/test-gen/page/index.js +0 -16
- package/bundled/test-gen/prompts/lib/ts-transformer.d.ts +0 -4
- package/bundled/test-gen/prompts/lib/ts-transformer.d.ts.map +0 -1
- package/bundled/test-gen/prompts/lib/ts-transformer.js +0 -92
- package/bundled/test-gen/reporter/index.d.ts +0 -33
- package/bundled/test-gen/reporter/index.d.ts.map +0 -1
- package/bundled/test-gen/reporter/index.js +0 -161
- package/bundled/test-gen/session/index.d.ts +0 -20
- package/bundled/test-gen/session/index.d.ts.map +0 -1
- package/bundled/test-gen/session/index.js +0 -105
- package/bundled/test-gen/test-build/index.d.ts +0 -10
- package/bundled/test-gen/test-build/index.d.ts.map +0 -1
- package/bundled/test-gen/test-build/index.js +0 -30
- package/bundled/test-gen/types/index.d.ts +0 -69
- package/bundled/test-gen/types/index.d.ts.map +0 -1
- package/bundled/test-gen/types/index.js +0 -2
- package/bundled/test-gen/uploader/index.d.ts +0 -26
- package/bundled/test-gen/uploader/index.d.ts.map +0 -1
- package/bundled/test-gen/uploader/index.js +0 -102
- package/bundled/test-gen/utils/env.d.ts +0 -2
- package/bundled/test-gen/utils/env.d.ts.map +0 -1
- package/bundled/test-gen/utils/env.js +0 -9
- package/bundled/test-gen/utils/exec.d.ts +0 -4
- package/bundled/test-gen/utils/exec.d.ts.map +0 -1
- package/bundled/test-gen/utils/exec.js +0 -45
- package/bundled/test-gen/utils/file.d.ts +0 -2
- package/bundled/test-gen/utils/file.d.ts.map +0 -1
- package/bundled/test-gen/utils/file.js +0 -25
- package/bundled/test-gen/utils/html.d.ts +0 -4
- package/bundled/test-gen/utils/html.d.ts.map +0 -1
- package/bundled/test-gen/utils/html.js +0 -46
- package/bundled/test-gen/utils/index.d.ts +0 -2
- package/bundled/test-gen/utils/index.d.ts.map +0 -1
- package/bundled/test-gen/utils/index.js +0 -5
- package/bundled/test-gen/utils/pw-test.d.ts +0 -3
- package/bundled/test-gen/utils/pw-test.d.ts.map +0 -1
- package/bundled/test-gen/utils/pw-test.js +0 -26
- package/bundled/test-gen/utils/slug.d.ts +0 -2
- package/bundled/test-gen/utils/slug.d.ts.map +0 -1
- package/bundled/test-gen/utils/slug.js +0 -18
- package/bundled/test-gen/utils/string.d.ts +0 -2
- package/bundled/test-gen/utils/string.d.ts.map +0 -1
- package/bundled/test-gen/utils/string.js +0 -9
- package/scripts/prepare-publish.js +0 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @empiricalrun/playwright-utils
|
|
2
2
|
|
|
3
|
+
## 0.23.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [9481edf]
|
|
8
|
+
- @empiricalrun/test-gen@0.47.0
|
|
9
|
+
|
|
10
|
+
## 0.23.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 73a27b8: revert: bundling test-gen with playwright-utils
|
|
15
|
+
|
|
3
16
|
## 0.23.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empiricalrun/playwright-utils",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/code-frame": "^7.24.7",
|
|
37
|
-
"@empiricalrun/test-gen": "file:./bundled/test-gen",
|
|
38
37
|
"async-retry": "^1.3.3",
|
|
39
38
|
"console-log-level": "^1.4.1",
|
|
40
39
|
"mailosaur": "^8.6.1",
|
|
@@ -44,7 +43,8 @@
|
|
|
44
43
|
"puppeteer-extra-plugin-recaptcha": "^3.6.8",
|
|
45
44
|
"rimraf": "^6.0.1",
|
|
46
45
|
"@empiricalrun/llm": "^0.9.35",
|
|
47
|
-
"@empiricalrun/r2-uploader": "^0.3.8"
|
|
46
|
+
"@empiricalrun/r2-uploader": "^0.3.8",
|
|
47
|
+
"@empiricalrun/test-gen": "^0.47.0"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "tsc --build --watch",
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AssertTextVisibilityActionArgs, PlaywrightActionGenerator } from "../types";
|
|
2
|
-
export declare const PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
|
|
3
|
-
export declare const assertTextVisibilityActionGenerator: PlaywrightActionGenerator<AssertTextVisibilityActionArgs>;
|
|
4
|
-
//# sourceMappingURL=assert.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/actions/assert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAIlB,eAAO,MAAM,6CAA6C,2BAChC,CAAC;AAE3B,eAAO,MAAM,mCAAmC,EAAE,yBAAyB,CACzE,8BAA8B,CAqD/B,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertTextVisibilityActionGenerator = exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME = "assert_text_visibility";
|
|
7
|
-
const assertTextVisibilityActionGenerator = (page) => {
|
|
8
|
-
return {
|
|
9
|
-
execute: async ({ args }) => {
|
|
10
|
-
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(args.css_selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
|
|
11
|
-
const exec = new Function("page", `return page.${locator}.isVisible({ timeout: 3000 })`);
|
|
12
|
-
await exec(page.pwPageInstance);
|
|
13
|
-
return {
|
|
14
|
-
locator,
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
template: (args, options) => {
|
|
18
|
-
return {
|
|
19
|
-
code: `await expect(${page.name}.${options.locator}).toBeVisible();`,
|
|
20
|
-
};
|
|
21
|
-
},
|
|
22
|
-
name: exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME,
|
|
23
|
-
schema: {
|
|
24
|
-
type: "function",
|
|
25
|
-
function: {
|
|
26
|
-
name: exports.PLAYWRIGHT_ASSERT_TEXT_VISIBILITY_ACTION_NAME,
|
|
27
|
-
description: "assert whether the given element on the page is visible",
|
|
28
|
-
parameters: {
|
|
29
|
-
type: "object",
|
|
30
|
-
properties: {
|
|
31
|
-
reason: {
|
|
32
|
-
type: "string",
|
|
33
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
34
|
-
},
|
|
35
|
-
xpath: {
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
38
|
-
},
|
|
39
|
-
css_selector: {
|
|
40
|
-
type: "string",
|
|
41
|
-
description: "CSS selector to identify the element uniquely and click it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
required: ["reason", "xpath", "css_selector"],
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
exports.assertTextVisibilityActionGenerator = assertTextVisibilityActionGenerator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"click.d.ts","sourceRoot":"","sources":["../../src/actions/click.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clickActionGenerator = exports.PLAYWRIGHT_CLICK_ACTION_NAME = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
exports.PLAYWRIGHT_CLICK_ACTION_NAME = "click_element";
|
|
7
|
-
const clickActionGenerator = (page) => {
|
|
8
|
-
return {
|
|
9
|
-
execute: async ({ args }) => {
|
|
10
|
-
const selector = args.css_selector;
|
|
11
|
-
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
|
|
12
|
-
const exec = new Function("page", `return page.${locator}.click({ timeout: 3000 })`);
|
|
13
|
-
await exec(page.pwPageInstance);
|
|
14
|
-
return {
|
|
15
|
-
locator,
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
template: (args, options) => {
|
|
19
|
-
return {
|
|
20
|
-
code: `await ${page.name}.${options.locator}.click();`,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
name: exports.PLAYWRIGHT_CLICK_ACTION_NAME,
|
|
24
|
-
schema: {
|
|
25
|
-
type: "function",
|
|
26
|
-
function: {
|
|
27
|
-
name: exports.PLAYWRIGHT_CLICK_ACTION_NAME,
|
|
28
|
-
description: "click an element on the page",
|
|
29
|
-
parameters: {
|
|
30
|
-
type: "object",
|
|
31
|
-
properties: {
|
|
32
|
-
reason: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
35
|
-
},
|
|
36
|
-
xpath: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
39
|
-
},
|
|
40
|
-
css_selector: {
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "CSS selector to identify the element uniquely and click it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
required: ["reason", "xpath", "css_selector"],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
exports.clickActionGenerator = clickActionGenerator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/constants/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,qFAC2C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"done.d.ts","sourceRoot":"","sources":["../../src/actions/done.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CACzD,cAAc,CAwBf,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.doneActionGenerator = exports.PLAYWRIGHT_DONE_ACTION_NAME = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
exports.PLAYWRIGHT_DONE_ACTION_NAME = "task_done";
|
|
6
|
-
const doneActionGenerator = () => {
|
|
7
|
-
return {
|
|
8
|
-
execute: async () => { },
|
|
9
|
-
template: () => ({ code: "" }),
|
|
10
|
-
name: exports.PLAYWRIGHT_DONE_ACTION_NAME,
|
|
11
|
-
schema: {
|
|
12
|
-
type: "function",
|
|
13
|
-
function: {
|
|
14
|
-
name: exports.PLAYWRIGHT_DONE_ACTION_NAME,
|
|
15
|
-
description: "end the task by calling this method",
|
|
16
|
-
parameters: {
|
|
17
|
-
type: "object",
|
|
18
|
-
properties: {
|
|
19
|
-
reason: {
|
|
20
|
-
type: "string",
|
|
21
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
required: [],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
exports.doneActionGenerator = doneActionGenerator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/actions/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAIrE,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAGhE,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CA+FzE,CAAC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fillActionGenerator = exports.PLAYWRIGHT_FILL_ACTION_NAME = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
exports.PLAYWRIGHT_FILL_ACTION_NAME = "fill_input_element";
|
|
7
|
-
const NO_STATE_VARIABLE = "NA";
|
|
8
|
-
const fillActionGenerator = (page, options) => {
|
|
9
|
-
const stateVariableNames = Object.keys(options?.stateVariables || {});
|
|
10
|
-
stateVariableNames.push(NO_STATE_VARIABLE);
|
|
11
|
-
return {
|
|
12
|
-
execute: async ({ args }) => {
|
|
13
|
-
const css = args.css_selector;
|
|
14
|
-
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(css, args.xpath, page.pwPageInstance, args?.elementAnnotation);
|
|
15
|
-
const concernedStateVariable = options?.stateVariables[args.variable_name]
|
|
16
|
-
? args.variable_name
|
|
17
|
-
: "";
|
|
18
|
-
const testCaseLine = `${locator}.fill(${options?.stateVariables[args.variable_name]
|
|
19
|
-
? args.variable_name
|
|
20
|
-
: `"${args.text}"`})`;
|
|
21
|
-
const exec = new Function("page", ...(concernedStateVariable ? [concernedStateVariable] : []), `return page.${testCaseLine}`);
|
|
22
|
-
await exec(page.pwPageInstance, options?.stateVariables[args.variable_name]);
|
|
23
|
-
return {
|
|
24
|
-
locator,
|
|
25
|
-
testCaseLine,
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
template: (args, options) => {
|
|
29
|
-
return {
|
|
30
|
-
code: `await ${page.name}.${options.testCaseLine}`,
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
name: exports.PLAYWRIGHT_FILL_ACTION_NAME,
|
|
34
|
-
schema: {
|
|
35
|
-
type: "function",
|
|
36
|
-
function: {
|
|
37
|
-
name: exports.PLAYWRIGHT_FILL_ACTION_NAME,
|
|
38
|
-
description: "fill the input element with a particular text",
|
|
39
|
-
parameters: {
|
|
40
|
-
type: "object",
|
|
41
|
-
properties: {
|
|
42
|
-
reason: {
|
|
43
|
-
type: "string",
|
|
44
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
45
|
-
},
|
|
46
|
-
text: {
|
|
47
|
-
type: "string",
|
|
48
|
-
description: "The text to fill the input element with",
|
|
49
|
-
},
|
|
50
|
-
variable_name: {
|
|
51
|
-
type: "string",
|
|
52
|
-
enum: stateVariableNames,
|
|
53
|
-
description: `variable name whose value needs to be filled in the input element.
|
|
54
|
-
The variable name and values are:
|
|
55
|
-
|
|
56
|
-
${JSON.stringify(stateVariableNames, null, 2)}
|
|
57
|
-
|
|
58
|
-
- Choose the variable name based on the value above.
|
|
59
|
-
- Set variable_name as 'NA' if there is no variable to be used.`,
|
|
60
|
-
},
|
|
61
|
-
xpath: {
|
|
62
|
-
type: "string",
|
|
63
|
-
description: "XPath selector to identify the element uniquely and click it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
64
|
-
},
|
|
65
|
-
css_selector: {
|
|
66
|
-
type: "string",
|
|
67
|
-
description: "CSS selector to identify the element uniquely.When creating CSS selectors, ensure they are unique to the page and specific enough to select only one element.",
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
required: [
|
|
71
|
-
"reason",
|
|
72
|
-
"text",
|
|
73
|
-
"variable_name",
|
|
74
|
-
"xpath",
|
|
75
|
-
"css_selector",
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
exports.fillActionGenerator = fillActionGenerator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"goto.d.ts","sourceRoot":"","sources":["../../src/actions/goto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGrE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAEvD,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,cAAc,CA0CzE,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.gotoActionGenerator = exports.PLAYWRIGHT_GOTO_ACTION_NAME = void 0;
|
|
4
|
-
const utils_1 = require("../agent/browsing/utils");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
exports.PLAYWRIGHT_GOTO_ACTION_NAME = "page_goto";
|
|
7
|
-
const gotoActionGenerator = (page) => {
|
|
8
|
-
return {
|
|
9
|
-
execute: async ({ args }) => {
|
|
10
|
-
const url = args.url;
|
|
11
|
-
await page.pwPageInstance.goto(url);
|
|
12
|
-
await page.pwPageInstance.waitForTimeout(3000);
|
|
13
|
-
await (0, utils_1.injectPwLocatorGenerator)(page.pwPageInstance);
|
|
14
|
-
},
|
|
15
|
-
// TODO: args transformer to be kept at a single place
|
|
16
|
-
template: (args) => {
|
|
17
|
-
const url = args.url;
|
|
18
|
-
const code = `await ${page.name}.goto("${url}");`;
|
|
19
|
-
return {
|
|
20
|
-
code,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
|
|
24
|
-
schema: {
|
|
25
|
-
type: "function",
|
|
26
|
-
function: {
|
|
27
|
-
name: exports.PLAYWRIGHT_GOTO_ACTION_NAME,
|
|
28
|
-
description: "navigate the page to a new URL",
|
|
29
|
-
parameters: {
|
|
30
|
-
type: "object",
|
|
31
|
-
properties: {
|
|
32
|
-
reason: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
35
|
-
},
|
|
36
|
-
url: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "URL to navigate page to. Must be prefixed with http or https (preferably https)",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
required: ["reason", "url"],
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
exports.gotoActionGenerator = gotoActionGenerator;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hover.d.ts","sourceRoot":"","sources":["../../src/actions/hover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAItE,eAAO,MAAM,4BAA4B,kBAAkB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,CAC1D,eAAe,CAsDhB,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hoverActionGenerator = exports.PLAYWRIGHT_HOVER_ACTION_NAME = void 0;
|
|
4
|
-
const constants_1 = require("./constants");
|
|
5
|
-
const utils_1 = require("./utils");
|
|
6
|
-
exports.PLAYWRIGHT_HOVER_ACTION_NAME = "hover_element";
|
|
7
|
-
const hoverActionGenerator = (page) => {
|
|
8
|
-
return {
|
|
9
|
-
execute: async ({ args }) => {
|
|
10
|
-
const selector = args.css_selector;
|
|
11
|
-
const locator = await (0, utils_1.getPlaywrightLocatorUsingCssSelector)(selector, args.xpath, page.pwPageInstance, args?.elementAnnotation);
|
|
12
|
-
const exec = new Function("page", `return page.${locator}.hover({ timeout: 3000 })`);
|
|
13
|
-
await exec(page.pwPageInstance);
|
|
14
|
-
return {
|
|
15
|
-
locator,
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
template: (args, options) => {
|
|
19
|
-
return {
|
|
20
|
-
code: `await ${page.name}.${options.locator}.hover();`,
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
|
|
24
|
-
schema: {
|
|
25
|
-
type: "function",
|
|
26
|
-
function: {
|
|
27
|
-
name: exports.PLAYWRIGHT_HOVER_ACTION_NAME,
|
|
28
|
-
description: "hover over an element on the page",
|
|
29
|
-
parameters: {
|
|
30
|
-
type: "object",
|
|
31
|
-
properties: {
|
|
32
|
-
reason: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: constants_1.DEFAULT_ACTION_REASON_PROMPT,
|
|
35
|
-
},
|
|
36
|
-
xpath: {
|
|
37
|
-
type: "string",
|
|
38
|
-
description: "XPath selector to identify the element uniquely and hover over it. When creating XPATH selector, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
39
|
-
},
|
|
40
|
-
css_selector: {
|
|
41
|
-
type: "string",
|
|
42
|
-
description: "CSS selector to identify the element uniquely and hover over it. When creating CSS selectors, ensure they are unique and specific enough to select only one element, even if there are multiple elements of the same type (like multiple h1 elements)",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
required: ["reason", "xpath", "css_selector"],
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
exports.hoverActionGenerator = hoverActionGenerator;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TraceClient } from "@empiricalrun/llm";
|
|
2
|
-
import { TestGenPage } from "../page";
|
|
3
|
-
import { ActionArgs, ActionSchema } from "../types";
|
|
4
|
-
export declare class PlaywrightActions {
|
|
5
|
-
private page;
|
|
6
|
-
private stateVariables;
|
|
7
|
-
private actionGenerators;
|
|
8
|
-
private recordedActions;
|
|
9
|
-
constructor(page: TestGenPage, stateVariables?: Record<string, any>);
|
|
10
|
-
executeAction(name: string | undefined, args: ActionArgs, trace?: TraceClient): Promise<string | undefined>;
|
|
11
|
-
getBrowsingActionSchemas(): ActionSchema[];
|
|
12
|
-
getMasterActionSchemas(): ActionSchema[];
|
|
13
|
-
generateCode(): {
|
|
14
|
-
code: string;
|
|
15
|
-
importPaths: string[];
|
|
16
|
-
};
|
|
17
|
-
getLastCodeLines(count: number): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Function to check if the last three actions are repeated.
|
|
20
|
-
* If the steps / code are repeated then it means the generation is stuck in a loop.
|
|
21
|
-
*
|
|
22
|
-
* @return {boolean}
|
|
23
|
-
* @memberof PlaywrightActions
|
|
24
|
-
*/
|
|
25
|
-
isStuckInLoop(): boolean;
|
|
26
|
-
isComplete(): boolean;
|
|
27
|
-
getStateVariables(): Record<string, any>;
|
|
28
|
-
setStateVariables(stateVariables: Record<string, any>): void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAEL,UAAU,EACV,YAAY,EAEb,MAAM,UAAU,CAAC;AAWlB,qBAAa,iBAAiB;IAQ1B,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,cAAc;IARxB,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,eAAe,CAInB;gBAEM,IAAI,EAAE,WAAW,EACjB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IAgB5C,aAAa,CACjB,IAAI,oBAAa,EACjB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IA0D9B,wBAAwB,IAAI,YAAY,EAAE;IAoB1C,sBAAsB,IAAI,YAAY,EAAE;IAWxC,YAAY,IAAI;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,EAAE,CAAC;KACvB;IAUD,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAK9B;;;;;;OAMG;IACH,aAAa,IAAI,OAAO;IAQxB,UAAU;IAWV,iBAAiB;IAIjB,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAItD"}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlaywrightActions = void 0;
|
|
4
|
-
const logger_1 = require("../bin/logger");
|
|
5
|
-
const errors_1 = require("../errors");
|
|
6
|
-
const reporter_1 = require("../reporter");
|
|
7
|
-
const assert_1 = require("./assert");
|
|
8
|
-
const click_1 = require("./click");
|
|
9
|
-
const done_1 = require("./done");
|
|
10
|
-
const fill_1 = require("./fill");
|
|
11
|
-
const goto_1 = require("./goto");
|
|
12
|
-
const hover_1 = require("./hover");
|
|
13
|
-
const press_1 = require("./press");
|
|
14
|
-
const skill_1 = require("./skill");
|
|
15
|
-
const text_content_1 = require("./text-content");
|
|
16
|
-
class PlaywrightActions {
|
|
17
|
-
page;
|
|
18
|
-
stateVariables;
|
|
19
|
-
actionGenerators;
|
|
20
|
-
recordedActions;
|
|
21
|
-
constructor(page, stateVariables = {}) {
|
|
22
|
-
this.page = page;
|
|
23
|
-
this.stateVariables = stateVariables;
|
|
24
|
-
this.actionGenerators = [
|
|
25
|
-
fill_1.fillActionGenerator,
|
|
26
|
-
goto_1.gotoActionGenerator,
|
|
27
|
-
click_1.clickActionGenerator,
|
|
28
|
-
hover_1.hoverActionGenerator,
|
|
29
|
-
press_1.pressActionGenerator,
|
|
30
|
-
done_1.doneActionGenerator,
|
|
31
|
-
assert_1.assertTextVisibilityActionGenerator,
|
|
32
|
-
text_content_1.textContentActionGenerator,
|
|
33
|
-
skill_1.skillActionGenerator,
|
|
34
|
-
];
|
|
35
|
-
this.recordedActions = [];
|
|
36
|
-
}
|
|
37
|
-
async executeAction(name = "", args, trace) {
|
|
38
|
-
const [action] = this.actionGenerators
|
|
39
|
-
.map((a) => a(this.page, {
|
|
40
|
-
stateVariables: this.stateVariables,
|
|
41
|
-
setStateVariables: this.setStateVariables.bind(this),
|
|
42
|
-
}))
|
|
43
|
-
.filter((a) => a.name === name);
|
|
44
|
-
if (!action) {
|
|
45
|
-
throw Error(`No action registered for action: ${name}`);
|
|
46
|
-
}
|
|
47
|
-
const logger = new logger_1.CustomLogger({ useReporter: false });
|
|
48
|
-
const testgenUpdatesReporter = new reporter_1.TestGenUpdatesReporter();
|
|
49
|
-
logger.logEmptyLine();
|
|
50
|
-
const actionSpan = trace?.span({
|
|
51
|
-
name: "execute-action",
|
|
52
|
-
input: {
|
|
53
|
-
name,
|
|
54
|
-
args,
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
try {
|
|
58
|
-
const templateOptions = (await action.execute({
|
|
59
|
-
args,
|
|
60
|
-
trace: actionSpan,
|
|
61
|
-
})) || {
|
|
62
|
-
locator: "",
|
|
63
|
-
};
|
|
64
|
-
// record successful actions
|
|
65
|
-
const { code, importPath } = action.template(args, templateOptions);
|
|
66
|
-
actionSpan?.end({
|
|
67
|
-
output: {
|
|
68
|
-
code,
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
this.recordedActions.push({ name, code, importPath });
|
|
72
|
-
if (code) {
|
|
73
|
-
logger.log(`action: ${name} \ncode: ${code} \nreason: ${args.reason}`);
|
|
74
|
-
void testgenUpdatesReporter.sendMessage("```ts\n" + code + "\n```");
|
|
75
|
-
}
|
|
76
|
-
return code;
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
actionSpan?.end({
|
|
80
|
-
output: {
|
|
81
|
-
error: e.message,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
logger.log(`action: ${name} \nreason: ${args.reason}`);
|
|
85
|
-
// if its already parsed error throw it as is
|
|
86
|
-
if (e instanceof errors_1.TestGenError) {
|
|
87
|
-
throw e;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
throw new errors_1.TestGenError(`Error executing ${name} action: ${e.message}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
getBrowsingActionSchemas() {
|
|
95
|
-
return [
|
|
96
|
-
fill_1.fillActionGenerator,
|
|
97
|
-
goto_1.gotoActionGenerator,
|
|
98
|
-
click_1.clickActionGenerator,
|
|
99
|
-
press_1.pressActionGenerator,
|
|
100
|
-
done_1.doneActionGenerator,
|
|
101
|
-
assert_1.assertTextVisibilityActionGenerator,
|
|
102
|
-
text_content_1.textContentActionGenerator,
|
|
103
|
-
hover_1.hoverActionGenerator,
|
|
104
|
-
]
|
|
105
|
-
.map((a) => a(this.page, {
|
|
106
|
-
stateVariables: this.stateVariables,
|
|
107
|
-
setStateVariables: this.setStateVariables.bind(this),
|
|
108
|
-
}))
|
|
109
|
-
.map((a) => a.schema);
|
|
110
|
-
}
|
|
111
|
-
getMasterActionSchemas() {
|
|
112
|
-
return [skill_1.skillActionGenerator]
|
|
113
|
-
.map((a) => a(this.page, {
|
|
114
|
-
stateVariables: this.stateVariables,
|
|
115
|
-
setStateVariables: this.setStateVariables.bind(this),
|
|
116
|
-
}))
|
|
117
|
-
.map((a) => a.schema);
|
|
118
|
-
}
|
|
119
|
-
generateCode() {
|
|
120
|
-
const importPaths = this.recordedActions
|
|
121
|
-
.map((a) => a.importPath || "")
|
|
122
|
-
.filter((a) => !!a);
|
|
123
|
-
return {
|
|
124
|
-
code: this.recordedActions.map((a) => a.code).join("\n"),
|
|
125
|
-
importPaths,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
getLastCodeLines(count) {
|
|
129
|
-
const actions = this.recordedActions;
|
|
130
|
-
return actions.slice(-count).map((a) => a.code);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Function to check if the last three actions are repeated.
|
|
134
|
-
* If the steps / code are repeated then it means the generation is stuck in a loop.
|
|
135
|
-
*
|
|
136
|
-
* @return {boolean}
|
|
137
|
-
* @memberof PlaywrightActions
|
|
138
|
-
*/
|
|
139
|
-
isStuckInLoop() {
|
|
140
|
-
const lastThreeLinesOfCode = this.getLastCodeLines(3);
|
|
141
|
-
const areLastActionsRepeatitive = lastThreeLinesOfCode.length === 3 &&
|
|
142
|
-
lastThreeLinesOfCode.every((a) => a === lastThreeLinesOfCode[0]);
|
|
143
|
-
return areLastActionsRepeatitive;
|
|
144
|
-
}
|
|
145
|
-
isComplete() {
|
|
146
|
-
const [doneAction] = this.recordedActions.filter((a) => a.name === done_1.PLAYWRIGHT_DONE_ACTION_NAME);
|
|
147
|
-
// filter out done action from recorded actions aftet execution is marked complete
|
|
148
|
-
this.recordedActions = this.recordedActions.filter((a) => a.name !== done_1.PLAYWRIGHT_DONE_ACTION_NAME);
|
|
149
|
-
return !!doneAction;
|
|
150
|
-
}
|
|
151
|
-
getStateVariables() {
|
|
152
|
-
return this.stateVariables;
|
|
153
|
-
}
|
|
154
|
-
setStateVariables(stateVariables) {
|
|
155
|
-
this.stateVariables = stateVariables;
|
|
156
|
-
console.log("setStateVariables", Object.keys(this.stateVariables));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
exports.PlaywrightActions = PlaywrightActions;
|