@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
|
@@ -320,13 +320,15 @@ export class ViewMetadataService extends CRUDService<ViewMetadata> {
|
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
// 6. We are resolving the create & edit actions if specified in the layout.
|
|
323
|
+
const actionUserKey = (action: string | { name?: string }): string | undefined =>
|
|
324
|
+
typeof action === 'string' ? action : action?.name;
|
|
323
325
|
if (entity?.layout?.attrs?.createAction) {
|
|
324
|
-
const actionName
|
|
325
|
-
entity.layout.attrs.createAction = await this.actionMetadataService.findOneByUserKey(actionName)
|
|
326
|
+
const actionName = actionUserKey(entity.layout.attrs.createAction);
|
|
327
|
+
entity.layout.attrs.createAction = actionName ? await this.actionMetadataService.findOneByUserKey(actionName) : null;
|
|
326
328
|
}
|
|
327
329
|
if (entity?.layout?.attrs?.editAction) {
|
|
328
|
-
const actionName
|
|
329
|
-
entity.layout.attrs.editAction = await this.actionMetadataService.findOneByUserKey(actionName)
|
|
330
|
+
const actionName = actionUserKey(entity.layout.attrs.editAction);
|
|
331
|
+
entity.layout.attrs.editAction = actionName ? await this.actionMetadataService.findOneByUserKey(actionName) : null;
|
|
330
332
|
}
|
|
331
333
|
|
|
332
334
|
// 7. For form views we need to fetch the workflow field metadata if specified.
|
package/src/testing/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Folder Structure
|
|
4
4
|
- `contracts/`: metadata + runtime context types
|
|
5
5
|
- `core/`: engine, registry, interpolation, utilities
|
|
6
|
-
- `adapters/`: API (axios)
|
|
6
|
+
- `adapters/`: API (axios), UI (Playwright) and mobile (Appium) adapters
|
|
7
7
|
- `steps/`: step implementations grouped by domain
|
|
8
8
|
- `reporter/`: reporting interfaces + console reporter
|
|
9
9
|
- `runner/`: lifecycle helpers + metadata runner
|
|
@@ -23,6 +23,53 @@ the binary is fetched separately.
|
|
|
23
23
|
installs as `root` but runs as another user must set `PLAYWRIGHT_BROWSERS_PATH` to a shared
|
|
24
24
|
location, or the runtime user will not find the binary.
|
|
25
25
|
|
|
26
|
+
## Mobile Setup
|
|
27
|
+
Mobile scenarios (`"type": "mobile"`, ops `mobile.*`) drive an Android emulator or phone through an
|
|
28
|
+
[Appium](https://appium.io) server. They are optional: nothing here is needed unless you run one.
|
|
29
|
+
|
|
30
|
+
- **Appium 3** with the **UiAutomator2** driver (`appium driver install uiautomator2`), started on the
|
|
31
|
+
machine the device is attached to (`appium --port 4723`).
|
|
32
|
+
- **Android SDK** with `platform-tools`, `emulator` and **`build-tools`**. Appium needs the build-tools'
|
|
33
|
+
`aapt2` to install an uploaded APK; its own doctor does not report this. Restart Appium after
|
|
34
|
+
installing SDK packages, because it caches where the tools are.
|
|
35
|
+
- **`webdriverio`** installed in the app that runs the tests (`npm i webdriverio@^10.0.1`). It is an
|
|
36
|
+
optional peer dependency of this package, loaded only when a mobile scenario starts. Its current
|
|
37
|
+
release declares Node 22.19 or newer.
|
|
38
|
+
- **A device.** Every run names its device (`udid` from `adb devices`). Core never lets Appium pick one,
|
|
39
|
+
and does not boot emulators: the caller (Test Hub) does that and passes the device serial.
|
|
40
|
+
|
|
41
|
+
A run needs `RunnerOptions.mobile`, or the `mobile` block of `POST /test-runs`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mobile": {
|
|
46
|
+
"appiumUrl": "http://localhost:4723",
|
|
47
|
+
"udid": "emulator-5554",
|
|
48
|
+
"appSource": "installed",
|
|
49
|
+
"appPackage": "com.acme.app",
|
|
50
|
+
"appActivity": ".MainActivity"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `appSource: "upload"` installs the APK at `appPath` (an absolute path on the Appium machine) and clears
|
|
56
|
+
the app's data at session start. `"installed"` opens an app that is already on the device and keeps its
|
|
57
|
+
data, restarting it so each session starts on its home screen.
|
|
58
|
+
- Timeouts follow the UI adapter: `defaultTimeoutMs` (element waits, default 30 s) and
|
|
59
|
+
`navigationTimeoutMs` (app launch). A step's own `timeoutMs` overrides both.
|
|
60
|
+
- All mobile scenarios in a run share one device session, in file order.
|
|
61
|
+
- The whole run is recorded, but the video (`run.mp4`) is only kept when the run fails. Android records 180 s per
|
|
62
|
+
file, so a long run is recorded in chunks. Install `ffmpeg` on the Appium machine to get them merged; without it
|
|
63
|
+
you get the most recent chunk (up to 3 minutes), which is the part leading up to the failure. A failed scenario
|
|
64
|
+
also gets the device log (`console.json`). A screenshot (`screenshot.png`) is only attached when the run's
|
|
65
|
+
`capture.screenshotOnFailure` is on, because it is a binary upload. The device log is filtered
|
|
66
|
+
to what is useful: warnings and errors from anything, the app's own lines, and the React Native, crash and
|
|
67
|
+
WebView tags. Each entry's `type` is read from the Android priority in the log line; the newest 500 are kept.
|
|
68
|
+
|
|
69
|
+
**Start every mobile scenario with `mobile.launch` and `"clearData": true`.** An app remembers things
|
|
70
|
+
between scenarios (who is logged in, the cart), so one scenario can break the next. Leave `clearData` out
|
|
71
|
+
only when a scenario deliberately relies on state prepared outside the test.
|
|
72
|
+
|
|
26
73
|
## Metadata Shape
|
|
27
74
|
`TestingMetadata` lives under `testing` in module metadata JSON files.
|
|
28
75
|
|
|
@@ -514,6 +561,156 @@ Options in `with`:
|
|
|
514
561
|
- `contains` (optional)
|
|
515
562
|
- `timeoutMs` (optional, overrides the run-wide UI timeout)
|
|
516
563
|
|
|
564
|
+
### **Mobile ops (`mobile.*`)**
|
|
565
|
+
Every op that takes a `locator` waits for the element to be displayed first. `with.timeoutMs` (or the
|
|
566
|
+
step's `timeoutMs`) overrides the wait. `locator` is an object:
|
|
567
|
+
|
|
568
|
+
```json
|
|
569
|
+
{ "by": "accessibilityId", "value": "Login button" }
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
| `by` | Finds | Notes |
|
|
573
|
+
|---|---|---|
|
|
574
|
+
| `accessibilityId` | Android `content-desc`; React Native `accessibilityLabel` / `testID` | Preferred when unique |
|
|
575
|
+
| `id` | Resource id | A bare id gets the app package prefixed (`edit` becomes `<package>:id/edit`). React Native apps have none. |
|
|
576
|
+
| `text` / `textContains` | Visible text | Exact / partial |
|
|
577
|
+
| `description` | `content-desc` through UiSelector | |
|
|
578
|
+
| `uiautomator` | A raw `new UiSelector()...` expression | Escape hatch |
|
|
579
|
+
| `xpath` | An XPath | Last resort; slower and fragile |
|
|
580
|
+
|
|
581
|
+
Add `"index": 1` (0-based) to pick one match. A locator that matches more than one element **fails the
|
|
582
|
+
step** unless it has an `index`. An `"android": { "by": ..., "value": ... }` block replaces `by`/`value`
|
|
583
|
+
on Android, and `"ios"` does the same on iOS.
|
|
584
|
+
|
|
585
|
+
A step waits by looking for the element about every half second and goes on as soon as it is there, so
|
|
586
|
+
`timeoutMs` is the longest it will wait, not how long it waits. Each lookup is also held to the step's
|
|
587
|
+
timeout: if the device does not answer a lookup in time (a busy phone can leave one unanswered for tens of
|
|
588
|
+
seconds), the step fails with "The device did not answer while looking for ..." rather than running past
|
|
589
|
+
its timeout. On Android the runner sets `appium:settings[waitForIdleTimeout]` to 500 ms; give a device a
|
|
590
|
+
different value with `extraCapabilities` (Test Hub's "Default Appium capabilities" setting does this for
|
|
591
|
+
every run).
|
|
592
|
+
|
|
593
|
+
| Op | `with` | Does |
|
|
594
|
+
|---|---|---|
|
|
595
|
+
| `mobile.launch` | `clearData` (optional, default false), `grantPermissions` (optional, default true) | Stops the app, optionally wipes its data, starts it. Android clears an installed app in place. iOS has no "clear data": it removes the app and installs the uploaded build again (the Simulator's `.app`, an iPhone's `.ipa`), so `clearData` fails on an iOS device that has no build (see "The reset scenario") |
|
|
596
|
+
| `mobile.reset` | – | `mobile.launch` with `clearData: true` |
|
|
597
|
+
| `mobile.terminate` | – | Stops the app |
|
|
598
|
+
| `mobile.tap` | `locator`, `optional` (optional) | Taps the element |
|
|
599
|
+
| `mobile.type` | `locator`, `text`, `clear` (default true), `optional` (optional) | Sets the text; `clear: false` appends |
|
|
600
|
+
| `mobile.clear` | `locator` | Clears the field |
|
|
601
|
+
| `mobile.swipe` | `direction` (up/down/left/right), `percent` (0.1 to 1, default 0.75), `locator` (optional) | Swipes on the element, or the screen |
|
|
602
|
+
| `mobile.scrollTo` | `locator`, `direction` (down/up, default down), `maxSwipes` (default 10) | Swipes until the element shows |
|
|
603
|
+
| `mobile.back` | `optional` (optional) | Presses Back |
|
|
604
|
+
| `mobile.hideKeyboard` | `method` (iPhone only, recorded by authoring: `driver`, `doneKey`, `tapOutside`, `swipeDown`) | Hides the keyboard if it is shown. On a real iPhone iOS has no hide action, so the keyboard's own Done key, a tap on a spot that is on no control, and a swipe down are tried in turn; the step passes with the first that works and fails when none does. The recorded `method` is tried first on a run |
|
|
605
|
+
| `mobile.submit` | `action` (optional: `search`, `go`, `send`, `done`, `next`, `enter`) | Presses the keyboard's action key on the field that has focus, e.g. to run a search. Typing `\n` does not submit, because the field takes it as a character. Android performs the editor action (`done` when none is named; `enter` presses the Enter key); iOS taps the keyboard's own key. No locator, never heals |
|
|
606
|
+
| `mobile.expectVisible` | `locator` | Passes when the element is displayed in time |
|
|
607
|
+
| `mobile.expectHidden` | `locator` | Passes when no match is displayed in time |
|
|
608
|
+
| `mobile.expectText` | `locator` and exactly one of `equals`, `contains`, `matches` (a regex) | Compares the element's text; returns it |
|
|
609
|
+
| `mobile.getText` | `locator` | Returns the element's text (use `saveAs`) |
|
|
610
|
+
|
|
611
|
+
`api.*`, `assert.*`, `util.*` and `test.spec` ops can be mixed in, for example to check the backend after a
|
|
612
|
+
tap. `ui.*` ops cannot be used in a mobile scenario.
|
|
613
|
+
|
|
614
|
+
#### Optional steps
|
|
615
|
+
`mobile.tap`, `mobile.type` and `mobile.back` accept `"optional": true`. The step looks for its element for
|
|
616
|
+
`timeoutMs` (default 3 seconds) and, if it is not there, passes without doing anything. That time is how long it
|
|
617
|
+
keeps re-checking, so a screen that is still drawing can settle; each individual check may take as long as an ordinary
|
|
618
|
+
step's wait (`defaultTimeoutMs`, 30 s) to answer, so a slow phone's late "not there" still skips the step. An optional
|
|
619
|
+
step only passes over a missing element: any other failure still fails it, and it never heals. It is meant for a reset,
|
|
620
|
+
which has to work from any state (a "Log out" button only exists when someone is logged in).
|
|
621
|
+
|
|
622
|
+
#### Healing: `fallbacks` and `fingerprint`
|
|
623
|
+
A step with a `locator` can carry other ways to find the same element, written when the scenario was authored:
|
|
624
|
+
|
|
625
|
+
```json
|
|
626
|
+
{ "op": "mobile.tap", "with": {
|
|
627
|
+
"locator": { "by": "accessibilityId", "value": "Save" },
|
|
628
|
+
"fallbacks": [{ "by": "text", "value": "Save" }],
|
|
629
|
+
"fingerprint": { "kind": "Button", "accessibilityId": "save-button", "label": "Save" }
|
|
630
|
+
} }
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
If the locator matches nothing within 2.5 seconds, the runner tries each fallback, then the fingerprint
|
|
634
|
+
(`accessibilityId`, `resourceId`, `text`, `label`, in that order). The first one that matches **exactly one
|
|
635
|
+
displayed element** is used, the step carries on, and the heal is reported on `scenario.end` with the locator
|
|
636
|
+
it replaced (`from`), the one that worked (`to`), and which locator that was in `field`: `locator`, or
|
|
637
|
+
`locator.android` / `locator.ios` when the run used that platform's override. The run's `healing` setting
|
|
638
|
+
controls it: `off` uses the locator only, `report` (the default) heals and reports, `auto` is `report` plus
|
|
639
|
+
permission to write the heal back to the scenario file.
|
|
640
|
+
|
|
641
|
+
`tap`, `type`, `clear`, `getText`, `expectVisible`, `expectText` and `swipe` on an element heal.
|
|
642
|
+
`expectHidden` does not (swapping a locator that should match nothing would hide a regression), and neither
|
|
643
|
+
does `scrollTo`.
|
|
644
|
+
|
|
645
|
+
#### Sessions and the reset scenario
|
|
646
|
+
A mobile run shares one device session, so by default each scenario carries on in the app as the last one left
|
|
647
|
+
it. The scenario fields `dependsOn`, `saveSession` and `session` work for mobile too; what they mean here is
|
|
648
|
+
about the app, not a browser:
|
|
649
|
+
|
|
650
|
+
- `"session": "shared"` (default): carry on in the app as it is.
|
|
651
|
+
- `"session": "fresh"`: start from scratch. On a device that can clear an app's data, the runner launches the
|
|
652
|
+
app with its data cleared. On an iOS device with no build to reinstall it relaunches the app and runs the file's
|
|
653
|
+
reset scenario.
|
|
654
|
+
- `"session": "restore"`: start logged in as the scenario it depends on left the app. If that scenario
|
|
655
|
+
(`saveSession: true`) has just passed and nothing has touched the app since, the app is only relaunched.
|
|
656
|
+
Otherwise, when the app was last brought to that scenario's state, it is relaunched and the scenario's last
|
|
657
|
+
`mobile.expectVisible` is looked for (up to 5 seconds): found, the scenario carries on and the login is not
|
|
658
|
+
run again; not found (something logged out, or the app crashed), or when that scenario ends on no check, the
|
|
659
|
+
app starts from scratch and that scenario's steps run again (and, for a scenario that was itself restored,
|
|
660
|
+
the ones before it). End a login scenario on a check of the logged-in screen to let restores skip it.
|
|
661
|
+
|
|
662
|
+
**`restoreFrom`: the short way to write a restore.** `"restoreFrom": "login"` on a scenario means three things at once:
|
|
663
|
+
`login` runs before it (it is a dependency, pulled in even when a tag filter leaves it out), `login`'s state is saved (it
|
|
664
|
+
needs no `saveSession`), and the scenario starts from it (`"session": "restore"`, which it must not contradict). It
|
|
665
|
+
takes one scenario id. `dependsOn` is then only for ordering and data (`create-product`), and the two can be combined:
|
|
666
|
+
`{ "id": "edit-product", "restoreFrom": "login-admin", "dependsOn": ["create-product"] }`. Only client state is
|
|
667
|
+
restored (cookies and storage on the web, the signed-in app on mobile), never the page or screen: the scenario's own
|
|
668
|
+
first steps get there. It also settles which login is meant when two are reachable, which the older
|
|
669
|
+
`dependsOn` + `"session": "restore"` form decides by list order. The older form still works. A missing source, the
|
|
670
|
+
scenario itself, the reset scenario, or a `session` other than `"restore"` fails the run before anything starts.
|
|
671
|
+
|
|
672
|
+
These steps run as setup inside the scenario that needs them. They are reported with the step event's `setup`
|
|
673
|
+
field (`"reset"` or `"restore"`) and keep the id and `steps[n]` paths of the scenario they come from.
|
|
674
|
+
|
|
675
|
+
**The reset scenario.** An iOS device with no build to reinstall (an iPhone without an uploaded `.ipa`, or a Simulator
|
|
676
|
+
with only an installed app) cannot clear an app's data, so the file declares one scenario with `"reset": true`
|
|
677
|
+
that brings the app back to its signed-out start screen from any state. A scenario whose first step is
|
|
678
|
+
`mobile.launch` with `clearData` (or `mobile.reset`) then starts through it, and that first step only relaunches the
|
|
679
|
+
app. A run on such a device ends before it starts, naming the scenarios, when the file has no reset scenario, or when
|
|
680
|
+
a scenario clears the data partway through. With a build to reinstall none of this applies. It is never run
|
|
681
|
+
as a scenario of its own, selected, or counted; it cannot use `dependsOn`, `restoreFrom`, `saveSession` or `session`, and no
|
|
682
|
+
scenario can depend on or restore from it. Use `optional` steps for what only applies in some states:
|
|
683
|
+
|
|
684
|
+
```json
|
|
685
|
+
{ "id": "reset-app", "type": "mobile", "reset": true, "steps": [
|
|
686
|
+
{ "given": { "op": "mobile.launch" } },
|
|
687
|
+
{ "and": { "op": "mobile.tap", "with": { "locator": { "by": "accessibilityId", "value": "open menu" }, "optional": true } } },
|
|
688
|
+
{ "and": { "op": "mobile.tap", "with": { "locator": { "by": "accessibilityId", "value": "menu item log out" }, "optional": true } } },
|
|
689
|
+
{ "then": { "op": "mobile.expectVisible", "with": { "locator": { "by": "accessibilityId", "value": "login screen" } } } }
|
|
690
|
+
] }
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
If a scenario asks for a fresh start on an iPhone and the file has no reset scenario, it fails and says what to
|
|
694
|
+
add. If a reset step fails, the scenario fails with `Setup "reset" (scenario "<id>") failed at <path>: ...`.
|
|
695
|
+
|
|
696
|
+
Example:
|
|
697
|
+
```json
|
|
698
|
+
{
|
|
699
|
+
"id": "rn-login-happy-path",
|
|
700
|
+
"type": "mobile",
|
|
701
|
+
"steps": [
|
|
702
|
+
{ "given": { "op": "mobile.launch", "with": { "clearData": true } } },
|
|
703
|
+
{ "when": { "op": "mobile.tap", "with": { "locator": { "by": "accessibilityId", "value": "open menu" } } } },
|
|
704
|
+
{ "and": { "op": "mobile.tap", "with": { "locator": { "by": "accessibilityId", "value": "menu item log in" } } } },
|
|
705
|
+
{ "and": { "op": "mobile.type", "with": { "locator": { "by": "accessibilityId", "value": "Username input field" }, "text": "bob@example.com" } } },
|
|
706
|
+
{ "and": { "op": "mobile.type", "with": { "locator": { "by": "accessibilityId", "value": "Password input field" }, "text": "${secret:RN_DEMO_PASSWORD}" } } },
|
|
707
|
+
{ "and": { "op": "mobile.hideKeyboard" } },
|
|
708
|
+
{ "and": { "op": "mobile.tap", "with": { "locator": { "by": "accessibilityId", "value": "Login button" } } } },
|
|
709
|
+
{ "then": { "op": "mobile.expectVisible", "with": { "locator": { "by": "accessibilityId", "value": "products screen" } } } }
|
|
710
|
+
]
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
517
714
|
### **Op: `assert.equals`**
|
|
518
715
|
Description: Asserts strict equality between two values.
|
|
519
716
|
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
// Opt-in integration checks: they drive a real Android emulator or phone through Appium.
|
|
2
|
+
//
|
|
3
|
+
// This is a plain script, not a Jest spec. WebdriverIO's network layer does not survive Jest's sandbox
|
|
4
|
+
// (it crashes the process), and plain Node is what a real run uses anyway.
|
|
5
|
+
//
|
|
6
|
+
// Needs, all running: Appium on MOBILE_IT_APPIUM, a device on MOBILE_IT_UDID, and `webdriverio` that Node can
|
|
7
|
+
// resolve. It is only an optional peer of this package, so point NODE_PATH at a folder that has it.
|
|
8
|
+
//
|
|
9
|
+
// NODE_PATH=/path/to/node_modules npm run test:mobile
|
|
10
|
+
//
|
|
11
|
+
// MOBILE_IT_LONG=1 also runs the four-minute recording check. Exit code is 1 if any check fails.
|
|
12
|
+
//
|
|
13
|
+
// iOS Simulator instead of Android: boot a simulator and start Appium, then
|
|
14
|
+
//
|
|
15
|
+
// MOBILE_IT_PLATFORM=ios MOBILE_IT_UDID=<simulator udid> NODE_PATH=/path/to/node_modules npm run test:mobile
|
|
16
|
+
//
|
|
17
|
+
// It installs the small sample app from the iOS spike (MOBILE_IT_IOS_APP, default
|
|
18
|
+
// test-hub/spikes/mobile-ios/sample-app/out/SampleApp.app, built by its build.sh). WebDriverAgent is cached in
|
|
19
|
+
// MOBILE_IT_WDA (default ~/.solidx/wda/xcode-27.0); the first run builds it, which takes minutes.
|
|
20
|
+
//
|
|
21
|
+
// A real iPhone instead, with the demo app already installed on it (from Xcode, TestFlight or the App Store). Plug the
|
|
22
|
+
// phone into this Mac with a USB cable, unlock it, start Appium, then
|
|
23
|
+
//
|
|
24
|
+
// MOBILE_IT_PLATFORM=ios-device MOBILE_IT_UDID=<phone udid> MOBILE_IT_IOS_TEAM=<10-character team id> \
|
|
25
|
+
// NODE_PATH=/path/to/node_modules npm run test:mobile
|
|
26
|
+
//
|
|
27
|
+
// The phone's UDID is in `xcrun devicectl list devices`; the team id is the OU of the "Apple Development" certificate.
|
|
28
|
+
// MOBILE_IT_IOS_BUNDLE (default com.oswald.mydemoapp) is the installed app's bundle id and MOBILE_IT_IOS_PROCESS (default
|
|
29
|
+
// "My Demo App") its executable, which names its lines in the device log. WebDriverAgent is built and signed for the
|
|
30
|
+
// phone into MOBILE_IT_WDA (default ~/.solidx/wda/xcode-27.0-iphoneos-<team>): the first run takes minutes, and the
|
|
31
|
+
// Mac's keychain asks for its password (answer Always Allow).
|
|
32
|
+
import * as assert from "node:assert/strict";
|
|
33
|
+
import * as fs from "node:fs";
|
|
34
|
+
import * as os from "node:os";
|
|
35
|
+
import * as path from "node:path";
|
|
36
|
+
import type { MobileAdapterOptions } from "../adapters/mobile/mobile.types";
|
|
37
|
+
import type { ScenarioSpec } from "../contracts/testing-metadata.types";
|
|
38
|
+
import { RecordingReporter } from "../runner/recording-reporter";
|
|
39
|
+
import { runFromMetadata } from "../runner/run-from-metadata";
|
|
40
|
+
|
|
41
|
+
const APPIUM = process.env.MOBILE_IT_APPIUM ?? "http://localhost:4723";
|
|
42
|
+
const UDID = process.env.MOBILE_IT_UDID ?? "emulator-5554";
|
|
43
|
+
const APPS_DIR =
|
|
44
|
+
process.env.MOBILE_IT_APPS_DIR ?? "/Users/oswald/projects/Solid_Starters/test-hub/spikes/mobile-appium/apps";
|
|
45
|
+
|
|
46
|
+
const IOS = process.env.MOBILE_IT_PLATFORM === "ios";
|
|
47
|
+
const IOS_DEVICE = process.env.MOBILE_IT_PLATFORM === "ios-device";
|
|
48
|
+
const IOS_APP =
|
|
49
|
+
process.env.MOBILE_IT_IOS_APP ??
|
|
50
|
+
path.join(APPS_DIR, "..", "..", "mobile-ios", "sample-app", "out", "SampleApp.app");
|
|
51
|
+
const WDA_DIR = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), ".solidx", "wda", "xcode-27.0");
|
|
52
|
+
|
|
53
|
+
const apiDemos: MobileAdapterOptions = {
|
|
54
|
+
appiumUrl: APPIUM,
|
|
55
|
+
udid: UDID,
|
|
56
|
+
appSource: "upload",
|
|
57
|
+
appPath: path.join(APPS_DIR, "ApiDemos-debug.apk"),
|
|
58
|
+
appPackage: "io.appium.android.apis",
|
|
59
|
+
capture: { console: true },
|
|
60
|
+
};
|
|
61
|
+
const rnDemo: MobileAdapterOptions = {
|
|
62
|
+
appiumUrl: APPIUM,
|
|
63
|
+
udid: UDID,
|
|
64
|
+
appSource: "installed",
|
|
65
|
+
appPackage: "com.saucelabs.mydemoapp.rn",
|
|
66
|
+
appActivity: ".MainActivity",
|
|
67
|
+
capture: { console: true },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const acc = (value: string) => ({ by: "accessibilityId", value });
|
|
71
|
+
|
|
72
|
+
const apiDemosFlow: ScenarioSpec = {
|
|
73
|
+
id: "apidemos-controls",
|
|
74
|
+
type: "mobile",
|
|
75
|
+
steps: [
|
|
76
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
77
|
+
{ when: { op: "mobile.tap", with: { locator: acc("Views") } } },
|
|
78
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Controls") } } },
|
|
79
|
+
{ and: { op: "mobile.tap", with: { locator: acc("1. Light Theme") } } },
|
|
80
|
+
// A bare id: exercises the app-package prefix.
|
|
81
|
+
{ and: { op: "mobile.type", with: { locator: { by: "id", value: "edit" }, text: "hello" } } },
|
|
82
|
+
{ then: { op: "mobile.expectText", with: { locator: { by: "id", value: "edit" }, equals: "hello" } } },
|
|
83
|
+
{ and: { op: "mobile.back" } },
|
|
84
|
+
{ and: { op: "mobile.back" } },
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const rnLogin = (id: string): ScenarioSpec => ({
|
|
89
|
+
id,
|
|
90
|
+
type: "mobile",
|
|
91
|
+
steps: [
|
|
92
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
93
|
+
{ when: { op: "mobile.tap", with: { locator: acc("open menu") } } },
|
|
94
|
+
{ and: { op: "mobile.tap", with: { locator: acc("menu item log in") } } },
|
|
95
|
+
{ and: { op: "mobile.type", with: { locator: acc("Username input field"), text: "bob@example.com" } } },
|
|
96
|
+
{ and: { op: "mobile.type", with: { locator: acc("Password input field"), text: "10203040" } } },
|
|
97
|
+
{ and: { op: "mobile.hideKeyboard" } },
|
|
98
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Login button") } } },
|
|
99
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("products screen"), timeoutMs: 15000 } } },
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// ---- iOS Simulator: the spike's sample app (a login form, a persisted login, and a location button) -----------------------
|
|
104
|
+
|
|
105
|
+
const sampleApp = (): MobileAdapterOptions => ({
|
|
106
|
+
appiumUrl: APPIUM,
|
|
107
|
+
udid: UDID,
|
|
108
|
+
platformName: "iOS",
|
|
109
|
+
simulator: true,
|
|
110
|
+
appSource: "upload",
|
|
111
|
+
appPath: IOS_APP,
|
|
112
|
+
appPackage: "io.solidx.testhub.sample",
|
|
113
|
+
appProcessName: "SampleApp",
|
|
114
|
+
wdaDerivedDataPath: WDA_DIR,
|
|
115
|
+
wdaPrebuilt: fs.existsSync(path.join(WDA_DIR, "Build", "Products", "Debug-iphonesimulator", "WebDriverAgentRunner-Runner.app")),
|
|
116
|
+
capture: { console: true },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const sampleLogin = (id: string): ScenarioSpec => ({
|
|
120
|
+
id,
|
|
121
|
+
type: "mobile",
|
|
122
|
+
steps: [
|
|
123
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
124
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("status label"), equals: "Logged out" } } },
|
|
125
|
+
{ when: { op: "mobile.type", with: { locator: acc("Username input field"), text: "bob" } } },
|
|
126
|
+
{ and: { op: "mobile.type", with: { locator: acc("Password input field"), text: "secret-pass" } } },
|
|
127
|
+
{ and: { op: "mobile.hideKeyboard" } },
|
|
128
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Login button") } } },
|
|
129
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("status label"), equals: "Logged in as bob" } } },
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
async function iosChecks() {
|
|
134
|
+
if (!process.env.MOBILE_IT_UDID) throw new Error("MOBILE_IT_UDID must be the booted simulator's UDID for MOBILE_IT_PLATFORM=ios");
|
|
135
|
+
if (!fs.existsSync(IOS_APP)) throw new Error(`The sample app is not built: ${IOS_APP} (run spikes/mobile-ios/sample-app/build.sh)`);
|
|
136
|
+
|
|
137
|
+
await check("iOS: login twice in one run; the second starts logged out, which proves the reinstall reset", async () => {
|
|
138
|
+
const reporter = new RecordingReporter();
|
|
139
|
+
await runFromMetadata({ scenarios: [sampleLogin("ios-login-1"), sampleLogin("ios-login-2")], mobile: sampleApp(), reporter });
|
|
140
|
+
assert.deepEqual(reporter.scenarioEnds, [
|
|
141
|
+
{ id: "ios-login-1", ok: true },
|
|
142
|
+
{ id: "ios-login-2", ok: true },
|
|
143
|
+
]);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
await check("iOS: permissions are granted after a reset, so no prompt blocks the location button", async () => {
|
|
147
|
+
const scenario: ScenarioSpec = {
|
|
148
|
+
id: "ios-location",
|
|
149
|
+
type: "mobile",
|
|
150
|
+
steps: [
|
|
151
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
152
|
+
{ when: { op: "mobile.tap", with: { locator: acc("Location button") } } },
|
|
153
|
+
// 4 is CLAuthorizationStatus.authorizedWhenInUse; an alert that autoAcceptAlerts accepted would leave 2 (denied).
|
|
154
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("location label"), equals: "Location: 4" } } },
|
|
155
|
+
],
|
|
156
|
+
};
|
|
157
|
+
const reporter = new RecordingReporter();
|
|
158
|
+
await runFromMetadata({ scenarios: [scenario], mobile: sampleApp(), reporter });
|
|
159
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "ios-location", ok: true }]);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
await check("iOS: mobile.back on a screen with no back button fails instead of passing silently", async () => {
|
|
163
|
+
const scenario: ScenarioSpec = {
|
|
164
|
+
id: "ios-back",
|
|
165
|
+
type: "mobile",
|
|
166
|
+
steps: [{ given: { op: "mobile.launch" } }, { when: { op: "mobile.back" } }],
|
|
167
|
+
};
|
|
168
|
+
const reporter = new RecordingReporter();
|
|
169
|
+
await assert.rejects(runFromMetadata({ scenarios: [scenario], mobile: sampleApp(), reporter }), /has no back button on iOS/);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
await check("iOS: a failing scenario still gets the recording and the device log", async () => {
|
|
173
|
+
const failing: ScenarioSpec = {
|
|
174
|
+
id: "ios-fails",
|
|
175
|
+
type: "mobile",
|
|
176
|
+
steps: [
|
|
177
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
178
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
179
|
+
],
|
|
180
|
+
};
|
|
181
|
+
const reporter = new RecordingReporter();
|
|
182
|
+
await assert.rejects(
|
|
183
|
+
runFromMetadata({ scenarios: [failing], mobile: sampleApp(), reporter }),
|
|
184
|
+
/No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/,
|
|
185
|
+
);
|
|
186
|
+
const names = reporter.attachments.filter((a) => a.scenarioId === "ios-fails").map((a) => a.name);
|
|
187
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
188
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
189
|
+
console.log(` attachments: ${names.join(", ") || "(none)"}; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// ---- A real iPhone: the demo app, already installed ---------------------------------------------------------------------
|
|
194
|
+
|
|
195
|
+
/** Keeps what a scenario attached, which the shared RecordingReporter drops. */
|
|
196
|
+
class ContentReporter extends RecordingReporter {
|
|
197
|
+
contents = new Map<string, string>();
|
|
198
|
+
attach(args: { scenarioId: string; name: string; contentType: string; data: Buffer | string }) {
|
|
199
|
+
super.attach(args);
|
|
200
|
+
this.contents.set(`${args.scenarioId}/${args.name}`, String(args.data));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const phoneApp = (): MobileAdapterOptions => {
|
|
205
|
+
const team = process.env.MOBILE_IT_IOS_TEAM ?? "";
|
|
206
|
+
const wdaDir = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), ".solidx", "wda", `xcode-27.0-iphoneos-${team}`);
|
|
207
|
+
return {
|
|
208
|
+
appiumUrl: APPIUM,
|
|
209
|
+
udid: UDID,
|
|
210
|
+
platformName: "iOS",
|
|
211
|
+
simulator: false,
|
|
212
|
+
appSource: "installed",
|
|
213
|
+
appPackage: process.env.MOBILE_IT_IOS_BUNDLE ?? "com.oswald.mydemoapp",
|
|
214
|
+
appProcessName: process.env.MOBILE_IT_IOS_PROCESS ?? "My Demo App",
|
|
215
|
+
wdaSigning: { teamId: team },
|
|
216
|
+
wdaDerivedDataPath: wdaDir,
|
|
217
|
+
wdaPrebuilt: fs.existsSync(path.join(wdaDir, "Build", "Products", "Debug-iphoneos", "WebDriverAgentRunner-Runner.app")),
|
|
218
|
+
capture: { console: true },
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
async function iosDeviceChecks() {
|
|
223
|
+
if (!process.env.MOBILE_IT_UDID) throw new Error("MOBILE_IT_UDID must be the phone's UDID (xcrun devicectl list devices) for MOBILE_IT_PLATFORM=ios-device");
|
|
224
|
+
if (!/^[A-Z0-9]{10}$/.test(process.env.MOBILE_IT_IOS_TEAM ?? "")) {
|
|
225
|
+
throw new Error("MOBILE_IT_IOS_TEAM must be the 10-character Apple team id (the OU of the Apple Development certificate)");
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
await check("iPhone: the installed app opens on its catalog without clearing anything", async () => {
|
|
229
|
+
const scenario: ScenarioSpec = {
|
|
230
|
+
id: "phone-catalog",
|
|
231
|
+
type: "mobile",
|
|
232
|
+
steps: [
|
|
233
|
+
{ given: { op: "mobile.launch" } },
|
|
234
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("Catalog-screen"), timeoutMs: 15000 } } },
|
|
235
|
+
],
|
|
236
|
+
};
|
|
237
|
+
const reporter = new ContentReporter();
|
|
238
|
+
await runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter });
|
|
239
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "phone-catalog", ok: true }]);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
await check("iPhone: a tap moves between screens (More tab, then the menu)", async () => {
|
|
243
|
+
const scenario: ScenarioSpec = {
|
|
244
|
+
id: "phone-menu",
|
|
245
|
+
type: "mobile",
|
|
246
|
+
steps: [
|
|
247
|
+
{ given: { op: "mobile.launch" } },
|
|
248
|
+
{ when: { op: "mobile.tap", with: { locator: acc("More-tab-item") } } },
|
|
249
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("GeoLocation-menu-item"), timeoutMs: 15000 } } },
|
|
250
|
+
],
|
|
251
|
+
};
|
|
252
|
+
const reporter = new ContentReporter();
|
|
253
|
+
await runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter });
|
|
254
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "phone-menu", ok: true }]);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
await check("iPhone: clearData is refused with the reason, before the app is touched", async () => {
|
|
258
|
+
const scenario: ScenarioSpec = {
|
|
259
|
+
id: "phone-clear",
|
|
260
|
+
type: "mobile",
|
|
261
|
+
steps: [{ given: { op: "mobile.launch", with: { clearData: true } } }],
|
|
262
|
+
};
|
|
263
|
+
const reporter = new ContentReporter();
|
|
264
|
+
await assert.rejects(
|
|
265
|
+
runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter }),
|
|
266
|
+
/Clearing data on an iPhone is not supported: Test Hub uses the app already installed on the phone/,
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
await check("iPhone: a failing scenario keeps the recording and a device log with the app's own lines", async () => {
|
|
271
|
+
const failing: ScenarioSpec = {
|
|
272
|
+
id: "phone-fails",
|
|
273
|
+
type: "mobile",
|
|
274
|
+
steps: [
|
|
275
|
+
{ given: { op: "mobile.launch" } },
|
|
276
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
277
|
+
],
|
|
278
|
+
};
|
|
279
|
+
const reporter = new ContentReporter();
|
|
280
|
+
await assert.rejects(
|
|
281
|
+
runFromMetadata({ scenarios: [failing], mobile: phoneApp(), reporter }),
|
|
282
|
+
/No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/,
|
|
283
|
+
);
|
|
284
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
285
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
286
|
+
const log = reporter.contents.get("phone-fails/console.json");
|
|
287
|
+
assert.ok(log, "no console.json was attached");
|
|
288
|
+
const entries = JSON.parse(log) as Array<{ type: string; text: string }>;
|
|
289
|
+
const own = entries.filter((e) => e.text.includes(`${process.env.MOBILE_IT_IOS_PROCESS ?? "My Demo App"}`));
|
|
290
|
+
assert.ok(own.length > 0, `the device log has no line from the app (${entries.length} lines kept)`);
|
|
291
|
+
assert.ok(!entries.some((e) => e.text.includes("WebDriverAgentRunner-Runner")), "WebDriverAgent's own lines should be filtered out");
|
|
292
|
+
console.log(` ${entries.length} log lines kept, ${own.length} from the app; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** Reads the duration, in seconds, from an MP4's movie header. */
|
|
297
|
+
function mp4Duration(data: Buffer): number {
|
|
298
|
+
const at = data.indexOf("mvhd");
|
|
299
|
+
const timescale = data.readUInt32BE(at + 16);
|
|
300
|
+
return data.readUInt32BE(at + 20) / timescale;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const results: Array<{ name: string; ok: boolean; seconds: number; error?: string }> = [];
|
|
304
|
+
async function check(name: string, fn: () => Promise<void>) {
|
|
305
|
+
const startedAt = Date.now();
|
|
306
|
+
try {
|
|
307
|
+
await fn();
|
|
308
|
+
results.push({ name, ok: true, seconds: Math.round((Date.now() - startedAt) / 1000) });
|
|
309
|
+
console.log(`PASS ${name}`);
|
|
310
|
+
} catch (error: any) {
|
|
311
|
+
results.push({ name, ok: false, seconds: Math.round((Date.now() - startedAt) / 1000), error: String(error?.message ?? error) });
|
|
312
|
+
console.log(`FAIL ${name}\n ${String(error?.message ?? error).split("\n")[0]}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
async function main() {
|
|
317
|
+
if (IOS_DEVICE) {
|
|
318
|
+
await iosDeviceChecks();
|
|
319
|
+
const failedPhone = results.filter((r) => !r.ok);
|
|
320
|
+
console.log(`\n${results.length - failedPhone.length}/${results.length} checks passed`);
|
|
321
|
+
process.exit(failedPhone.length ? 1 : 0);
|
|
322
|
+
}
|
|
323
|
+
if (IOS) {
|
|
324
|
+
await iosChecks();
|
|
325
|
+
const failedIos = results.filter((r) => !r.ok);
|
|
326
|
+
console.log(`\n${results.length - failedIos.length}/${results.length} checks passed`);
|
|
327
|
+
process.exit(failedIos.length ? 1 : 0);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
await check("ApiDemos: uploaded APK, bare-id locator, text assertion", async () => {
|
|
331
|
+
const reporter = new RecordingReporter();
|
|
332
|
+
await runFromMetadata({ scenarios: [apiDemosFlow], mobile: apiDemos, reporter });
|
|
333
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "apidemos-controls", ok: true }]);
|
|
334
|
+
assert.deepEqual(reporter.runArtifacts, [], "a passing run keeps no recording");
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
await check("React Native demo: installed app; two logins in one run prove each scenario starts clean", async () => {
|
|
338
|
+
const reporter = new RecordingReporter();
|
|
339
|
+
await runFromMetadata({ scenarios: [rnLogin("rn-login-1"), rnLogin("rn-login-2")], mobile: rnDemo, reporter });
|
|
340
|
+
assert.deepEqual(reporter.scenarioEnds, [
|
|
341
|
+
{ id: "rn-login-1", ok: true },
|
|
342
|
+
{ id: "rn-login-2", ok: true },
|
|
343
|
+
]);
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
await check("a failing scenario still gets the recording, and no screenshot is uploaded", async () => {
|
|
347
|
+
const failing: ScenarioSpec = {
|
|
348
|
+
id: "rn-fails",
|
|
349
|
+
type: "mobile",
|
|
350
|
+
steps: [
|
|
351
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
352
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
353
|
+
],
|
|
354
|
+
};
|
|
355
|
+
const reporter = new RecordingReporter();
|
|
356
|
+
await assert.rejects(
|
|
357
|
+
runFromMetadata({ scenarios: [failing], mobile: rnDemo, reporter }),
|
|
358
|
+
/No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/,
|
|
359
|
+
);
|
|
360
|
+
const names = reporter.attachments.filter((a) => a.scenarioId === "rn-fails").map((a) => a.name);
|
|
361
|
+
assert.ok(!names.includes("screenshot.png"), `screenshot.png should not be attached by default, got: ${names.join(", ")}`);
|
|
362
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
363
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
364
|
+
console.log(` attachments: ${names.join(", ")}; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
if (process.env.MOBILE_IT_LONG === "1") {
|
|
368
|
+
await check("a four-minute run: how much of it does the recording cover?", async () => {
|
|
369
|
+
const waits = Array.from({ length: 11 }, () => [
|
|
370
|
+
{ op: "util.sleep", with: { ms: 20_000 } },
|
|
371
|
+
{ op: "mobile.expectVisible", with: { locator: acc("products screen") } },
|
|
372
|
+
]).flat();
|
|
373
|
+
const long: ScenarioSpec = {
|
|
374
|
+
id: "rn-long",
|
|
375
|
+
type: "mobile",
|
|
376
|
+
steps: [
|
|
377
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
378
|
+
...waits,
|
|
379
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 2000 } } },
|
|
380
|
+
],
|
|
381
|
+
};
|
|
382
|
+
const captured: Buffer[] = [];
|
|
383
|
+
const reporter = new RecordingReporter();
|
|
384
|
+
const original = reporter.attachRunArtifact.bind(reporter);
|
|
385
|
+
reporter.attachRunArtifact = (args: { name: string; data: Buffer | string }) => {
|
|
386
|
+
captured.push(Buffer.from(args.data));
|
|
387
|
+
original(args);
|
|
388
|
+
};
|
|
389
|
+
const startedAt = Date.now();
|
|
390
|
+
await assert.rejects(runFromMetadata({ scenarios: [long], mobile: rnDemo, reporter }));
|
|
391
|
+
assert.equal(captured.length, 1, "expected one recording");
|
|
392
|
+
const outcome = {
|
|
393
|
+
ranSeconds: Math.round((Date.now() - startedAt) / 1000),
|
|
394
|
+
recordedSeconds: Math.round(mp4Duration(captured[0])),
|
|
395
|
+
bytes: captured[0].length,
|
|
396
|
+
};
|
|
397
|
+
console.log(` ${JSON.stringify(outcome)}`);
|
|
398
|
+
const outDir = path.join(APPS_DIR, "..", "out");
|
|
399
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
400
|
+
fs.writeFileSync(path.join(outDir, "long-recording.json"), JSON.stringify(outcome, null, 2));
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
const failed = results.filter((r) => !r.ok);
|
|
405
|
+
console.log(`\n${results.length - failed.length}/${results.length} checks passed`);
|
|
406
|
+
process.exit(failed.length ? 1 : 0);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
void main();
|