@solidxai/core 0.1.22-beta.1 → 0.1.22-beta.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 +16 -0
- package/dist/controllers/module-package.controller.d.ts +198 -0
- package/dist/controllers/module-package.controller.d.ts.map +1 -1
- package/dist/controllers/test-run.controller.d.ts +5 -0
- package/dist/controllers/test-run.controller.d.ts.map +1 -1
- package/dist/controllers/test-run.controller.js +17 -0
- package/dist/controllers/test-run.controller.js.map +1 -1
- package/dist/dtos/confirm-module-package-import.dto.d.ts +2 -0
- package/dist/dtos/confirm-module-package-import.dto.d.ts.map +1 -1
- package/dist/dtos/confirm-module-package-import.dto.js +21 -1
- package/dist/dtos/confirm-module-package-import.dto.js.map +1 -1
- package/dist/dtos/create-field-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-field-metadata.dto.js +3 -3
- package/dist/dtos/create-field-metadata.dto.js.map +1 -1
- package/dist/dtos/create-model-metadata.dto.d.ts +6 -6
- package/dist/dtos/create-model-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-model-metadata.dto.js +13 -7
- package/dist/dtos/create-model-metadata.dto.js.map +1 -1
- package/dist/dtos/test-run-request.dto.d.ts +12 -1
- package/dist/dtos/test-run-request.dto.d.ts.map +1 -1
- package/dist/dtos/test-run-request.dto.js +16 -1
- package/dist/dtos/test-run-request.dto.js.map +1 -1
- package/dist/helpers/module-package-sync.helper.d.ts +71 -0
- package/dist/helpers/module-package-sync.helper.d.ts.map +1 -0
- package/dist/helpers/module-package-sync.helper.js +318 -0
- package/dist/helpers/module-package-sync.helper.js.map +1 -0
- package/dist/helpers/module-package-sync.helper.spec.d.ts +2 -0
- package/dist/helpers/module-package-sync.helper.spec.d.ts.map +1 -0
- package/dist/helpers/module-package-sync.helper.spec.js +229 -0
- package/dist/helpers/module-package-sync.helper.spec.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts +3 -1
- package/dist/jobs/database/test-run-queue-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/test-run-queue-subscriber-database.service.js +19 -6
- package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts +9 -0
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +138 -0
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +0 -47
- package/dist/services/module-package.service.d.ts +38 -0
- package/dist/services/module-package.service.d.ts.map +1 -1
- package/dist/services/module-package.service.js +314 -33
- package/dist/services/module-package.service.js.map +1 -1
- package/dist/services/module-package.service.spec.d.ts +2 -0
- package/dist/services/module-package.service.spec.d.ts.map +1 -0
- package/dist/services/module-package.service.spec.js +347 -0
- package/dist/services/module-package.service.spec.js.map +1 -0
- package/dist/services/view-metadata.service.d.ts.map +1 -1
- package/dist/services/view-metadata.service.js +5 -4
- package/dist/services/view-metadata.service.js.map +1 -1
- package/dist/testing/__integration__/mobile-emulator.integration.d.ts +2 -0
- package/dist/testing/__integration__/mobile-emulator.integration.d.ts.map +1 -0
- package/dist/testing/__integration__/mobile-emulator.integration.js +368 -0
- package/dist/testing/__integration__/mobile-emulator.integration.js.map +1 -0
- package/dist/testing/adapters/mobile/capabilities.d.ts +4 -0
- package/dist/testing/adapters/mobile/capabilities.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/capabilities.js +85 -0
- package/dist/testing/adapters/mobile/capabilities.js.map +1 -0
- package/dist/testing/adapters/mobile/capabilities.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/capabilities.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/capabilities.spec.js +215 -0
- package/dist/testing/adapters/mobile/capabilities.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/fake-driver.d.ts +113 -0
- package/dist/testing/adapters/mobile/fake-driver.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/fake-driver.js +122 -0
- package/dist/testing/adapters/mobile/fake-driver.js.map +1 -0
- package/dist/testing/adapters/mobile/ios-keyboard.d.ts +31 -0
- package/dist/testing/adapters/mobile/ios-keyboard.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/ios-keyboard.js +157 -0
- package/dist/testing/adapters/mobile/ios-keyboard.js.map +1 -0
- package/dist/testing/adapters/mobile/ios-keyboard.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/ios-keyboard.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/ios-keyboard.spec.js +36 -0
- package/dist/testing/adapters/mobile/ios-keyboard.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/locator.d.ts +12 -0
- package/dist/testing/adapters/mobile/locator.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/locator.js +96 -0
- package/dist/testing/adapters/mobile/locator.js.map +1 -0
- package/dist/testing/adapters/mobile/locator.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/locator.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/locator.spec.js +136 -0
- package/dist/testing/adapters/mobile/locator.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/logcat.d.ts +9 -0
- package/dist/testing/adapters/mobile/logcat.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/logcat.js +28 -0
- package/dist/testing/adapters/mobile/logcat.js.map +1 -0
- package/dist/testing/adapters/mobile/logcat.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/logcat.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/logcat.spec.js +46 -0
- package/dist/testing/adapters/mobile/logcat.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.d.ts +67 -0
- package/dist/testing/adapters/mobile/mobile-adapter.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.ios.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/mobile-adapter.ios.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.ios.spec.js +240 -0
- package/dist/testing/adapters/mobile/mobile-adapter.ios.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.js +494 -0
- package/dist/testing/adapters/mobile/mobile-adapter.js.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/mobile-adapter.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/mobile-adapter.spec.js +567 -0
- package/dist/testing/adapters/mobile/mobile-adapter.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/mobile.types.d.ts +111 -0
- package/dist/testing/adapters/mobile/mobile.types.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/mobile.types.js +3 -0
- package/dist/testing/adapters/mobile/mobile.types.js.map +1 -0
- package/dist/testing/adapters/mobile/phone-errors.d.ts +6 -0
- package/dist/testing/adapters/mobile/phone-errors.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/phone-errors.js +43 -0
- package/dist/testing/adapters/mobile/phone-errors.js.map +1 -0
- package/dist/testing/adapters/mobile/platform.d.ts +7 -0
- package/dist/testing/adapters/mobile/platform.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/platform.js +11 -0
- package/dist/testing/adapters/mobile/platform.js.map +1 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.d.ts +6 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.js +95 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.js.map +1 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.spec.js +199 -0
- package/dist/testing/adapters/mobile/resolve-mobile-target.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/run-options.d.ts +11 -0
- package/dist/testing/adapters/mobile/run-options.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/run-options.js +41 -0
- package/dist/testing/adapters/mobile/run-options.js.map +1 -0
- package/dist/testing/adapters/mobile/run-options.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/run-options.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/run-options.spec.js +100 -0
- package/dist/testing/adapters/mobile/run-options.spec.js.map +1 -0
- package/dist/testing/adapters/mobile/syslog.d.ts +9 -0
- package/dist/testing/adapters/mobile/syslog.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/syslog.js +45 -0
- package/dist/testing/adapters/mobile/syslog.js.map +1 -0
- package/dist/testing/adapters/mobile/syslog.spec.d.ts +2 -0
- package/dist/testing/adapters/mobile/syslog.spec.d.ts.map +1 -0
- package/dist/testing/adapters/mobile/syslog.spec.js +81 -0
- package/dist/testing/adapters/mobile/syslog.spec.js.map +1 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts +24 -3
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.js +113 -14
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
- package/dist/testing/adapters/ui/resolve-target.d.ts +12 -0
- package/dist/testing/adapters/ui/resolve-target.d.ts.map +1 -0
- package/dist/testing/adapters/ui/resolve-target.js +95 -0
- package/dist/testing/adapters/ui/resolve-target.js.map +1 -0
- package/dist/testing/adapters/ui/ui.types.d.ts +12 -0
- package/dist/testing/adapters/ui/ui.types.d.ts.map +1 -1
- package/dist/testing/adapters/ui/ui.types.js.map +1 -1
- package/dist/testing/contracts/runtime-context.types.d.ts +14 -0
- package/dist/testing/contracts/runtime-context.types.d.ts.map +1 -1
- package/dist/testing/contracts/runtime-context.types.js.map +1 -1
- package/dist/testing/contracts/testing-metadata.types.d.ts +28 -1
- package/dist/testing/contracts/testing-metadata.types.d.ts.map +1 -1
- package/dist/testing/contracts/testing-metadata.types.js.map +1 -1
- package/dist/testing/core/step-registry.d.ts +1 -0
- package/dist/testing/core/step-registry.d.ts.map +1 -1
- package/dist/testing/core/step-registry.js +3 -0
- package/dist/testing/core/step-registry.js.map +1 -1
- package/dist/testing/core/testing-engine.d.ts +16 -4
- package/dist/testing/core/testing-engine.d.ts.map +1 -1
- package/dist/testing/core/testing-engine.js +109 -33
- package/dist/testing/core/testing-engine.js.map +1 -1
- package/dist/testing/reporter/console-reporter.d.ts +7 -13
- package/dist/testing/reporter/console-reporter.d.ts.map +1 -1
- package/dist/testing/reporter/console-reporter.js +15 -1
- package/dist/testing/reporter/console-reporter.js.map +1 -1
- package/dist/testing/reporter/file-service-artifact-sink.d.ts +2 -0
- package/dist/testing/reporter/file-service-artifact-sink.d.ts.map +1 -1
- package/dist/testing/reporter/file-service-artifact-sink.js +2 -1
- package/dist/testing/reporter/file-service-artifact-sink.js.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.d.ts +11 -0
- package/dist/testing/reporter/lifecycle-events.types.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.js.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts +7 -5
- package/dist/testing/reporter/lifecycle-webhook-reporter.d.ts.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.js +25 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.spec.d.ts +2 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.spec.d.ts.map +1 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.spec.js +72 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.spec.js.map +1 -0
- package/dist/testing/reporter/progress-reporter.d.ts +4 -13
- package/dist/testing/reporter/progress-reporter.d.ts.map +1 -1
- package/dist/testing/reporter/progress-reporter.js +5 -1
- package/dist/testing/reporter/progress-reporter.js.map +1 -1
- package/dist/testing/reporter/reporter.types.d.ts +27 -13
- package/dist/testing/reporter/reporter.types.d.ts.map +1 -1
- package/dist/testing/reporter/reporter.types.js.map +1 -1
- package/dist/testing/runner/lifecycle.d.ts +8 -0
- package/dist/testing/runner/lifecycle.d.ts.map +1 -1
- package/dist/testing/runner/lifecycle.js +80 -0
- package/dist/testing/runner/lifecycle.js.map +1 -1
- package/dist/testing/runner/lifecycle.spec.d.ts +2 -0
- package/dist/testing/runner/lifecycle.spec.d.ts.map +1 -0
- package/dist/testing/runner/lifecycle.spec.js +33 -0
- package/dist/testing/runner/lifecycle.spec.js.map +1 -0
- package/dist/testing/runner/mobile-session.d.ts +24 -0
- package/dist/testing/runner/mobile-session.d.ts.map +1 -0
- package/dist/testing/runner/mobile-session.js +96 -0
- package/dist/testing/runner/mobile-session.js.map +1 -0
- package/dist/testing/runner/mobile-session.spec.d.ts +2 -0
- package/dist/testing/runner/mobile-session.spec.d.ts.map +1 -0
- package/dist/testing/runner/mobile-session.spec.js +89 -0
- package/dist/testing/runner/mobile-session.spec.js.map +1 -0
- package/dist/testing/runner/recording-reporter.d.ts +62 -0
- package/dist/testing/runner/recording-reporter.d.ts.map +1 -0
- package/dist/testing/runner/recording-reporter.js +35 -0
- package/dist/testing/runner/recording-reporter.js.map +1 -0
- package/dist/testing/runner/run-cancellation.d.ts +7 -0
- package/dist/testing/runner/run-cancellation.d.ts.map +1 -0
- package/dist/testing/runner/run-cancellation.js +30 -0
- package/dist/testing/runner/run-cancellation.js.map +1 -0
- package/dist/testing/runner/run-from-metadata.cancel.spec.d.ts +2 -0
- package/dist/testing/runner/run-from-metadata.cancel.spec.d.ts.map +1 -0
- package/dist/testing/runner/run-from-metadata.cancel.spec.js +58 -0
- package/dist/testing/runner/run-from-metadata.cancel.spec.js.map +1 -0
- package/dist/testing/runner/run-from-metadata.d.ts +4 -0
- package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
- package/dist/testing/runner/run-from-metadata.js +152 -25
- package/dist/testing/runner/run-from-metadata.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.mobile.spec.d.ts +2 -0
- package/dist/testing/runner/run-from-metadata.mobile.spec.d.ts.map +1 -0
- package/dist/testing/runner/run-from-metadata.mobile.spec.js +498 -0
- package/dist/testing/runner/run-from-metadata.mobile.spec.js.map +1 -0
- package/dist/testing/runner/run-from-metadata.spec.js +188 -0
- package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
- package/dist/testing/runner/scenario-graph.d.ts +8 -0
- package/dist/testing/runner/scenario-graph.d.ts.map +1 -0
- package/dist/testing/runner/scenario-graph.js +120 -0
- package/dist/testing/runner/scenario-graph.js.map +1 -0
- package/dist/testing/runner/scenario-graph.spec.d.ts +2 -0
- package/dist/testing/runner/scenario-graph.spec.d.ts.map +1 -0
- package/dist/testing/runner/scenario-graph.spec.js +97 -0
- package/dist/testing/runner/scenario-graph.spec.js.map +1 -0
- package/dist/testing/runtime/default-registry.d.ts +3 -0
- package/dist/testing/runtime/default-registry.d.ts.map +1 -0
- package/dist/testing/runtime/default-registry.js +21 -0
- package/dist/testing/runtime/default-registry.js.map +1 -0
- package/dist/testing/runtime/index.d.ts +22 -0
- package/dist/testing/runtime/index.d.ts.map +1 -0
- package/dist/testing/runtime/index.js +63 -0
- package/dist/testing/runtime/index.js.map +1 -0
- package/dist/testing/runtime/mobile-step-executor.spec.d.ts +2 -0
- package/dist/testing/runtime/mobile-step-executor.spec.d.ts.map +1 -0
- package/dist/testing/runtime/mobile-step-executor.spec.js +157 -0
- package/dist/testing/runtime/mobile-step-executor.spec.js.map +1 -0
- package/dist/testing/runtime/step-executor.d.ts +92 -0
- package/dist/testing/runtime/step-executor.d.ts.map +1 -0
- package/dist/testing/runtime/step-executor.js +171 -0
- package/dist/testing/runtime/step-executor.js.map +1 -0
- package/dist/testing/runtime/step-executor.spec.d.ts +2 -0
- package/dist/testing/runtime/step-executor.spec.d.ts.map +1 -0
- package/dist/testing/runtime/step-executor.spec.js +137 -0
- package/dist/testing/runtime/step-executor.spec.js.map +1 -0
- package/dist/testing/steps/mobile/actions.step.d.ts +3 -0
- package/dist/testing/steps/mobile/actions.step.d.ts.map +1 -0
- package/dist/testing/steps/mobile/actions.step.js +151 -0
- package/dist/testing/steps/mobile/actions.step.js.map +1 -0
- package/dist/testing/steps/mobile/app.step.d.ts +3 -0
- package/dist/testing/steps/mobile/app.step.d.ts.map +1 -0
- package/dist/testing/steps/mobile/app.step.js +20 -0
- package/dist/testing/steps/mobile/app.step.js.map +1 -0
- package/dist/testing/steps/mobile/assertions.step.d.ts +3 -0
- package/dist/testing/steps/mobile/assertions.step.d.ts.map +1 -0
- package/dist/testing/steps/mobile/assertions.step.js +55 -0
- package/dist/testing/steps/mobile/assertions.step.js.map +1 -0
- package/dist/testing/steps/mobile/gestures.step.d.ts +3 -0
- package/dist/testing/steps/mobile/gestures.step.d.ts.map +1 -0
- package/dist/testing/steps/mobile/gestures.step.js +85 -0
- package/dist/testing/steps/mobile/gestures.step.js.map +1 -0
- package/dist/testing/steps/mobile/index.d.ts +3 -0
- package/dist/testing/steps/mobile/index.d.ts.map +1 -0
- package/dist/testing/steps/mobile/index.js +14 -0
- package/dist/testing/steps/mobile/index.js.map +1 -0
- package/dist/testing/steps/mobile/mobile-steps.ios.spec.d.ts +2 -0
- package/dist/testing/steps/mobile/mobile-steps.ios.spec.d.ts.map +1 -0
- package/dist/testing/steps/mobile/mobile-steps.ios.spec.js +315 -0
- package/dist/testing/steps/mobile/mobile-steps.ios.spec.js.map +1 -0
- package/dist/testing/steps/mobile/mobile-steps.spec.d.ts +2 -0
- package/dist/testing/steps/mobile/mobile-steps.spec.d.ts.map +1 -0
- package/dist/testing/steps/mobile/mobile-steps.spec.js +338 -0
- package/dist/testing/steps/mobile/mobile-steps.spec.js.map +1 -0
- package/dist/testing/steps/mobile/shared.d.ts +13 -0
- package/dist/testing/steps/mobile/shared.d.ts.map +1 -0
- package/dist/testing/steps/mobile/shared.js +41 -0
- package/dist/testing/steps/mobile/shared.js.map +1 -0
- package/dist/testing/steps/mobile/swipe-line.d.ts +14 -0
- package/dist/testing/steps/mobile/swipe-line.d.ts.map +1 -0
- package/dist/testing/steps/mobile/swipe-line.js +20 -0
- package/dist/testing/steps/mobile/swipe-line.js.map +1 -0
- package/dist/testing/steps/mobile/swipe-line.spec.d.ts +2 -0
- package/dist/testing/steps/mobile/swipe-line.spec.d.ts.map +1 -0
- package/dist/testing/steps/mobile/swipe-line.spec.js +25 -0
- package/dist/testing/steps/mobile/swipe-line.spec.js.map +1 -0
- package/dist/testing/steps/ui/actions.step.d.ts.map +1 -1
- package/dist/testing/steps/ui/actions.step.js +8 -5
- package/dist/testing/steps/ui/actions.step.js.map +1 -1
- package/dist/testing/steps/ui/aria-snapshot.step.d.ts +3 -0
- package/dist/testing/steps/ui/aria-snapshot.step.d.ts.map +1 -0
- package/dist/testing/steps/ui/aria-snapshot.step.js +70 -0
- package/dist/testing/steps/ui/aria-snapshot.step.js.map +1 -0
- package/dist/testing/steps/ui/assertions.step.d.ts.map +1 -1
- package/dist/testing/steps/ui/assertions.step.js +5 -2
- package/dist/testing/steps/ui/assertions.step.js.map +1 -1
- package/dist/testing/steps/ui/form.step.d.ts.map +1 -1
- package/dist/testing/steps/ui/form.step.js +7 -3
- package/dist/testing/steps/ui/form.step.js.map +1 -1
- package/dist/testing/steps/ui/index.d.ts.map +1 -1
- package/dist/testing/steps/ui/index.js +2 -0
- package/dist/testing/steps/ui/index.js.map +1 -1
- package/package.json +15 -5
- package/src/controllers/test-run.controller.ts +17 -1
- package/src/dtos/confirm-module-package-import.dto.ts +16 -0
- package/src/dtos/create-field-metadata.dto.ts +4 -3
- package/src/dtos/create-model-metadata.dto.ts +19 -13
- package/src/dtos/test-run-request.dto.ts +18 -0
- package/src/entities/media-migration-plan.md +20 -0
- package/src/helpers/module-package-sync.helper.spec.ts +253 -0
- package/src/helpers/module-package-sync.helper.ts +381 -0
- package/src/index.ts +3 -0
- package/src/jobs/database/test-run-queue-subscriber-database.service.ts +21 -5
- package/src/seeders/module-metadata-seeder.service.ts +154 -0
- package/src/seeders/seed-data/solid-core-metadata.json +0 -47
- package/src/services/module-package.service.spec.ts +398 -0
- package/src/services/module-package.service.ts +433 -37
- package/src/services/view-metadata.service.ts +6 -4
- package/src/testing/README.md +198 -1
- package/src/testing/__integration__/mobile-emulator.integration.ts +409 -0
- package/src/testing/adapters/mobile/capabilities.spec.ts +247 -0
- package/src/testing/adapters/mobile/capabilities.ts +108 -0
- package/src/testing/adapters/mobile/fake-driver.ts +133 -0
- package/src/testing/adapters/mobile/ios-keyboard.spec.ts +40 -0
- package/src/testing/adapters/mobile/ios-keyboard.ts +187 -0
- package/src/testing/adapters/mobile/locator.spec.ts +200 -0
- package/src/testing/adapters/mobile/locator.ts +118 -0
- package/src/testing/adapters/mobile/logcat.spec.ts +63 -0
- package/src/testing/adapters/mobile/logcat.ts +44 -0
- package/src/testing/adapters/mobile/mobile-adapter.ios.spec.ts +277 -0
- package/src/testing/adapters/mobile/mobile-adapter.spec.ts +632 -0
- package/src/testing/adapters/mobile/mobile-adapter.ts +599 -0
- package/src/testing/adapters/mobile/mobile.types.ts +177 -0
- package/src/testing/adapters/mobile/phone-errors.ts +59 -0
- package/src/testing/adapters/mobile/platform.ts +15 -0
- package/src/testing/adapters/mobile/resolve-mobile-target.spec.ts +227 -0
- package/src/testing/adapters/mobile/resolve-mobile-target.ts +104 -0
- package/src/testing/adapters/mobile/run-options.spec.ts +121 -0
- package/src/testing/adapters/mobile/run-options.ts +49 -0
- package/src/testing/adapters/mobile/syslog.spec.ts +108 -0
- package/src/testing/adapters/mobile/syslog.ts +57 -0
- package/src/testing/adapters/ui/playwright-adapter.ts +149 -22
- package/src/testing/adapters/ui/resolve-target.ts +121 -0
- package/src/testing/adapters/ui/ui.types.ts +23 -0
- package/src/testing/contracts/runtime-context.types.ts +24 -0
- package/src/testing/contracts/testing-metadata.types.ts +72 -1
- package/src/testing/core/step-registry.ts +4 -0
- package/src/testing/core/testing-engine.ts +148 -42
- package/src/testing/reporter/console-reporter.ts +22 -10
- package/src/testing/reporter/file-service-artifact-sink.ts +9 -3
- package/src/testing/reporter/lifecycle-events.types.ts +17 -0
- package/src/testing/reporter/lifecycle-webhook-reporter.spec.ts +77 -0
- package/src/testing/reporter/lifecycle-webhook-reporter.ts +31 -2
- package/src/testing/reporter/progress-reporter.ts +9 -10
- package/src/testing/reporter/reporter.types.ts +37 -9
- package/src/testing/runner/lifecycle.spec.ts +41 -0
- package/src/testing/runner/lifecycle.ts +95 -0
- package/src/testing/runner/mobile-session.spec.ts +106 -0
- package/src/testing/runner/mobile-session.ts +138 -0
- package/src/testing/runner/recording-reporter.ts +34 -0
- package/src/testing/runner/run-cancellation.ts +38 -0
- package/src/testing/runner/run-from-metadata.cancel.spec.ts +75 -0
- package/src/testing/runner/run-from-metadata.mobile.spec.ts +580 -0
- package/src/testing/runner/run-from-metadata.spec.ts +180 -2
- package/src/testing/runner/run-from-metadata.ts +215 -33
- package/src/testing/runner/scenario-graph.spec.ts +122 -0
- package/src/testing/runner/scenario-graph.ts +142 -0
- package/src/testing/runtime/default-registry.ts +19 -0
- package/src/testing/runtime/index.ts +79 -0
- package/src/testing/runtime/mobile-step-executor.spec.ts +177 -0
- package/src/testing/runtime/step-executor.spec.ts +156 -0
- package/src/testing/runtime/step-executor.ts +315 -0
- package/src/testing/steps/mobile/actions.step.ts +176 -0
- package/src/testing/steps/mobile/app.step.ts +23 -0
- package/src/testing/steps/mobile/assertions.step.ts +59 -0
- package/src/testing/steps/mobile/gestures.step.ts +102 -0
- package/src/testing/steps/mobile/index.ts +12 -0
- package/src/testing/steps/mobile/mobile-steps.ios.spec.ts +364 -0
- package/src/testing/steps/mobile/mobile-steps.spec.ts +415 -0
- package/src/testing/steps/mobile/shared.ts +48 -0
- package/src/testing/steps/mobile/swipe-line.spec.ts +27 -0
- package/src/testing/steps/mobile/swipe-line.ts +30 -0
- package/src/testing/steps/ui/actions.step.ts +11 -8
- package/src/testing/steps/ui/aria-snapshot.step.ts +101 -0
- package/src/testing/steps/ui/assertions.step.ts +7 -9
- package/src/testing/steps/ui/form.step.ts +10 -10
- package/src/testing/steps/ui/index.ts +2 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { FakeClock, FakeDriver, FakeElement } from "../../adapters/mobile/fake-driver";
|
|
2
|
+
import { MobileAdapter } from "../../adapters/mobile/mobile-adapter";
|
|
3
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
4
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
5
|
+
import { StepRegistry } from "../../core/step-registry";
|
|
6
|
+
import type { MobileClock } from "../../adapters/mobile/mobile.types";
|
|
7
|
+
import { registerMobileSteps } from "./index";
|
|
8
|
+
|
|
9
|
+
const ALL_OPS = [
|
|
10
|
+
"mobile.launch",
|
|
11
|
+
"mobile.reset",
|
|
12
|
+
"mobile.terminate",
|
|
13
|
+
"mobile.tap",
|
|
14
|
+
"mobile.type",
|
|
15
|
+
"mobile.clear",
|
|
16
|
+
"mobile.swipe",
|
|
17
|
+
"mobile.scrollTo",
|
|
18
|
+
"mobile.back",
|
|
19
|
+
"mobile.hideKeyboard",
|
|
20
|
+
"mobile.submit",
|
|
21
|
+
"mobile.expectVisible",
|
|
22
|
+
"mobile.expectHidden",
|
|
23
|
+
"mobile.expectText",
|
|
24
|
+
"mobile.getText",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const save = { by: "accessibilityId", value: "Save" };
|
|
28
|
+
|
|
29
|
+
async function setup(started = true, clock: MobileClock = new FakeClock(), defaultTimeoutMs?: number) {
|
|
30
|
+
const driver = new FakeDriver();
|
|
31
|
+
const mobile = new MobileAdapter({
|
|
32
|
+
appiumUrl: "http://localhost:4723",
|
|
33
|
+
udid: "emulator-5554",
|
|
34
|
+
appSource: "installed",
|
|
35
|
+
appPackage: "com.acme.app",
|
|
36
|
+
appActivity: ".MainActivity",
|
|
37
|
+
recordVideo: false,
|
|
38
|
+
driverFactory: async () => driver,
|
|
39
|
+
clock,
|
|
40
|
+
defaultTimeoutMs,
|
|
41
|
+
});
|
|
42
|
+
if (started) await mobile.start();
|
|
43
|
+
const registry = new StepRegistry();
|
|
44
|
+
registerMobileSteps(registry);
|
|
45
|
+
const ctx = { scenarioId: "s1", scenarioType: "mobile", params: {}, mobile } as unknown as TestContext;
|
|
46
|
+
const run = (op: string, withArgs?: Record<string, unknown>, extra: Partial<OpStep> = {}) =>
|
|
47
|
+
registry.get(op)(ctx, { op, with: withArgs, ...extra });
|
|
48
|
+
return { driver, mobile, registry, ctx, run };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const executes = (driver: FakeDriver) => driver.callsTo("execute").map((call) => call.args);
|
|
52
|
+
|
|
53
|
+
describe("mobile steps", () => {
|
|
54
|
+
it("registers every op", async () => {
|
|
55
|
+
const { registry } = await setup();
|
|
56
|
+
for (const op of ALL_OPS) expect(registry.has(op)).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("every op needs a started mobile session", async () => {
|
|
60
|
+
const { run } = await setup(false);
|
|
61
|
+
for (const op of ALL_OPS) {
|
|
62
|
+
await expect(run(op, { locator: save, text: "x", equals: "x", direction: "up" })).rejects.toThrow(
|
|
63
|
+
`Missing mobile session on context for op "${op}"`,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe("app steps", () => {
|
|
69
|
+
it("launch restarts the app without clearing data", async () => {
|
|
70
|
+
const { run, driver } = await setup();
|
|
71
|
+
await run("mobile.launch");
|
|
72
|
+
expect(executes(driver).map((args) => args[0])).toEqual([
|
|
73
|
+
"mobile: terminateApp",
|
|
74
|
+
"mobile: activateApp",
|
|
75
|
+
"mobile: queryAppState",
|
|
76
|
+
]);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("launch with clearData wipes the app's data", async () => {
|
|
80
|
+
const { run, driver } = await setup();
|
|
81
|
+
await run("mobile.launch", { clearData: true });
|
|
82
|
+
expect(executes(driver).map((args) => args[0])).toContain("mobile: clearApp");
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("launch rejects a clearData that is not a boolean", async () => {
|
|
86
|
+
const { run } = await setup();
|
|
87
|
+
await expect(run("mobile.launch", { clearData: "yes" })).rejects.toThrow(
|
|
88
|
+
'"clearData" must be true or false for op "mobile.launch"',
|
|
89
|
+
);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("reset always clears data", async () => {
|
|
93
|
+
const { run, driver } = await setup();
|
|
94
|
+
await run("mobile.reset");
|
|
95
|
+
expect(executes(driver).map((args) => args[0])).toContain("mobile: clearApp");
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("terminate stops the app", async () => {
|
|
99
|
+
const { run, driver } = await setup();
|
|
100
|
+
await run("mobile.terminate");
|
|
101
|
+
expect(executes(driver)).toEqual([["mobile: terminateApp", { appId: "com.acme.app" }]]);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
describe("tap, type and clear", () => {
|
|
106
|
+
it("tap waits for the element and clicks it", async () => {
|
|
107
|
+
const { run, driver } = await setup();
|
|
108
|
+
const [button] = driver.add("~Save", new FakeElement());
|
|
109
|
+
await run("mobile.tap", { locator: save });
|
|
110
|
+
expect(button.displayChecks).toBe(1);
|
|
111
|
+
expect(button.calls).toContain("click");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("tap needs a locator", async () => {
|
|
115
|
+
const { run } = await setup();
|
|
116
|
+
await expect(run("mobile.tap", {})).rejects.toThrow('Missing "locator" in step.with for op "mobile.tap"');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("tap fails on an ambiguous locator", async () => {
|
|
120
|
+
const { run, driver } = await setup();
|
|
121
|
+
driver.add("~Save", new FakeElement(), new FakeElement());
|
|
122
|
+
await expect(run("mobile.tap", { locator: save })).rejects.toThrow("matched 2 elements");
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it("tap taps the match at index", async () => {
|
|
126
|
+
const { run, driver } = await setup();
|
|
127
|
+
const [, second] = driver.add("~Save", new FakeElement(), new FakeElement());
|
|
128
|
+
await run("mobile.tap", { locator: { ...save, index: 1 } });
|
|
129
|
+
expect(second.calls).toContain("click");
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("uses the step's timeout, from with.timeoutMs or step.timeoutMs", async () => {
|
|
133
|
+
const { run } = await setup();
|
|
134
|
+
await expect(run("mobile.tap", { locator: save, timeoutMs: 3000 })).rejects.toThrow("after 3000 ms");
|
|
135
|
+
await expect(run("mobile.tap", { locator: save }, { timeoutMs: 4000 })).rejects.toThrow("after 4000 ms");
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("type replaces the text by default", async () => {
|
|
139
|
+
const { run, driver } = await setup();
|
|
140
|
+
const [field] = driver.add("~Name", new FakeElement({ text: "old" }));
|
|
141
|
+
await run("mobile.type", { locator: { by: "accessibilityId", value: "Name" }, text: "bob" });
|
|
142
|
+
expect(field.calls).toContain("setValue:bob");
|
|
143
|
+
expect(field.text).toBe("bob");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("type appends with clear: false, and accepts a number", async () => {
|
|
147
|
+
const { run, driver } = await setup();
|
|
148
|
+
const [field] = driver.add("~Pin", new FakeElement({ text: "12" }));
|
|
149
|
+
await run("mobile.type", { locator: { by: "accessibilityId", value: "Pin" }, text: 34, clear: false });
|
|
150
|
+
expect(field.text).toBe("1234");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("type needs text", async () => {
|
|
154
|
+
const { run } = await setup();
|
|
155
|
+
await expect(run("mobile.type", { locator: save })).rejects.toThrow('Missing "text" in step.with for op "mobile.type"');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it("type rejects a clear that is not a boolean", async () => {
|
|
159
|
+
const { run } = await setup();
|
|
160
|
+
await expect(run("mobile.type", { locator: save, text: "x", clear: "no" })).rejects.toThrow(
|
|
161
|
+
'"clear" must be true or false for op "mobile.type"',
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("clear empties the field", async () => {
|
|
166
|
+
const { run, driver } = await setup();
|
|
167
|
+
const [field] = driver.add("~Name", new FakeElement({ text: "bob" }));
|
|
168
|
+
await run("mobile.clear", { locator: { by: "accessibilityId", value: "Name" } });
|
|
169
|
+
expect(field.text).toBe("");
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe("back and hideKeyboard", () => {
|
|
174
|
+
it("back presses back", async () => {
|
|
175
|
+
const { run, driver } = await setup();
|
|
176
|
+
await run("mobile.back");
|
|
177
|
+
expect(driver.callsTo("back")).toHaveLength(1);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("hideKeyboard hides it only when it is shown", async () => {
|
|
181
|
+
const { run, driver } = await setup();
|
|
182
|
+
await run("mobile.hideKeyboard");
|
|
183
|
+
expect(driver.callsTo("hideKeyboard")).toHaveLength(0);
|
|
184
|
+
driver.keyboardShown = true;
|
|
185
|
+
await run("mobile.hideKeyboard");
|
|
186
|
+
expect(driver.callsTo("hideKeyboard")).toHaveLength(1);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe("swipe", () => {
|
|
191
|
+
it("swipes across the screen, clear of the system bars, when there is no locator", async () => {
|
|
192
|
+
const { run, driver } = await setup();
|
|
193
|
+
await run("mobile.swipe", { direction: "up" });
|
|
194
|
+
expect(executes(driver)[0]).toEqual([
|
|
195
|
+
"mobile: swipeGesture",
|
|
196
|
+
{ left: 108, top: 240, width: 864, height: 1920, direction: "up", percent: 0.75 },
|
|
197
|
+
]);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("swipes inside an element when it has a locator, with a custom percent", async () => {
|
|
201
|
+
const { run, driver } = await setup();
|
|
202
|
+
driver.add("~List", new FakeElement({ location: { x: 10, y: 20 }, size: { width: 500, height: 800 } }));
|
|
203
|
+
await run("mobile.swipe", { direction: "left", percent: 0.5, locator: { by: "accessibilityId", value: "List" } });
|
|
204
|
+
expect(executes(driver)[0]).toEqual([
|
|
205
|
+
"mobile: swipeGesture",
|
|
206
|
+
{ left: 10, top: 20, width: 500, height: 800, direction: "left", percent: 0.5 },
|
|
207
|
+
]);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it.each([[undefined], ["sideways"], [3]])("rejects direction %p", async (direction) => {
|
|
211
|
+
const { run } = await setup();
|
|
212
|
+
await expect(run("mobile.swipe", { direction })).rejects.toThrow(
|
|
213
|
+
'"direction" must be one of up, down, left, right for op "mobile.swipe"',
|
|
214
|
+
);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it.each([[0], [1.5], ["half"]])("rejects percent %p", async (percent) => {
|
|
218
|
+
const { run } = await setup();
|
|
219
|
+
await expect(run("mobile.swipe", { direction: "up", percent })).rejects.toThrow(
|
|
220
|
+
'"percent" must be a number from 0.1 to 1 for op "mobile.swipe"',
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
describe("scrollTo", () => {
|
|
226
|
+
const target = { by: "accessibilityId", value: "Target" };
|
|
227
|
+
|
|
228
|
+
it("does not swipe when the element is already on screen", async () => {
|
|
229
|
+
const { run, driver } = await setup();
|
|
230
|
+
driver.add("~Target", new FakeElement());
|
|
231
|
+
await run("mobile.scrollTo", { locator: target });
|
|
232
|
+
expect(executes(driver)).toHaveLength(0);
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("swipes up to scroll down until the element appears", async () => {
|
|
236
|
+
const { run, driver } = await setup();
|
|
237
|
+
const original = driver.execute.bind(driver);
|
|
238
|
+
let swipes = 0;
|
|
239
|
+
driver.execute = async (script: string, ...args: unknown[]) => {
|
|
240
|
+
if (script === "mobile: swipeGesture") {
|
|
241
|
+
swipes += 1;
|
|
242
|
+
if (swipes === 2) driver.add("~Target", new FakeElement());
|
|
243
|
+
}
|
|
244
|
+
return original(script, ...args);
|
|
245
|
+
};
|
|
246
|
+
await run("mobile.scrollTo", { locator: target });
|
|
247
|
+
expect(swipes).toBe(2);
|
|
248
|
+
const swipeArgs = driver.callsTo("execute").filter((c) => c.args[0] === "mobile: swipeGesture");
|
|
249
|
+
expect((swipeArgs[0].args[1] as any).direction).toBe("up");
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("scrolls up by swiping down", async () => {
|
|
253
|
+
const { run, driver } = await setup();
|
|
254
|
+
await expect(run("mobile.scrollTo", { locator: target, direction: "up", maxSwipes: 1 })).rejects.toThrow();
|
|
255
|
+
const swipeArgs = driver.callsTo("execute").filter((c) => c.args[0] === "mobile: swipeGesture");
|
|
256
|
+
expect((swipeArgs[0].args[1] as any).direction).toBe("down");
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it("gives up after maxSwipes, naming the locator", async () => {
|
|
260
|
+
const { run, driver } = await setup();
|
|
261
|
+
await expect(run("mobile.scrollTo", { locator: target, maxSwipes: 3 })).rejects.toThrow(
|
|
262
|
+
'{ by: "accessibilityId", value: "Target" } not found after 3 swipes',
|
|
263
|
+
);
|
|
264
|
+
expect(executes(driver).filter((args) => args[0] === "mobile: swipeGesture")).toHaveLength(3);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it("does not keep scrolling when the locator is ambiguous", async () => {
|
|
268
|
+
const { run, driver } = await setup();
|
|
269
|
+
driver.add("~Target", new FakeElement(), new FakeElement());
|
|
270
|
+
await expect(run("mobile.scrollTo", { locator: target })).rejects.toThrow("matched 2 elements");
|
|
271
|
+
expect(executes(driver)).toHaveLength(0);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("validates its options", async () => {
|
|
275
|
+
const { run } = await setup();
|
|
276
|
+
await expect(run("mobile.scrollTo", { locator: target, direction: "left" })).rejects.toThrow(
|
|
277
|
+
'"direction" must be down or up for op "mobile.scrollTo"',
|
|
278
|
+
);
|
|
279
|
+
await expect(run("mobile.scrollTo", { locator: target, maxSwipes: 0 })).rejects.toThrow(
|
|
280
|
+
'"maxSwipes" must be a whole number >= 1 for op "mobile.scrollTo"',
|
|
281
|
+
);
|
|
282
|
+
await expect(run("mobile.scrollTo", {})).rejects.toThrow('Missing "locator" in step.with for op "mobile.scrollTo"');
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
describe("assertions", () => {
|
|
287
|
+
const title = { by: "accessibilityId", value: "Title" };
|
|
288
|
+
|
|
289
|
+
it("expectVisible passes for a displayed element and fails for a missing one", async () => {
|
|
290
|
+
const { run, driver } = await setup();
|
|
291
|
+
driver.add("~Title", new FakeElement());
|
|
292
|
+
await run("mobile.expectVisible", { locator: title });
|
|
293
|
+
await expect(run("mobile.expectVisible", { locator: { by: "accessibilityId", value: "Nope" }, timeoutMs: 2000 })).rejects.toThrow(
|
|
294
|
+
'No element matches { by: "accessibilityId", value: "Nope" } after 2000 ms',
|
|
295
|
+
);
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it("expectHidden passes when absent, and fails while visible", async () => {
|
|
299
|
+
const { run, driver } = await setup();
|
|
300
|
+
driver.add("~Title", new FakeElement());
|
|
301
|
+
await run("mobile.expectHidden", { locator: { by: "accessibilityId", value: "Gone" } });
|
|
302
|
+
await expect(run("mobile.expectHidden", { locator: title, timeoutMs: 1000 })).rejects.toThrow("is still visible after 1000 ms");
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it("getText returns the text", async () => {
|
|
306
|
+
const { run, driver } = await setup();
|
|
307
|
+
driver.add("~Title", new FakeElement({ text: "Hello" }));
|
|
308
|
+
expect(await run("mobile.getText", { locator: title })).toBe("Hello");
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe("expectText", () => {
|
|
312
|
+
it("equals", async () => {
|
|
313
|
+
const { run, driver } = await setup();
|
|
314
|
+
driver.add("~Title", new FakeElement({ text: "Hello" }));
|
|
315
|
+
expect(await run("mobile.expectText", { locator: title, equals: "Hello" })).toBe("Hello");
|
|
316
|
+
await expect(run("mobile.expectText", { locator: title, equals: "Bye" })).rejects.toThrow(
|
|
317
|
+
'Expected text of { by: "accessibilityId", value: "Title" } to equal "Bye", got "Hello"',
|
|
318
|
+
);
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("contains", async () => {
|
|
322
|
+
const { run, driver } = await setup();
|
|
323
|
+
driver.add("~Title", new FakeElement({ text: "Hello world" }));
|
|
324
|
+
await run("mobile.expectText", { locator: title, contains: "world" });
|
|
325
|
+
await expect(run("mobile.expectText", { locator: title, contains: "moon" })).rejects.toThrow(
|
|
326
|
+
'to contain "moon", got "Hello world"',
|
|
327
|
+
);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it("matches", async () => {
|
|
331
|
+
const { run, driver } = await setup();
|
|
332
|
+
driver.add("~Title", new FakeElement({ text: "Order 123" }));
|
|
333
|
+
await run("mobile.expectText", { locator: title, matches: "^Order \\d+$" });
|
|
334
|
+
await expect(run("mobile.expectText", { locator: title, matches: "^Cart" })).rejects.toThrow('to match "^Cart"');
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it("needs exactly one comparison", async () => {
|
|
338
|
+
const { run } = await setup();
|
|
339
|
+
const message = 'mobile.expectText needs exactly one of "equals", "contains", "matches"';
|
|
340
|
+
await expect(run("mobile.expectText", { locator: title })).rejects.toThrow(message);
|
|
341
|
+
await expect(run("mobile.expectText", { locator: title, equals: "a", contains: "b" })).rejects.toThrow(message);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it("rejects an invalid regular expression before touching the device", async () => {
|
|
345
|
+
const { run, driver } = await setup();
|
|
346
|
+
await expect(run("mobile.expectText", { locator: title, matches: "(" })).rejects.toThrow(
|
|
347
|
+
'"matches" is not a valid regular expression',
|
|
348
|
+
);
|
|
349
|
+
expect(driver.callsTo("$$")).toHaveLength(0);
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
describe("optional steps on a slow device", () => {
|
|
356
|
+
// Real time: the point is a device that answers later than the step keeps looking for.
|
|
357
|
+
const realClock: MobileClock = { now: () => Date.now(), sleep: (ms) => new Promise<void>((r) => setTimeout(r, ms)) };
|
|
358
|
+
const maybe = { by: "accessibilityId", value: "Maybe" };
|
|
359
|
+
|
|
360
|
+
it("skips an element that is not there even when the device is slower than the optional wait to say so", async () => {
|
|
361
|
+
const { run, driver } = await setup(true, realClock);
|
|
362
|
+
driver.lookupDelayMs = 400;
|
|
363
|
+
await expect(run("mobile.tap", { locator: maybe, optional: true, timeoutMs: 100 })).resolves.toEqual({ skipped: "optional-not-found" });
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it("taps an element a slow device reports late", async () => {
|
|
367
|
+
const { run, driver } = await setup(true, realClock);
|
|
368
|
+
const [element] = driver.add("~Maybe", new FakeElement());
|
|
369
|
+
driver.lookupDelayMs = 400;
|
|
370
|
+
await run("mobile.tap", { locator: maybe, optional: true, timeoutMs: 100 });
|
|
371
|
+
expect(element.calls).toContain("click");
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it("still fails when the device does not answer at all", async () => {
|
|
375
|
+
const { run, driver } = await setup(true, realClock, 300);
|
|
376
|
+
driver.lookupDelayMs = 1500;
|
|
377
|
+
await expect(run("mobile.tap", { locator: maybe, optional: true, timeoutMs: 100 })).rejects.toThrow("The device did not answer");
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
it("scrollTo takes a slow device's answer that the element is already on screen", async () => {
|
|
381
|
+
const { run, driver } = await setup(true, realClock);
|
|
382
|
+
driver.add("~Target", new FakeElement());
|
|
383
|
+
driver.lookupDelayMs = 1500; // slower than scrollTo's 1 s look per attempt
|
|
384
|
+
await run("mobile.scrollTo", { locator: { by: "accessibilityId", value: "Target" } });
|
|
385
|
+
expect(executes(driver)).toHaveLength(0);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
describe("mobile.submit on Android", () => {
|
|
390
|
+
it("performs the editor action the field asked for", async () => {
|
|
391
|
+
const { run, driver } = await setup();
|
|
392
|
+
await run("mobile.submit", { action: "search" });
|
|
393
|
+
expect(executes(driver)).toEqual([["mobile: performEditorAction", { action: "search" }]]);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it("performs 'done' when no action is named", async () => {
|
|
397
|
+
const { run, driver } = await setup();
|
|
398
|
+
await run("mobile.submit");
|
|
399
|
+
expect(executes(driver)).toEqual([["mobile: performEditorAction", { action: "done" }]]);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
it("presses the Enter key for a native field that listens for the key itself", async () => {
|
|
403
|
+
const { run, driver } = await setup();
|
|
404
|
+
await run("mobile.submit", { action: "enter" });
|
|
405
|
+
expect(executes(driver)).toEqual([["mobile: pressKey", { keycode: 66 }]]);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it("refuses an action it does not know", async () => {
|
|
409
|
+
const { run, driver } = await setup();
|
|
410
|
+
await expect(run("mobile.submit", { action: "bogus" })).rejects.toThrow(
|
|
411
|
+
'"action" must be one of search, go, send, done, next, enter for op "mobile.submit"',
|
|
412
|
+
);
|
|
413
|
+
expect(executes(driver)).toEqual([]);
|
|
414
|
+
});
|
|
415
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { MobileAdapter } from "../../adapters/mobile/mobile-adapter";
|
|
2
|
+
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
3
|
+
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
4
|
+
|
|
5
|
+
export function requireMobile(ctx: TestContext, op: string): MobileAdapter {
|
|
6
|
+
if (!ctx.mobile || !ctx.mobile.isStarted()) {
|
|
7
|
+
throw new Error(`Missing mobile session on context for op "${op}"`);
|
|
8
|
+
}
|
|
9
|
+
return ctx.mobile;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function requireLocator(step: OpStep, op: string): unknown {
|
|
13
|
+
const locator = step.with?.locator;
|
|
14
|
+
if (locator === undefined || locator === null) {
|
|
15
|
+
throw new Error(`Missing "locator" in step.with for op "${op}"`);
|
|
16
|
+
}
|
|
17
|
+
return locator;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** A step's own timeout: `with.timeoutMs` like the UI steps, else the step-level `timeoutMs`. */
|
|
21
|
+
export function stepTimeout(step: OpStep): number | undefined {
|
|
22
|
+
const value = step.with?.timeoutMs ?? step.timeoutMs;
|
|
23
|
+
return typeof value === "number" ? value : undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function optionalBoolean(step: OpStep, key: string, op: string): boolean | undefined {
|
|
27
|
+
const value = step.with?.[key];
|
|
28
|
+
if (value === undefined) return undefined;
|
|
29
|
+
if (typeof value !== "boolean") {
|
|
30
|
+
throw new Error(`"${key}" must be true or false for op "${op}"`);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* How long an optional step keeps re-checking after its element is not there, so a screen that is still drawing can settle.
|
|
37
|
+
* Each check may take as long as a step's timeout to answer.
|
|
38
|
+
*/
|
|
39
|
+
export const OPTIONAL_TIMEOUT_MS = 3000;
|
|
40
|
+
|
|
41
|
+
/** The step's element is missing or never shown, as opposed to the device not answering or a bad locator. */
|
|
42
|
+
export function isNotFound(error: unknown): boolean {
|
|
43
|
+
const message = String((error as Error)?.message ?? error);
|
|
44
|
+
return message.includes("No element matches") || message.includes("is not displayed after");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** What an optional step returns when its element was not there. */
|
|
48
|
+
export const OPTIONAL_SKIPPED = { skipped: "optional-not-found" } as const;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { swipeLine } from "./swipe-line";
|
|
2
|
+
|
|
3
|
+
const area = { left: 100, top: 200, width: 400, height: 800 }; // centre (300, 600)
|
|
4
|
+
|
|
5
|
+
describe("swipeLine", () => {
|
|
6
|
+
it("up: the finger moves from the bottom to the top", () => {
|
|
7
|
+
expect(swipeLine(area, "up", 0.5)).toEqual({ fromX: 300, fromY: 800, toX: 300, toY: 400 });
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("down: the finger moves from the top to the bottom", () => {
|
|
11
|
+
expect(swipeLine(area, "down", 0.5)).toEqual({ fromX: 300, fromY: 400, toX: 300, toY: 800 });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("left and right use the width", () => {
|
|
15
|
+
expect(swipeLine(area, "left", 0.5)).toEqual({ fromX: 400, fromY: 600, toX: 200, toY: 600 });
|
|
16
|
+
expect(swipeLine(area, "right", 0.5)).toEqual({ fromX: 200, fromY: 600, toX: 400, toY: 600 });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("percent 1 covers the whole area", () => {
|
|
20
|
+
expect(swipeLine(area, "up", 1)).toEqual({ fromX: 300, fromY: 1000, toX: 300, toY: 200 });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("rounds to whole points", () => {
|
|
24
|
+
const line = swipeLine({ left: 0, top: 0, width: 101, height: 301 }, "up", 0.75);
|
|
25
|
+
for (const value of Object.values(line)) expect(Number.isInteger(value)).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface Area {
|
|
2
|
+
left: number;
|
|
3
|
+
top: number;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type SwipeDirection = "up" | "down" | "left" | "right";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The finger's path for a swipe inside `area`: a line through its centre, `percent` of its height (up and down) or width
|
|
12
|
+
* (left and right) long. The direction is where the finger moves, so "up" starts at the bottom, as on Android's
|
|
13
|
+
* `mobile: swipeGesture`. iOS has no swipe-in-an-area command, so the path is dragged instead.
|
|
14
|
+
*/
|
|
15
|
+
export function swipeLine(area: Area, direction: SwipeDirection, percent: number) {
|
|
16
|
+
const cx = area.left + area.width / 2;
|
|
17
|
+
const cy = area.top + area.height / 2;
|
|
18
|
+
const half = ((direction === "up" || direction === "down" ? area.height : area.width) * percent) / 2;
|
|
19
|
+
const round = (n: number) => Math.round(n);
|
|
20
|
+
switch (direction) {
|
|
21
|
+
case "up":
|
|
22
|
+
return { fromX: round(cx), fromY: round(cy + half), toX: round(cx), toY: round(cy - half) };
|
|
23
|
+
case "down":
|
|
24
|
+
return { fromX: round(cx), fromY: round(cy - half), toX: round(cx), toY: round(cy + half) };
|
|
25
|
+
case "left":
|
|
26
|
+
return { fromX: round(cx + half), fromY: round(cy), toX: round(cx - half), toY: round(cy) };
|
|
27
|
+
case "right":
|
|
28
|
+
return { fromX: round(cx - half), fromY: round(cy), toX: round(cx + half), toY: round(cy) };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { TestContext } from "../../contracts/runtime-context.types";
|
|
2
2
|
import type { OpStep } from "../../contracts/testing-metadata.types";
|
|
3
3
|
import { StepRegistry } from "../../core/step-registry";
|
|
4
|
+
import { resolveTarget, type TargetInput } from "../../adapters/ui/resolve-target";
|
|
4
5
|
|
|
5
|
-
type ClickInput =
|
|
6
|
-
type PressInput =
|
|
7
|
-
type TypeInput =
|
|
6
|
+
type ClickInput = TargetInput & { optional?: boolean; force?: boolean; js?: boolean };
|
|
7
|
+
type PressInput = TargetInput & { key: string };
|
|
8
|
+
type TypeInput = TargetInput & { value: string; delayMs?: number; clear?: boolean };
|
|
8
9
|
|
|
9
10
|
function requirePage(ctx: TestContext, op: string) {
|
|
10
11
|
if (!ctx.ui || !ctx.ui.page) {
|
|
@@ -24,22 +25,23 @@ export function registerActionSteps(registry: StepRegistry): void {
|
|
|
24
25
|
// intermittent popup): if the element never appears/clicks in time, swallow
|
|
25
26
|
// the error instead of failing the scenario.
|
|
26
27
|
try {
|
|
28
|
+
const selector = await resolveTarget(ctx, step, input);
|
|
27
29
|
// `js: true` invokes the element's native .click() in page context — the last
|
|
28
30
|
// resort for a button a real click can't reach (e.g. a fixed drawer rendered
|
|
29
31
|
// outside the viewport in headless). Waits for it to be attached first.
|
|
30
32
|
if (input.js) {
|
|
31
|
-
const loc = page.locator(
|
|
33
|
+
const loc = page.locator(selector).first();
|
|
32
34
|
await loc.waitFor({ state: "attached", timeout: ctx.ui?.resolveTimeout(input.timeoutMs) });
|
|
33
35
|
await loc.evaluate((el: any) => el.click());
|
|
34
36
|
} else if (input.force) {
|
|
35
37
|
// `force: true` bypasses actionability checks (e.g. an overlay intercepting
|
|
36
38
|
// pointer events on a drawer/sheet button). Playwright's force still refuses
|
|
37
39
|
// to click an element outside the viewport, so scroll it into view first.
|
|
38
|
-
const loc = page.locator(
|
|
40
|
+
const loc = page.locator(selector).first();
|
|
39
41
|
await loc.scrollIntoViewIfNeeded({ timeout: ctx.ui?.resolveTimeout(input.timeoutMs) });
|
|
40
42
|
await loc.click({ timeout: ctx.ui?.resolveTimeout(input.timeoutMs), force: true });
|
|
41
43
|
} else {
|
|
42
|
-
await page.click(
|
|
44
|
+
await page.click(selector, {
|
|
43
45
|
timeout: ctx.ui?.resolveTimeout(input.timeoutMs),
|
|
44
46
|
});
|
|
45
47
|
}
|
|
@@ -57,7 +59,8 @@ export function registerActionSteps(registry: StepRegistry): void {
|
|
|
57
59
|
if (!input.key) {
|
|
58
60
|
throw new Error('Missing "key" in step.with for op "ui.press"');
|
|
59
61
|
}
|
|
60
|
-
await
|
|
62
|
+
const selector = await resolveTarget(ctx, step, input);
|
|
63
|
+
await page.press(selector, input.key, {
|
|
61
64
|
timeout: ctx.ui?.resolveTimeout(input.timeoutMs),
|
|
62
65
|
});
|
|
63
66
|
});
|
|
@@ -76,7 +79,7 @@ export function registerActionSteps(registry: StepRegistry): void {
|
|
|
76
79
|
throw new Error('Missing "value" in step.with for op "ui.type"');
|
|
77
80
|
}
|
|
78
81
|
const timeout = ctx.ui?.resolveTimeout(input.timeoutMs);
|
|
79
|
-
const locator = page.locator(input
|
|
82
|
+
const locator = page.locator(await resolveTarget(ctx, step, input));
|
|
80
83
|
if (input.clear !== false) {
|
|
81
84
|
await locator.fill("", { timeout });
|
|
82
85
|
}
|