@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-metadata.service.js","sourceRoot":"","sources":["../../src/services/view-metadata.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA6F;AAC7F,uCAAyC;AACzC,6CAAsD;AACtD,iDAAwD;AACxD,qCAAwC;AAExC,4FAAuF;AACvF,8DAA2D;AAC3D,uFAAmF;AACnF,qFAAiF;AAIjF,uEAAkE;AAClE,6EAAuE;AACvE,yEAAoE;AACpE,6EAAuE;AAGvE,oEAAkE;AAG3D,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,0BAAyB;IAaxD,uBAAuB,CAAC,KAAU;QACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;YAClC,IACE,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC5D,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAC5D,CAAC;gBACD,IAAI,CAAC;oBACH,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;gBAChE,CAAC;gBAAC,MAAM,CAAC;oBACP,OAAO,KAAK,CAAC;gBACf,CAAC;YACH,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;QACjE,CAAC;QAED,IA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port { InjectEntityManager } from '@nestjs/typeorm';\nimport { CRUDService } from 'src/services/crud.service';\nimport { EntityManager } from 'typeorm';\n\nimport { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { ModelMetadataRepository } from 'src/repository/model-metadata.repository';\nimport { ViewMetadataRepository } from 'src/repository/view-metadata.repository';\nimport { UpdateViewMetadataDto } from '../dtos/update-view-metadata.dto';\nimport { FieldMetadata } from '../entities/field-metadata.entity';\nimport { ViewMetadata } from '../entities/view-metadata.entity';\nimport { ActionMetadataService } from './action-metadata.service';\nimport { MenuItemMetadataService } from './menu-item-metadata.service';\nimport { SolidIntrospectService } from './solid-introspect.service';\nimport { UserViewMetadataService } from './user-view-metadata.service';\nimport { MenuItemMetadata } from 'src/entities/menu-item-metadata.entity';\nimport { IWorkflowFieldDataProviderValues } from 'src/interfaces';\nimport { MEDIA_FILE_TYPES } from 'src/constants/media-file-types';\n\n@Injectable()\nexport class ViewMetadataService extends CRUDService<ViewMetadata> {\n private readonly comparableFields = [\n 'name',\n 'displayName',\n 'type',\n 'context',\n 'layout',\n 'module',\n 'model',\n ] as const;\n private readonly relationCompareFields = new Set(['module', 'model']);\n private readonly jsonCompareFields = new Set(['layout', 'context']);\n\n private normalizeJsonFieldValue(value: any): any {\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n if (\n (trimmedValue.startsWith('{') && trimmedValue.endsWith('}')) ||\n (trimmedValue.startsWith('[') && trimmedValue.endsWith(']'))\n ) {\n try {\n return this.normalizeJsonFieldValue(JSON.parse(trimmedValue));\n } catch {\n return value;\n }\n }\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => this.normalizeJsonFieldValue(item));\n }\n\n if (value && typeof value === 'object') {\n return Object.keys(value)\n .sort()\n .reduce((result, key) => {\n result[key] = this.normalizeJsonFieldValue(value[key]);\n return result;\n }, {} as Record<string, any>);\n }\n\n return value;\n }\n\n private getCanonicalJsonFieldString(value: any): string {\n return JSON.stringify(this.normalizeJsonFieldValue(value) ?? null);\n }\n\n private hasChanges(existingSolidView: ViewMetadata, updateSolidViewDto: UpdateViewMetadataDto): boolean {\n return this.comparableFields.some((key) => {\n const value = (updateSolidViewDto as any)[key];\n if (typeof value === 'undefined') {\n return false;\n }\n\n if (this.relationCompareFields.has(key)) {\n const relationValue = value as any;\n return (existingSolidView as any)[key]?.id !== relationValue?.id;\n }\n\n if (this.jsonCompareFields.has(key)) {\n return this.getCanonicalJsonFieldString((existingSolidView as any)[key]) !== this.getCanonicalJsonFieldString(value);\n }\n\n return (existingSolidView as any)[key] !== value;\n });\n }\n\n constructor(\n readonly actionMetadataService: ActionMetadataService,\n readonly menuItemMetadataService: MenuItemMetadataService,\n readonly introspectService: SolidIntrospectService,\n readonly userViewMetadataService: UserViewMetadataService,\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ViewMetadata, 'default')\n readonly repo: ViewMetadataRepository,\n // @InjectRepository(FieldMetadata)\n // private readonly fieldMetadataRepo: Repository<FieldMetadata>,\n // @InjectRepository(ModelMetadata)\n // private readonly modelMetadataRepo: Repository<ModelMetadata>,\n @Inject(forwardRef(() => ModelMetadataRepository))\n private readonly modelMetadataRepo: ModelMetadataRepository,\n private readonly modelMetadataHelperService: ModelMetadataHelperService,\n readonly moduleRef: ModuleRef\n ) {\n super(entityManager, repo, 'viewMetadata', 'solid-core', moduleRef);\n }\n\n private readonly logger = new Logger(ViewMetadataService.name);\n\n private parseJsonObject(value: any): Record<string, any> {\n if (!value) {\n return {};\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch (error: any) {\n this.logger.warn(`Unable to parse workflow field provider context: ${error?.message ?? error}`);\n }\n }\n\n return {};\n }\n\n private async getDefaultWorkflowFieldData(\n workflowField: FieldMetadata,\n workflowFieldName: string,\n fieldsMap: Map<string, FieldMetadata>,\n ): Promise<IWorkflowFieldDataProviderValues[]> {\n if (workflowField.type === 'selectionStatic') {\n return workflowField.selectionStaticValues.map(item => {\n const [value, label] = item.split(\":\");\n return { label, value };\n });\n }\n\n if (workflowField.type === 'relation' && workflowField.relationType === 'many-to-one') {\n const comodelCrudService = this.introspectService.getCRUDService(workflowField.relationCoModelSingularName);\n const data = await comodelCrudService.find({ limit: 100, offset: 0, });\n const records = data.records ?? [];\n const workflowFieldMetadata = fieldsMap.get(workflowFieldName);\n const workflowFieldUserKey = (workflowFieldMetadata as any)?.relationModel?.userKeyField?.name;\n\n if (!workflowFieldUserKey) {\n this.logger.warn(`Unable to identify relation user key for workflow field: ${workflowFieldName}`);\n return [];\n }\n\n return records.map(item => ({ label: item[workflowFieldUserKey], value: item['id'] }));\n }\n\n return [];\n }\n\n private async getWorkflowFieldData(\n entity: ViewMetadata,\n workflowField: FieldMetadata,\n workflowFieldName: string,\n fieldsMap: Map<string, FieldMetadata>,\n query: Record<string, any>,\n activeUser: any,\n ): Promise<readonly IWorkflowFieldDataProviderValues[]> {\n const workflowFieldDataProviderName = entity.layout?.attrs?.workflowFieldDataProvider;\n if (workflowFieldDataProviderName) {\n const solidRegistry = await this.moduleRef.get(SolidRegistry, { strict: false });\n const provider = solidRegistry.getWorkflowFieldDataProviderInstance(workflowFieldDataProviderName);\n if (!provider) {\n throw new BadRequestException(`Workflow field data provider ${workflowFieldDataProviderName} not found`);\n }\n\n return provider.values({\n entityId: query?.id,\n modelName: entity.model?.singularName ?? query?.modelName,\n moduleName: entity.module?.name ?? query?.moduleName,\n workflowFieldName,\n workflowField,\n solidModel: entity.model,\n solidView: entity,\n solidFieldsMetadata: Object.fromEntries(fieldsMap),\n query,\n providerContext: this.parseJsonObject(entity.layout?.attrs?.workflowFieldDataProviderCtxt),\n activeUser,\n });\n }\n\n return this.getDefaultWorkflowFieldData(workflowField, workflowFieldName, fieldsMap);\n }\n\n // START: Custom Service Methods\n async getLayout(query, activeUser) {\n let { modelName, moduleName, viewType, id, populate, menuItemId, menuItemName, actionId, actionName } = query;\n\n // 1. Fetch the action based on actionId.\n const solidRequestContext = {\n activeUser: activeUser\n }\n const actionQuery = {\n populate: [\"view\"]\n }\n let action = null;\n if (actionId) {\n action = await this.actionMetadataService.findOne(actionId, actionQuery, solidRequestContext);\n }\n\n // 2. Fetch the menu based on menuItemId.\n const menuItemQuery = {\n populate: ['action', 'action.model', 'module']\n }\n let menuItem: MenuItemMetadata = null;\n if (menuItemId) {\n menuItem = await this.menuItemMetadataService.findOne(menuItemId, menuItemQuery, solidRequestContext);\n }\n\n let viewModes = [];\n const collectionViewTypes = ['card', 'list', 'kanban', 'tree'];\n // The menu can belong to a different module than the views it opens.\n // Resolve view modes from the module/model requested for this layout,\n // while keeping the menu item as the navigation context in the response.\n const requestedModel = modelName && moduleName\n ? await this.modelMetadataRepo.findOne({\n where: {\n singularName: modelName,\n module: { name: moduleName },\n },\n relations: { module: true },\n })\n : null;\n const requestedModelId = requestedModel?.id;\n const requestedModuleId = requestedModel?.module?.id;\n if (menuItem && requestedModelId && requestedModuleId) {\n const actionQb = await this.actionMetadataService.repo.createSecurityRuleAwareQueryBuilder('action');\n const actionsForViewModes = await actionQb\n .leftJoinAndSelect('action.model', 'model')\n .leftJoinAndSelect('action.module', 'module')\n .leftJoinAndSelect('action.view', 'view')\n .where('model.id = :modelId', { modelId: requestedModelId })\n .andWhere('module.id = :moduleId', { moduleId: requestedModuleId })\n .andWhere('view.type IN (:...viewTypes)', { viewTypes: collectionViewTypes })\n .getMany();\n\n const canonicalActionsByViewType = new Map();\n for (const actionItem of actionsForViewModes) {\n const resolvedViewType = actionItem.view?.type;\n if (!resolvedViewType || canonicalActionsByViewType.has(resolvedViewType)) {\n continue;\n }\n canonicalActionsByViewType.set(resolvedViewType, actionItem);\n }\n\n if (action?.view?.type && collectionViewTypes.includes(action.view.type) && action?.id) {\n canonicalActionsByViewType.set(action.view.type, action);\n }\n\n viewModes = collectionViewTypes\n .map((resolvedViewType) => canonicalActionsByViewType.get(resolvedViewType))\n .filter(Boolean)\n .map(actionItem => ({\n type: actionItem.view?.type ?? '',\n menuItemId: menuItem.id,\n menuItemName: menuItem.displayName,\n actionId: actionItem.id ?? '',\n actionName: actionItem.displayName ?? '',\n }));\n }\n\n const viewId = action?.view?.id\n // 3. Fetch the view based on module, model & view name.\n const entity = await this.repo.findOne({\n where: {\n model: { singularName: modelName },\n module: { name: moduleName },\n ...(actionId && viewId ? { id: action.view.id } : { type: viewType })\n },\n relations: {\n model: {\n userKeyField: true,\n },\n module: true,\n }\n });\n\n if (!entity) {\n throw new BadRequestException(`Unable to identify view for module: ${moduleName}, model: ${modelName} and viewType: ${viewType}`);\n }\n if (!activeUser?.sub) {\n throw new BadRequestException(`Unable to identify user for module: ${moduleName}, model: ${modelName} and viewType: ${viewType}`);\n }\n\n // 4. add action and menuItem to Entity which is our solid View\n if (actionId) {\n delete action.view;\n entity['action'] = action\n }\n if (menuItemId) {\n entity['menu'] = menuItem\n }\n\n // 5. See if we have a user specific layout for this view.\n const userLayout = await this.userViewMetadataService.repo.findOne({\n where: {\n user: { id: activeUser?.sub },\n viewMetadata: { id: entity.id },\n },\n });\n // Based on where we found the layout we are converting it from string to json.\n if (userLayout) {\n entity.layout = JSON.parse(userLayout.layout);\n } else {\n entity.layout = JSON.parse(entity.layout);\n }\n\n // 6. We are resolving the create & edit actions if specified in the layout.\n if (entity?.layout?.attrs?.createAction) {\n const actionName: string = entity.layout.attrs.createAction;\n entity.layout.attrs.createAction = await this.actionMetadataService.findOneByUserKey(actionName)\n }\n if (entity?.layout?.attrs?.editAction) {\n const actionName: string = entity.layout.attrs.editAction;\n entity.layout.attrs.editAction = await this.actionMetadataService.findOneByUserKey(actionName)\n }\n\n // 7. For form views we need to fetch the workflow field metadata if specified.\n let workflowFieldName = null;\n let workflowField = null;\n if (viewType === 'form') {\n workflowFieldName = entity.layout?.attrs?.workflowField;\n }\n\n // 8. Create an easy to use map of field metadata, rather than sending an array of fields it becomes easier to use in the frontend.\n const fields = await this.modelMetadataHelperService.loadFieldHierarchy(modelName);\n const fieldsMap = new Map<string, FieldMetadata>();\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n\n // We need to identify the workflowField metadata if specified. \n if (workflowFieldName && field.name === workflowFieldName) {\n workflowField = field;\n }\n\n // For fields of type relation & relationType many-to-one\n // We fetch metadata regarding the relationCoModelSingularName\n if (field.type === 'relation') {\n const relationModel = await this.modelMetadataRepo.find({\n where: {\n singularName: field.relationCoModelSingularName\n },\n relations: {\n userKeyField: true\n }\n });\n\n if (relationModel) {\n field['relationModel'] = relationModel[0];\n }\n }\n if (!fieldsMap.has(field.name)) {\n fieldsMap.set(field.name, field);\n }\n }\n\n // 9. Use the resolved workflowField to populate workflow specific metadata.\n let solidFormViewWorkflowData: readonly IWorkflowFieldDataProviderValues[] = [];\n if (viewType === 'form' && workflowField) {\n solidFormViewWorkflowData = await this.getWorkflowFieldData(entity, workflowField, workflowFieldName, fieldsMap, query, activeUser);\n }\n\n // 10. If this model supports internationalisation, we need to load the locales applicable with the id of an actual record for each locale if present.\n // This is the shape of locales that will be returned \n /**\n * [\n * {locale: 'en', displayName: 'English', isDefault: 'yes', defaultEntityLocaleId: '', entityId: '1'}, \n * {locale: 'en-IN', displayName: 'English (India)', isDefault: 'no', defaultEntityLocaleId: '1', entityId: '2'}, \n * {locale: 'en-SG', displayName: 'English (Singapore)', isDefault: 'no', defaultEntityLocaleId: '', entityId: '3'}, \n * {locale: 'fr', displayName: 'French', isDefault: 'no', defaultEntityLocaleId: '', entityId: ''}\n * ]\n */\n\n let applicableLocales: any[] = [];\n if (entity.model.internationalisation) {\n const draftPublishEnabled = entity.model.draftPublishWorkflow === true;\n applicableLocales = await this.internationalisationHelperService.buildApplicableLocales(\n this.entityManager, modelName, id, query?.defaultEntityLocaleId, draftPublishEnabled,\n );\n }\n\n const r = {\n 'solidView': entity,\n 'solidFieldsMetadata': Object.fromEntries(fieldsMap),\n // Reuse the form view payload for media picker filtering so the runtime widgets\n // can derive category-to-extension fallbacks without exposing unused MIME details.\n 'mediaFileTypeDefinitions': MEDIA_FILE_TYPES.map(({ mediaType, extension }) => ({ mediaType, extension })),\n 'solidFormViewWorkflowData': solidFormViewWorkflowData,\n 'applicableLocales': applicableLocales,\n 'viewModes': viewModes\n }\n\n return r;\n }\n\n private async loadFieldHierarchy(modelName: any) {\n const model = await this.modelMetadataRepo.findOne({\n where: {\n singularName: modelName,\n },\n relations: {\n fields: true,\n parentModel: {\n fields: true,\n }\n }\n });\n const fields = [];\n if (model) {\n // Add the fields of the current model\n fields.push(...model.fields);\n\n // Add the fields of the parent model\n if (model.parentModel) {\n fields.push(...model.parentModel.fields);\n }\n }\n return fields;\n }\n\n async findOneByUserKey(name: string, relations = {}) {\n const entity = await this.repo.findOne({\n where: {\n name: name,\n },\n relations: relations,\n });\n return entity;\n }\n\n async upsert(updateSolidViewDto: UpdateViewMetadataDto) {\n // First check if module already exists using name\n const existingSolidView = await this.findOneByUserKey(updateSolidViewDto.name, {\n module: true,\n model: true,\n });\n\n // if found\n if (existingSolidView) {\n const hasChanges = this.hasChanges(existingSolidView, updateSolidViewDto);\n\n if (!hasChanges) {\n this.logger.debug(`Skipping view upsert for ${updateSolidViewDto.name}; no changes detected.`);\n return existingSolidView;\n }\n\n const updatedSolidViewDto = { ...existingSolidView, ...updateSolidViewDto };\n return this.repo.save(updatedSolidViewDto);\n }\n // if not found - create new \n else {\n const viewData = this.repo.create(updateSolidViewDto);\n return this.repo.save(viewData);\n }\n }\n\n async createIfNotPresent(updateSolidViewDto: UpdateViewMetadataDto) {\n // First check if module already exists using name\n const existingSolidView = await this.findOneByUserKey(updateSolidViewDto.name);\n\n // if found\n if (existingSolidView) {\n }\n // if not found - create new \n else {\n const viewData = this.repo.create(updateSolidViewDto);\n return this.repo.save(viewData);\n }\n }\n\n // END: Custom Service Methods\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"view-metadata.service.js","sourceRoot":"","sources":["../../src/services/view-metadata.service.ts"],"names":[],"mappings":";;;;;;;;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Content":["import { BadRequestException, forwardRef, Inject, Injectable, Logger } from '@nestjs/common';\nimport { ModuleRef } from \"@nestjs/core\";\nimport { InjectEntityManager } from '@nestjs/typeorm';\nimport { CRUDService } from 'src/services/crud.service';\nimport { EntityManager } from 'typeorm';\n\nimport { ModelMetadataHelperService } from 'src/helpers/model-metadata-helper.service';\nimport { SolidRegistry } from 'src/helpers/solid-registry';\nimport { ModelMetadataRepository } from 'src/repository/model-metadata.repository';\nimport { ViewMetadataRepository } from 'src/repository/view-metadata.repository';\nimport { UpdateViewMetadataDto } from '../dtos/update-view-metadata.dto';\nimport { FieldMetadata } from '../entities/field-metadata.entity';\nimport { ViewMetadata } from '../entities/view-metadata.entity';\nimport { ActionMetadataService } from './action-metadata.service';\nimport { MenuItemMetadataService } from './menu-item-metadata.service';\nimport { SolidIntrospectService } from './solid-introspect.service';\nimport { UserViewMetadataService } from './user-view-metadata.service';\nimport { MenuItemMetadata } from 'src/entities/menu-item-metadata.entity';\nimport { IWorkflowFieldDataProviderValues } from 'src/interfaces';\nimport { MEDIA_FILE_TYPES } from 'src/constants/media-file-types';\n\n@Injectable()\nexport class ViewMetadataService extends CRUDService<ViewMetadata> {\n private readonly comparableFields = [\n 'name',\n 'displayName',\n 'type',\n 'context',\n 'layout',\n 'module',\n 'model',\n ] as const;\n private readonly relationCompareFields = new Set(['module', 'model']);\n private readonly jsonCompareFields = new Set(['layout', 'context']);\n\n private normalizeJsonFieldValue(value: any): any {\n if (typeof value === 'string') {\n const trimmedValue = value.trim();\n if (\n (trimmedValue.startsWith('{') && trimmedValue.endsWith('}')) ||\n (trimmedValue.startsWith('[') && trimmedValue.endsWith(']'))\n ) {\n try {\n return this.normalizeJsonFieldValue(JSON.parse(trimmedValue));\n } catch {\n return value;\n }\n }\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) => this.normalizeJsonFieldValue(item));\n }\n\n if (value && typeof value === 'object') {\n return Object.keys(value)\n .sort()\n .reduce((result, key) => {\n result[key] = this.normalizeJsonFieldValue(value[key]);\n return result;\n }, {} as Record<string, any>);\n }\n\n return value;\n }\n\n private getCanonicalJsonFieldString(value: any): string {\n return JSON.stringify(this.normalizeJsonFieldValue(value) ?? null);\n }\n\n private hasChanges(existingSolidView: ViewMetadata, updateSolidViewDto: UpdateViewMetadataDto): boolean {\n return this.comparableFields.some((key) => {\n const value = (updateSolidViewDto as any)[key];\n if (typeof value === 'undefined') {\n return false;\n }\n\n if (this.relationCompareFields.has(key)) {\n const relationValue = value as any;\n return (existingSolidView as any)[key]?.id !== relationValue?.id;\n }\n\n if (this.jsonCompareFields.has(key)) {\n return this.getCanonicalJsonFieldString((existingSolidView as any)[key]) !== this.getCanonicalJsonFieldString(value);\n }\n\n return (existingSolidView as any)[key] !== value;\n });\n }\n\n constructor(\n readonly actionMetadataService: ActionMetadataService,\n readonly menuItemMetadataService: MenuItemMetadataService,\n readonly introspectService: SolidIntrospectService,\n readonly userViewMetadataService: UserViewMetadataService,\n @InjectEntityManager()\n readonly entityManager: EntityManager,\n // @InjectRepository(ViewMetadata, 'default')\n readonly repo: ViewMetadataRepository,\n // @InjectRepository(FieldMetadata)\n // private readonly fieldMetadataRepo: Repository<FieldMetadata>,\n // @InjectRepository(ModelMetadata)\n // private readonly modelMetadataRepo: Repository<ModelMetadata>,\n @Inject(forwardRef(() => ModelMetadataRepository))\n private readonly modelMetadataRepo: ModelMetadataRepository,\n private readonly modelMetadataHelperService: ModelMetadataHelperService,\n readonly moduleRef: ModuleRef\n ) {\n super(entityManager, repo, 'viewMetadata', 'solid-core', moduleRef);\n }\n\n private readonly logger = new Logger(ViewMetadataService.name);\n\n private parseJsonObject(value: any): Record<string, any> {\n if (!value) {\n return {};\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n if (typeof value === 'string') {\n try {\n return JSON.parse(value);\n } catch (error: any) {\n this.logger.warn(`Unable to parse workflow field provider context: ${error?.message ?? error}`);\n }\n }\n\n return {};\n }\n\n private async getDefaultWorkflowFieldData(\n workflowField: FieldMetadata,\n workflowFieldName: string,\n fieldsMap: Map<string, FieldMetadata>,\n ): Promise<IWorkflowFieldDataProviderValues[]> {\n if (workflowField.type === 'selectionStatic') {\n return workflowField.selectionStaticValues.map(item => {\n const [value, label] = item.split(\":\");\n return { label, value };\n });\n }\n\n if (workflowField.type === 'relation' && workflowField.relationType === 'many-to-one') {\n const comodelCrudService = this.introspectService.getCRUDService(workflowField.relationCoModelSingularName);\n const data = await comodelCrudService.find({ limit: 100, offset: 0, });\n const records = data.records ?? [];\n const workflowFieldMetadata = fieldsMap.get(workflowFieldName);\n const workflowFieldUserKey = (workflowFieldMetadata as any)?.relationModel?.userKeyField?.name;\n\n if (!workflowFieldUserKey) {\n this.logger.warn(`Unable to identify relation user key for workflow field: ${workflowFieldName}`);\n return [];\n }\n\n return records.map(item => ({ label: item[workflowFieldUserKey], value: item['id'] }));\n }\n\n return [];\n }\n\n private async getWorkflowFieldData(\n entity: ViewMetadata,\n workflowField: FieldMetadata,\n workflowFieldName: string,\n fieldsMap: Map<string, FieldMetadata>,\n query: Record<string, any>,\n activeUser: any,\n ): Promise<readonly IWorkflowFieldDataProviderValues[]> {\n const workflowFieldDataProviderName = entity.layout?.attrs?.workflowFieldDataProvider;\n if (workflowFieldDataProviderName) {\n const solidRegistry = await this.moduleRef.get(SolidRegistry, { strict: false });\n const provider = solidRegistry.getWorkflowFieldDataProviderInstance(workflowFieldDataProviderName);\n if (!provider) {\n throw new BadRequestException(`Workflow field data provider ${workflowFieldDataProviderName} not found`);\n }\n\n return provider.values({\n entityId: query?.id,\n modelName: entity.model?.singularName ?? query?.modelName,\n moduleName: entity.module?.name ?? query?.moduleName,\n workflowFieldName,\n workflowField,\n solidModel: entity.model,\n solidView: entity,\n solidFieldsMetadata: Object.fromEntries(fieldsMap),\n query,\n providerContext: this.parseJsonObject(entity.layout?.attrs?.workflowFieldDataProviderCtxt),\n activeUser,\n });\n }\n\n return this.getDefaultWorkflowFieldData(workflowField, workflowFieldName, fieldsMap);\n }\n\n // START: Custom Service Methods\n async getLayout(query, activeUser) {\n let { modelName, moduleName, viewType, id, populate, menuItemId, menuItemName, actionId, actionName } = query;\n\n // 1. Fetch the action based on actionId.\n const solidRequestContext = {\n activeUser: activeUser\n }\n const actionQuery = {\n populate: [\"view\"]\n }\n let action = null;\n if (actionId) {\n action = await this.actionMetadataService.findOne(actionId, actionQuery, solidRequestContext);\n }\n\n // 2. Fetch the menu based on menuItemId.\n const menuItemQuery = {\n populate: ['action', 'action.model', 'module']\n }\n let menuItem: MenuItemMetadata = null;\n if (menuItemId) {\n menuItem = await this.menuItemMetadataService.findOne(menuItemId, menuItemQuery, solidRequestContext);\n }\n\n let viewModes = [];\n const collectionViewTypes = ['card', 'list', 'kanban', 'tree'];\n // The menu can belong to a different module than the views it opens.\n // Resolve view modes from the module/model requested for this layout,\n // while keeping the menu item as the navigation context in the response.\n const requestedModel = modelName && moduleName\n ? await this.modelMetadataRepo.findOne({\n where: {\n singularName: modelName,\n module: { name: moduleName },\n },\n relations: { module: true },\n })\n : null;\n const requestedModelId = requestedModel?.id;\n const requestedModuleId = requestedModel?.module?.id;\n if (menuItem && requestedModelId && requestedModuleId) {\n const actionQb = await this.actionMetadataService.repo.createSecurityRuleAwareQueryBuilder('action');\n const actionsForViewModes = await actionQb\n .leftJoinAndSelect('action.model', 'model')\n .leftJoinAndSelect('action.module', 'module')\n .leftJoinAndSelect('action.view', 'view')\n .where('model.id = :modelId', { modelId: requestedModelId })\n .andWhere('module.id = :moduleId', { moduleId: requestedModuleId })\n .andWhere('view.type IN (:...viewTypes)', { viewTypes: collectionViewTypes })\n .getMany();\n\n const canonicalActionsByViewType = new Map();\n for (const actionItem of actionsForViewModes) {\n const resolvedViewType = actionItem.view?.type;\n if (!resolvedViewType || canonicalActionsByViewType.has(resolvedViewType)) {\n continue;\n }\n canonicalActionsByViewType.set(resolvedViewType, actionItem);\n }\n\n if (action?.view?.type && collectionViewTypes.includes(action.view.type) && action?.id) {\n canonicalActionsByViewType.set(action.view.type, action);\n }\n\n viewModes = collectionViewTypes\n .map((resolvedViewType) => canonicalActionsByViewType.get(resolvedViewType))\n .filter(Boolean)\n .map(actionItem => ({\n type: actionItem.view?.type ?? '',\n menuItemId: menuItem.id,\n menuItemName: menuItem.displayName,\n actionId: actionItem.id ?? '',\n actionName: actionItem.displayName ?? '',\n }));\n }\n\n const viewId = action?.view?.id\n // 3. Fetch the view based on module, model & view name.\n const entity = await this.repo.findOne({\n where: {\n model: { singularName: modelName },\n module: { name: moduleName },\n ...(actionId && viewId ? { id: action.view.id } : { type: viewType })\n },\n relations: {\n model: {\n userKeyField: true,\n },\n module: true,\n }\n });\n\n if (!entity) {\n throw new BadRequestException(`Unable to identify view for module: ${moduleName}, model: ${modelName} and viewType: ${viewType}`);\n }\n if (!activeUser?.sub) {\n throw new BadRequestException(`Unable to identify user for module: ${moduleName}, model: ${modelName} and viewType: ${viewType}`);\n }\n\n // 4. add action and menuItem to Entity which is our solid View\n if (actionId) {\n delete action.view;\n entity['action'] = action\n }\n if (menuItemId) {\n entity['menu'] = menuItem\n }\n\n // 5. See if we have a user specific layout for this view.\n const userLayout = await this.userViewMetadataService.repo.findOne({\n where: {\n user: { id: activeUser?.sub },\n viewMetadata: { id: entity.id },\n },\n });\n // Based on where we found the layout we are converting it from string to json.\n if (userLayout) {\n entity.layout = JSON.parse(userLayout.layout);\n } else {\n entity.layout = JSON.parse(entity.layout);\n }\n\n // 6. We are resolving the create & edit actions if specified in the layout.\n const actionUserKey = (action: string | { name?: string }): string | undefined =>\n typeof action === 'string' ? action : action?.name;\n if (entity?.layout?.attrs?.createAction) {\n const actionName = actionUserKey(entity.layout.attrs.createAction);\n entity.layout.attrs.createAction = actionName ? await this.actionMetadataService.findOneByUserKey(actionName) : null;\n }\n if (entity?.layout?.attrs?.editAction) {\n const actionName = actionUserKey(entity.layout.attrs.editAction);\n entity.layout.attrs.editAction = actionName ? await this.actionMetadataService.findOneByUserKey(actionName) : null;\n }\n\n // 7. For form views we need to fetch the workflow field metadata if specified.\n let workflowFieldName = null;\n let workflowField = null;\n if (viewType === 'form') {\n workflowFieldName = entity.layout?.attrs?.workflowField;\n }\n\n // 8. Create an easy to use map of field metadata, rather than sending an array of fields it becomes easier to use in the frontend.\n const fields = await this.modelMetadataHelperService.loadFieldHierarchy(modelName);\n const fieldsMap = new Map<string, FieldMetadata>();\n for (let i = 0; i < fields.length; i++) {\n const field = fields[i];\n\n // We need to identify the workflowField metadata if specified. \n if (workflowFieldName && field.name === workflowFieldName) {\n workflowField = field;\n }\n\n // For fields of type relation & relationType many-to-one\n // We fetch metadata regarding the relationCoModelSingularName\n if (field.type === 'relation') {\n const relationModel = await this.modelMetadataRepo.find({\n where: {\n singularName: field.relationCoModelSingularName\n },\n relations: {\n userKeyField: true\n }\n });\n\n if (relationModel) {\n field['relationModel'] = relationModel[0];\n }\n }\n if (!fieldsMap.has(field.name)) {\n fieldsMap.set(field.name, field);\n }\n }\n\n // 9. Use the resolved workflowField to populate workflow specific metadata.\n let solidFormViewWorkflowData: readonly IWorkflowFieldDataProviderValues[] = [];\n if (viewType === 'form' && workflowField) {\n solidFormViewWorkflowData = await this.getWorkflowFieldData(entity, workflowField, workflowFieldName, fieldsMap, query, activeUser);\n }\n\n // 10. If this model supports internationalisation, we need to load the locales applicable with the id of an actual record for each locale if present.\n // This is the shape of locales that will be returned \n /**\n * [\n * {locale: 'en', displayName: 'English', isDefault: 'yes', defaultEntityLocaleId: '', entityId: '1'}, \n * {locale: 'en-IN', displayName: 'English (India)', isDefault: 'no', defaultEntityLocaleId: '1', entityId: '2'}, \n * {locale: 'en-SG', displayName: 'English (Singapore)', isDefault: 'no', defaultEntityLocaleId: '', entityId: '3'}, \n * {locale: 'fr', displayName: 'French', isDefault: 'no', defaultEntityLocaleId: '', entityId: ''}\n * ]\n */\n\n let applicableLocales: any[] = [];\n if (entity.model.internationalisation) {\n const draftPublishEnabled = entity.model.draftPublishWorkflow === true;\n applicableLocales = await this.internationalisationHelperService.buildApplicableLocales(\n this.entityManager, modelName, id, query?.defaultEntityLocaleId, draftPublishEnabled,\n );\n }\n\n const r = {\n 'solidView': entity,\n 'solidFieldsMetadata': Object.fromEntries(fieldsMap),\n // Reuse the form view payload for media picker filtering so the runtime widgets\n // can derive category-to-extension fallbacks without exposing unused MIME details.\n 'mediaFileTypeDefinitions': MEDIA_FILE_TYPES.map(({ mediaType, extension }) => ({ mediaType, extension })),\n 'solidFormViewWorkflowData': solidFormViewWorkflowData,\n 'applicableLocales': applicableLocales,\n 'viewModes': viewModes\n }\n\n return r;\n }\n\n private async loadFieldHierarchy(modelName: any) {\n const model = await this.modelMetadataRepo.findOne({\n where: {\n singularName: modelName,\n },\n relations: {\n fields: true,\n parentModel: {\n fields: true,\n }\n }\n });\n const fields = [];\n if (model) {\n // Add the fields of the current model\n fields.push(...model.fields);\n\n // Add the fields of the parent model\n if (model.parentModel) {\n fields.push(...model.parentModel.fields);\n }\n }\n return fields;\n }\n\n async findOneByUserKey(name: string, relations = {}) {\n const entity = await this.repo.findOne({\n where: {\n name: name,\n },\n relations: relations,\n });\n return entity;\n }\n\n async upsert(updateSolidViewDto: UpdateViewMetadataDto) {\n // First check if module already exists using name\n const existingSolidView = await this.findOneByUserKey(updateSolidViewDto.name, {\n module: true,\n model: true,\n });\n\n // if found\n if (existingSolidView) {\n const hasChanges = this.hasChanges(existingSolidView, updateSolidViewDto);\n\n if (!hasChanges) {\n this.logger.debug(`Skipping view upsert for ${updateSolidViewDto.name}; no changes detected.`);\n return existingSolidView;\n }\n\n const updatedSolidViewDto = { ...existingSolidView, ...updateSolidViewDto };\n return this.repo.save(updatedSolidViewDto);\n }\n // if not found - create new \n else {\n const viewData = this.repo.create(updateSolidViewDto);\n return this.repo.save(viewData);\n }\n }\n\n async createIfNotPresent(updateSolidViewDto: UpdateViewMetadataDto) {\n // First check if module already exists using name\n const existingSolidView = await this.findOneByUserKey(updateSolidViewDto.name);\n\n // if found\n if (existingSolidView) {\n }\n // if not found - create new \n else {\n const viewData = this.repo.create(updateSolidViewDto);\n return this.repo.save(viewData);\n }\n }\n\n // END: Custom Service Methods\n\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-emulator.integration.d.ts","sourceRoot":"","sources":["../../../src/testing/__integration__/mobile-emulator.integration.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const assert = __importStar(require("node:assert/strict"));
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const os = __importStar(require("node:os"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const recording_reporter_1 = require("../runner/recording-reporter");
|
|
41
|
+
const run_from_metadata_1 = require("../runner/run-from-metadata");
|
|
42
|
+
const APPIUM = process.env.MOBILE_IT_APPIUM ?? "http://localhost:4723";
|
|
43
|
+
const UDID = process.env.MOBILE_IT_UDID ?? "emulator-5554";
|
|
44
|
+
const APPS_DIR = process.env.MOBILE_IT_APPS_DIR ?? "/Users/oswald/projects/Solid_Starters/test-hub/spikes/mobile-appium/apps";
|
|
45
|
+
const IOS = process.env.MOBILE_IT_PLATFORM === "ios";
|
|
46
|
+
const IOS_DEVICE = process.env.MOBILE_IT_PLATFORM === "ios-device";
|
|
47
|
+
const IOS_APP = process.env.MOBILE_IT_IOS_APP ??
|
|
48
|
+
path.join(APPS_DIR, "..", "..", "mobile-ios", "sample-app", "out", "SampleApp.app");
|
|
49
|
+
const WDA_DIR = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), ".solidx", "wda", "xcode-27.0");
|
|
50
|
+
const apiDemos = {
|
|
51
|
+
appiumUrl: APPIUM,
|
|
52
|
+
udid: UDID,
|
|
53
|
+
appSource: "upload",
|
|
54
|
+
appPath: path.join(APPS_DIR, "ApiDemos-debug.apk"),
|
|
55
|
+
appPackage: "io.appium.android.apis",
|
|
56
|
+
capture: { console: true },
|
|
57
|
+
};
|
|
58
|
+
const rnDemo = {
|
|
59
|
+
appiumUrl: APPIUM,
|
|
60
|
+
udid: UDID,
|
|
61
|
+
appSource: "installed",
|
|
62
|
+
appPackage: "com.saucelabs.mydemoapp.rn",
|
|
63
|
+
appActivity: ".MainActivity",
|
|
64
|
+
capture: { console: true },
|
|
65
|
+
};
|
|
66
|
+
const acc = (value) => ({ by: "accessibilityId", value });
|
|
67
|
+
const apiDemosFlow = {
|
|
68
|
+
id: "apidemos-controls",
|
|
69
|
+
type: "mobile",
|
|
70
|
+
steps: [
|
|
71
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
72
|
+
{ when: { op: "mobile.tap", with: { locator: acc("Views") } } },
|
|
73
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Controls") } } },
|
|
74
|
+
{ and: { op: "mobile.tap", with: { locator: acc("1. Light Theme") } } },
|
|
75
|
+
{ and: { op: "mobile.type", with: { locator: { by: "id", value: "edit" }, text: "hello" } } },
|
|
76
|
+
{ then: { op: "mobile.expectText", with: { locator: { by: "id", value: "edit" }, equals: "hello" } } },
|
|
77
|
+
{ and: { op: "mobile.back" } },
|
|
78
|
+
{ and: { op: "mobile.back" } },
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
const rnLogin = (id) => ({
|
|
82
|
+
id,
|
|
83
|
+
type: "mobile",
|
|
84
|
+
steps: [
|
|
85
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
86
|
+
{ when: { op: "mobile.tap", with: { locator: acc("open menu") } } },
|
|
87
|
+
{ and: { op: "mobile.tap", with: { locator: acc("menu item log in") } } },
|
|
88
|
+
{ and: { op: "mobile.type", with: { locator: acc("Username input field"), text: "bob@example.com" } } },
|
|
89
|
+
{ and: { op: "mobile.type", with: { locator: acc("Password input field"), text: "10203040" } } },
|
|
90
|
+
{ and: { op: "mobile.hideKeyboard" } },
|
|
91
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Login button") } } },
|
|
92
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("products screen"), timeoutMs: 15000 } } },
|
|
93
|
+
],
|
|
94
|
+
});
|
|
95
|
+
const sampleApp = () => ({
|
|
96
|
+
appiumUrl: APPIUM,
|
|
97
|
+
udid: UDID,
|
|
98
|
+
platformName: "iOS",
|
|
99
|
+
simulator: true,
|
|
100
|
+
appSource: "upload",
|
|
101
|
+
appPath: IOS_APP,
|
|
102
|
+
appPackage: "io.solidx.testhub.sample",
|
|
103
|
+
appProcessName: "SampleApp",
|
|
104
|
+
wdaDerivedDataPath: WDA_DIR,
|
|
105
|
+
wdaPrebuilt: fs.existsSync(path.join(WDA_DIR, "Build", "Products", "Debug-iphonesimulator", "WebDriverAgentRunner-Runner.app")),
|
|
106
|
+
capture: { console: true },
|
|
107
|
+
});
|
|
108
|
+
const sampleLogin = (id) => ({
|
|
109
|
+
id,
|
|
110
|
+
type: "mobile",
|
|
111
|
+
steps: [
|
|
112
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
113
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("status label"), equals: "Logged out" } } },
|
|
114
|
+
{ when: { op: "mobile.type", with: { locator: acc("Username input field"), text: "bob" } } },
|
|
115
|
+
{ and: { op: "mobile.type", with: { locator: acc("Password input field"), text: "secret-pass" } } },
|
|
116
|
+
{ and: { op: "mobile.hideKeyboard" } },
|
|
117
|
+
{ and: { op: "mobile.tap", with: { locator: acc("Login button") } } },
|
|
118
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("status label"), equals: "Logged in as bob" } } },
|
|
119
|
+
],
|
|
120
|
+
});
|
|
121
|
+
async function iosChecks() {
|
|
122
|
+
if (!process.env.MOBILE_IT_UDID)
|
|
123
|
+
throw new Error("MOBILE_IT_UDID must be the booted simulator's UDID for MOBILE_IT_PLATFORM=ios");
|
|
124
|
+
if (!fs.existsSync(IOS_APP))
|
|
125
|
+
throw new Error(`The sample app is not built: ${IOS_APP} (run spikes/mobile-ios/sample-app/build.sh)`);
|
|
126
|
+
await check("iOS: login twice in one run; the second starts logged out, which proves the reinstall reset", async () => {
|
|
127
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
128
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [sampleLogin("ios-login-1"), sampleLogin("ios-login-2")], mobile: sampleApp(), reporter });
|
|
129
|
+
assert.deepEqual(reporter.scenarioEnds, [
|
|
130
|
+
{ id: "ios-login-1", ok: true },
|
|
131
|
+
{ id: "ios-login-2", ok: true },
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
await check("iOS: permissions are granted after a reset, so no prompt blocks the location button", async () => {
|
|
135
|
+
const scenario = {
|
|
136
|
+
id: "ios-location",
|
|
137
|
+
type: "mobile",
|
|
138
|
+
steps: [
|
|
139
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
140
|
+
{ when: { op: "mobile.tap", with: { locator: acc("Location button") } } },
|
|
141
|
+
{ then: { op: "mobile.expectText", with: { locator: acc("location label"), equals: "Location: 4" } } },
|
|
142
|
+
],
|
|
143
|
+
};
|
|
144
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
145
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [scenario], mobile: sampleApp(), reporter });
|
|
146
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "ios-location", ok: true }]);
|
|
147
|
+
});
|
|
148
|
+
await check("iOS: mobile.back on a screen with no back button fails instead of passing silently", async () => {
|
|
149
|
+
const scenario = {
|
|
150
|
+
id: "ios-back",
|
|
151
|
+
type: "mobile",
|
|
152
|
+
steps: [{ given: { op: "mobile.launch" } }, { when: { op: "mobile.back" } }],
|
|
153
|
+
};
|
|
154
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
155
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [scenario], mobile: sampleApp(), reporter }), /has no back button on iOS/);
|
|
156
|
+
});
|
|
157
|
+
await check("iOS: a failing scenario still gets the recording and the device log", async () => {
|
|
158
|
+
const failing = {
|
|
159
|
+
id: "ios-fails",
|
|
160
|
+
type: "mobile",
|
|
161
|
+
steps: [
|
|
162
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
163
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
167
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [failing], mobile: sampleApp(), reporter }), /No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/);
|
|
168
|
+
const names = reporter.attachments.filter((a) => a.scenarioId === "ios-fails").map((a) => a.name);
|
|
169
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
170
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
171
|
+
console.log(` attachments: ${names.join(", ") || "(none)"}; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
class ContentReporter extends recording_reporter_1.RecordingReporter {
|
|
175
|
+
constructor() {
|
|
176
|
+
super(...arguments);
|
|
177
|
+
this.contents = new Map();
|
|
178
|
+
}
|
|
179
|
+
attach(args) {
|
|
180
|
+
super.attach(args);
|
|
181
|
+
this.contents.set(`${args.scenarioId}/${args.name}`, String(args.data));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const phoneApp = () => {
|
|
185
|
+
const team = process.env.MOBILE_IT_IOS_TEAM ?? "";
|
|
186
|
+
const wdaDir = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), ".solidx", "wda", `xcode-27.0-iphoneos-${team}`);
|
|
187
|
+
return {
|
|
188
|
+
appiumUrl: APPIUM,
|
|
189
|
+
udid: UDID,
|
|
190
|
+
platformName: "iOS",
|
|
191
|
+
simulator: false,
|
|
192
|
+
appSource: "installed",
|
|
193
|
+
appPackage: process.env.MOBILE_IT_IOS_BUNDLE ?? "com.oswald.mydemoapp",
|
|
194
|
+
appProcessName: process.env.MOBILE_IT_IOS_PROCESS ?? "My Demo App",
|
|
195
|
+
wdaSigning: { teamId: team },
|
|
196
|
+
wdaDerivedDataPath: wdaDir,
|
|
197
|
+
wdaPrebuilt: fs.existsSync(path.join(wdaDir, "Build", "Products", "Debug-iphoneos", "WebDriverAgentRunner-Runner.app")),
|
|
198
|
+
capture: { console: true },
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
async function iosDeviceChecks() {
|
|
202
|
+
if (!process.env.MOBILE_IT_UDID)
|
|
203
|
+
throw new Error("MOBILE_IT_UDID must be the phone's UDID (xcrun devicectl list devices) for MOBILE_IT_PLATFORM=ios-device");
|
|
204
|
+
if (!/^[A-Z0-9]{10}$/.test(process.env.MOBILE_IT_IOS_TEAM ?? "")) {
|
|
205
|
+
throw new Error("MOBILE_IT_IOS_TEAM must be the 10-character Apple team id (the OU of the Apple Development certificate)");
|
|
206
|
+
}
|
|
207
|
+
await check("iPhone: the installed app opens on its catalog without clearing anything", async () => {
|
|
208
|
+
const scenario = {
|
|
209
|
+
id: "phone-catalog",
|
|
210
|
+
type: "mobile",
|
|
211
|
+
steps: [
|
|
212
|
+
{ given: { op: "mobile.launch" } },
|
|
213
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("Catalog-screen"), timeoutMs: 15000 } } },
|
|
214
|
+
],
|
|
215
|
+
};
|
|
216
|
+
const reporter = new ContentReporter();
|
|
217
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [scenario], mobile: phoneApp(), reporter });
|
|
218
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "phone-catalog", ok: true }]);
|
|
219
|
+
});
|
|
220
|
+
await check("iPhone: a tap moves between screens (More tab, then the menu)", async () => {
|
|
221
|
+
const scenario = {
|
|
222
|
+
id: "phone-menu",
|
|
223
|
+
type: "mobile",
|
|
224
|
+
steps: [
|
|
225
|
+
{ given: { op: "mobile.launch" } },
|
|
226
|
+
{ when: { op: "mobile.tap", with: { locator: acc("More-tab-item") } } },
|
|
227
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("GeoLocation-menu-item"), timeoutMs: 15000 } } },
|
|
228
|
+
],
|
|
229
|
+
};
|
|
230
|
+
const reporter = new ContentReporter();
|
|
231
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [scenario], mobile: phoneApp(), reporter });
|
|
232
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "phone-menu", ok: true }]);
|
|
233
|
+
});
|
|
234
|
+
await check("iPhone: clearData is refused with the reason, before the app is touched", async () => {
|
|
235
|
+
const scenario = {
|
|
236
|
+
id: "phone-clear",
|
|
237
|
+
type: "mobile",
|
|
238
|
+
steps: [{ given: { op: "mobile.launch", with: { clearData: true } } }],
|
|
239
|
+
};
|
|
240
|
+
const reporter = new ContentReporter();
|
|
241
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [scenario], mobile: phoneApp(), reporter }), /Clearing data on an iPhone is not supported: Test Hub uses the app already installed on the phone/);
|
|
242
|
+
});
|
|
243
|
+
await check("iPhone: a failing scenario keeps the recording and a device log with the app's own lines", async () => {
|
|
244
|
+
const failing = {
|
|
245
|
+
id: "phone-fails",
|
|
246
|
+
type: "mobile",
|
|
247
|
+
steps: [
|
|
248
|
+
{ given: { op: "mobile.launch" } },
|
|
249
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
250
|
+
],
|
|
251
|
+
};
|
|
252
|
+
const reporter = new ContentReporter();
|
|
253
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [failing], mobile: phoneApp(), reporter }), /No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/);
|
|
254
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
255
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
256
|
+
const log = reporter.contents.get("phone-fails/console.json");
|
|
257
|
+
assert.ok(log, "no console.json was attached");
|
|
258
|
+
const entries = JSON.parse(log);
|
|
259
|
+
const own = entries.filter((e) => e.text.includes(`${process.env.MOBILE_IT_IOS_PROCESS ?? "My Demo App"}`));
|
|
260
|
+
assert.ok(own.length > 0, `the device log has no line from the app (${entries.length} lines kept)`);
|
|
261
|
+
assert.ok(!entries.some((e) => e.text.includes("WebDriverAgentRunner-Runner")), "WebDriverAgent's own lines should be filtered out");
|
|
262
|
+
console.log(` ${entries.length} log lines kept, ${own.length} from the app; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function mp4Duration(data) {
|
|
266
|
+
const at = data.indexOf("mvhd");
|
|
267
|
+
const timescale = data.readUInt32BE(at + 16);
|
|
268
|
+
return data.readUInt32BE(at + 20) / timescale;
|
|
269
|
+
}
|
|
270
|
+
const results = [];
|
|
271
|
+
async function check(name, fn) {
|
|
272
|
+
const startedAt = Date.now();
|
|
273
|
+
try {
|
|
274
|
+
await fn();
|
|
275
|
+
results.push({ name, ok: true, seconds: Math.round((Date.now() - startedAt) / 1000) });
|
|
276
|
+
console.log(`PASS ${name}`);
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
results.push({ name, ok: false, seconds: Math.round((Date.now() - startedAt) / 1000), error: String(error?.message ?? error) });
|
|
280
|
+
console.log(`FAIL ${name}\n ${String(error?.message ?? error).split("\n")[0]}`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
async function main() {
|
|
284
|
+
if (IOS_DEVICE) {
|
|
285
|
+
await iosDeviceChecks();
|
|
286
|
+
const failedPhone = results.filter((r) => !r.ok);
|
|
287
|
+
console.log(`\n${results.length - failedPhone.length}/${results.length} checks passed`);
|
|
288
|
+
process.exit(failedPhone.length ? 1 : 0);
|
|
289
|
+
}
|
|
290
|
+
if (IOS) {
|
|
291
|
+
await iosChecks();
|
|
292
|
+
const failedIos = results.filter((r) => !r.ok);
|
|
293
|
+
console.log(`\n${results.length - failedIos.length}/${results.length} checks passed`);
|
|
294
|
+
process.exit(failedIos.length ? 1 : 0);
|
|
295
|
+
}
|
|
296
|
+
await check("ApiDemos: uploaded APK, bare-id locator, text assertion", async () => {
|
|
297
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
298
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [apiDemosFlow], mobile: apiDemos, reporter });
|
|
299
|
+
assert.deepEqual(reporter.scenarioEnds, [{ id: "apidemos-controls", ok: true }]);
|
|
300
|
+
assert.deepEqual(reporter.runArtifacts, [], "a passing run keeps no recording");
|
|
301
|
+
});
|
|
302
|
+
await check("React Native demo: installed app; two logins in one run prove each scenario starts clean", async () => {
|
|
303
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
304
|
+
await (0, run_from_metadata_1.runFromMetadata)({ scenarios: [rnLogin("rn-login-1"), rnLogin("rn-login-2")], mobile: rnDemo, reporter });
|
|
305
|
+
assert.deepEqual(reporter.scenarioEnds, [
|
|
306
|
+
{ id: "rn-login-1", ok: true },
|
|
307
|
+
{ id: "rn-login-2", ok: true },
|
|
308
|
+
]);
|
|
309
|
+
});
|
|
310
|
+
await check("a failing scenario still gets the recording, and no screenshot is uploaded", async () => {
|
|
311
|
+
const failing = {
|
|
312
|
+
id: "rn-fails",
|
|
313
|
+
type: "mobile",
|
|
314
|
+
steps: [
|
|
315
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
316
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 3000 } } },
|
|
317
|
+
],
|
|
318
|
+
};
|
|
319
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
320
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [failing], mobile: rnDemo, reporter }), /No element matches \{ by: "accessibilityId", value: "does-not-exist" \} after 3000 ms/);
|
|
321
|
+
const names = reporter.attachments.filter((a) => a.scenarioId === "rn-fails").map((a) => a.name);
|
|
322
|
+
assert.ok(!names.includes("screenshot.png"), `screenshot.png should not be attached by default, got: ${names.join(", ")}`);
|
|
323
|
+
assert.deepEqual(reporter.runArtifacts.map((a) => a.name), ["run.mp4"]);
|
|
324
|
+
assert.ok(reporter.runArtifacts[0].bytes > 1000, "recording looks empty");
|
|
325
|
+
console.log(` attachments: ${names.join(", ")}; recording ${reporter.runArtifacts[0].bytes} bytes`);
|
|
326
|
+
});
|
|
327
|
+
if (process.env.MOBILE_IT_LONG === "1") {
|
|
328
|
+
await check("a four-minute run: how much of it does the recording cover?", async () => {
|
|
329
|
+
const waits = Array.from({ length: 11 }, () => [
|
|
330
|
+
{ op: "util.sleep", with: { ms: 20_000 } },
|
|
331
|
+
{ op: "mobile.expectVisible", with: { locator: acc("products screen") } },
|
|
332
|
+
]).flat();
|
|
333
|
+
const long = {
|
|
334
|
+
id: "rn-long",
|
|
335
|
+
type: "mobile",
|
|
336
|
+
steps: [
|
|
337
|
+
{ given: { op: "mobile.launch", with: { clearData: true } } },
|
|
338
|
+
...waits,
|
|
339
|
+
{ then: { op: "mobile.expectVisible", with: { locator: acc("does-not-exist"), timeoutMs: 2000 } } },
|
|
340
|
+
],
|
|
341
|
+
};
|
|
342
|
+
const captured = [];
|
|
343
|
+
const reporter = new recording_reporter_1.RecordingReporter();
|
|
344
|
+
const original = reporter.attachRunArtifact.bind(reporter);
|
|
345
|
+
reporter.attachRunArtifact = (args) => {
|
|
346
|
+
captured.push(Buffer.from(args.data));
|
|
347
|
+
original(args);
|
|
348
|
+
};
|
|
349
|
+
const startedAt = Date.now();
|
|
350
|
+
await assert.rejects((0, run_from_metadata_1.runFromMetadata)({ scenarios: [long], mobile: rnDemo, reporter }));
|
|
351
|
+
assert.equal(captured.length, 1, "expected one recording");
|
|
352
|
+
const outcome = {
|
|
353
|
+
ranSeconds: Math.round((Date.now() - startedAt) / 1000),
|
|
354
|
+
recordedSeconds: Math.round(mp4Duration(captured[0])),
|
|
355
|
+
bytes: captured[0].length,
|
|
356
|
+
};
|
|
357
|
+
console.log(` ${JSON.stringify(outcome)}`);
|
|
358
|
+
const outDir = path.join(APPS_DIR, "..", "out");
|
|
359
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
360
|
+
fs.writeFileSync(path.join(outDir, "long-recording.json"), JSON.stringify(outcome, null, 2));
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
const failed = results.filter((r) => !r.ok);
|
|
364
|
+
console.log(`\n${results.length - failed.length}/${results.length} checks passed`);
|
|
365
|
+
process.exit(failed.length ? 1 : 0);
|
|
366
|
+
}
|
|
367
|
+
void main();
|
|
368
|
+
//# sourceMappingURL=mobile-emulator.integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mobile-emulator.integration.js","sourceRoot":"","sources":["../../../src/testing/__integration__/mobile-emulator.integration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,2DAA6C;AAC7C,4CAA8B;AAC9B,4CAA8B;AAC9B,gDAAkC;AAGlC,qEAAiE;AACjE,mEAA8D;AAE9D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,uBAAuB,CAAC;AACvE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,eAAe,CAAC;AAC3D,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,0EAA0E,CAAC;AAE/G,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,KAAK,CAAC;AACrD,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,YAAY,CAAC;AACnE,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC;AACtF,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,I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ChD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAChD,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC1C,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,gBAAgB,CAAC,CAAC;IACnF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,KAAK,IAAI,EAAE,CAAC","sourcesContent":["// Opt-in integration checks: they drive a real Android emulator or phone through Appium.\n//\n// This is a plain script, not a Jest spec. WebdriverIO's network layer does not survive Jest's sandbox\n// (it crashes the process), and plain Node is what a real run uses anyway.\n//\n// Needs, all running: Appium on MOBILE_IT_APPIUM, a device on MOBILE_IT_UDID, and `webdriverio` that Node can\n// resolve. It is only an optional peer of this package, so point NODE_PATH at a folder that has it.\n//\n// NODE_PATH=/path/to/node_modules npm run test:mobile\n//\n// MOBILE_IT_LONG=1 also runs the four-minute recording check. Exit code is 1 if any check fails.\n//\n// iOS Simulator instead of Android: boot a simulator and start Appium, then\n//\n// MOBILE_IT_PLATFORM=ios MOBILE_IT_UDID=<simulator udid> NODE_PATH=/path/to/node_modules npm run test:mobile\n//\n// It installs the small sample app from the iOS spike (MOBILE_IT_IOS_APP, default\n// test-hub/spikes/mobile-ios/sample-app/out/SampleApp.app, built by its build.sh). WebDriverAgent is cached in\n// MOBILE_IT_WDA (default ~/.solidx/wda/xcode-27.0); the first run builds it, which takes minutes.\n//\n// A real iPhone instead, with the demo app already installed on it (from Xcode, TestFlight or the App Store). Plug the\n// phone into this Mac with a USB cable, unlock it, start Appium, then\n//\n// MOBILE_IT_PLATFORM=ios-device MOBILE_IT_UDID=<phone udid> MOBILE_IT_IOS_TEAM=<10-character team id> \\\n// NODE_PATH=/path/to/node_modules npm run test:mobile\n//\n// The phone's UDID is in `xcrun devicectl list devices`; the team id is the OU of the \"Apple Development\" certificate.\n// MOBILE_IT_IOS_BUNDLE (default com.oswald.mydemoapp) is the installed app's bundle id and MOBILE_IT_IOS_PROCESS (default\n// \"My Demo App\") its executable, which names its lines in the device log. WebDriverAgent is built and signed for the\n// phone into MOBILE_IT_WDA (default ~/.solidx/wda/xcode-27.0-iphoneos-<team>): the first run takes minutes, and the\n// Mac's keychain asks for its password (answer Always Allow).\nimport * as assert from \"node:assert/strict\";\nimport * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport type { MobileAdapterOptions } from \"../adapters/mobile/mobile.types\";\nimport type { ScenarioSpec } from \"../contracts/testing-metadata.types\";\nimport { RecordingReporter } from \"../runner/recording-reporter\";\nimport { runFromMetadata } from \"../runner/run-from-metadata\";\n\nconst APPIUM = process.env.MOBILE_IT_APPIUM ?? \"http://localhost:4723\";\nconst UDID = process.env.MOBILE_IT_UDID ?? \"emulator-5554\";\nconst APPS_DIR =\n process.env.MOBILE_IT_APPS_DIR ?? \"/Users/oswald/projects/Solid_Starters/test-hub/spikes/mobile-appium/apps\";\n\nconst IOS = process.env.MOBILE_IT_PLATFORM === \"ios\";\nconst IOS_DEVICE = process.env.MOBILE_IT_PLATFORM === \"ios-device\";\nconst IOS_APP =\n process.env.MOBILE_IT_IOS_APP ??\n path.join(APPS_DIR, \"..\", \"..\", \"mobile-ios\", \"sample-app\", \"out\", \"SampleApp.app\");\nconst WDA_DIR = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), \".solidx\", \"wda\", \"xcode-27.0\");\n\nconst apiDemos: MobileAdapterOptions = {\n appiumUrl: APPIUM,\n udid: UDID,\n appSource: \"upload\",\n appPath: path.join(APPS_DIR, \"ApiDemos-debug.apk\"),\n appPackage: \"io.appium.android.apis\",\n capture: { console: true },\n};\nconst rnDemo: MobileAdapterOptions = {\n appiumUrl: APPIUM,\n udid: UDID,\n appSource: \"installed\",\n appPackage: \"com.saucelabs.mydemoapp.rn\",\n appActivity: \".MainActivity\",\n capture: { console: true },\n};\n\nconst acc = (value: string) => ({ by: \"accessibilityId\", value });\n\nconst apiDemosFlow: ScenarioSpec = {\n id: \"apidemos-controls\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { when: { op: \"mobile.tap\", with: { locator: acc(\"Views\") } } },\n { and: { op: \"mobile.tap\", with: { locator: acc(\"Controls\") } } },\n { and: { op: \"mobile.tap\", with: { locator: acc(\"1. Light Theme\") } } },\n // A bare id: exercises the app-package prefix.\n { and: { op: \"mobile.type\", with: { locator: { by: \"id\", value: \"edit\" }, text: \"hello\" } } },\n { then: { op: \"mobile.expectText\", with: { locator: { by: \"id\", value: \"edit\" }, equals: \"hello\" } } },\n { and: { op: \"mobile.back\" } },\n { and: { op: \"mobile.back\" } },\n ],\n};\n\nconst rnLogin = (id: string): ScenarioSpec => ({\n id,\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { when: { op: \"mobile.tap\", with: { locator: acc(\"open menu\") } } },\n { and: { op: \"mobile.tap\", with: { locator: acc(\"menu item log in\") } } },\n { and: { op: \"mobile.type\", with: { locator: acc(\"Username input field\"), text: \"bob@example.com\" } } },\n { and: { op: \"mobile.type\", with: { locator: acc(\"Password input field\"), text: \"10203040\" } } },\n { and: { op: \"mobile.hideKeyboard\" } },\n { and: { op: \"mobile.tap\", with: { locator: acc(\"Login button\") } } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"products screen\"), timeoutMs: 15000 } } },\n ],\n});\n\n// ---- iOS Simulator: the spike's sample app (a login form, a persisted login, and a location button) -----------------------\n\nconst sampleApp = (): MobileAdapterOptions => ({\n appiumUrl: APPIUM,\n udid: UDID,\n platformName: \"iOS\",\n simulator: true,\n appSource: \"upload\",\n appPath: IOS_APP,\n appPackage: \"io.solidx.testhub.sample\",\n appProcessName: \"SampleApp\",\n wdaDerivedDataPath: WDA_DIR,\n wdaPrebuilt: fs.existsSync(path.join(WDA_DIR, \"Build\", \"Products\", \"Debug-iphonesimulator\", \"WebDriverAgentRunner-Runner.app\")),\n capture: { console: true },\n});\n\nconst sampleLogin = (id: string): ScenarioSpec => ({\n id,\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { then: { op: \"mobile.expectText\", with: { locator: acc(\"status label\"), equals: \"Logged out\" } } },\n { when: { op: \"mobile.type\", with: { locator: acc(\"Username input field\"), text: \"bob\" } } },\n { and: { op: \"mobile.type\", with: { locator: acc(\"Password input field\"), text: \"secret-pass\" } } },\n { and: { op: \"mobile.hideKeyboard\" } },\n { and: { op: \"mobile.tap\", with: { locator: acc(\"Login button\") } } },\n { then: { op: \"mobile.expectText\", with: { locator: acc(\"status label\"), equals: \"Logged in as bob\" } } },\n ],\n});\n\nasync function iosChecks() {\n if (!process.env.MOBILE_IT_UDID) throw new Error(\"MOBILE_IT_UDID must be the booted simulator's UDID for MOBILE_IT_PLATFORM=ios\");\n if (!fs.existsSync(IOS_APP)) throw new Error(`The sample app is not built: ${IOS_APP} (run spikes/mobile-ios/sample-app/build.sh)`);\n\n await check(\"iOS: login twice in one run; the second starts logged out, which proves the reinstall reset\", async () => {\n const reporter = new RecordingReporter();\n await runFromMetadata({ scenarios: [sampleLogin(\"ios-login-1\"), sampleLogin(\"ios-login-2\")], mobile: sampleApp(), reporter });\n assert.deepEqual(reporter.scenarioEnds, [\n { id: \"ios-login-1\", ok: true },\n { id: \"ios-login-2\", ok: true },\n ]);\n });\n\n await check(\"iOS: permissions are granted after a reset, so no prompt blocks the location button\", async () => {\n const scenario: ScenarioSpec = {\n id: \"ios-location\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { when: { op: \"mobile.tap\", with: { locator: acc(\"Location button\") } } },\n // 4 is CLAuthorizationStatus.authorizedWhenInUse; an alert that autoAcceptAlerts accepted would leave 2 (denied).\n { then: { op: \"mobile.expectText\", with: { locator: acc(\"location label\"), equals: \"Location: 4\" } } },\n ],\n };\n const reporter = new RecordingReporter();\n await runFromMetadata({ scenarios: [scenario], mobile: sampleApp(), reporter });\n assert.deepEqual(reporter.scenarioEnds, [{ id: \"ios-location\", ok: true }]);\n });\n\n await check(\"iOS: mobile.back on a screen with no back button fails instead of passing silently\", async () => {\n const scenario: ScenarioSpec = {\n id: \"ios-back\",\n type: \"mobile\",\n steps: [{ given: { op: \"mobile.launch\" } }, { when: { op: \"mobile.back\" } }],\n };\n const reporter = new RecordingReporter();\n await assert.rejects(runFromMetadata({ scenarios: [scenario], mobile: sampleApp(), reporter }), /has no back button on iOS/);\n });\n\n await check(\"iOS: a failing scenario still gets the recording and the device log\", async () => {\n const failing: ScenarioSpec = {\n id: \"ios-fails\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"does-not-exist\"), timeoutMs: 3000 } } },\n ],\n };\n const reporter = new RecordingReporter();\n await assert.rejects(\n runFromMetadata({ scenarios: [failing], mobile: sampleApp(), reporter }),\n /No element matches \\{ by: \"accessibilityId\", value: \"does-not-exist\" \\} after 3000 ms/,\n );\n const names = reporter.attachments.filter((a) => a.scenarioId === \"ios-fails\").map((a) => a.name);\n assert.deepEqual(reporter.runArtifacts.map((a) => a.name), [\"run.mp4\"]);\n assert.ok(reporter.runArtifacts[0].bytes > 1000, \"recording looks empty\");\n console.log(` attachments: ${names.join(\", \") || \"(none)\"}; recording ${reporter.runArtifacts[0].bytes} bytes`);\n });\n}\n\n// ---- A real iPhone: the demo app, already installed ---------------------------------------------------------------------\n\n/** Keeps what a scenario attached, which the shared RecordingReporter drops. */\nclass ContentReporter extends RecordingReporter {\n contents = new Map<string, string>();\n attach(args: { scenarioId: string; name: string; contentType: string; data: Buffer | string }) {\n super.attach(args);\n this.contents.set(`${args.scenarioId}/${args.name}`, String(args.data));\n }\n}\n\nconst phoneApp = (): MobileAdapterOptions => {\n const team = process.env.MOBILE_IT_IOS_TEAM ?? \"\";\n const wdaDir = process.env.MOBILE_IT_WDA ?? path.join(os.homedir(), \".solidx\", \"wda\", `xcode-27.0-iphoneos-${team}`);\n return {\n appiumUrl: APPIUM,\n udid: UDID,\n platformName: \"iOS\",\n simulator: false,\n appSource: \"installed\",\n appPackage: process.env.MOBILE_IT_IOS_BUNDLE ?? \"com.oswald.mydemoapp\",\n appProcessName: process.env.MOBILE_IT_IOS_PROCESS ?? \"My Demo App\",\n wdaSigning: { teamId: team },\n wdaDerivedDataPath: wdaDir,\n wdaPrebuilt: fs.existsSync(path.join(wdaDir, \"Build\", \"Products\", \"Debug-iphoneos\", \"WebDriverAgentRunner-Runner.app\")),\n capture: { console: true },\n };\n};\n\nasync function iosDeviceChecks() {\n 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\");\n if (!/^[A-Z0-9]{10}$/.test(process.env.MOBILE_IT_IOS_TEAM ?? \"\")) {\n throw new Error(\"MOBILE_IT_IOS_TEAM must be the 10-character Apple team id (the OU of the Apple Development certificate)\");\n }\n\n await check(\"iPhone: the installed app opens on its catalog without clearing anything\", async () => {\n const scenario: ScenarioSpec = {\n id: \"phone-catalog\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\" } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"Catalog-screen\"), timeoutMs: 15000 } } },\n ],\n };\n const reporter = new ContentReporter();\n await runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter });\n assert.deepEqual(reporter.scenarioEnds, [{ id: \"phone-catalog\", ok: true }]);\n });\n\n await check(\"iPhone: a tap moves between screens (More tab, then the menu)\", async () => {\n const scenario: ScenarioSpec = {\n id: \"phone-menu\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\" } },\n { when: { op: \"mobile.tap\", with: { locator: acc(\"More-tab-item\") } } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"GeoLocation-menu-item\"), timeoutMs: 15000 } } },\n ],\n };\n const reporter = new ContentReporter();\n await runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter });\n assert.deepEqual(reporter.scenarioEnds, [{ id: \"phone-menu\", ok: true }]);\n });\n\n await check(\"iPhone: clearData is refused with the reason, before the app is touched\", async () => {\n const scenario: ScenarioSpec = {\n id: \"phone-clear\",\n type: \"mobile\",\n steps: [{ given: { op: \"mobile.launch\", with: { clearData: true } } }],\n };\n const reporter = new ContentReporter();\n await assert.rejects(\n runFromMetadata({ scenarios: [scenario], mobile: phoneApp(), reporter }),\n /Clearing data on an iPhone is not supported: Test Hub uses the app already installed on the phone/,\n );\n });\n\n await check(\"iPhone: a failing scenario keeps the recording and a device log with the app's own lines\", async () => {\n const failing: ScenarioSpec = {\n id: \"phone-fails\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\" } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"does-not-exist\"), timeoutMs: 3000 } } },\n ],\n };\n const reporter = new ContentReporter();\n await assert.rejects(\n runFromMetadata({ scenarios: [failing], mobile: phoneApp(), reporter }),\n /No element matches \\{ by: \"accessibilityId\", value: \"does-not-exist\" \\} after 3000 ms/,\n );\n assert.deepEqual(reporter.runArtifacts.map((a) => a.name), [\"run.mp4\"]);\n assert.ok(reporter.runArtifacts[0].bytes > 1000, \"recording looks empty\");\n const log = reporter.contents.get(\"phone-fails/console.json\");\n assert.ok(log, \"no console.json was attached\");\n const entries = JSON.parse(log) as Array<{ type: string; text: string }>;\n const own = entries.filter((e) => e.text.includes(`${process.env.MOBILE_IT_IOS_PROCESS ?? \"My Demo App\"}`));\n assert.ok(own.length > 0, `the device log has no line from the app (${entries.length} lines kept)`);\n assert.ok(!entries.some((e) => e.text.includes(\"WebDriverAgentRunner-Runner\")), \"WebDriverAgent's own lines should be filtered out\");\n console.log(` ${entries.length} log lines kept, ${own.length} from the app; recording ${reporter.runArtifacts[0].bytes} bytes`);\n });\n}\n\n/** Reads the duration, in seconds, from an MP4's movie header. */\nfunction mp4Duration(data: Buffer): number {\n const at = data.indexOf(\"mvhd\");\n const timescale = data.readUInt32BE(at + 16);\n return data.readUInt32BE(at + 20) / timescale;\n}\n\nconst results: Array<{ name: string; ok: boolean; seconds: number; error?: string }> = [];\nasync function check(name: string, fn: () => Promise<void>) {\n const startedAt = Date.now();\n try {\n await fn();\n results.push({ name, ok: true, seconds: Math.round((Date.now() - startedAt) / 1000) });\n console.log(`PASS ${name}`);\n } catch (error: any) {\n results.push({ name, ok: false, seconds: Math.round((Date.now() - startedAt) / 1000), error: String(error?.message ?? error) });\n console.log(`FAIL ${name}\\n ${String(error?.message ?? error).split(\"\\n\")[0]}`);\n }\n}\n\nasync function main() {\n if (IOS_DEVICE) {\n await iosDeviceChecks();\n const failedPhone = results.filter((r) => !r.ok);\n console.log(`\\n${results.length - failedPhone.length}/${results.length} checks passed`);\n process.exit(failedPhone.length ? 1 : 0);\n }\n if (IOS) {\n await iosChecks();\n const failedIos = results.filter((r) => !r.ok);\n console.log(`\\n${results.length - failedIos.length}/${results.length} checks passed`);\n process.exit(failedIos.length ? 1 : 0);\n }\n\n await check(\"ApiDemos: uploaded APK, bare-id locator, text assertion\", async () => {\n const reporter = new RecordingReporter();\n await runFromMetadata({ scenarios: [apiDemosFlow], mobile: apiDemos, reporter });\n assert.deepEqual(reporter.scenarioEnds, [{ id: \"apidemos-controls\", ok: true }]);\n assert.deepEqual(reporter.runArtifacts, [], \"a passing run keeps no recording\");\n });\n\n await check(\"React Native demo: installed app; two logins in one run prove each scenario starts clean\", async () => {\n const reporter = new RecordingReporter();\n await runFromMetadata({ scenarios: [rnLogin(\"rn-login-1\"), rnLogin(\"rn-login-2\")], mobile: rnDemo, reporter });\n assert.deepEqual(reporter.scenarioEnds, [\n { id: \"rn-login-1\", ok: true },\n { id: \"rn-login-2\", ok: true },\n ]);\n });\n\n await check(\"a failing scenario still gets the recording, and no screenshot is uploaded\", async () => {\n const failing: ScenarioSpec = {\n id: \"rn-fails\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"does-not-exist\"), timeoutMs: 3000 } } },\n ],\n };\n const reporter = new RecordingReporter();\n await assert.rejects(\n runFromMetadata({ scenarios: [failing], mobile: rnDemo, reporter }),\n /No element matches \\{ by: \"accessibilityId\", value: \"does-not-exist\" \\} after 3000 ms/,\n );\n const names = reporter.attachments.filter((a) => a.scenarioId === \"rn-fails\").map((a) => a.name);\n assert.ok(!names.includes(\"screenshot.png\"), `screenshot.png should not be attached by default, got: ${names.join(\", \")}`);\n assert.deepEqual(reporter.runArtifacts.map((a) => a.name), [\"run.mp4\"]);\n assert.ok(reporter.runArtifacts[0].bytes > 1000, \"recording looks empty\");\n console.log(` attachments: ${names.join(\", \")}; recording ${reporter.runArtifacts[0].bytes} bytes`);\n });\n\n if (process.env.MOBILE_IT_LONG === \"1\") {\n await check(\"a four-minute run: how much of it does the recording cover?\", async () => {\n const waits = Array.from({ length: 11 }, () => [\n { op: \"util.sleep\", with: { ms: 20_000 } },\n { op: \"mobile.expectVisible\", with: { locator: acc(\"products screen\") } },\n ]).flat();\n const long: ScenarioSpec = {\n id: \"rn-long\",\n type: \"mobile\",\n steps: [\n { given: { op: \"mobile.launch\", with: { clearData: true } } },\n ...waits,\n { then: { op: \"mobile.expectVisible\", with: { locator: acc(\"does-not-exist\"), timeoutMs: 2000 } } },\n ],\n };\n const captured: Buffer[] = [];\n const reporter = new RecordingReporter();\n const original = reporter.attachRunArtifact.bind(reporter);\n reporter.attachRunArtifact = (args: { name: string; data: Buffer | string }) => {\n captured.push(Buffer.from(args.data));\n original(args);\n };\n const startedAt = Date.now();\n await assert.rejects(runFromMetadata({ scenarios: [long], mobile: rnDemo, reporter }));\n assert.equal(captured.length, 1, \"expected one recording\");\n const outcome = {\n ranSeconds: Math.round((Date.now() - startedAt) / 1000),\n recordedSeconds: Math.round(mp4Duration(captured[0])),\n bytes: captured[0].length,\n };\n console.log(` ${JSON.stringify(outcome)}`);\n const outDir = path.join(APPS_DIR, \"..\", \"out\");\n fs.mkdirSync(outDir, { recursive: true });\n fs.writeFileSync(path.join(outDir, \"long-recording.json\"), JSON.stringify(outcome, null, 2));\n });\n }\n\n const failed = results.filter((r) => !r.ok);\n console.log(`\\n${results.length - failed.length}/${results.length} checks passed`);\n process.exit(failed.length ? 1 : 0);\n}\n\nvoid main();\n"]}
|