create-appraisejs 0.3.1-alpha.0 → 0.3.1-alpha.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/README.md +17 -17
- package/dist/cli.e2e.test.d.ts +2 -2
- package/dist/cli.e2e.test.js +74 -72
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/config.test.d.ts +2 -2
- package/dist/config.test.js +64 -64
- package/dist/copy-template.test.d.ts +2 -2
- package/dist/copy-template.test.js +70 -70
- package/dist/download-repo.test.d.ts +2 -2
- package/dist/download-repo.test.js +15 -13
- package/dist/install.test.d.ts +2 -2
- package/dist/install.test.js +115 -114
- package/dist/prepare-template-utils.d.ts.map +1 -1
- package/dist/prepare-template-utils.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +2 -2
- package/dist/prompts.js.map +1 -1
- package/dist/prompts.test.d.ts +2 -2
- package/dist/prompts.test.js +54 -54
- package/dist/sync-templates-utils.d.ts.map +1 -1
- package/dist/sync-templates-utils.js +1 -5
- package/dist/sync-templates-utils.js.map +1 -1
- package/package.json +1 -1
- package/templates/blank/.editorconfig +11 -0
- package/templates/blank/.gitattributes +21 -0
- package/templates/blank/.gitconfig.appraise +14 -0
- package/templates/blank/.prettierrc +13 -0
- package/templates/blank/.vscode/settings.json +2 -0
- package/templates/blank/README.md +12 -12
- package/templates/blank/components.json +24 -24
- package/templates/blank/cucumber.mjs +16 -16
- package/templates/blank/e2e/README.md +56 -0
- package/templates/blank/e2e/apply-migrations.mjs +76 -0
- package/templates/blank/e2e/appraise-smoke.spec.ts +78 -0
- package/templates/blank/e2e/authoring.spec.ts +53 -0
- package/templates/blank/e2e/crud-configuration.spec.ts +138 -0
- package/templates/blank/e2e/crud-tests.spec.ts +76 -0
- package/templates/blank/e2e/helpers/forms.ts +186 -0
- package/templates/blank/e2e/helpers/navigation.ts +27 -0
- package/templates/blank/e2e/helpers/table.ts +45 -0
- package/templates/blank/e2e/helpers/test-data.ts +549 -0
- package/templates/blank/e2e/helpers/ui.ts +41 -0
- package/templates/blank/e2e/navigation.spec.ts +101 -0
- package/templates/blank/e2e/runs-and-reports.spec.ts +82 -0
- package/templates/blank/e2e/settings-sync.spec.ts +39 -0
- package/templates/blank/e2e/start-server.mjs +61 -0
- package/templates/blank/eslint.config.mjs +4 -4
- package/templates/blank/gitignore +0 -3
- package/templates/blank/next-env.d.ts +1 -1
- package/templates/blank/package-lock.json +58 -102
- package/templates/blank/package.json +10 -9
- package/templates/blank/packages/cucumber-runtime/package.json +13 -13
- package/templates/blank/packages/cucumber-runtime/src/cache.util.ts +93 -93
- package/templates/blank/packages/cucumber-runtime/src/cli.ts +77 -68
- package/templates/blank/packages/cucumber-runtime/src/environment.util.ts +21 -21
- package/templates/blank/packages/cucumber-runtime/src/executor.ts +32 -32
- package/templates/blank/packages/cucumber-runtime/src/index.ts +17 -17
- package/templates/blank/packages/cucumber-runtime/src/locator.util.ts +234 -234
- package/templates/blank/packages/cucumber-runtime/src/parameter-types.ts +7 -7
- package/templates/blank/packages/cucumber-runtime/src/random-data.util.ts +35 -35
- package/templates/blank/packages/cucumber-runtime/src/types.ts +13 -13
- package/templates/blank/packages/cucumber-runtime/src/world.ts +44 -44
- package/templates/blank/packages/cucumber-runtime/tsconfig.json +11 -11
- package/templates/blank/packages/locator-picker-companion/dist/cli.js +1 -1
- package/templates/blank/packages/locator-picker-companion/dist/index.d.ts +3 -3
- package/templates/blank/packages/locator-picker-companion/dist/index.js +3 -3
- package/templates/blank/packages/locator-picker-companion/dist/injected-picker-script.js +13 -3
- package/templates/blank/packages/locator-picker-companion/dist/selector-generator.d.ts +6 -3
- package/templates/blank/packages/locator-picker-companion/dist/selector-generator.js +233 -229
- package/templates/blank/packages/locator-picker-companion/src/cli.ts +1 -7
- package/templates/blank/packages/locator-picker-companion/src/injected-picker-script.ts +26 -5
- package/templates/blank/packages/locator-picker-companion/src/launcher.ts +1 -3
- package/templates/blank/packages/locator-picker-companion/src/session-file.ts +4 -15
- package/templates/blank/packages/locator-picker-companion/src/types.ts +1 -8
- package/templates/blank/playwright.config.ts +46 -0
- package/templates/blank/postcss.config.mjs +8 -8
- package/templates/blank/prisma/dev.db +0 -0
- package/templates/blank/scripts/configure-git-line-endings.mjs +91 -0
- package/templates/blank/scripts/install-template-step.ts +5 -1
- package/templates/blank/scripts/lib/step-matcher.test.ts +3 -3
- package/templates/blank/scripts/lib/step-matcher.ts +5 -1
- package/templates/blank/scripts/lib/template-step-installer.test.ts +4 -2
- package/templates/blank/scripts/lib/template-step-installer.ts +16 -4
- package/templates/blank/scripts/lib/template-step-registry.test.ts +1 -1
- package/templates/blank/scripts/lib/template-step-registry.ts +4 -1
- package/templates/blank/scripts/run-fallow-commit.mjs +4 -6
- package/templates/blank/scripts/sync-all.ts +7 -6
- package/templates/blank/scripts/sync-appraise-base-template.ts +84 -77
- package/templates/blank/scripts/sync-environments.ts +47 -44
- package/templates/blank/scripts/sync-locator-groups.ts +67 -76
- package/templates/blank/scripts/sync-locators.ts +50 -53
- package/templates/blank/scripts/sync-modules.ts +42 -42
- package/templates/blank/scripts/sync-tags.ts +51 -51
- package/templates/blank/scripts/sync-template-step-groups.ts +34 -32
- package/templates/blank/scripts/sync-template-steps.ts +97 -97
- package/templates/blank/scripts/sync-test-cases.ts +65 -74
- package/templates/blank/scripts/sync-test-suites.ts +85 -80
- package/templates/blank/src/actions/server-action-boundary.test.ts +1 -7
- package/templates/blank/src/actions/settings/sync-actions.ts +3 -1
- package/templates/blank/src/actions/tags/tag-actions.ts +1 -7
- package/templates/blank/src/actions/template-test-case/template-test-case-actions.ts +3 -1
- package/templates/blank/src/app/(base)/environments/create/page.tsx +28 -28
- package/templates/blank/src/app/(base)/environments/environment-form.tsx +3 -2
- package/templates/blank/src/app/(base)/environments/environment-helpers.ts +4 -1
- package/templates/blank/src/app/(base)/layout.tsx +10 -10
- package/templates/blank/src/app/(base)/locator-groups/locator-group-form.tsx +5 -3
- package/templates/blank/src/app/(base)/locator-groups/locator-group-table-columns.tsx +77 -77
- package/templates/blank/src/app/(base)/locator-groups/locator-group-table.tsx +28 -28
- package/templates/blank/src/app/(base)/locator-groups/modify/[id]/page.tsx +46 -46
- package/templates/blank/src/app/(base)/locator-groups/page.tsx +9 -19
- package/templates/blank/src/app/(base)/locators/create/create-locator-workspace-helpers.test.ts +3 -6
- package/templates/blank/src/app/(base)/locators/create/create-locator-workspace-response.ts +22 -5
- package/templates/blank/src/app/(base)/locators/create/create-locator-workspace-state.ts +5 -1
- package/templates/blank/src/app/(base)/locators/create/use-locator-workspace.ts +7 -2
- package/templates/blank/src/app/(base)/locators/locator-file-sync.ts +1 -5
- package/templates/blank/src/app/(base)/locators/locator-helpers.ts +2 -12
- package/templates/blank/src/app/(base)/locators/locator-table-columns.tsx +59 -60
- package/templates/blank/src/app/(base)/modules/module-form.tsx +3 -1
- package/templates/blank/src/app/(base)/reports/overview-chart.tsx +49 -49
- package/templates/blank/src/app/(base)/reports/test-cases/test-cases-metric-table-columns.tsx +114 -115
- package/templates/blank/src/app/(base)/reports/test-cases/test-cases-metric-table.tsx +27 -27
- package/templates/blank/src/app/(base)/reports/test-suites/test-suites-metric-table-columns.tsx +80 -79
- package/templates/blank/src/app/(base)/reports/test-suites/test-suites-metric-table.tsx +29 -27
- package/templates/blank/src/app/(base)/settings/settings-sync-panel-helpers.test.tsx +4 -6
- package/templates/blank/src/app/(base)/settings/settings-sync-panel.tsx +22 -23
- package/templates/blank/src/app/(base)/tags/tag-form.test.tsx +2 -10
- package/templates/blank/src/app/(base)/tags/tag-form.tsx +5 -3
- package/templates/blank/src/app/(base)/tags/tag-table-columns.tsx +63 -63
- package/templates/blank/src/app/(base)/tags/tag-table.tsx +29 -29
- package/templates/blank/src/app/(base)/template-step-groups/create/page.tsx +28 -28
- package/templates/blank/src/app/(base)/template-step-groups/template-step-group-form.tsx +3 -1
- package/templates/blank/src/app/(base)/template-step-groups/template-step-group-helpers.ts +4 -1
- package/templates/blank/src/app/(base)/template-steps/paramChip.tsx +6 -10
- package/templates/blank/src/app/(base)/template-steps/template-step-form-helpers.ts +4 -2
- package/templates/blank/src/app/(base)/template-steps/template-step-helpers.test.ts +19 -1
- package/templates/blank/src/app/(base)/template-steps/template-step-helpers.ts +1 -5
- package/templates/blank/src/app/(base)/template-steps/template-step-row-guards.ts +1 -5
- package/templates/blank/src/app/(base)/template-steps/template-step-types.ts +1 -5
- package/templates/blank/src/app/(base)/template-test-cases/create-template-test-case-page-data.test.ts +4 -1
- package/templates/blank/src/app/(base)/template-test-cases/create-template-test-case-page-data.ts +1 -2
- package/templates/blank/src/app/(base)/template-test-cases/modify/[id]/page.tsx +1 -0
- package/templates/blank/src/app/(base)/template-test-cases/template-test-case-flow.test.tsx +0 -1
- package/templates/blank/src/app/(base)/template-test-cases/template-test-case-form.tsx +3 -1
- package/templates/blank/src/app/(base)/template-test-cases/template-test-case-table-columns.tsx +76 -76
- package/templates/blank/src/app/(base)/template-test-cases/template-test-case-table.tsx +32 -32
- package/templates/blank/src/app/(base)/test-cases/create/page.tsx +1 -5
- package/templates/blank/src/app/(base)/test-cases/create-from-template/create-from-template-selection-helpers.ts +1 -4
- package/templates/blank/src/app/(base)/test-cases/create-from-template/page.test.tsx +2 -2
- package/templates/blank/src/app/(base)/test-cases/inline-tag-creation-dialog.tsx +1 -7
- package/templates/blank/src/app/(base)/test-cases/inline-test-suite-creation-dialog.tsx +1 -7
- package/templates/blank/src/app/(base)/test-cases/modify/[id]/page.tsx +1 -5
- package/templates/blank/src/app/(base)/test-cases/test-case-form.tsx +63 -78
- package/templates/blank/src/app/(base)/test-cases/test-case-route-helpers.test.ts +2 -7
- package/templates/blank/src/app/(base)/test-suites/editable-test-suite-helpers.ts +1 -6
- package/templates/blank/src/app/(base)/test-suites/test-suite-form.test.tsx +2 -10
- package/templates/blank/src/app/(dashboard-components)/data-card-grid.tsx +10 -10
- package/templates/blank/src/app/api/test-runs/[runId]/download/route.ts +1 -4
- package/templates/blank/src/app/api/test-runs/[runId]/trace/[testCaseId]/route.test.ts +18 -9
- package/templates/blank/src/assets/icons/empty-tube.tsx +23 -23
- package/templates/blank/src/assets/icons/tube-plus.tsx +29 -29
- package/templates/blank/src/components/data-visualization/info-card.tsx +56 -70
- package/templates/blank/src/components/data-visualization/info-grid.tsx +22 -22
- package/templates/blank/src/components/diagram/add-node-prompt-node.tsx +1 -1
- package/templates/blank/src/components/diagram/dynamic-parameters-helpers.ts +4 -3
- package/templates/blank/src/components/diagram/dynamic-parameters.test.tsx +4 -1
- package/templates/blank/src/components/diagram/dynamic-parameters.tsx +0 -1
- package/templates/blank/src/components/diagram/flow-diagram-block-dialog.test.tsx +26 -0
- package/templates/blank/src/components/diagram/flow-diagram-block-dialog.tsx +3 -1
- package/templates/blank/src/components/diagram/flow-diagram-connection-guards.ts +24 -6
- package/templates/blank/src/components/diagram/flow-diagram-helpers.test.ts +27 -0
- package/templates/blank/src/components/diagram/flow-diagram-node-search.tsx +65 -65
- package/templates/blank/src/components/diagram/flow-diagram-toolbar.tsx +1 -3
- package/templates/blank/src/components/diagram/flow-diagram-view.tsx +1 -7
- package/templates/blank/src/components/diagram/flow-node-data-helpers.ts +1 -1
- package/templates/blank/src/components/diagram/node-form-fields-content.tsx +9 -2
- package/templates/blank/src/components/diagram/node-form-helpers.test.ts +3 -1
- package/templates/blank/src/components/diagram/node-form-helpers.ts +1 -4
- package/templates/blank/src/components/diagram/node-form-template-step-selection.ts +1 -4
- package/templates/blank/src/components/diagram/node-form.test.tsx +25 -0
- package/templates/blank/src/components/diagram/node-form.tsx +2 -12
- package/templates/blank/src/components/diagram/options-header-node.test.tsx +4 -1
- package/templates/blank/src/components/diagram/options-header-node.tsx +140 -130
- package/templates/blank/src/components/diagram/use-flow-diagram.ts +1 -2
- package/templates/blank/src/components/form/error-message.tsx +7 -7
- package/templates/blank/src/components/loading-skeleton/form/button-skeleton.tsx +8 -8
- package/templates/blank/src/components/loading-skeleton/form/text-input-skeleton.tsx +8 -8
- package/templates/blank/src/components/loading-skeleton/visualization/table-skeleton.tsx +14 -14
- package/templates/blank/src/components/navigation/entity-search-command.tsx +3 -9
- package/templates/blank/src/components/navigation/nav-link.tsx +60 -60
- package/templates/blank/src/components/test-case/test-case-form-helpers.test.ts +1 -5
- package/templates/blank/src/components/test-case/test-case-form-helpers.ts +1 -5
- package/templates/blank/src/components/test-case/test-case-picker-helpers.ts +8 -7
- package/templates/blank/src/components/test-case/test-case-picker.tsx +2 -6
- package/templates/blank/src/components/test-run/log-viewer.test.tsx +25 -0
- package/templates/blank/src/components/test-run/log-viewer.tsx +2 -2
- package/templates/blank/src/components/test-run/test-run-details-guards.ts +10 -1
- package/templates/blank/src/components/test-run/test-run-details.test.tsx +9 -19
- package/templates/blank/src/components/test-run/use-log-viewer.ts +2 -8
- package/templates/blank/src/components/test-run/use-test-run-header.ts +1 -4
- package/templates/blank/src/components/test-suite/test-suite-picker.tsx +1 -1
- package/templates/blank/src/components/theme/theme-provider.tsx +7 -1
- package/templates/blank/src/components/typography/page-header-subtitle.tsx +7 -7
- package/templates/blank/src/components/typography/page-header.tsx +7 -7
- package/templates/blank/src/components/ui/chart.tsx +2 -8
- package/templates/blank/src/components/ui/command.tsx +2 -5
- package/templates/blank/src/components/ui/data-table-column-header.tsx +3 -3
- package/templates/blank/src/components/ui/data-table.test.tsx +1 -8
- package/templates/blank/src/components/ui/dialog.tsx +1 -4
- package/templates/blank/src/components/ui/select.tsx +2 -2
- package/templates/blank/src/components/ui/separator.tsx +5 -1
- package/templates/blank/src/components/ui/skeleton.tsx +7 -7
- package/templates/blank/src/components/ui/table.tsx +1 -1
- package/templates/blank/src/components/ui/toaster.tsx +26 -26
- package/templates/blank/src/components/ui/tooltip.tsx +1 -1
- package/templates/blank/src/constants/form-opts/locator-group-form-opts.ts +1 -1
- package/templates/blank/src/lib/locator-group-file-utils.ts +5 -1
- package/templates/blank/src/lib/locator-picker/session-manager.ts +1 -2
- package/templates/blank/src/lib/metrics/metric-calculator.test.ts +105 -6
- package/templates/blank/src/lib/metrics/metric-calculator.ts +39 -40
- package/templates/blank/src/lib/sync/sync-executor.ts +1 -4
- package/templates/blank/src/lib/sync/sync-pending-counts.test.ts +201 -7
- package/templates/blank/src/lib/sync/sync-pending-counts.ts +81 -13
- package/templates/blank/src/lib/template-automation-paths.ts +1 -1
- package/templates/blank/src/lib/template-sync-utils.d.ts +14 -7
- package/templates/blank/src/lib/test-case-utils.ts +6 -6
- package/templates/blank/src/lib/test-run/log-formatter.ts +82 -83
- package/templates/blank/src/lib/test-run/report-parser.ts +352 -352
- package/templates/blank/src/lib/transformers/gherkin-converter.ts +42 -42
- package/templates/blank/src/lib/transformers/key-to-icon-transformer.tsx +95 -95
- package/templates/blank/src/lib/utils/node-param-validation.ts +81 -81
- package/templates/blank/src/lib/utils/template-step-file-generator.ts +5 -3
- package/templates/blank/src/lib/utils/template-step-file-manager-intelligent.ts +11 -1
- package/templates/blank/src/services/dashboard/dashboard-service.test.ts +28 -1
- package/templates/blank/src/services/dashboard/dashboard-service.ts +2 -0
- package/templates/blank/src/services/locator/locator-service.test.ts +1 -3
- package/templates/blank/src/services/locator/locator-service.ts +3 -1
- package/templates/blank/src/services/locator/locator-sync-utils.test.ts +1 -4
- package/templates/blank/src/services/module/module-service.ts +1 -4
- package/templates/blank/src/services/report/report-service.test.ts +70 -6
- package/templates/blank/src/services/report/report-service.ts +52 -9
- package/templates/blank/src/services/shared/errors.ts +2 -4
- package/templates/blank/src/services/template-step/template-step-service.ts +3 -1
- package/templates/blank/src/services/template-step-group/template-step-group-service.ts +3 -1
- package/templates/blank/src/services/test-case/test-case-service.ts +0 -5
- package/templates/blank/src/services/test-run/test-run-service.test.ts +3 -6
- package/templates/blank/src/services/test-run/test-run-service.ts +12 -7
- package/templates/blank/src/services/test-suite/test-suite-service.test.ts +1 -5
- package/templates/blank/src/services/test-suite/test-suite-service.ts +2 -4
- package/templates/blank/src/types/form/actionHandler.ts +1 -5
- package/templates/blank/tsconfig.json +8 -8
- package/templates/default/packages/locator-picker-companion/dist/cli.d.ts +1 -1
- package/templates/default/packages/locator-picker-companion/dist/cli.js +313 -279
- package/templates/default/packages/locator-picker-companion/dist/index.d.ts +3 -3
- package/templates/default/packages/locator-picker-companion/dist/index.js +3 -3
- package/templates/default/packages/locator-picker-companion/dist/injected-picker-script.d.ts +1 -1
- package/templates/default/packages/locator-picker-companion/dist/injected-picker-script.js +526 -481
- package/templates/default/packages/locator-picker-companion/dist/launcher.d.ts +13 -10
- package/templates/default/packages/locator-picker-companion/dist/launcher.js +47 -48
- package/templates/default/packages/locator-picker-companion/dist/selector-generator.d.ts +6 -3
- package/templates/default/packages/locator-picker-companion/dist/selector-generator.js +233 -229
- package/templates/default/packages/locator-picker-companion/dist/session-file.d.ts +30 -22
- package/templates/default/packages/locator-picker-companion/dist/session-file.js +116 -104
- package/templates/default/packages/locator-picker-companion/dist/types.d.ts +25 -25
- package/templates/default/packages/locator-picker-companion/dist/types.js +1 -1
- package/templates/starter/.editorconfig +11 -0
- package/templates/starter/.gitattributes +21 -0
- package/templates/starter/.gitconfig.appraise +14 -0
- package/templates/starter/.prettierrc +13 -0
- package/templates/starter/.vscode/settings.json +2 -0
- package/templates/starter/README.md +12 -12
- package/templates/starter/automation/steps/actions/click.step.ts +56 -58
- package/templates/starter/automation/steps/actions/hover.step.ts +25 -27
- package/templates/starter/automation/steps/actions/input.step.ts +85 -108
- package/templates/starter/automation/steps/actions/navigation.step.ts +67 -70
- package/templates/starter/automation/steps/actions/random_data.step.ts +149 -143
- package/templates/starter/automation/steps/actions/store.step.ts +69 -1
- package/templates/starter/automation/steps/actions/wait.step.ts +84 -1
- package/templates/starter/automation/steps/validations/active_state_assertion.step.ts +28 -30
- package/templates/starter/automation/steps/validations/navigation_assertion.step.ts +20 -22
- package/templates/starter/automation/steps/validations/text_assertion.step.ts +67 -107
- package/templates/starter/automation/steps/validations/visibility_assertion.step.ts +24 -26
- package/templates/starter/components.json +24 -24
- package/templates/starter/cucumber.mjs +16 -16
- package/templates/starter/e2e/README.md +56 -0
- package/templates/starter/e2e/apply-migrations.mjs +76 -0
- package/templates/starter/e2e/appraise-smoke.spec.ts +78 -0
- package/templates/starter/e2e/authoring.spec.ts +53 -0
- package/templates/starter/e2e/crud-configuration.spec.ts +138 -0
- package/templates/starter/e2e/crud-tests.spec.ts +76 -0
- package/templates/starter/e2e/helpers/forms.ts +186 -0
- package/templates/starter/e2e/helpers/navigation.ts +27 -0
- package/templates/starter/e2e/helpers/table.ts +45 -0
- package/templates/starter/e2e/helpers/test-data.ts +549 -0
- package/templates/starter/e2e/helpers/ui.ts +41 -0
- package/templates/starter/e2e/navigation.spec.ts +101 -0
- package/templates/starter/e2e/runs-and-reports.spec.ts +82 -0
- package/templates/starter/e2e/settings-sync.spec.ts +39 -0
- package/templates/starter/e2e/start-server.mjs +61 -0
- package/templates/starter/eslint.config.mjs +4 -4
- package/templates/starter/gitignore +0 -3
- package/templates/starter/next-env.d.ts +1 -1
- package/templates/starter/package-lock.json +58 -102
- package/templates/starter/package.json +10 -9
- package/templates/starter/packages/cucumber-runtime/package.json +13 -13
- package/templates/starter/packages/cucumber-runtime/src/cache.util.ts +93 -93
- package/templates/starter/packages/cucumber-runtime/src/cli.ts +77 -68
- package/templates/starter/packages/cucumber-runtime/src/environment.util.ts +21 -21
- package/templates/starter/packages/cucumber-runtime/src/executor.ts +32 -32
- package/templates/starter/packages/cucumber-runtime/src/index.ts +17 -17
- package/templates/starter/packages/cucumber-runtime/src/locator.util.ts +234 -234
- package/templates/starter/packages/cucumber-runtime/src/parameter-types.ts +7 -7
- package/templates/starter/packages/cucumber-runtime/src/random-data.util.ts +35 -35
- package/templates/starter/packages/cucumber-runtime/src/types.ts +13 -13
- package/templates/starter/packages/cucumber-runtime/src/world.ts +44 -44
- package/templates/starter/packages/cucumber-runtime/tsconfig.json +11 -11
- package/templates/starter/packages/locator-picker-companion/dist/cli.js +1 -1
- package/templates/starter/packages/locator-picker-companion/dist/index.d.ts +3 -3
- package/templates/starter/packages/locator-picker-companion/dist/index.js +3 -3
- package/templates/starter/packages/locator-picker-companion/dist/injected-picker-script.js +13 -3
- package/templates/starter/packages/locator-picker-companion/dist/selector-generator.d.ts +6 -3
- package/templates/starter/packages/locator-picker-companion/dist/selector-generator.js +233 -229
- package/templates/starter/packages/locator-picker-companion/src/cli.ts +1 -7
- package/templates/starter/packages/locator-picker-companion/src/injected-picker-script.ts +26 -5
- package/templates/starter/packages/locator-picker-companion/src/launcher.ts +1 -3
- package/templates/starter/packages/locator-picker-companion/src/session-file.ts +4 -15
- package/templates/starter/packages/locator-picker-companion/src/types.ts +1 -8
- package/templates/starter/playwright.config.ts +46 -0
- package/templates/starter/postcss.config.mjs +8 -8
- package/templates/starter/prisma/dev.db +0 -0
- package/templates/starter/scripts/configure-git-line-endings.mjs +91 -0
- package/templates/starter/scripts/install-template-step.ts +5 -1
- package/templates/starter/scripts/lib/step-matcher.test.ts +3 -3
- package/templates/starter/scripts/lib/step-matcher.ts +5 -1
- package/templates/starter/scripts/lib/template-step-installer.test.ts +4 -2
- package/templates/starter/scripts/lib/template-step-installer.ts +16 -4
- package/templates/starter/scripts/lib/template-step-registry.test.ts +1 -1
- package/templates/starter/scripts/lib/template-step-registry.ts +4 -1
- package/templates/starter/scripts/run-fallow-commit.mjs +4 -6
- package/templates/starter/scripts/sync-all.ts +7 -6
- package/templates/starter/scripts/sync-appraise-base-template.ts +84 -77
- package/templates/starter/scripts/sync-environments.ts +47 -44
- package/templates/starter/scripts/sync-locator-groups.ts +67 -76
- package/templates/starter/scripts/sync-locators.ts +50 -53
- package/templates/starter/scripts/sync-modules.ts +42 -42
- package/templates/starter/scripts/sync-tags.ts +51 -51
- package/templates/starter/scripts/sync-template-step-groups.ts +34 -32
- package/templates/starter/scripts/sync-template-steps.ts +97 -97
- package/templates/starter/scripts/sync-test-cases.ts +65 -74
- package/templates/starter/scripts/sync-test-suites.ts +85 -80
- package/templates/starter/src/actions/server-action-boundary.test.ts +1 -7
- package/templates/starter/src/actions/settings/sync-actions.ts +3 -1
- package/templates/starter/src/actions/tags/tag-actions.ts +1 -7
- package/templates/starter/src/actions/template-test-case/template-test-case-actions.ts +3 -1
- package/templates/starter/src/app/(base)/environments/create/page.tsx +28 -28
- package/templates/starter/src/app/(base)/environments/environment-form.tsx +3 -2
- package/templates/starter/src/app/(base)/environments/environment-helpers.ts +4 -1
- package/templates/starter/src/app/(base)/layout.tsx +10 -10
- package/templates/starter/src/app/(base)/locator-groups/locator-group-form.tsx +5 -3
- package/templates/starter/src/app/(base)/locator-groups/locator-group-table-columns.tsx +77 -77
- package/templates/starter/src/app/(base)/locator-groups/locator-group-table.tsx +28 -28
- package/templates/starter/src/app/(base)/locator-groups/modify/[id]/page.tsx +46 -46
- package/templates/starter/src/app/(base)/locator-groups/page.tsx +9 -19
- package/templates/starter/src/app/(base)/locators/create/create-locator-workspace-helpers.test.ts +3 -6
- package/templates/starter/src/app/(base)/locators/create/create-locator-workspace-response.ts +22 -5
- package/templates/starter/src/app/(base)/locators/create/create-locator-workspace-state.ts +5 -1
- package/templates/starter/src/app/(base)/locators/create/use-locator-workspace.ts +7 -2
- package/templates/starter/src/app/(base)/locators/locator-file-sync.ts +1 -5
- package/templates/starter/src/app/(base)/locators/locator-helpers.ts +2 -12
- package/templates/starter/src/app/(base)/locators/locator-table-columns.tsx +59 -60
- package/templates/starter/src/app/(base)/modules/module-form.tsx +3 -1
- package/templates/starter/src/app/(base)/reports/overview-chart.tsx +49 -49
- package/templates/starter/src/app/(base)/reports/test-cases/test-cases-metric-table-columns.tsx +114 -115
- package/templates/starter/src/app/(base)/reports/test-cases/test-cases-metric-table.tsx +27 -27
- package/templates/starter/src/app/(base)/reports/test-suites/test-suites-metric-table-columns.tsx +80 -79
- package/templates/starter/src/app/(base)/reports/test-suites/test-suites-metric-table.tsx +29 -27
- package/templates/starter/src/app/(base)/settings/settings-sync-panel-helpers.test.tsx +4 -6
- package/templates/starter/src/app/(base)/settings/settings-sync-panel.tsx +22 -23
- package/templates/starter/src/app/(base)/tags/tag-form.test.tsx +2 -10
- package/templates/starter/src/app/(base)/tags/tag-form.tsx +5 -3
- package/templates/starter/src/app/(base)/tags/tag-table-columns.tsx +63 -63
- package/templates/starter/src/app/(base)/tags/tag-table.tsx +29 -29
- package/templates/starter/src/app/(base)/template-step-groups/create/page.tsx +28 -28
- package/templates/starter/src/app/(base)/template-step-groups/template-step-group-form.tsx +3 -1
- package/templates/starter/src/app/(base)/template-step-groups/template-step-group-helpers.ts +4 -1
- package/templates/starter/src/app/(base)/template-steps/paramChip.tsx +6 -10
- package/templates/starter/src/app/(base)/template-steps/template-step-form-helpers.ts +4 -2
- package/templates/starter/src/app/(base)/template-steps/template-step-helpers.test.ts +19 -1
- package/templates/starter/src/app/(base)/template-steps/template-step-helpers.ts +1 -5
- package/templates/starter/src/app/(base)/template-steps/template-step-row-guards.ts +1 -5
- package/templates/starter/src/app/(base)/template-steps/template-step-types.ts +1 -5
- package/templates/starter/src/app/(base)/template-test-cases/create-template-test-case-page-data.test.ts +4 -1
- package/templates/starter/src/app/(base)/template-test-cases/create-template-test-case-page-data.ts +1 -2
- package/templates/starter/src/app/(base)/template-test-cases/modify/[id]/page.tsx +1 -0
- package/templates/starter/src/app/(base)/template-test-cases/template-test-case-flow.test.tsx +0 -1
- package/templates/starter/src/app/(base)/template-test-cases/template-test-case-form.tsx +3 -1
- package/templates/starter/src/app/(base)/template-test-cases/template-test-case-table-columns.tsx +76 -76
- package/templates/starter/src/app/(base)/template-test-cases/template-test-case-table.tsx +32 -32
- package/templates/starter/src/app/(base)/test-cases/create/page.tsx +1 -5
- package/templates/starter/src/app/(base)/test-cases/create-from-template/create-from-template-selection-helpers.ts +1 -4
- package/templates/starter/src/app/(base)/test-cases/create-from-template/page.test.tsx +2 -2
- package/templates/starter/src/app/(base)/test-cases/inline-tag-creation-dialog.tsx +1 -7
- package/templates/starter/src/app/(base)/test-cases/inline-test-suite-creation-dialog.tsx +1 -7
- package/templates/starter/src/app/(base)/test-cases/modify/[id]/page.tsx +1 -5
- package/templates/starter/src/app/(base)/test-cases/test-case-form.tsx +63 -78
- package/templates/starter/src/app/(base)/test-cases/test-case-route-helpers.test.ts +2 -7
- package/templates/starter/src/app/(base)/test-suites/editable-test-suite-helpers.ts +1 -6
- package/templates/starter/src/app/(base)/test-suites/test-suite-form.test.tsx +2 -10
- package/templates/starter/src/app/(dashboard-components)/data-card-grid.tsx +10 -10
- package/templates/starter/src/app/api/test-runs/[runId]/download/route.ts +1 -4
- package/templates/starter/src/app/api/test-runs/[runId]/trace/[testCaseId]/route.test.ts +18 -9
- package/templates/starter/src/assets/icons/empty-tube.tsx +23 -23
- package/templates/starter/src/assets/icons/tube-plus.tsx +29 -29
- package/templates/starter/src/components/data-visualization/info-card.tsx +56 -70
- package/templates/starter/src/components/data-visualization/info-grid.tsx +22 -22
- package/templates/starter/src/components/diagram/add-node-prompt-node.tsx +1 -1
- package/templates/starter/src/components/diagram/dynamic-parameters-helpers.ts +4 -3
- package/templates/starter/src/components/diagram/dynamic-parameters.test.tsx +4 -1
- package/templates/starter/src/components/diagram/dynamic-parameters.tsx +0 -1
- package/templates/starter/src/components/diagram/flow-diagram-block-dialog.test.tsx +26 -0
- package/templates/starter/src/components/diagram/flow-diagram-block-dialog.tsx +3 -1
- package/templates/starter/src/components/diagram/flow-diagram-connection-guards.ts +24 -6
- package/templates/starter/src/components/diagram/flow-diagram-helpers.test.ts +27 -0
- package/templates/starter/src/components/diagram/flow-diagram-node-search.tsx +65 -65
- package/templates/starter/src/components/diagram/flow-diagram-toolbar.tsx +1 -3
- package/templates/starter/src/components/diagram/flow-diagram-view.tsx +1 -7
- package/templates/starter/src/components/diagram/flow-node-data-helpers.ts +1 -1
- package/templates/starter/src/components/diagram/node-form-fields-content.tsx +9 -2
- package/templates/starter/src/components/diagram/node-form-helpers.test.ts +3 -1
- package/templates/starter/src/components/diagram/node-form-helpers.ts +1 -4
- package/templates/starter/src/components/diagram/node-form-template-step-selection.ts +1 -4
- package/templates/starter/src/components/diagram/node-form.test.tsx +25 -0
- package/templates/starter/src/components/diagram/node-form.tsx +2 -12
- package/templates/starter/src/components/diagram/options-header-node.test.tsx +4 -1
- package/templates/starter/src/components/diagram/options-header-node.tsx +140 -130
- package/templates/starter/src/components/diagram/use-flow-diagram.ts +1 -2
- package/templates/starter/src/components/form/error-message.tsx +7 -7
- package/templates/starter/src/components/loading-skeleton/form/button-skeleton.tsx +8 -8
- package/templates/starter/src/components/loading-skeleton/form/text-input-skeleton.tsx +8 -8
- package/templates/starter/src/components/loading-skeleton/visualization/table-skeleton.tsx +14 -14
- package/templates/starter/src/components/navigation/entity-search-command.tsx +3 -9
- package/templates/starter/src/components/navigation/nav-link.tsx +60 -60
- package/templates/starter/src/components/test-case/test-case-form-helpers.test.ts +1 -5
- package/templates/starter/src/components/test-case/test-case-form-helpers.ts +1 -5
- package/templates/starter/src/components/test-case/test-case-picker-helpers.ts +8 -7
- package/templates/starter/src/components/test-case/test-case-picker.tsx +2 -6
- package/templates/starter/src/components/test-run/log-viewer.test.tsx +25 -0
- package/templates/starter/src/components/test-run/log-viewer.tsx +2 -2
- package/templates/starter/src/components/test-run/test-run-details-guards.ts +10 -1
- package/templates/starter/src/components/test-run/test-run-details.test.tsx +9 -19
- package/templates/starter/src/components/test-run/use-log-viewer.ts +2 -8
- package/templates/starter/src/components/test-run/use-test-run-header.ts +1 -4
- package/templates/starter/src/components/test-suite/test-suite-picker.tsx +1 -1
- package/templates/starter/src/components/theme/theme-provider.tsx +7 -1
- package/templates/starter/src/components/typography/page-header-subtitle.tsx +7 -7
- package/templates/starter/src/components/typography/page-header.tsx +7 -7
- package/templates/starter/src/components/ui/chart.tsx +2 -8
- package/templates/starter/src/components/ui/command.tsx +2 -5
- package/templates/starter/src/components/ui/data-table-column-header.tsx +3 -3
- package/templates/starter/src/components/ui/data-table.test.tsx +1 -8
- package/templates/starter/src/components/ui/dialog.tsx +1 -4
- package/templates/starter/src/components/ui/select.tsx +2 -2
- package/templates/starter/src/components/ui/separator.tsx +5 -1
- package/templates/starter/src/components/ui/skeleton.tsx +7 -7
- package/templates/starter/src/components/ui/table.tsx +1 -1
- package/templates/starter/src/components/ui/toaster.tsx +26 -26
- package/templates/starter/src/components/ui/tooltip.tsx +1 -1
- package/templates/starter/src/constants/form-opts/locator-group-form-opts.ts +1 -1
- package/templates/starter/src/lib/locator-group-file-utils.ts +5 -1
- package/templates/starter/src/lib/locator-picker/session-manager.ts +1 -2
- package/templates/starter/src/lib/metrics/metric-calculator.test.ts +105 -6
- package/templates/starter/src/lib/metrics/metric-calculator.ts +39 -40
- package/templates/starter/src/lib/sync/sync-executor.ts +1 -4
- package/templates/starter/src/lib/sync/sync-pending-counts.test.ts +201 -7
- package/templates/starter/src/lib/sync/sync-pending-counts.ts +81 -13
- package/templates/starter/src/lib/template-automation-paths.ts +1 -1
- package/templates/starter/src/lib/template-sync-utils.d.ts +14 -7
- package/templates/starter/src/lib/test-case-utils.ts +6 -6
- package/templates/starter/src/lib/test-run/log-formatter.ts +82 -83
- package/templates/starter/src/lib/test-run/report-parser.ts +352 -352
- package/templates/starter/src/lib/transformers/gherkin-converter.ts +42 -42
- package/templates/starter/src/lib/transformers/key-to-icon-transformer.tsx +95 -95
- package/templates/starter/src/lib/utils/node-param-validation.ts +81 -81
- package/templates/starter/src/lib/utils/template-step-file-generator.ts +5 -3
- package/templates/starter/src/lib/utils/template-step-file-manager-intelligent.ts +11 -1
- package/templates/starter/src/services/dashboard/dashboard-service.test.ts +28 -1
- package/templates/starter/src/services/dashboard/dashboard-service.ts +2 -0
- package/templates/starter/src/services/locator/locator-service.test.ts +1 -3
- package/templates/starter/src/services/locator/locator-service.ts +3 -1
- package/templates/starter/src/services/locator/locator-sync-utils.test.ts +1 -4
- package/templates/starter/src/services/module/module-service.ts +1 -4
- package/templates/starter/src/services/report/report-service.test.ts +70 -6
- package/templates/starter/src/services/report/report-service.ts +52 -9
- package/templates/starter/src/services/shared/errors.ts +2 -4
- package/templates/starter/src/services/template-step/template-step-service.ts +3 -1
- package/templates/starter/src/services/template-step-group/template-step-group-service.ts +3 -1
- package/templates/starter/src/services/test-case/test-case-service.ts +0 -5
- package/templates/starter/src/services/test-run/test-run-service.test.ts +3 -6
- package/templates/starter/src/services/test-run/test-run-service.ts +12 -7
- package/templates/starter/src/services/test-suite/test-suite-service.test.ts +1 -5
- package/templates/starter/src/services/test-suite/test-suite-service.ts +2 -4
- package/templates/starter/src/types/form/actionHandler.ts +1 -5
- package/templates/starter/tsconfig.json +8 -8
|
@@ -1,288 +1,300 @@
|
|
|
1
1
|
export function installLocatorPickerOverlay() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
catch (_a) {
|
|
37
|
-
return value.startsWith('/') ? value : `/${value}`;
|
|
38
|
-
}
|
|
2
|
+
var _a
|
|
3
|
+
const globalState = window
|
|
4
|
+
const ROOT_ID = 'appraise-locator-picker-root'
|
|
5
|
+
const STYLE_ID = 'appraise-locator-picker-style'
|
|
6
|
+
const HOVER_CLASS = 'appraise-locator-picker-hover'
|
|
7
|
+
const ACTIVE_CLASS = 'appraise-locator-picker-active'
|
|
8
|
+
const state =
|
|
9
|
+
(_a = globalState.__appraiseLocatorPickerState) !== null && _a !== void 0
|
|
10
|
+
? _a
|
|
11
|
+
: (globalState.__appraiseLocatorPickerState = {
|
|
12
|
+
picking: false,
|
|
13
|
+
submitting: false,
|
|
14
|
+
hoveredElement: null,
|
|
15
|
+
preview: null,
|
|
16
|
+
error: '',
|
|
17
|
+
elements: {},
|
|
18
|
+
})
|
|
19
|
+
function stopOverlayEvent(event) {
|
|
20
|
+
event.preventDefault()
|
|
21
|
+
event.stopPropagation()
|
|
22
|
+
}
|
|
23
|
+
function normalizeText(value) {
|
|
24
|
+
return (value !== null && value !== void 0 ? value : '').replace(/\s+/g, ' ').trim()
|
|
25
|
+
}
|
|
26
|
+
function escapeForCss(value) {
|
|
27
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, match => `\\${match}`)
|
|
28
|
+
}
|
|
29
|
+
function escapeForSelectorText(value) {
|
|
30
|
+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')
|
|
31
|
+
}
|
|
32
|
+
function normalizeRoute(value) {
|
|
33
|
+
if (!value) {
|
|
34
|
+
return '/'
|
|
39
35
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const normalized = value.trim();
|
|
45
|
-
if (!normalized || normalized.length > 120) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
return !/\d{4,}/.test(normalized) && !/[A-Fa-f0-9]{8,}/.test(normalized);
|
|
36
|
+
try {
|
|
37
|
+
return new URL(value).pathname || '/'
|
|
38
|
+
} catch (_a) {
|
|
39
|
+
return value.startsWith('/') ? value : `/${value}`
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
}
|
|
42
|
+
function isLikelyStableIdentifier(value) {
|
|
43
|
+
if (!value) {
|
|
44
|
+
return false
|
|
52
45
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
const input = element;
|
|
58
|
-
if (input.labels && input.labels.length > 0) {
|
|
59
|
-
return normalizeText(Array.from(input.labels)
|
|
60
|
-
.map(label => label.textContent || '')
|
|
61
|
-
.join(' '));
|
|
62
|
-
}
|
|
63
|
-
return '';
|
|
46
|
+
const normalized = value.trim()
|
|
47
|
+
if (!normalized || normalized.length > 120) {
|
|
48
|
+
return false
|
|
64
49
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.split(/\s+/)
|
|
74
|
-
.map(id => { var _a; return ((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.textContent) || ''; })
|
|
75
|
-
.join(' ');
|
|
76
|
-
const normalized = normalizeText(text);
|
|
77
|
-
if (normalized) {
|
|
78
|
-
return normalized;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const labelText = getLabelText(element);
|
|
82
|
-
if (labelText) {
|
|
83
|
-
return labelText;
|
|
84
|
-
}
|
|
85
|
-
const alt = normalizeText(element.getAttribute('alt'));
|
|
86
|
-
if (alt) {
|
|
87
|
-
return alt;
|
|
88
|
-
}
|
|
89
|
-
const title = normalizeText(element.getAttribute('title'));
|
|
90
|
-
if (title) {
|
|
91
|
-
return title;
|
|
92
|
-
}
|
|
93
|
-
const placeholder = normalizeText(element.getAttribute('placeholder'));
|
|
94
|
-
if (placeholder) {
|
|
95
|
-
return placeholder;
|
|
96
|
-
}
|
|
97
|
-
return normalizeText(element.textContent).slice(0, 240);
|
|
50
|
+
return !/\d{4,}/.test(normalized) && !/[A-Fa-f0-9]{8,}/.test(normalized)
|
|
51
|
+
}
|
|
52
|
+
function isFormControl(element) {
|
|
53
|
+
return ['input', 'textarea', 'select'].includes(element.tagName.toLowerCase())
|
|
54
|
+
}
|
|
55
|
+
function getLabelText(element) {
|
|
56
|
+
if (!isFormControl(element)) {
|
|
57
|
+
return ''
|
|
98
58
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return 'button';
|
|
107
|
-
}
|
|
108
|
-
if (tagName === 'a' && element.hasAttribute('href')) {
|
|
109
|
-
return 'link';
|
|
110
|
-
}
|
|
111
|
-
if (tagName === 'textarea') {
|
|
112
|
-
return 'textbox';
|
|
113
|
-
}
|
|
114
|
-
if (tagName === 'select') {
|
|
115
|
-
return 'combobox';
|
|
116
|
-
}
|
|
117
|
-
if (tagName === 'img') {
|
|
118
|
-
return 'img';
|
|
119
|
-
}
|
|
120
|
-
if (tagName === 'input') {
|
|
121
|
-
const type = (element.getAttribute('type') || 'text').toLowerCase();
|
|
122
|
-
if (['button', 'submit', 'reset'].includes(type)) {
|
|
123
|
-
return 'button';
|
|
124
|
-
}
|
|
125
|
-
if (type === 'checkbox') {
|
|
126
|
-
return 'checkbox';
|
|
127
|
-
}
|
|
128
|
-
if (type === 'radio') {
|
|
129
|
-
return 'radio';
|
|
130
|
-
}
|
|
131
|
-
return 'textbox';
|
|
132
|
-
}
|
|
133
|
-
return '';
|
|
134
|
-
}
|
|
135
|
-
function countRoleNameMatches(role, accessibleName) {
|
|
136
|
-
let count = 0;
|
|
137
|
-
for (const candidate of Array.from(document.querySelectorAll('*'))) {
|
|
138
|
-
if (getRole(candidate) !== role) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (getAccessibleName(candidate) !== accessibleName) {
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
count += 1;
|
|
145
|
-
if (count > 1) {
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return count;
|
|
150
|
-
}
|
|
151
|
-
function buildCssSelector(element) {
|
|
152
|
-
const tagName = element.tagName.toLowerCase();
|
|
153
|
-
const name = element.getAttribute('name');
|
|
154
|
-
const type = element.getAttribute('type');
|
|
155
|
-
const ariaLabel = element.getAttribute('aria-label');
|
|
156
|
-
const parts = [tagName];
|
|
157
|
-
if (isLikelyStableIdentifier(name)) {
|
|
158
|
-
parts.push(`[name="${escapeForSelectorText(name)}"]`);
|
|
159
|
-
}
|
|
160
|
-
if (isLikelyStableIdentifier(type)) {
|
|
161
|
-
parts.push(`[type="${escapeForSelectorText(type)}"]`);
|
|
162
|
-
}
|
|
163
|
-
if (isLikelyStableIdentifier(ariaLabel)) {
|
|
164
|
-
parts.push(`[aria-label="${escapeForSelectorText(ariaLabel)}"]`);
|
|
165
|
-
}
|
|
166
|
-
if (parts.length === 1) {
|
|
167
|
-
const stableClasses = Array.from(element.classList || []).filter(isLikelyStableIdentifier).slice(0, 2);
|
|
168
|
-
if (stableClasses.length > 0) {
|
|
169
|
-
parts.push(...stableClasses.map(className => `.${escapeForCss(className)}`));
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return parts.length > 1 ? `css=${parts.join('')}` : '';
|
|
59
|
+
const input = element
|
|
60
|
+
if (input.labels && input.labels.length > 0) {
|
|
61
|
+
return normalizeText(
|
|
62
|
+
Array.from(input.labels)
|
|
63
|
+
.map(label => label.textContent || '')
|
|
64
|
+
.join(' '),
|
|
65
|
+
)
|
|
173
66
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
67
|
+
return ''
|
|
68
|
+
}
|
|
69
|
+
function getAccessibleName(element) {
|
|
70
|
+
const ariaLabel = normalizeText(element.getAttribute('aria-label'))
|
|
71
|
+
if (ariaLabel) {
|
|
72
|
+
return ariaLabel
|
|
73
|
+
}
|
|
74
|
+
const labelledBy = normalizeText(element.getAttribute('aria-labelledby'))
|
|
75
|
+
if (labelledBy) {
|
|
76
|
+
const text = labelledBy
|
|
77
|
+
.split(/\s+/)
|
|
78
|
+
.map(id => {
|
|
79
|
+
var _a
|
|
80
|
+
return ((_a = document.getElementById(id)) === null || _a === void 0 ? void 0 : _a.textContent) || ''
|
|
81
|
+
})
|
|
82
|
+
.join(' ')
|
|
83
|
+
const normalized = normalizeText(text)
|
|
84
|
+
if (normalized) {
|
|
85
|
+
return normalized
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const labelText = getLabelText(element)
|
|
89
|
+
if (labelText) {
|
|
90
|
+
return labelText
|
|
91
|
+
}
|
|
92
|
+
const alt = normalizeText(element.getAttribute('alt'))
|
|
93
|
+
if (alt) {
|
|
94
|
+
return alt
|
|
95
|
+
}
|
|
96
|
+
const title = normalizeText(element.getAttribute('title'))
|
|
97
|
+
if (title) {
|
|
98
|
+
return title
|
|
99
|
+
}
|
|
100
|
+
const placeholder = normalizeText(element.getAttribute('placeholder'))
|
|
101
|
+
if (placeholder) {
|
|
102
|
+
return placeholder
|
|
103
|
+
}
|
|
104
|
+
return normalizeText(element.textContent).slice(0, 240)
|
|
105
|
+
}
|
|
106
|
+
function getRole(element) {
|
|
107
|
+
const explicitRole = normalizeText(element.getAttribute('role'))
|
|
108
|
+
if (explicitRole) {
|
|
109
|
+
return explicitRole
|
|
110
|
+
}
|
|
111
|
+
const tagName = element.tagName.toLowerCase()
|
|
112
|
+
if (tagName === 'button') {
|
|
113
|
+
return 'button'
|
|
114
|
+
}
|
|
115
|
+
if (tagName === 'a' && element.hasAttribute('href')) {
|
|
116
|
+
return 'link'
|
|
117
|
+
}
|
|
118
|
+
if (tagName === 'textarea') {
|
|
119
|
+
return 'textbox'
|
|
120
|
+
}
|
|
121
|
+
if (tagName === 'select') {
|
|
122
|
+
return 'combobox'
|
|
123
|
+
}
|
|
124
|
+
if (tagName === 'img') {
|
|
125
|
+
return 'img'
|
|
126
|
+
}
|
|
127
|
+
if (tagName === 'input') {
|
|
128
|
+
const type = (element.getAttribute('type') || 'text').toLowerCase()
|
|
129
|
+
if (['button', 'submit', 'reset'].includes(type)) {
|
|
130
|
+
return 'button'
|
|
131
|
+
}
|
|
132
|
+
if (type === 'checkbox') {
|
|
133
|
+
return 'checkbox'
|
|
134
|
+
}
|
|
135
|
+
if (type === 'radio') {
|
|
136
|
+
return 'radio'
|
|
137
|
+
}
|
|
138
|
+
return 'textbox'
|
|
139
|
+
}
|
|
140
|
+
return ''
|
|
141
|
+
}
|
|
142
|
+
function countRoleNameMatches(role, accessibleName) {
|
|
143
|
+
let count = 0
|
|
144
|
+
for (const candidate of Array.from(document.querySelectorAll('*'))) {
|
|
145
|
+
if (getRole(candidate) !== role) {
|
|
146
|
+
continue
|
|
147
|
+
}
|
|
148
|
+
if (getAccessibleName(candidate) !== accessibleName) {
|
|
149
|
+
continue
|
|
150
|
+
}
|
|
151
|
+
count += 1
|
|
152
|
+
if (count > 1) {
|
|
153
|
+
break
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return count
|
|
157
|
+
}
|
|
158
|
+
function buildCssSelector(element) {
|
|
159
|
+
const tagName = element.tagName.toLowerCase()
|
|
160
|
+
const name = element.getAttribute('name')
|
|
161
|
+
const type = element.getAttribute('type')
|
|
162
|
+
const ariaLabel = element.getAttribute('aria-label')
|
|
163
|
+
const parts = [tagName]
|
|
164
|
+
if (isLikelyStableIdentifier(name)) {
|
|
165
|
+
parts.push(`[name="${escapeForSelectorText(name)}"]`)
|
|
235
166
|
}
|
|
236
|
-
|
|
237
|
-
|
|
167
|
+
if (isLikelyStableIdentifier(type)) {
|
|
168
|
+
parts.push(`[type="${escapeForSelectorText(type)}"]`)
|
|
169
|
+
}
|
|
170
|
+
if (isLikelyStableIdentifier(ariaLabel)) {
|
|
171
|
+
parts.push(`[aria-label="${escapeForSelectorText(ariaLabel)}"]`)
|
|
172
|
+
}
|
|
173
|
+
if (parts.length === 1) {
|
|
174
|
+
const stableClasses = Array.from(element.classList || [])
|
|
175
|
+
.filter(isLikelyStableIdentifier)
|
|
176
|
+
.slice(0, 2)
|
|
177
|
+
if (stableClasses.length > 0) {
|
|
178
|
+
parts.push(...stableClasses.map(className => `.${escapeForCss(className)}`))
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return parts.length > 1 ? `css=${parts.join('')}` : ''
|
|
182
|
+
}
|
|
183
|
+
function buildXPathSelector(element, text) {
|
|
184
|
+
const tagName = element.tagName.toLowerCase()
|
|
185
|
+
const id = element.getAttribute('id')
|
|
186
|
+
if (id) {
|
|
187
|
+
return `xpath=//*[@id="${id.replace(/"/g, '\\"')}"]`
|
|
188
|
+
}
|
|
189
|
+
if (text) {
|
|
190
|
+
return `xpath=//${tagName}[normalize-space()="${text.replace(/"/g, '\\"')}"]`
|
|
191
|
+
}
|
|
192
|
+
return `xpath=//${tagName}`
|
|
193
|
+
}
|
|
194
|
+
function buildPrimarySelector(element) {
|
|
195
|
+
for (const attributeName of ['data-testid', 'data-test', 'data-qa']) {
|
|
196
|
+
const value = element.getAttribute(attributeName)
|
|
197
|
+
if (isLikelyStableIdentifier(value)) {
|
|
238
198
|
return {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
currentUrl: window.location.href,
|
|
242
|
-
pathname: normalizeRoute(window.location.href),
|
|
243
|
-
pageTitle: document.title || '',
|
|
244
|
-
tagName: element.tagName.toLowerCase(),
|
|
245
|
-
text: normalizeText(element.textContent).slice(0, 240) || undefined,
|
|
246
|
-
accessibleName: getAccessibleName(element) || undefined,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function clearHover() {
|
|
250
|
-
if (state.hoveredElement instanceof Element) {
|
|
251
|
-
state.hoveredElement.classList.remove(HOVER_CLASS);
|
|
199
|
+
selector: `css=[${attributeName}="${escapeForSelectorText(value)}"]`,
|
|
200
|
+
strategy: 'test-id',
|
|
252
201
|
}
|
|
253
|
-
|
|
202
|
+
}
|
|
254
203
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
204
|
+
const accessibleName = getAccessibleName(element)
|
|
205
|
+
const role = getRole(element)
|
|
206
|
+
if (role && accessibleName && countRoleNameMatches(role, accessibleName) === 1) {
|
|
207
|
+
return {
|
|
208
|
+
selector: `role=${role}[name="${escapeForSelectorText(accessibleName)}"]`,
|
|
209
|
+
strategy: 'role',
|
|
210
|
+
}
|
|
262
211
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
return null;
|
|
212
|
+
const labelText = getLabelText(element)
|
|
213
|
+
if (labelText) {
|
|
214
|
+
return {
|
|
215
|
+
selector: `label="${escapeForSelectorText(labelText)}"`,
|
|
216
|
+
strategy: 'label',
|
|
217
|
+
}
|
|
271
218
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
219
|
+
const placeholder = normalizeText(element.getAttribute('placeholder'))
|
|
220
|
+
if (placeholder) {
|
|
221
|
+
return {
|
|
222
|
+
selector: `placeholder="${escapeForSelectorText(placeholder)}"`,
|
|
223
|
+
strategy: 'placeholder',
|
|
224
|
+
}
|
|
275
225
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
226
|
+
const id = element.getAttribute('id')
|
|
227
|
+
if (isLikelyStableIdentifier(id)) {
|
|
228
|
+
return {
|
|
229
|
+
selector: `css=#${escapeForCss(id)}`,
|
|
230
|
+
strategy: 'id',
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const cssSelector = buildCssSelector(element)
|
|
234
|
+
if (cssSelector) {
|
|
235
|
+
return {
|
|
236
|
+
selector: cssSelector,
|
|
237
|
+
strategy: 'css',
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
selector: buildXPathSelector(element, normalizeText(element.textContent).slice(0, 120)),
|
|
242
|
+
strategy: 'xpath',
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function buildPreviewPayload(element) {
|
|
246
|
+
const selection = buildPrimarySelector(element)
|
|
247
|
+
return {
|
|
248
|
+
selector: selection.selector,
|
|
249
|
+
strategy: selection.strategy,
|
|
250
|
+
currentUrl: window.location.href,
|
|
251
|
+
pathname: normalizeRoute(window.location.href),
|
|
252
|
+
pageTitle: document.title || '',
|
|
253
|
+
tagName: element.tagName.toLowerCase(),
|
|
254
|
+
text: normalizeText(element.textContent).slice(0, 240) || undefined,
|
|
255
|
+
accessibleName: getAccessibleName(element) || undefined,
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function clearHover() {
|
|
259
|
+
if (state.hoveredElement instanceof Element) {
|
|
260
|
+
state.hoveredElement.classList.remove(HOVER_CLASS)
|
|
261
|
+
}
|
|
262
|
+
state.hoveredElement = null
|
|
263
|
+
}
|
|
264
|
+
function setPicking(enabled) {
|
|
265
|
+
state.picking = enabled
|
|
266
|
+
document.documentElement.classList.toggle(ACTIVE_CLASS, enabled)
|
|
267
|
+
if (!enabled) {
|
|
268
|
+
clearHover()
|
|
269
|
+
}
|
|
270
|
+
render()
|
|
271
|
+
}
|
|
272
|
+
function resolveElement(target) {
|
|
273
|
+
if (target instanceof Element) {
|
|
274
|
+
return target
|
|
275
|
+
}
|
|
276
|
+
if (target instanceof Node) {
|
|
277
|
+
return target.parentElement
|
|
278
|
+
}
|
|
279
|
+
return null
|
|
280
|
+
}
|
|
281
|
+
function getMountTarget() {
|
|
282
|
+
var _a, _b
|
|
283
|
+
return (_b = (_a = document.body) !== null && _a !== void 0 ? _a : document.documentElement) !== null &&
|
|
284
|
+
_b !== void 0
|
|
285
|
+
? _b
|
|
286
|
+
: null
|
|
287
|
+
}
|
|
288
|
+
function ensureStyle() {
|
|
289
|
+
if (!document.documentElement) {
|
|
290
|
+
return
|
|
291
|
+
}
|
|
292
|
+
if (document.getElementById(STYLE_ID)) {
|
|
293
|
+
return
|
|
294
|
+
}
|
|
295
|
+
const style = document.createElement('style')
|
|
296
|
+
style.id = STYLE_ID
|
|
297
|
+
style.textContent = `
|
|
286
298
|
.${HOVER_CLASS} {
|
|
287
299
|
outline: 2px solid #0f766e !important;
|
|
288
300
|
outline-offset: 2px !important;
|
|
@@ -400,216 +412,249 @@ export function installLocatorPickerOverlay() {
|
|
|
400
412
|
font-size: 12px;
|
|
401
413
|
line-height: 1.4;
|
|
402
414
|
}
|
|
403
|
-
|
|
404
|
-
|
|
415
|
+
`
|
|
416
|
+
document.documentElement.appendChild(style)
|
|
417
|
+
}
|
|
418
|
+
function ensureRoot() {
|
|
419
|
+
var _a
|
|
420
|
+
const mountTarget = getMountTarget()
|
|
421
|
+
if (!mountTarget) {
|
|
422
|
+
return
|
|
405
423
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
424
|
+
if ((_a = state.elements.root) === null || _a === void 0 ? void 0 : _a.isConnected) {
|
|
425
|
+
return
|
|
426
|
+
}
|
|
427
|
+
const root = document.createElement('div')
|
|
428
|
+
root.id = ROOT_ID
|
|
429
|
+
root.setAttribute('role', 'dialog')
|
|
430
|
+
root.setAttribute('aria-label', 'Appraise locator picker')
|
|
431
|
+
const heading = document.createElement('p')
|
|
432
|
+
heading.className = 'appraise-picker-heading'
|
|
433
|
+
heading.textContent = 'Appraise Locator Picker'
|
|
434
|
+
const helperText = document.createElement('p')
|
|
435
|
+
helperText.className = 'appraise-picker-copy'
|
|
436
|
+
const statusText = document.createElement('p')
|
|
437
|
+
statusText.className = 'appraise-picker-status'
|
|
438
|
+
const previewCard = document.createElement('div')
|
|
439
|
+
previewCard.className = 'appraise-picker-card'
|
|
440
|
+
const selectorLabel = document.createElement('span')
|
|
441
|
+
selectorLabel.className = 'appraise-picker-label'
|
|
442
|
+
selectorLabel.textContent = 'Selector'
|
|
443
|
+
const selectorValue = document.createElement('pre')
|
|
444
|
+
selectorValue.className = 'appraise-picker-value'
|
|
445
|
+
const metadataLabel = document.createElement('span')
|
|
446
|
+
metadataLabel.className = 'appraise-picker-label'
|
|
447
|
+
metadataLabel.textContent = 'Page'
|
|
448
|
+
const metadataValue = document.createElement('p')
|
|
449
|
+
metadataValue.className = 'appraise-picker-value'
|
|
450
|
+
previewCard.appendChild(selectorLabel)
|
|
451
|
+
previewCard.appendChild(selectorValue)
|
|
452
|
+
previewCard.appendChild(metadataLabel)
|
|
453
|
+
previewCard.appendChild(metadataValue)
|
|
454
|
+
const errorValue = document.createElement('p')
|
|
455
|
+
errorValue.className = 'appraise-picker-error'
|
|
456
|
+
const actions = document.createElement('div')
|
|
457
|
+
actions.className = 'appraise-picker-actions'
|
|
458
|
+
const startButton = document.createElement('button')
|
|
459
|
+
startButton.className = 'appraise-picker-primary'
|
|
460
|
+
startButton.type = 'button'
|
|
461
|
+
startButton.textContent = 'Start picking'
|
|
462
|
+
startButton.addEventListener('click', event => {
|
|
463
|
+
stopOverlayEvent(event)
|
|
464
|
+
state.submitting = false
|
|
465
|
+
state.preview = null
|
|
466
|
+
state.error = ''
|
|
467
|
+
setPicking(true)
|
|
468
|
+
})
|
|
469
|
+
const useButton = document.createElement('button')
|
|
470
|
+
useButton.className = 'appraise-picker-primary'
|
|
471
|
+
useButton.type = 'button'
|
|
472
|
+
useButton.textContent = 'Use selector'
|
|
473
|
+
useButton.addEventListener('click', event => {
|
|
474
|
+
stopOverlayEvent(event)
|
|
475
|
+
if (!state.preview || state.submitting || !globalState.__appraiseLocatorPickerConfirm) {
|
|
476
|
+
return
|
|
477
|
+
}
|
|
478
|
+
state.submitting = true
|
|
479
|
+
state.error = ''
|
|
480
|
+
render()
|
|
481
|
+
void globalState
|
|
482
|
+
.__appraiseLocatorPickerConfirm(state.preview)
|
|
483
|
+
.catch(error => {
|
|
484
|
+
state.error = error instanceof Error ? error.message : 'Unable to use selector.'
|
|
485
|
+
})
|
|
486
|
+
.finally(() => {
|
|
487
|
+
state.submitting = false
|
|
488
|
+
render()
|
|
489
|
+
})
|
|
490
|
+
})
|
|
491
|
+
const pickAgainButton = document.createElement('button')
|
|
492
|
+
pickAgainButton.className = 'appraise-picker-secondary'
|
|
493
|
+
pickAgainButton.type = 'button'
|
|
494
|
+
pickAgainButton.textContent = 'Pick again'
|
|
495
|
+
pickAgainButton.addEventListener('click', event => {
|
|
496
|
+
stopOverlayEvent(event)
|
|
497
|
+
state.submitting = false
|
|
498
|
+
state.preview = null
|
|
499
|
+
state.error = ''
|
|
500
|
+
setPicking(true)
|
|
501
|
+
})
|
|
502
|
+
const cancelButton = document.createElement('button')
|
|
503
|
+
cancelButton.className = 'appraise-picker-secondary'
|
|
504
|
+
cancelButton.type = 'button'
|
|
505
|
+
cancelButton.textContent = 'Cancel'
|
|
506
|
+
cancelButton.addEventListener('click', event => {
|
|
507
|
+
stopOverlayEvent(event)
|
|
508
|
+
if (state.submitting || !globalState.__appraiseLocatorPickerCancel) {
|
|
509
|
+
return
|
|
510
|
+
}
|
|
511
|
+
state.submitting = true
|
|
512
|
+
render()
|
|
513
|
+
void globalState.__appraiseLocatorPickerCancel().catch(() => undefined)
|
|
514
|
+
})
|
|
515
|
+
actions.append(startButton, useButton, pickAgainButton, cancelButton)
|
|
516
|
+
root.append(heading, helperText, statusText, previewCard, errorValue, actions)
|
|
517
|
+
root.addEventListener('pointerdown', event => event.stopPropagation())
|
|
518
|
+
root.addEventListener('click', event => event.stopPropagation())
|
|
519
|
+
mountTarget.appendChild(root)
|
|
520
|
+
state.elements = {
|
|
521
|
+
root,
|
|
522
|
+
startButton,
|
|
523
|
+
useButton,
|
|
524
|
+
pickAgainButton,
|
|
525
|
+
cancelButton,
|
|
526
|
+
helperText,
|
|
527
|
+
statusText,
|
|
528
|
+
selectorValue,
|
|
529
|
+
metadataValue,
|
|
530
|
+
errorValue,
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function render() {
|
|
534
|
+
var _a, _b
|
|
535
|
+
ensureStyle()
|
|
536
|
+
ensureRoot()
|
|
537
|
+
document.documentElement.classList.toggle(ACTIVE_CLASS, state.picking)
|
|
538
|
+
if (state.hoveredElement && !state.hoveredElement.isConnected) {
|
|
539
|
+
state.hoveredElement = null
|
|
540
|
+
}
|
|
541
|
+
const {
|
|
542
|
+
helperText,
|
|
543
|
+
statusText,
|
|
544
|
+
selectorValue,
|
|
545
|
+
metadataValue,
|
|
546
|
+
errorValue,
|
|
547
|
+
startButton,
|
|
548
|
+
useButton,
|
|
549
|
+
pickAgainButton,
|
|
550
|
+
cancelButton,
|
|
551
|
+
} = state.elements
|
|
552
|
+
if (
|
|
553
|
+
!helperText ||
|
|
554
|
+
!statusText ||
|
|
555
|
+
!selectorValue ||
|
|
556
|
+
!metadataValue ||
|
|
557
|
+
!errorValue ||
|
|
558
|
+
!startButton ||
|
|
559
|
+
!useButton ||
|
|
560
|
+
!pickAgainButton ||
|
|
561
|
+
!cancelButton
|
|
562
|
+
) {
|
|
563
|
+
return
|
|
564
|
+
}
|
|
565
|
+
helperText.textContent = state.preview
|
|
566
|
+
? 'Review the generated selector, then confirm it or pick a different element.'
|
|
567
|
+
: 'Start picking, hover to highlight, then click one element to preview a single generated selector.'
|
|
568
|
+
if (state.picking) {
|
|
569
|
+
statusText.textContent = 'Picking mode is on'
|
|
570
|
+
} else if (state.preview) {
|
|
571
|
+
statusText.textContent = 'Selection ready'
|
|
572
|
+
} else {
|
|
573
|
+
statusText.textContent = 'Waiting to start'
|
|
574
|
+
}
|
|
575
|
+
selectorValue.textContent =
|
|
576
|
+
(_b = (_a = state.preview) === null || _a === void 0 ? void 0 : _a.selector) !== null && _b !== void 0
|
|
577
|
+
? _b
|
|
578
|
+
: 'No selector picked yet.'
|
|
579
|
+
metadataValue.textContent = state.preview
|
|
580
|
+
? [state.preview.pageTitle || '(untitled page)', state.preview.currentUrl].filter(Boolean).join('\n')
|
|
581
|
+
: 'The selected page metadata will appear here.'
|
|
582
|
+
errorValue.textContent = state.error
|
|
583
|
+
startButton.style.display = state.preview ? 'none' : 'inline-flex'
|
|
584
|
+
useButton.style.display = state.preview ? 'inline-flex' : 'none'
|
|
585
|
+
pickAgainButton.style.display = state.preview ? 'inline-flex' : 'none'
|
|
586
|
+
useButton.disabled = !state.preview || state.submitting
|
|
587
|
+
pickAgainButton.disabled = state.submitting
|
|
588
|
+
cancelButton.disabled = state.submitting
|
|
589
|
+
}
|
|
590
|
+
function installOrRender() {
|
|
591
|
+
render()
|
|
592
|
+
}
|
|
593
|
+
if (!globalState.__appraiseLocatorPickerDomListenersBound) {
|
|
594
|
+
globalState.__appraiseLocatorPickerDomListenersBound = true
|
|
595
|
+
document.addEventListener('DOMContentLoaded', installOrRender)
|
|
596
|
+
window.addEventListener('load', installOrRender)
|
|
597
|
+
}
|
|
598
|
+
if (globalState.__appraiseLocatorPickerInstalled) {
|
|
599
|
+
installOrRender()
|
|
600
|
+
return
|
|
601
|
+
}
|
|
602
|
+
globalState.__appraiseLocatorPickerInstalled = true
|
|
603
|
+
document.addEventListener(
|
|
604
|
+
'mouseover',
|
|
605
|
+
event => {
|
|
606
|
+
if (!state.picking) {
|
|
607
|
+
return
|
|
608
|
+
}
|
|
609
|
+
const target = resolveElement(event.target)
|
|
610
|
+
if (!target || target.closest(`#${ROOT_ID}`)) {
|
|
611
|
+
return
|
|
612
|
+
}
|
|
613
|
+
clearHover()
|
|
614
|
+
target.classList.add(HOVER_CLASS)
|
|
615
|
+
state.hoveredElement = target
|
|
616
|
+
},
|
|
617
|
+
true,
|
|
618
|
+
)
|
|
619
|
+
document.addEventListener(
|
|
620
|
+
'mouseout',
|
|
621
|
+
event => {
|
|
622
|
+
if (!state.picking) {
|
|
623
|
+
return
|
|
624
|
+
}
|
|
625
|
+
const target = resolveElement(event.target)
|
|
626
|
+
if (target instanceof Element) {
|
|
627
|
+
target.classList.remove(HOVER_CLASS)
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
true,
|
|
631
|
+
)
|
|
632
|
+
document.addEventListener(
|
|
633
|
+
'click',
|
|
634
|
+
event => {
|
|
635
|
+
if (!state.picking) {
|
|
636
|
+
return
|
|
637
|
+
}
|
|
638
|
+
const target = resolveElement(event.target)
|
|
639
|
+
if (!target || target.closest(`#${ROOT_ID}`)) {
|
|
640
|
+
return
|
|
641
|
+
}
|
|
642
|
+
event.preventDefault()
|
|
643
|
+
event.stopPropagation()
|
|
644
|
+
event.stopImmediatePropagation()
|
|
645
|
+
void Promise.resolve()
|
|
646
|
+
.then(() => {
|
|
647
|
+
const preview = buildPreviewPayload(target)
|
|
648
|
+
state.preview = preview
|
|
649
|
+
state.error = ''
|
|
650
|
+
setPicking(false)
|
|
651
|
+
})
|
|
652
|
+
.catch(error => {
|
|
653
|
+
state.error = error instanceof Error ? error.message : 'Unable to inspect that element.'
|
|
654
|
+
setPicking(false)
|
|
608
655
|
})
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
}, true);
|
|
614
|
-
installOrRender();
|
|
656
|
+
},
|
|
657
|
+
true,
|
|
658
|
+
)
|
|
659
|
+
installOrRender()
|
|
615
660
|
}
|