@solidxai/core 0.1.22-beta.2 → 0.1.22-beta.4
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 +41 -0
- package/dist/constants/error-messages.d.ts +1 -1
- package/dist/constants/error-messages.d.ts.map +1 -1
- package/dist/constants/error-messages.js +1 -1
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/controllers/agent-registry.controller.d.ts +8 -0
- package/dist/controllers/agent-registry.controller.d.ts.map +1 -1
- package/dist/controllers/agent-registry.controller.js +14 -0
- package/dist/controllers/agent-registry.controller.js.map +1 -1
- package/dist/controllers/agent-session.controller.d.ts +8 -1
- package/dist/controllers/agent-session.controller.d.ts.map +1 -1
- package/dist/controllers/agent-session.controller.js +66 -2
- package/dist/controllers/agent-session.controller.js.map +1 -1
- package/dist/controllers/media-migration-item.controller.d.ts +8 -0
- package/dist/controllers/media-migration-item.controller.d.ts.map +1 -0
- package/dist/controllers/media-migration-item.controller.js +66 -0
- package/dist/controllers/media-migration-item.controller.js.map +1 -0
- package/dist/controllers/media-migration-job.controller.d.ts +8 -0
- package/dist/controllers/media-migration-job.controller.d.ts.map +1 -0
- package/dist/controllers/media-migration-job.controller.js +66 -0
- package/dist/controllers/media-migration-job.controller.js.map +1 -0
- package/dist/controllers/media-migration.controller.d.ts +321 -0
- package/dist/controllers/media-migration.controller.d.ts.map +1 -0
- package/dist/controllers/media-migration.controller.js +197 -0
- package/dist/controllers/media-migration.controller.js.map +1 -0
- package/dist/controllers/media-migration.controller.spec.d.ts +2 -0
- package/dist/controllers/media-migration.controller.spec.d.ts.map +1 -0
- package/dist/controllers/media-migration.controller.spec.js +72 -0
- package/dist/controllers/media-migration.controller.spec.js.map +1 -0
- package/dist/controllers/test-data.controller.d.ts +12 -0
- package/dist/controllers/test-data.controller.d.ts.map +1 -0
- package/dist/controllers/test-data.controller.js +66 -0
- package/dist/controllers/test-data.controller.js.map +1 -0
- package/dist/controllers/test-data.controller.spec.d.ts +2 -0
- package/dist/controllers/test-data.controller.spec.d.ts.map +1 -0
- package/dist/controllers/test-data.controller.spec.js +78 -0
- package/dist/controllers/test-data.controller.spec.js.map +1 -0
- package/dist/dtos/create-agent-job.dto.d.ts +1 -0
- package/dist/dtos/create-agent-job.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-job.dto.js +8 -1
- package/dist/dtos/create-agent-job.dto.js.map +1 -1
- package/dist/dtos/create-agent-process.dto.d.ts +5 -0
- package/dist/dtos/create-agent-process.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-process.dto.js +37 -1
- package/dist/dtos/create-agent-process.dto.js.map +1 -1
- package/dist/dtos/create-agent-registry.dto.d.ts +5 -0
- package/dist/dtos/create-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/create-agent-registry.dto.js +39 -1
- package/dist/dtos/create-agent-registry.dto.js.map +1 -1
- package/dist/dtos/create-agent-session.dto.js +1 -1
- package/dist/dtos/create-agent-session.dto.js.map +1 -1
- package/dist/dtos/create-media-migration.dto.d.ts +21 -0
- package/dist/dtos/create-media-migration.dto.d.ts.map +1 -0
- package/dist/dtos/create-media-migration.dto.js +126 -0
- package/dist/dtos/create-media-migration.dto.js.map +1 -0
- package/dist/dtos/create-media-storage-provider-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-media-storage-provider-metadata.dto.js +11 -0
- package/dist/dtos/create-media-storage-provider-metadata.dto.js.map +1 -1
- package/dist/dtos/create-media-storage-provider-metadata.dto.spec.d.ts +2 -0
- package/dist/dtos/create-media-storage-provider-metadata.dto.spec.d.ts.map +1 -0
- package/dist/dtos/create-media-storage-provider-metadata.dto.spec.js +29 -0
- package/dist/dtos/create-media-storage-provider-metadata.dto.spec.js.map +1 -0
- package/dist/dtos/test-run-request.dto.d.ts +1 -0
- package/dist/dtos/test-run-request.dto.d.ts.map +1 -1
- package/dist/dtos/test-run-request.dto.js +7 -1
- package/dist/dtos/test-run-request.dto.js.map +1 -1
- package/dist/dtos/update-agent-deployment.dto.d.ts +8 -0
- package/dist/dtos/update-agent-deployment.dto.d.ts.map +1 -0
- package/dist/dtos/update-agent-deployment.dto.js +60 -0
- package/dist/dtos/update-agent-deployment.dto.js.map +1 -0
- package/dist/dtos/update-agent-job.dto.d.ts +1 -0
- package/dist/dtos/update-agent-job.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-job.dto.js +8 -1
- package/dist/dtos/update-agent-job.dto.js.map +1 -1
- package/dist/dtos/update-agent-process.dto.d.ts +5 -0
- package/dist/dtos/update-agent-process.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-process.dto.js +37 -1
- package/dist/dtos/update-agent-process.dto.js.map +1 -1
- package/dist/dtos/update-agent-registry.dto.d.ts +5 -0
- package/dist/dtos/update-agent-registry.dto.d.ts.map +1 -1
- package/dist/dtos/update-agent-registry.dto.js +39 -1
- package/dist/dtos/update-agent-registry.dto.js.map +1 -1
- package/dist/dtos/update-agent-session.dto.js +1 -1
- package/dist/dtos/update-agent-session.dto.js.map +1 -1
- package/dist/entities/agent-job.entity.d.ts +1 -0
- package/dist/entities/agent-job.entity.d.ts.map +1 -1
- package/dist/entities/agent-job.entity.js +7 -2
- package/dist/entities/agent-job.entity.js.map +1 -1
- package/dist/entities/agent-process.entity.d.ts +8 -0
- package/dist/entities/agent-process.entity.d.ts.map +1 -1
- package/dist/entities/agent-process.entity.js +38 -1
- package/dist/entities/agent-process.entity.js.map +1 -1
- package/dist/entities/agent-registry.entity.d.ts +5 -0
- package/dist/entities/agent-registry.entity.d.ts.map +1 -1
- package/dist/entities/agent-registry.entity.js +22 -1
- package/dist/entities/agent-registry.entity.js.map +1 -1
- package/dist/entities/agent-session.entity.d.ts.map +1 -1
- package/dist/entities/agent-session.entity.js +3 -1
- package/dist/entities/agent-session.entity.js.map +1 -1
- package/dist/entities/media-migration-item.entity.d.ts +19 -0
- package/dist/entities/media-migration-item.entity.d.ts.map +1 -0
- package/dist/entities/media-migration-item.entity.js +85 -0
- package/dist/entities/media-migration-item.entity.js.map +1 -0
- package/dist/entities/media-migration-job.entity.d.ts +30 -0
- package/dist/entities/media-migration-job.entity.d.ts.map +1 -0
- package/dist/entities/media-migration-job.entity.js +131 -0
- package/dist/entities/media-migration-job.entity.js.map +1 -0
- package/dist/helpers/agent-config-version-name.d.ts +2 -0
- package/dist/helpers/agent-config-version-name.d.ts.map +1 -0
- package/dist/helpers/agent-config-version-name.js +17 -0
- package/dist/helpers/agent-config-version-name.js.map +1 -0
- package/dist/helpers/agent-config-version-name.spec.d.ts +2 -0
- package/dist/helpers/agent-config-version-name.spec.d.ts.map +1 -0
- package/dist/helpers/agent-config-version-name.spec.js +31 -0
- package/dist/helpers/agent-config-version-name.spec.js.map +1 -0
- package/dist/helpers/typeorm-db-helper.d.ts.map +1 -1
- package/dist/helpers/typeorm-db-helper.js +9 -0
- package/dist/helpers/typeorm-db-helper.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/database/media-migration-publisher-database.service.d.ts +13 -0
- package/dist/jobs/database/media-migration-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/media-migration-publisher-database.service.js +39 -0
- package/dist/jobs/database/media-migration-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/media-migration-queue-options-database.d.ts +8 -0
- package/dist/jobs/database/media-migration-queue-options-database.d.ts.map +1 -0
- package/dist/jobs/database/media-migration-queue-options-database.js +10 -0
- package/dist/jobs/database/media-migration-queue-options-database.js.map +1 -0
- package/dist/jobs/database/media-migration-subscriber-database.service.d.ts +21 -0
- package/dist/jobs/database/media-migration-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/media-migration-subscriber-database.service.js +48 -0
- package/dist/jobs/database/media-migration-subscriber-database.service.js.map +1 -0
- 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 +8 -4
- package/dist/jobs/database/test-run-queue-subscriber-database.service.js.map +1 -1
- package/dist/jobs/media-migration-queues.spec.d.ts +2 -0
- package/dist/jobs/media-migration-queues.spec.d.ts.map +1 -0
- package/dist/jobs/media-migration-queues.spec.js +49 -0
- package/dist/jobs/media-migration-queues.spec.js.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-publisher.service.d.ts +13 -0
- package/dist/jobs/rabbitmq/media-migration-publisher.service.d.ts.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-publisher.service.js +39 -0
- package/dist/jobs/rabbitmq/media-migration-publisher.service.js.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-queue-options.d.ts +8 -0
- package/dist/jobs/rabbitmq/media-migration-queue-options.d.ts.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-queue-options.js +10 -0
- package/dist/jobs/rabbitmq/media-migration-queue-options.js.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-subscriber.service.d.ts +19 -0
- package/dist/jobs/rabbitmq/media-migration-subscriber.service.d.ts.map +1 -0
- package/dist/jobs/rabbitmq/media-migration-subscriber.service.js +45 -0
- package/dist/jobs/rabbitmq/media-migration-subscriber.service.js.map +1 -0
- package/dist/jobs/redis/media-migration-publisher-redis.service.d.ts +13 -0
- package/dist/jobs/redis/media-migration-publisher-redis.service.d.ts.map +1 -0
- package/dist/jobs/redis/media-migration-publisher-redis.service.js +39 -0
- package/dist/jobs/redis/media-migration-publisher-redis.service.js.map +1 -0
- package/dist/jobs/redis/media-migration-queue-options-redis.d.ts +8 -0
- package/dist/jobs/redis/media-migration-queue-options-redis.d.ts.map +1 -0
- package/dist/jobs/redis/media-migration-queue-options-redis.js +10 -0
- package/dist/jobs/redis/media-migration-queue-options-redis.js.map +1 -0
- package/dist/jobs/redis/media-migration-subscriber-redis.service.d.ts +19 -0
- package/dist/jobs/redis/media-migration-subscriber-redis.service.d.ts.map +1 -0
- package/dist/jobs/redis/media-migration-subscriber-redis.service.js +45 -0
- package/dist/jobs/redis/media-migration-subscriber-redis.service.js.map +1 -0
- package/dist/repository/media-migration-item.repository.d.ts +12 -0
- package/dist/repository/media-migration-item.repository.d.ts.map +1 -0
- package/dist/repository/media-migration-item.repository.js +34 -0
- package/dist/repository/media-migration-item.repository.js.map +1 -0
- package/dist/repository/media-migration-job.repository.d.ts +12 -0
- package/dist/repository/media-migration-job.repository.d.ts.map +1 -0
- package/dist/repository/media-migration-job.repository.js +34 -0
- package/dist/repository/media-migration-job.repository.js.map +1 -0
- package/dist/resources/agent-embed/solid-agent-embed.js +244 -4
- package/dist/seeders/media-migration-metadata.spec.d.ts +2 -0
- package/dist/seeders/media-migration-metadata.spec.d.ts.map +1 -0
- package/dist/seeders/media-migration-metadata.spec.js +119 -0
- package/dist/seeders/media-migration-metadata.spec.js.map +1 -0
- package/dist/seeders/module-test-data.service.d.ts +19 -0
- package/dist/seeders/module-test-data.service.d.ts.map +1 -1
- package/dist/seeders/module-test-data.service.js +95 -15
- package/dist/seeders/module-test-data.service.js.map +1 -1
- package/dist/seeders/module-test-data.service.spec.d.ts +2 -0
- package/dist/seeders/module-test-data.service.spec.d.ts.map +1 -0
- package/dist/seeders/module-test-data.service.spec.js +158 -0
- package/dist/seeders/module-test-data.service.spec.js.map +1 -0
- package/dist/seeders/seed-data/solid-core-metadata.json +2565 -1162
- package/dist/services/agent-hub-process-manager.service.d.ts +4 -0
- package/dist/services/agent-hub-process-manager.service.d.ts.map +1 -1
- package/dist/services/agent-hub-process-manager.service.js +19 -3
- package/dist/services/agent-hub-process-manager.service.js.map +1 -1
- package/dist/services/agent-registry.service.d.ts +8 -0
- package/dist/services/agent-registry.service.d.ts.map +1 -1
- package/dist/services/agent-registry.service.js +32 -1
- package/dist/services/agent-registry.service.js.map +1 -1
- package/dist/services/crud.service.d.ts +1 -0
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +26 -2
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/file/disk-file.service.d.ts +3 -0
- package/dist/services/file/disk-file.service.d.ts.map +1 -1
- package/dist/services/file/disk-file.service.js +12 -0
- package/dist/services/file/disk-file.service.js.map +1 -1
- package/dist/services/file/file-service.interface.d.ts +1 -0
- package/dist/services/file/file-service.interface.d.ts.map +1 -1
- package/dist/services/file/file-service.interface.js.map +1 -1
- package/dist/services/file/multipart-part-size.d.ts +3 -0
- package/dist/services/file/multipart-part-size.d.ts.map +1 -0
- package/dist/services/file/multipart-part-size.js +16 -0
- package/dist/services/file/multipart-part-size.js.map +1 -0
- package/dist/services/file/multipart-part-size.spec.d.ts +2 -0
- package/dist/services/file/multipart-part-size.spec.d.ts.map +1 -0
- package/dist/services/file/multipart-part-size.spec.js +25 -0
- package/dist/services/file/multipart-part-size.spec.js.map +1 -0
- package/dist/services/file/s3-file.service.d.ts +5 -0
- package/dist/services/file/s3-file.service.d.ts.map +1 -1
- package/dist/services/file/s3-file.service.js +42 -12
- package/dist/services/file/s3-file.service.js.map +1 -1
- package/dist/services/file/s3-file.service.spec.d.ts +2 -0
- package/dist/services/file/s3-file.service.spec.d.ts.map +1 -0
- package/dist/services/file/s3-file.service.spec.js +54 -0
- package/dist/services/file/s3-file.service.spec.js.map +1 -0
- package/dist/services/media-download-url.service.d.ts +5 -2
- package/dist/services/media-download-url.service.d.ts.map +1 -1
- package/dist/services/media-download-url.service.js +22 -1
- package/dist/services/media-download-url.service.js.map +1 -1
- package/dist/services/media-download-url.service.spec.d.ts +2 -0
- package/dist/services/media-download-url.service.spec.d.ts.map +1 -0
- package/dist/services/media-download-url.service.spec.js +55 -0
- package/dist/services/media-download-url.service.spec.js.map +1 -0
- package/dist/services/media-file-storage.service.d.ts +17 -0
- package/dist/services/media-file-storage.service.d.ts.map +1 -0
- package/dist/services/media-file-storage.service.js +73 -0
- package/dist/services/media-file-storage.service.js.map +1 -0
- package/dist/services/media-file-storage.service.spec.d.ts +2 -0
- package/dist/services/media-file-storage.service.spec.d.ts.map +1 -0
- package/dist/services/media-file-storage.service.spec.js +46 -0
- package/dist/services/media-file-storage.service.spec.js.map +1 -0
- package/dist/services/media-migration/media-location.d.ts +20 -0
- package/dist/services/media-migration/media-location.d.ts.map +1 -0
- package/dist/services/media-migration/media-location.js +140 -0
- package/dist/services/media-migration/media-location.js.map +1 -0
- package/dist/services/media-migration/media-location.spec.d.ts +2 -0
- package/dist/services/media-migration/media-location.spec.d.ts.map +1 -0
- package/dist/services/media-migration/media-location.spec.js +148 -0
- package/dist/services/media-migration/media-location.spec.js.map +1 -0
- package/dist/services/media-migration/media-migration-runner.service.d.ts +44 -0
- package/dist/services/media-migration/media-migration-runner.service.d.ts.map +1 -0
- package/dist/services/media-migration/media-migration-runner.service.js +434 -0
- package/dist/services/media-migration/media-migration-runner.service.js.map +1 -0
- package/dist/services/media-migration/media-migration-scope.d.ts +21 -0
- package/dist/services/media-migration/media-migration-scope.d.ts.map +1 -0
- package/dist/services/media-migration/media-migration-scope.js +128 -0
- package/dist/services/media-migration/media-migration-scope.js.map +1 -0
- package/dist/services/media-migration/media-migration.integration.spec.d.ts +2 -0
- package/dist/services/media-migration/media-migration.integration.spec.d.ts.map +1 -0
- package/dist/services/media-migration/media-migration.integration.spec.js +688 -0
- package/dist/services/media-migration/media-migration.integration.spec.js.map +1 -0
- package/dist/services/media-migration/media-migration.service.d.ts +86 -0
- package/dist/services/media-migration/media-migration.service.d.ts.map +1 -0
- package/dist/services/media-migration/media-migration.service.js +468 -0
- package/dist/services/media-migration/media-migration.service.js.map +1 -0
- package/dist/services/media-migration/media-transfer.service.d.ts +26 -0
- package/dist/services/media-migration/media-transfer.service.d.ts.map +1 -0
- package/dist/services/media-migration/media-transfer.service.js +274 -0
- package/dist/services/media-migration/media-transfer.service.js.map +1 -0
- package/dist/services/media-migration/media-transfer.service.spec.d.ts +2 -0
- package/dist/services/media-migration/media-transfer.service.spec.d.ts.map +1 -0
- package/dist/services/media-migration/media-transfer.service.spec.js +266 -0
- package/dist/services/media-migration/media-transfer.service.spec.js.map +1 -0
- package/dist/services/media-migration/migration-error.d.ts +10 -0
- package/dist/services/media-migration/migration-error.d.ts.map +1 -0
- package/dist/services/media-migration/migration-error.js +40 -0
- package/dist/services/media-migration/migration-error.js.map +1 -0
- package/dist/services/media-migration/migration-error.spec.d.ts +2 -0
- package/dist/services/media-migration/migration-error.spec.d.ts.map +1 -0
- package/dist/services/media-migration/migration-error.spec.js +37 -0
- package/dist/services/media-migration/migration-error.spec.js.map +1 -0
- package/dist/services/media-migration-item.service.d.ts +12 -0
- package/dist/services/media-migration-item.service.d.ts.map +1 -0
- package/dist/services/media-migration-item.service.js +38 -0
- package/dist/services/media-migration-item.service.js.map +1 -0
- package/dist/services/media-migration-job.service.d.ts +12 -0
- package/dist/services/media-migration-job.service.d.ts.map +1 -0
- package/dist/services/media-migration-job.service.js +38 -0
- package/dist/services/media-migration-job.service.js.map +1 -0
- package/dist/services/media-storage-provider-changes.d.ts +15 -0
- package/dist/services/media-storage-provider-changes.d.ts.map +1 -0
- package/dist/services/media-storage-provider-changes.js +39 -0
- package/dist/services/media-storage-provider-changes.js.map +1 -0
- package/dist/services/media-storage-provider-changes.spec.d.ts +2 -0
- package/dist/services/media-storage-provider-changes.spec.d.ts.map +1 -0
- package/dist/services/media-storage-provider-changes.spec.js +47 -0
- package/dist/services/media-storage-provider-changes.spec.js.map +1 -0
- package/dist/services/media-storage-provider-metadata.service.d.ts +6 -1
- package/dist/services/media-storage-provider-metadata.service.d.ts.map +1 -1
- package/dist/services/media-storage-provider-metadata.service.js +59 -5
- package/dist/services/media-storage-provider-metadata.service.js.map +1 -1
- package/dist/services/media-storage-provider-metadata.service.spec.d.ts +2 -0
- package/dist/services/media-storage-provider-metadata.service.spec.d.ts.map +1 -0
- package/dist/services/media-storage-provider-metadata.service.spec.js +88 -0
- package/dist/services/media-storage-provider-metadata.service.spec.js.map +1 -0
- package/dist/services/media.service.d.ts +3 -1
- package/dist/services/media.service.d.ts.map +1 -1
- package/dist/services/media.service.js +12 -35
- package/dist/services/media.service.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts +4 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js +33 -23
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.spec.d.ts +2 -0
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.spec.d.ts.map +1 -0
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.spec.js +63 -0
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.spec.js.map +1 -0
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts +3 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.js +8 -9
- package/dist/services/mediaStorageProviders/file-storage-provider.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +12 -2
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
- package/dist/services/settings/default-settings-provider.service.js +7 -1
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +41 -0
- package/dist/solid-core.module.js.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.d.ts +11 -0
- package/dist/testing/adapters/ui/browser-provisioner.d.ts.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.js +51 -1
- package/dist/testing/adapters/ui/browser-provisioner.js.map +1 -1
- package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts +2 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.d.ts.map +1 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.js +137 -0
- package/dist/testing/adapters/ui/browser-provisioner.spec.js.map +1 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts +7 -0
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.js +37 -8
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
- package/dist/testing/adapters/ui/run-video.d.ts +40 -0
- package/dist/testing/adapters/ui/run-video.d.ts.map +1 -0
- package/dist/testing/adapters/ui/run-video.js +113 -0
- package/dist/testing/adapters/ui/run-video.js.map +1 -0
- package/dist/testing/adapters/ui/run-video.spec.d.ts +2 -0
- package/dist/testing/adapters/ui/run-video.spec.d.ts.map +1 -0
- package/dist/testing/adapters/ui/run-video.spec.js +62 -0
- package/dist/testing/adapters/ui/run-video.spec.js.map +1 -0
- package/dist/testing/contracts/testing-metadata.types.d.ts +1 -0
- 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/testing-engine.d.ts +1 -1
- package/dist/testing/core/testing-engine.d.ts.map +1 -1
- package/dist/testing/core/testing-engine.js +22 -4
- package/dist/testing/core/testing-engine.js.map +1 -1
- package/dist/testing/reporter/lifecycle-events.types.d.ts +1 -1
- 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.map +1 -1
- package/dist/testing/reporter/lifecycle-webhook-reporter.js +2 -0
- package/dist/testing/reporter/lifecycle-webhook-reporter.js.map +1 -1
- package/dist/testing/runner/read-scenarios-file.d.ts +1 -0
- package/dist/testing/runner/read-scenarios-file.d.ts.map +1 -1
- package/dist/testing/runner/read-scenarios-file.js +20 -0
- package/dist/testing/runner/read-scenarios-file.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.d.ts.map +1 -1
- package/dist/testing/runner/run-from-metadata.js +9 -1
- package/dist/testing/runner/run-from-metadata.js.map +1 -1
- package/dist/testing/runner/run-from-metadata.spec.js +12 -1
- package/dist/testing/runner/run-from-metadata.spec.js.map +1 -1
- package/dist/transformers/typeorm/bigint-to-number-transformer.d.ts +3 -0
- package/dist/transformers/typeorm/bigint-to-number-transformer.d.ts.map +1 -0
- package/dist/transformers/typeorm/bigint-to-number-transformer.js +8 -0
- package/dist/transformers/typeorm/bigint-to-number-transformer.js.map +1 -0
- package/package.json +2 -1
- package/postman/media-migration.postman_collection.json +519 -0
- package/postman/media-migration.test.postman_collection.json +1013 -0
- package/resources/agent-embed/solid-agent-embed.js +244 -4
- package/src/constants/error-messages.ts +2 -1
- package/src/controllers/agent-registry.controller.ts +8 -1
- package/src/controllers/agent-session.controller.ts +37 -2
- package/src/controllers/media-migration-item.controller.ts +32 -0
- package/src/controllers/media-migration-job.controller.ts +32 -0
- package/src/controllers/media-migration.controller.spec.ts +85 -0
- package/src/controllers/media-migration.controller.ts +123 -0
- package/src/controllers/test-data.controller.spec.ts +94 -0
- package/src/controllers/test-data.controller.ts +58 -0
- package/src/dtos/create-agent-job.dto.ts +6 -0
- package/src/dtos/create-agent-process.dto.ts +32 -1
- package/src/dtos/create-agent-registry.dto.ts +34 -1
- package/src/dtos/create-agent-session.dto.ts +1 -1
- package/src/dtos/create-media-migration.dto.ts +95 -0
- package/src/dtos/create-media-storage-provider-metadata.dto.spec.ts +35 -0
- package/src/dtos/create-media-storage-provider-metadata.dto.ts +9 -0
- package/src/dtos/test-run-request.dto.ts +6 -0
- package/src/dtos/update-agent-deployment.dto.ts +37 -0
- package/src/dtos/update-agent-job.dto.ts +6 -0
- package/src/dtos/update-agent-process.dto.ts +32 -1
- package/src/dtos/update-agent-registry.dto.ts +34 -1
- package/src/dtos/update-agent-session.dto.ts +1 -1
- package/src/entities/agent-job.entity.ts +5 -1
- package/src/entities/agent-process.entity.ts +28 -0
- package/src/entities/agent-registry.entity.ts +15 -0
- package/src/entities/agent-session.entity.ts +3 -0
- package/src/entities/media-migration-item.entity.ts +67 -0
- package/src/entities/media-migration-job.entity.ts +103 -0
- package/src/helpers/agent-config-version-name.spec.ts +35 -0
- package/src/helpers/agent-config-version-name.ts +16 -0
- package/src/helpers/typeorm-db-helper.ts +12 -0
- package/src/index.ts +8 -0
- package/src/jobs/database/media-migration-publisher-database.service.ts +24 -0
- package/src/jobs/database/media-migration-queue-options-database.ts +9 -0
- package/src/jobs/database/media-migration-subscriber-database.service.ts +37 -0
- package/src/jobs/database/test-run-queue-subscriber-database.service.ts +10 -6
- package/src/jobs/media-migration-queues.spec.ts +53 -0
- package/src/jobs/rabbitmq/media-migration-publisher.service.ts +24 -0
- package/src/jobs/rabbitmq/media-migration-queue-options.ts +9 -0
- package/src/jobs/rabbitmq/media-migration-subscriber.service.ts +31 -0
- package/src/jobs/redis/media-migration-publisher-redis.service.ts +24 -0
- package/src/jobs/redis/media-migration-queue-options-redis.ts +9 -0
- package/src/jobs/redis/media-migration-subscriber-redis.service.ts +31 -0
- package/src/repository/media-migration-item.repository.ts +17 -0
- package/src/repository/media-migration-job.repository.ts +17 -0
- package/src/seeders/media-migration-metadata.spec.ts +97 -0
- package/src/seeders/module-test-data.service.spec.ts +184 -0
- package/src/seeders/module-test-data.service.ts +136 -20
- package/src/seeders/seed-data/solid-core-metadata.json +2565 -1162
- package/src/services/agent-hub-process-manager.service.ts +25 -4
- package/src/services/agent-registry.service.ts +35 -2
- package/src/services/crud.service.ts +30 -2
- package/src/services/file/disk-file.service.ts +16 -0
- package/src/services/file/file-service.interface.ts +2 -0
- package/src/services/file/multipart-part-size.spec.ts +26 -0
- package/src/services/file/multipart-part-size.ts +18 -0
- package/src/services/file/s3-file.service.spec.ts +65 -0
- package/src/services/file/s3-file.service.ts +56 -15
- package/src/services/media-download-url.service.spec.ts +62 -0
- package/src/services/media-download-url.service.ts +33 -2
- package/src/services/media-file-storage.service.spec.ts +51 -0
- package/src/services/media-file-storage.service.ts +75 -0
- package/src/services/media-migration/media-location.spec.ts +130 -0
- package/src/services/media-migration/media-location.ts +149 -0
- package/src/services/media-migration/media-migration-runner.service.ts +563 -0
- package/src/services/media-migration/media-migration-scope.ts +136 -0
- package/src/services/media-migration/media-migration.integration.spec.ts +802 -0
- package/src/services/media-migration/media-migration.service.ts +576 -0
- package/src/services/media-migration/media-transfer.service.spec.ts +288 -0
- package/src/services/media-migration/media-transfer.service.ts +285 -0
- package/src/services/media-migration/migration-error.spec.ts +41 -0
- package/src/services/media-migration/migration-error.ts +70 -0
- package/src/services/media-migration-item.service.ts +20 -0
- package/src/services/media-migration-job.service.ts +20 -0
- package/src/services/media-storage-provider-changes.spec.ts +55 -0
- package/src/services/media-storage-provider-changes.ts +70 -0
- package/src/services/media-storage-provider-metadata.service.spec.ts +99 -0
- package/src/services/media-storage-provider-metadata.service.ts +71 -4
- package/src/services/media.service.ts +10 -50
- package/src/services/mediaStorageProviders/file-s3-storage-provider.spec.ts +69 -0
- package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +40 -30
- package/src/services/mediaStorageProviders/file-storage-provider.ts +8 -9
- package/src/services/settings/default-settings-provider.service.ts +11 -1
- package/src/solid-core.module.ts +41 -0
- package/src/testing/adapters/ui/browser-provisioner.spec.ts +131 -0
- package/src/testing/adapters/ui/browser-provisioner.ts +85 -2
- package/src/testing/adapters/ui/playwright-adapter.ts +48 -10
- package/src/testing/adapters/ui/run-video.spec.ts +72 -0
- package/src/testing/adapters/ui/run-video.ts +122 -0
- package/src/testing/contracts/testing-metadata.types.ts +5 -0
- package/src/testing/core/testing-engine.ts +28 -5
- package/src/testing/reporter/lifecycle-events.types.ts +2 -1
- package/src/testing/reporter/lifecycle-webhook-reporter.ts +1 -0
- package/src/testing/runner/read-scenarios-file.ts +24 -0
- package/src/testing/runner/run-from-metadata.spec.ts +15 -1
- package/src/testing/runner/run-from-metadata.ts +13 -5
- package/src/transformers/typeorm/bigint-to-number-transformer.ts +7 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ClipTiming {
|
|
2
|
+
startedAt: number;
|
|
3
|
+
endedAt: number;
|
|
4
|
+
durationMs: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ScenarioMark {
|
|
7
|
+
scenarioId: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
attempt: number;
|
|
10
|
+
ok: boolean;
|
|
11
|
+
startedAt: number;
|
|
12
|
+
endedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export interface RunVideoTimeline {
|
|
15
|
+
version: 1;
|
|
16
|
+
oneFile: boolean;
|
|
17
|
+
clips: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
durationMs: number;
|
|
20
|
+
}>;
|
|
21
|
+
scenarios: Array<{
|
|
22
|
+
scenarioId: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
attempt: number;
|
|
25
|
+
ok: boolean;
|
|
26
|
+
clip: number;
|
|
27
|
+
startMs: number;
|
|
28
|
+
endMs: number;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export declare function videoPosition(clips: ClipTiming[], t: number): {
|
|
32
|
+
clip: number;
|
|
33
|
+
ms: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function buildTimeline(clips: ClipTiming[], names: string[], marks: ScenarioMark[], oneFile: boolean): RunVideoTimeline;
|
|
36
|
+
export declare function findFfmpeg(): Promise<string | undefined>;
|
|
37
|
+
export declare function clipDurationMs(ffmpeg: string, file: string): Promise<number | undefined>;
|
|
38
|
+
export declare function parseDurationMs(ffmpegOutput: string): number | undefined;
|
|
39
|
+
export declare function joinClips(ffmpeg: string, files: string[], listFile: string, out: string): Promise<boolean>;
|
|
40
|
+
//# sourceMappingURL=run-video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-video.d.ts","sourceRoot":"","sources":["../../../../src/testing/adapters/ui/run-video.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE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,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAMhH"}
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
exports.videoPosition = videoPosition;
|
|
37
|
+
exports.buildTimeline = buildTimeline;
|
|
38
|
+
exports.findFfmpeg = findFfmpeg;
|
|
39
|
+
exports.clipDurationMs = clipDurationMs;
|
|
40
|
+
exports.parseDurationMs = parseDurationMs;
|
|
41
|
+
exports.joinClips = joinClips;
|
|
42
|
+
const child_process_1 = require("child_process");
|
|
43
|
+
function videoPosition(clips, t) {
|
|
44
|
+
for (const [clip, c] of clips.entries()) {
|
|
45
|
+
if (t > c.endedAt)
|
|
46
|
+
continue;
|
|
47
|
+
if (t < c.startedAt)
|
|
48
|
+
return { clip, ms: 0 };
|
|
49
|
+
return { clip, ms: Math.min(c.durationMs, Math.max(0, c.durationMs - (c.endedAt - t))) };
|
|
50
|
+
}
|
|
51
|
+
const last = clips.length - 1;
|
|
52
|
+
return { clip: last, ms: clips[last]?.durationMs ?? 0 };
|
|
53
|
+
}
|
|
54
|
+
function buildTimeline(clips, names, marks, oneFile) {
|
|
55
|
+
const offsets = clips.map((_, i) => clips.slice(0, i).reduce((sum, c) => sum + c.durationMs, 0));
|
|
56
|
+
const first = clips[0];
|
|
57
|
+
const last = clips[clips.length - 1];
|
|
58
|
+
const scenarios = !first
|
|
59
|
+
? []
|
|
60
|
+
: marks
|
|
61
|
+
.filter((m) => m.endedAt >= first.startedAt && m.startedAt <= last.endedAt)
|
|
62
|
+
.map((m) => {
|
|
63
|
+
const start = videoPosition(clips, m.startedAt);
|
|
64
|
+
const end = videoPosition(clips, m.endedAt);
|
|
65
|
+
const endMs = end.clip === start.clip ? end.ms : clips[start.clip].durationMs;
|
|
66
|
+
const at = (clip, ms) => (oneFile ? offsets[clip] + ms : ms);
|
|
67
|
+
return {
|
|
68
|
+
scenarioId: m.scenarioId,
|
|
69
|
+
...(m.name ? { name: m.name } : {}),
|
|
70
|
+
attempt: m.attempt,
|
|
71
|
+
ok: m.ok,
|
|
72
|
+
clip: oneFile ? 0 : start.clip,
|
|
73
|
+
startMs: Math.round(at(start.clip, start.ms)),
|
|
74
|
+
endMs: Math.round(oneFile ? at(end.clip, end.ms) : endMs),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
const total = clips.reduce((sum, c) => sum + c.durationMs, 0);
|
|
78
|
+
return {
|
|
79
|
+
version: 1,
|
|
80
|
+
oneFile,
|
|
81
|
+
clips: oneFile ? [{ name: names[0], durationMs: Math.round(total) }] : clips.map((c, i) => ({ name: names[i], durationMs: Math.round(c.durationMs) })),
|
|
82
|
+
scenarios,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function run(bin, args) {
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
(0, child_process_1.execFile)(bin, args, { maxBuffer: 4 * 1024 * 1024, timeout: 120_000 }, (error, _stdout, stderr) => {
|
|
88
|
+
resolve({ ok: !error, stderr: String(stderr ?? "") });
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async function findFfmpeg() {
|
|
93
|
+
const bin = process.env.SOLID_FFMPEG_PATH?.trim() || "ffmpeg";
|
|
94
|
+
return (await run(bin, ["-hide_banner", "-version"])).ok ? bin : undefined;
|
|
95
|
+
}
|
|
96
|
+
async function clipDurationMs(ffmpeg, file) {
|
|
97
|
+
const { stderr } = await run(ffmpeg, ["-hide_banner", "-i", file]);
|
|
98
|
+
return parseDurationMs(stderr);
|
|
99
|
+
}
|
|
100
|
+
function parseDurationMs(ffmpegOutput) {
|
|
101
|
+
const m = /Duration:\s*(\d+):(\d+):(\d+(?:\.\d+)?)/.exec(ffmpegOutput);
|
|
102
|
+
if (!m)
|
|
103
|
+
return undefined;
|
|
104
|
+
return (Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3])) * 1000;
|
|
105
|
+
}
|
|
106
|
+
async function joinClips(ffmpeg, files, listFile, out) {
|
|
107
|
+
const fs = await Promise.resolve().then(() => __importStar(require("fs")));
|
|
108
|
+
const quote = (f) => `file '${f.replace(/'/g, "'\\''")}'`;
|
|
109
|
+
await fs.promises.writeFile(listFile, files.map(quote).join("\n") + "\n");
|
|
110
|
+
const { ok } = await run(ffmpeg, ["-hide_banner", "-v", "error", "-y", "-f", "concat", "-safe", "0", "-i", listFile, "-c", "copy", out]);
|
|
111
|
+
return ok && fs.existsSync(out);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=run-video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-video.js","sourceRoot":"","sources":["../../../../src/testing/adapters/ui/run-video.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,sCAQC;AAMD,sCA+BC;AAWD,gCAGC;AAGD,wCAGC;AAED,0CAIC;AAGD,8BAMC;AAzHD,iDAAyC;AAyCzC,SAAgB,aAAa,CAAC,KAAmB,EAAE,CAAS;IAC1D,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS;YAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,UAAU,IAAI,CAAC,EAAE,CAAC;AAC1D,CAAC;AAMD,SAAgB,aAAa,CAAC,KAAmB,EAAE,KAAe,EAAE,KAAqB,EAAE,OAAgB;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,CAAC,CAAC,GAAG,IAAI,CAAC;AACzE,CAAC;AAGM,KAAK,UAAU,SAAS,CAAC,MAAc,EAAE,KAAe,EAAE,QAAgB,EAAE,GAAW;IAC5F,MAAM,EAAE,GAAG,wDAAa,IAAI,GAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;IAClE,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1E,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACzI,OAAO,EAAE,IAAI,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { execFile } from \"child_process\";\n\n/**\n * The whole-run video and where each scenario is in it.\n *\n * Playwright records one clip per browser context, so a run that opens a new context for `session: restore|fresh`\n * has several. They are joined into one file with ffmpeg (from SOLID_FFMPEG_PATH, else `ffmpeg` on the PATH);\n * without ffmpeg the clips stay separate and the timeline says which clip each scenario is in.\n */\n\n/** One recorded clip: when its page was open (wall clock) and how long the clip actually is. */\nexport interface ClipTiming {\n startedAt: number;\n endedAt: number;\n durationMs: number;\n}\n\n/** One scenario attempt, by wall clock. */\nexport interface ScenarioMark {\n scenarioId: string;\n name?: string;\n attempt: number;\n ok: boolean;\n startedAt: number;\n endedAt: number;\n}\n\nexport interface RunVideoTimeline {\n version: 1;\n /** Every scenario is in one file: the clips were joined, or there was only one. */\n oneFile: boolean;\n clips: Array<{ name: string; durationMs: number }>;\n /** Times are milliseconds into `clips[clip]`. */\n scenarios: Array<{ scenarioId: string; name?: string; attempt: number; ok: boolean; clip: number; startMs: number; endMs: number }>;\n}\n\n/**\n * Where wall-clock time `t` is in the recording: the clip and how far into it. Recording starts a moment after the\n * page opens but runs until the context closes, so the position is measured back from the clip's end. A time\n * between two clips (a context switch) is the start of the next one.\n */\nexport function videoPosition(clips: ClipTiming[], t: number): { clip: number; ms: number } {\n for (const [clip, c] of clips.entries()) {\n if (t > c.endedAt) continue;\n if (t < c.startedAt) return { clip, ms: 0 };\n return { clip, ms: Math.min(c.durationMs, Math.max(0, c.durationMs - (c.endedAt - t))) };\n }\n const last = clips.length - 1;\n return { clip: last, ms: clips[last]?.durationMs ?? 0 };\n}\n\n/**\n * The timeline of a run's video. `oneFile`: the clips are joined in order into one file, so every time is into\n * that file. Scenarios that ran while nothing was recording (e.g. API scenarios before the browser opened) are left out.\n */\nexport function buildTimeline(clips: ClipTiming[], names: string[], marks: ScenarioMark[], oneFile: boolean): RunVideoTimeline {\n const offsets = clips.map((_, i) => clips.slice(0, i).reduce((sum, c) => sum + c.durationMs, 0));\n const first = clips[0];\n const last = clips[clips.length - 1];\n const scenarios = !first\n ? []\n : marks\n .filter((m) => m.endedAt >= first.startedAt && m.startedAt <= last.endedAt)\n .map((m) => {\n const start = videoPosition(clips, m.startedAt);\n const end = videoPosition(clips, m.endedAt);\n // Separate clips: a scenario cannot run past the end of the clip it started in.\n const endMs = end.clip === start.clip ? end.ms : clips[start.clip].durationMs;\n const at = (clip: number, ms: number) => (oneFile ? offsets[clip] + ms : ms);\n return {\n scenarioId: m.scenarioId,\n ...(m.name ? { name: m.name } : {}),\n attempt: m.attempt,\n ok: m.ok,\n clip: oneFile ? 0 : start.clip,\n startMs: Math.round(at(start.clip, start.ms)),\n endMs: Math.round(oneFile ? at(end.clip, end.ms) : endMs),\n };\n });\n const total = clips.reduce((sum, c) => sum + c.durationMs, 0);\n return {\n version: 1,\n oneFile,\n clips: oneFile ? [{ name: names[0], durationMs: Math.round(total) }] : clips.map((c, i) => ({ name: names[i], durationMs: Math.round(c.durationMs) })),\n scenarios,\n };\n}\n\nfunction run(bin: string, args: string[]): Promise<{ ok: boolean; stderr: string }> {\n return new Promise((resolve) => {\n execFile(bin, args, { maxBuffer: 4 * 1024 * 1024, timeout: 120_000 }, (error, _stdout, stderr) => {\n resolve({ ok: !error, stderr: String(stderr ?? \"\") });\n });\n });\n}\n\n/** The ffmpeg to use, or undefined when there is none. */\nexport async function findFfmpeg(): Promise<string | undefined> {\n const bin = process.env.SOLID_FFMPEG_PATH?.trim() || \"ffmpeg\";\n return (await run(bin, [\"-hide_banner\", \"-version\"])).ok ? bin : undefined;\n}\n\n/** A clip's length from ffmpeg's \"Duration: 00:00:02.44\" line, or undefined. */\nexport async function clipDurationMs(ffmpeg: string, file: string): Promise<number | undefined> {\n const { stderr } = await run(ffmpeg, [\"-hide_banner\", \"-i\", file]);\n return parseDurationMs(stderr);\n}\n\nexport function parseDurationMs(ffmpegOutput: string): number | undefined {\n const m = /Duration:\\s*(\\d+):(\\d+):(\\d+(?:\\.\\d+)?)/.exec(ffmpegOutput);\n if (!m) return undefined;\n return (Number(m[1]) * 3600 + Number(m[2]) * 60 + Number(m[3])) * 1000;\n}\n\n/** Join same-size WebM clips into `out` without re-encoding. */\nexport async function joinClips(ffmpeg: string, files: string[], listFile: string, out: string): Promise<boolean> {\n const fs = await import(\"fs\");\n const quote = (f: string) => `file '${f.replace(/'/g, \"'\\\\''\")}'`;\n await fs.promises.writeFile(listFile, files.map(quote).join(\"\\n\") + \"\\n\");\n const { ok } = await run(ffmpeg, [\"-hide_banner\", \"-v\", \"error\", \"-y\", \"-f\", \"concat\", \"-safe\", \"0\", \"-i\", listFile, \"-c\", \"copy\", out]);\n return ok && fs.existsSync(out);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-video.spec.d.ts","sourceRoot":"","sources":["../../../../src/testing/adapters/ui/run-video.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const run_video_1 = require("./run-video");
|
|
4
|
+
const CLIPS = [
|
|
5
|
+
{ startedAt: 1_000, endedAt: 3_650, durationMs: 2_440 },
|
|
6
|
+
{ startedAt: 3_700, endedAt: 7_870, durationMs: 3_920 },
|
|
7
|
+
];
|
|
8
|
+
const mark = (scenarioId, startedAt, endedAt, ok = true, attempt = 1) => ({
|
|
9
|
+
scenarioId,
|
|
10
|
+
attempt,
|
|
11
|
+
ok,
|
|
12
|
+
startedAt,
|
|
13
|
+
endedAt,
|
|
14
|
+
});
|
|
15
|
+
describe("run video timeline", () => {
|
|
16
|
+
it("measures a time back from the end of its clip", () => {
|
|
17
|
+
expect((0, run_video_1.videoPosition)(CLIPS, 3_650)).toEqual({ clip: 0, ms: 2_440 });
|
|
18
|
+
expect((0, run_video_1.videoPosition)(CLIPS, 2_650)).toEqual({ clip: 0, ms: 1_440 });
|
|
19
|
+
expect((0, run_video_1.videoPosition)(CLIPS, 1_000)).toEqual({ clip: 0, ms: 0 });
|
|
20
|
+
});
|
|
21
|
+
it("puts a time between two clips at the start of the next", () => {
|
|
22
|
+
expect((0, run_video_1.videoPosition)(CLIPS, 3_680)).toEqual({ clip: 1, ms: 0 });
|
|
23
|
+
expect((0, run_video_1.videoPosition)(CLIPS, 9_000)).toEqual({ clip: 1, ms: 3_920 });
|
|
24
|
+
});
|
|
25
|
+
it("gives every scenario its place in the joined file", () => {
|
|
26
|
+
const timeline = (0, run_video_1.buildTimeline)(CLIPS, ["run.webm"], [
|
|
27
|
+
mark("login", 1_100, 3_600),
|
|
28
|
+
mark("tasks-list", 4_000, 5_000),
|
|
29
|
+
mark("task-create", 5_000, 7_800, false),
|
|
30
|
+
], true);
|
|
31
|
+
expect(timeline.oneFile).toBe(true);
|
|
32
|
+
expect(timeline.clips).toEqual([{ name: "run.webm", durationMs: 6_360 }]);
|
|
33
|
+
expect(timeline.scenarios).toEqual([
|
|
34
|
+
{ scenarioId: "login", attempt: 1, ok: true, clip: 0, startMs: 0, endMs: 2_390 },
|
|
35
|
+
{ scenarioId: "tasks-list", attempt: 1, ok: true, clip: 0, startMs: 2_440 + 50, endMs: 2_440 + 1_050 },
|
|
36
|
+
{ scenarioId: "task-create", attempt: 1, ok: false, clip: 0, startMs: 2_440 + 1_050, endMs: 2_440 + 3_850 },
|
|
37
|
+
]);
|
|
38
|
+
});
|
|
39
|
+
it("keeps clip-relative times when the clips stay separate", () => {
|
|
40
|
+
const timeline = (0, run_video_1.buildTimeline)(CLIPS, ["run-1.webm", "run-2.webm"], [mark("tasks-list", 4_000, 5_000)], false);
|
|
41
|
+
expect(timeline.oneFile).toBe(false);
|
|
42
|
+
expect(timeline.clips).toEqual([
|
|
43
|
+
{ name: "run-1.webm", durationMs: 2_440 },
|
|
44
|
+
{ name: "run-2.webm", durationMs: 3_920 },
|
|
45
|
+
]);
|
|
46
|
+
expect(timeline.scenarios).toEqual([{ scenarioId: "tasks-list", attempt: 1, ok: true, clip: 1, startMs: 50, endMs: 1_050 }]);
|
|
47
|
+
});
|
|
48
|
+
it("leaves out scenarios that ran while nothing was recording, and keeps retries apart", () => {
|
|
49
|
+
const timeline = (0, run_video_1.buildTimeline)(CLIPS, ["run.webm"], [
|
|
50
|
+
mark("api-health", 100, 900),
|
|
51
|
+
mark("flaky", 4_000, 4_500, false, 1),
|
|
52
|
+
mark("flaky", 4_500, 5_000, true, 2),
|
|
53
|
+
], true);
|
|
54
|
+
expect(timeline.scenarios.map((s) => `${s.scenarioId}#${s.attempt}:${s.ok}`)).toEqual(["flaky#1:false", "flaky#2:true"]);
|
|
55
|
+
});
|
|
56
|
+
it("reads ffmpeg's duration line", () => {
|
|
57
|
+
expect((0, run_video_1.parseDurationMs)(" Duration: 00:00:06.36, start: 0.000000, bitrate: 19 kb/s")).toBe(6_360);
|
|
58
|
+
expect((0, run_video_1.parseDurationMs)(" Duration: 01:02:03.50, start: 0")).toBe(3_723_500);
|
|
59
|
+
expect((0, run_video_1.parseDurationMs)("Duration: N/A")).toBeUndefined();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=run-video.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-video.spec.js","sourceRoot":"","sources":["../../../../src/testing/adapters/ui/run-video.spec.ts"],"names":[],"mappings":";;AAAA,2CAAgH;AAIhH,MAAM,KAAK,GAAiB;IAC1B,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;IACvD,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;CACxD,CAAC;AAEF,MAAM,IAAI,GAAG,CAAC,UAAkB,EAAE,SAAiB,EAAE,OAAe,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,GAAG,CAAC,EAAgB,EAAE,CAAC,CAAC;IAC9G,UAAU;IACV,OAAO;IACP,EAAE;IACF,SAAS;IACT,OAAO;CACR,CAAC,CAAC;AAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,IAAA,yBAAa,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,MAAM,CAAC,IAAA,yBAAa,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEpE,MAAM,CAAC,IAAA,yBAAa,EAAC,KAAK,EAAE,KAAK,CA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,EAAE;QAC5F,MAAM,QAAQ,GAAG,IAAA,yBAAa,EAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE;YAClD,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,GAAG,CAAC;YAC5B,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACrC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;SACrC,EAAE,IAAI,CAAC,CAAC;QACT,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;IAC3H,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,IAAA,2BAAe,EAAC,4DAA4D,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClG,MAAM,CAAC,IAAA,2BAAe,EAAC,mCAAmC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7E,MAAM,CAAC,IAAA,2BAAe,EAAC,eAAe,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { buildTimeline, parseDurationMs, videoPosition, type ClipTiming, type ScenarioMark } from \"./run-video\";\n\n// Two contexts as Playwright records them: each clip is a little shorter than its page was open,\n// because recording starts a moment after the page opens.\nconst CLIPS: ClipTiming[] = [\n { startedAt: 1_000, endedAt: 3_650, durationMs: 2_440 },\n { startedAt: 3_700, endedAt: 7_870, durationMs: 3_920 },\n];\n\nconst mark = (scenarioId: string, startedAt: number, endedAt: number, ok = true, attempt = 1): ScenarioMark => ({\n scenarioId,\n attempt,\n ok,\n startedAt,\n endedAt,\n});\n\ndescribe(\"run video timeline\", () => {\n it(\"measures a time back from the end of its clip\", () => {\n expect(videoPosition(CLIPS, 3_650)).toEqual({ clip: 0, ms: 2_440 });\n expect(videoPosition(CLIPS, 2_650)).toEqual({ clip: 0, ms: 1_440 });\n // The moment the page opened is before the recording started: clamp to 0.\n expect(videoPosition(CLIPS, 1_000)).toEqual({ clip: 0, ms: 0 });\n });\n\n it(\"puts a time between two clips at the start of the next\", () => {\n expect(videoPosition(CLIPS, 3_680)).toEqual({ clip: 1, ms: 0 });\n expect(videoPosition(CLIPS, 9_000)).toEqual({ clip: 1, ms: 3_920 });\n });\n\n it(\"gives every scenario its place in the joined file\", () => {\n const timeline = buildTimeline(CLIPS, [\"run.webm\"], [\n mark(\"login\", 1_100, 3_600),\n mark(\"tasks-list\", 4_000, 5_000),\n mark(\"task-create\", 5_000, 7_800, false),\n ], true);\n\n expect(timeline.oneFile).toBe(true);\n expect(timeline.clips).toEqual([{ name: \"run.webm\", durationMs: 6_360 }]);\n expect(timeline.scenarios).toEqual([\n { scenarioId: \"login\", attempt: 1, ok: true, clip: 0, startMs: 0, endMs: 2_390 },\n // Second clip starts at 2440 in the joined file.\n { scenarioId: \"tasks-list\", attempt: 1, ok: true, clip: 0, startMs: 2_440 + 50, endMs: 2_440 + 1_050 },\n { scenarioId: \"task-create\", attempt: 1, ok: false, clip: 0, startMs: 2_440 + 1_050, endMs: 2_440 + 3_850 },\n ]);\n });\n\n it(\"keeps clip-relative times when the clips stay separate\", () => {\n const timeline = buildTimeline(CLIPS, [\"run-1.webm\", \"run-2.webm\"], [mark(\"tasks-list\", 4_000, 5_000)], false);\n expect(timeline.oneFile).toBe(false);\n expect(timeline.clips).toEqual([\n { name: \"run-1.webm\", durationMs: 2_440 },\n { name: \"run-2.webm\", durationMs: 3_920 },\n ]);\n expect(timeline.scenarios).toEqual([{ scenarioId: \"tasks-list\", attempt: 1, ok: true, clip: 1, startMs: 50, endMs: 1_050 }]);\n });\n\n it(\"leaves out scenarios that ran while nothing was recording, and keeps retries apart\", () => {\n const timeline = buildTimeline(CLIPS, [\"run.webm\"], [\n mark(\"api-health\", 100, 900),\n mark(\"flaky\", 4_000, 4_500, false, 1),\n mark(\"flaky\", 4_500, 5_000, true, 2),\n ], true);\n expect(timeline.scenarios.map((s) => `${s.scenarioId}#${s.attempt}:${s.ok}`)).toEqual([\"flaky#1:false\", \"flaky#2:true\"]);\n });\n\n it(\"reads ffmpeg's duration line\", () => {\n expect(parseDurationMs(\" Duration: 00:00:06.36, start: 0.000000, bitrate: 19 kb/s\")).toBe(6_360);\n expect(parseDurationMs(\" Duration: 01:02:03.50, start: 0\")).toBe(3_723_500);\n expect(parseDurationMs(\"Duration: N/A\")).toBeUndefined();\n });\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-metadata.types.d.ts","sourceRoot":"","sources":["../../../src/testing/contracts/testing-metadata.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAYjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;QAC1B,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;QAC1B,IAAI,CAAC,EAAE,iBAAiB,EAAE,CAAC;QAC3B,SAAS,EAAE,YAAY,EAAE,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"testing-metadata.types.d.ts","sourceRoot":"","sources":["../../../src/testing/contracts/testing-metadata.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CA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,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAMD,MAAM,WAAW,iBAAiB;IAEhC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACxC;AAKD,MAAM,MAAM,SAAS,GACjB;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAE,GAC3B;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GACf,MAAM,CAAC;AAEX,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-metadata.types.js","sourceRoot":"","sources":["../../../src/testing/contracts/testing-metadata.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ScenarioType = \"api\" | \"ui\" | \"mixed\" | \"mobile\";\n\nexport interface TestingDataRecord {\n modelUserKey: string;\n recUserKeyValue: string;\n data: Record<string, any>;\n}\n\nexport interface TestingRoleSpec {\n name: string;\n permissions?: string[];\n}\n\nexport interface TestingUserSpec {\n username: string;\n email: string;\n password: string;\n fullName?: string;\n mobile?: string;\n roles?: string[];\n /**\n * Seed this user through the registered IExtensionUserCreationProvider, making it\n * an instance of the app's extension entity rather than a base `User`.\n *\n * Absent means a base `User`, so existing specs are unaffected. Set it on users\n * that carry extension fields (`userType` and the like) - without it those fields\n * are ignored and a plain `User` is created.\n *\n * `roles` is ignored on a flagged user: the provider derives them from the\n * extension fields, exactly as it does on the model's own CRUD form.\n */\n isExtensionUser?: boolean;\n [key: string]: any;\n}\n\nexport interface TestingMetadata {\n testing: {\n specs?: string[];\n roles?: TestingRoleSpec[];\n users?: TestingUserSpec[];\n data?: TestingDataRecord[];\n scenarios: ScenarioSpec[];\n };\n}\n\nexport interface ScenarioSpec {\n id: string;\n name?: string;\n type: ScenarioType;\n params?: Record<string, any>;\n tags?: string[];\n timeoutMs?: number;\n retries?: number;\n /**\n * Scenarios that must pass before this one runs. Selecting this scenario pulls its\n * dependencies into the run; a failed dependency skips it with `dependency_failed`.\n * Using it anywhere in a run switches that run from fail-fast to dependency-aware.\n */\n dependsOn?: string[];\n /**\n * Start as the identity another scenario signed in as: `restoreFrom: \"login\"` means `login` runs first, its state is saved\n * (it needs no `saveSession`), and this scenario starts from it (`session: \"restore\"`). It is also a dependency, so it need\n * not be listed in `dependsOn`, which keeps only ordering and data dependencies. Only client state is restored (cookies and\n * storage on the web, the signed-in app on mobile), never the page or screen. One scenario id, not a list.\n */\n restoreFrom?: string;\n /** Keep this scenario's browser storage state (cookies + localStorage) after it passes. */\n saveSession?: boolean;\n /**\n * Browser context for this scenario:\n * - `shared` (default): keep the context left by the previous scenario.\n * - `restore`: new context seeded from the nearest `dependsOn` entry that saved a session.\n * - `fresh`: new empty context.\n */\n session?: ScenarioSessionMode;\n /**\n * Mobile only. Marks the one scenario that brings the app back to its signed-out start screen from any state. A real\n * iPhone cannot clear an app's data, so the runner runs this before a scenario that needs a fresh start. It is never run\n * or counted as a scenario of its own.\n */\n reset?: boolean;\n steps: StepBlock[];\n}\n\nexport type ScenarioSessionMode = \"shared\" | \"restore\" | \"fresh\";\n\n/**\n * How UI steps react when their primary selector is missing:\n * - `off`: primary selector only.\n * - `report` (default): fall back to `fallbacks` / `fingerprint`, keep running, report the heal.\n * - `auto`: as `report`, and mark the heal for automatic application to the scenario file.\n */\nexport type HealingPolicy = \"off\" | \"report\" | \"auto\";\n\n/**\n * Identity of a UI target, recorded at authoring time and used to re-find the element\n * when every selector misses. Matched with Playwright's user-facing locators only.\n */\nexport interface TargetFingerprint {\n role?: string;\n name?: string;\n label?: string;\n placeholder?: string;\n testId?: string;\n text?: string;\n /** Selector scoping the search, e.g. a dialog or form. */\n within?: string;\n}\n\n/**\n * Identity of a mobile element, recorded at authoring time and used to find it again when every locator misses. Only\n * `accessibilityId`, `resourceId`, `text` and `label` are matched today; `kind` and `within` are kept for the reviewer.\n */\nexport interface MobileFingerprint {\n /** Short class of the element, e.g. \"Button\", \"EditText\", \"XCUIElementTypeButton\". */\n kind?: string;\n /** The visible label the author saw. */\n label?: string;\n text?: string;\n /** Content description on Android, name on iOS. */\n accessibilityId?: string;\n /** Android resource id without the package prefix. */\n resourceId?: string;\n /** Nearest ancestor with an accessibility id. */\n within?: { by: string; value: string };\n}\n\n/**\n * A step can be written in a phase block (Given/When/Then/And) or as a flat op step.\n */\nexport type StepBlock =\n | { given: OpStep }\n | { when: OpStep }\n | { then: OpStep | OpStep[] }\n | { and: OpStep }\n | OpStep;\n\nexport interface OpStep {\n op: string;\n with?: Record<string, any>;\n saveAs?: string;\n name?: string;\n // spec is used by op \"test.spec\" to point to a registered custom spec implementation.\n spec?: string;\n timeoutMs?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"testing-metadata.types.js","sourceRoot":"","sources":["../../../src/testing/contracts/testing-metadata.types.ts"],"names":[],"mappings":"","sourcesContent":["export type ScenarioType = \"api\" | \"ui\" | \"mixed\" | \"mobile\";\n\nexport interface TestingDataRecord {\n modelUserKey: string;\n recUserKeyValue: string;\n data: Record<string, any>;\n}\n\nexport interface TestingRoleSpec {\n name: string;\n permissions?: string[];\n}\n\nexport interface TestingUserSpec {\n username: string;\n email: string;\n password: string;\n fullName?: string;\n mobile?: string;\n roles?: string[];\n /**\n * Seed this user through the registered IExtensionUserCreationProvider, making it\n * an instance of the app's extension entity rather than a base `User`.\n *\n * Absent means a base `User`, so existing specs are unaffected. Set it on users\n * that carry extension fields (`userType` and the like) - without it those fields\n * are ignored and a plain `User` is created.\n *\n * `roles` is ignored on a flagged user: the provider derives them from the\n * extension fields, exactly as it does on the model's own CRUD form.\n */\n isExtensionUser?: boolean;\n [key: string]: any;\n}\n\nexport interface TestingMetadata {\n testing: {\n specs?: string[];\n roles?: TestingRoleSpec[];\n users?: TestingUserSpec[];\n data?: TestingDataRecord[];\n scenarios: ScenarioSpec[];\n };\n}\n\nexport interface ScenarioSpec {\n id: string;\n name?: string;\n type: ScenarioType;\n params?: Record<string, any>;\n tags?: string[];\n timeoutMs?: number;\n /**\n * How long each step may take, for every step that sets no timeout of its own: the wait for browser and device\n * steps (`with.timeoutMs`), the step-level `timeoutMs` for the rest. `timeoutMs` above bounds the whole scenario.\n */\n stepTimeoutMs?: number;\n retries?: number;\n /**\n * Scenarios that must pass before this one runs. Selecting this scenario pulls its\n * dependencies into the run; a failed dependency skips it with `dependency_failed`.\n * Using it anywhere in a run switches that run from fail-fast to dependency-aware.\n */\n dependsOn?: string[];\n /**\n * Start as the identity another scenario signed in as: `restoreFrom: \"login\"` means `login` runs first, its state is saved\n * (it needs no `saveSession`), and this scenario starts from it (`session: \"restore\"`). It is also a dependency, so it need\n * not be listed in `dependsOn`, which keeps only ordering and data dependencies. Only client state is restored (cookies and\n * storage on the web, the signed-in app on mobile), never the page or screen. One scenario id, not a list.\n */\n restoreFrom?: string;\n /** Keep this scenario's browser storage state (cookies + localStorage) after it passes. */\n saveSession?: boolean;\n /**\n * Browser context for this scenario:\n * - `shared` (default): keep the context left by the previous scenario.\n * - `restore`: new context seeded from the nearest `dependsOn` entry that saved a session.\n * - `fresh`: new empty context.\n */\n session?: ScenarioSessionMode;\n /**\n * Mobile only. Marks the one scenario that brings the app back to its signed-out start screen from any state. A real\n * iPhone cannot clear an app's data, so the runner runs this before a scenario that needs a fresh start. It is never run\n * or counted as a scenario of its own.\n */\n reset?: boolean;\n steps: StepBlock[];\n}\n\nexport type ScenarioSessionMode = \"shared\" | \"restore\" | \"fresh\";\n\n/**\n * How UI steps react when their primary selector is missing:\n * - `off`: primary selector only.\n * - `report` (default): fall back to `fallbacks` / `fingerprint`, keep running, report the heal.\n * - `auto`: as `report`, and mark the heal for automatic application to the scenario file.\n */\nexport type HealingPolicy = \"off\" | \"report\" | \"auto\";\n\n/**\n * Identity of a UI target, recorded at authoring time and used to re-find the element\n * when every selector misses. Matched with Playwright's user-facing locators only.\n */\nexport interface TargetFingerprint {\n role?: string;\n name?: string;\n label?: string;\n placeholder?: string;\n testId?: string;\n text?: string;\n /** Selector scoping the search, e.g. a dialog or form. */\n within?: string;\n}\n\n/**\n * Identity of a mobile element, recorded at authoring time and used to find it again when every locator misses. Only\n * `accessibilityId`, `resourceId`, `text` and `label` are matched today; `kind` and `within` are kept for the reviewer.\n */\nexport interface MobileFingerprint {\n /** Short class of the element, e.g. \"Button\", \"EditText\", \"XCUIElementTypeButton\". */\n kind?: string;\n /** The visible label the author saw. */\n label?: string;\n text?: string;\n /** Content description on Android, name on iOS. */\n accessibilityId?: string;\n /** Android resource id without the package prefix. */\n resourceId?: string;\n /** Nearest ancestor with an accessibility id. */\n within?: { by: string; value: string };\n}\n\n/**\n * A step can be written in a phase block (Given/When/Then/And) or as a flat op step.\n */\nexport type StepBlock =\n | { given: OpStep }\n | { when: OpStep }\n | { then: OpStep | OpStep[] }\n | { and: OpStep }\n | OpStep;\n\nexport interface OpStep {\n op: string;\n with?: Record<string, any>;\n saveAs?: string;\n name?: string;\n // spec is used by op \"test.spec\" to point to a registered custom spec implementation.\n spec?: string;\n timeoutMs?: number;\n}\n"]}
|
|
@@ -22,6 +22,6 @@ export declare class TestingEngine {
|
|
|
22
22
|
runScenario(scenario: ScenarioSpec, ctxBase: Omit<TestContext, "scenarioId" | "scenarioType" | "params">, setup?: ScenarioSetup[]): Promise<void>;
|
|
23
23
|
private runSetup;
|
|
24
24
|
private resolveStep;
|
|
25
|
-
runStep(phase: StepPhase, step: OpStep, ctx: TestContext, stepPath?: string, setup?: string): Promise<unknown>;
|
|
25
|
+
runStep(phase: StepPhase, step: OpStep, ctx: TestContext, stepPath?: string, setup?: string, stepTimeoutMs?: number): Promise<unknown>;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=testing-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-engine.d.ts","sourceRoot":"","sources":["../../../src/testing/core/testing-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAG3F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS3F;AAOD,MAAM,WAAW,aAAa;IAE5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IAEvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAK9B,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"testing-engine.d.ts","sourceRoot":"","sources":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AM,EACjB,KAAK,CAAC,EAAE,MAAM,EACd,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;CA+CpB"}
|
|
@@ -19,6 +19,16 @@ function stepPathFor(block, blockIndex, stepIndex) {
|
|
|
19
19
|
}
|
|
20
20
|
return base;
|
|
21
21
|
}
|
|
22
|
+
function withStepTimeout(step, stepTimeoutMs) {
|
|
23
|
+
if (typeof stepTimeoutMs !== "number" || !Number.isFinite(stepTimeoutMs) || stepTimeoutMs <= 0)
|
|
24
|
+
return step;
|
|
25
|
+
if (step.timeoutMs !== undefined || step.with?.timeoutMs !== undefined)
|
|
26
|
+
return step;
|
|
27
|
+
if (step.op.startsWith("ui.") || step.op.startsWith("mobile.")) {
|
|
28
|
+
return { ...step, with: { ...(step.with ?? {}), timeoutMs: stepTimeoutMs } };
|
|
29
|
+
}
|
|
30
|
+
return { ...step, timeoutMs: stepTimeoutMs };
|
|
31
|
+
}
|
|
22
32
|
const SLOW_CALL_REPORT_MS = 2000;
|
|
23
33
|
class TestingEngine {
|
|
24
34
|
constructor(registry, defaults) {
|
|
@@ -58,7 +68,7 @@ class TestingEngine {
|
|
|
58
68
|
for (const [blockIndex, block] of scenario.steps.entries()) {
|
|
59
69
|
const normalized = (0, normalize_steps_1.normalizeBlock)(block);
|
|
60
70
|
for (const [stepIndex, step] of normalized.steps.entries()) {
|
|
61
|
-
await this.runStep(normalized.phase, step, ctx, stepPathFor(block, blockIndex, stepIndex));
|
|
71
|
+
await this.runStep(normalized.phase, step, ctx, stepPathFor(block, blockIndex, stepIndex), undefined, scenario.stepTimeoutMs);
|
|
62
72
|
}
|
|
63
73
|
}
|
|
64
74
|
};
|
|
@@ -104,6 +114,14 @@ class TestingEngine {
|
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
const durationMs = Date.now() - scenarioStart;
|
|
117
|
+
ctx.ui?.recordScenario({
|
|
118
|
+
scenarioId: scenario.id,
|
|
119
|
+
name: scenario.name,
|
|
120
|
+
attempt,
|
|
121
|
+
ok: !scenarioError,
|
|
122
|
+
startedAt: scenarioStart,
|
|
123
|
+
endedAt: scenarioStart + durationMs,
|
|
124
|
+
});
|
|
107
125
|
const heals = [...(ctx.ui?.getHeals() ?? []), ...(ctx.mobile?.getHeals() ?? [])];
|
|
108
126
|
reporter.onScenarioEnd(scenario, {
|
|
109
127
|
ok: !scenarioError,
|
|
@@ -133,7 +151,7 @@ class TestingEngine {
|
|
|
133
151
|
for (const [stepIndex, step] of normalized.steps.entries()) {
|
|
134
152
|
const stepPath = stepPathFor(block, blockIndex, stepIndex);
|
|
135
153
|
try {
|
|
136
|
-
await this.runStep(normalized.phase, step, partCtx, stepPath, part.kind);
|
|
154
|
+
await this.runStep(normalized.phase, step, partCtx, stepPath, part.kind, part.scenario.stepTimeoutMs);
|
|
137
155
|
}
|
|
138
156
|
catch (err) {
|
|
139
157
|
const failure = new Error(`Setup "${part.kind}" (scenario "${part.scenario.id}") failed at ${stepPath}: ${err?.message ?? err}`);
|
|
@@ -157,7 +175,7 @@ class TestingEngine {
|
|
|
157
175
|
const kept = Object.fromEntries(raw.map((field) => [field, step.with[field]]));
|
|
158
176
|
return { ...resolved, with: { ...resolved.with, ...kept } };
|
|
159
177
|
}
|
|
160
|
-
async runStep(phase, step, ctx, stepPath, setup) {
|
|
178
|
+
async runStep(phase, step, ctx, stepPath, setup, stepTimeoutMs) {
|
|
161
179
|
const reporter = ctx.reporter;
|
|
162
180
|
const stepStart = Date.now();
|
|
163
181
|
let stepError;
|
|
@@ -166,7 +184,7 @@ class TestingEngine {
|
|
|
166
184
|
ctx.stepPath = stepPath;
|
|
167
185
|
reporter.onStepStart({ scenarioId: ctx.scenarioId, phase, step, stepPath, ...(setup ? { setup } : {}) });
|
|
168
186
|
try {
|
|
169
|
-
resolvedStep = this.resolveStep(step, ctx);
|
|
187
|
+
resolvedStep = withStepTimeout(this.resolveStep(step, ctx), stepTimeoutMs);
|
|
170
188
|
const handler = this.registry.get(resolvedStep.op);
|
|
171
189
|
const run = handler(ctx, resolvedStep);
|
|
172
190
|
result =
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing-engine.js","sourceRoot":"","sources":["../../../src/testing/core/testing-engine.ts"],"names":[],"mappings":";;;AAYA,kCASC;AAnBD,mDAAkD;AAClD,uDAAmD;AAEnD,mDAA0D;AAC1D,uCAAwC;AAMxC,SAAgB,WAAW,CAAC,KAAgB,EAAE,UAAkB,EAAE,SAAiB;IACjF,MAAM,IAAI,GAAG,SAAS,UAAU,GAAG,CAAC;IACpC,IAAI,OAAO,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,QAAQ,CAAC;IAC7C,IAAI,MAAM,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,OAAO,CAAC;IAC3C,IAAI,KAAK,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,MAAM,CAAC;IACzC,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC;IACnF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAsBD,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC,MAAa,aAAa;IAIxB,YACE,QAAsB,EACtB,QAAmD;QAEnD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,WAAW,CACf,QAAsB,EACtB,OAAoE,EACpE,QAAyB,EAAE;QAE3B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,CAAC;QAChE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,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YAE1C,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAC3D,QAAQ,CAAC,SAAS,CAAC;gBACjB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,KAAK;gBACL,IAAI,EAAE,YAAY,IAAI,IAAI;gBAC1B,EAAE,EAAE,CAAC,SAAS;gBACd,KAAK,EAAE,SAAS;gBAChB,UAAU;gBACV,QAAQ;gBACR,GAAG,CAAC,aAAa,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AAhOD,sCAgOC","sourcesContent":["import type { TestContext, StepPhase } from \"../contracts/runtime-context.types\";\nimport type { OpStep, ScenarioSpec, StepBlock } from \"../contracts/testing-metadata.types\";\nimport { interpolateDeep } from \"./interpolation\";\nimport { normalizeBlock } from \"./normalize-steps\";\nimport { StepRegistry } from \"./step-registry\";\nimport { scenarioNeedsMobile } from \"../runner/lifecycle\";\nimport { withTimeout } from \"./timeout\";\n\n/**\n * Path of a step inside `scenario.steps`, matching the file layout so a consumer can\n * patch the exact step: `steps[2]`, `steps[3].when`, `steps[5].then[1]`.\n */\nexport function stepPathFor(block: StepBlock, blockIndex: number, stepIndex: number): string {\n const base = `steps[${blockIndex}]`;\n if (\"given\" in block) return `${base}.given`;\n if (\"when\" in block) return `${base}.when`;\n if (\"and\" in block) return `${base}.and`;\n if (\"then\" in block) {\n return Array.isArray(block.then) ? `${base}.then[${stepIndex}]` : `${base}.then`;\n }\n return base;\n}\n\n/**\n * Steps that run before a scenario's own, as part of that scenario's report: bringing a phone back to its start screen,\n * or logging in again, so the scenario does not depend on what ran before it. They keep the scenario they come from\n * (`scenario.id`, and `steps[n]` paths inside it), so a heal found in them can be applied to that scenario's file.\n */\nexport interface ScenarioSetup {\n /** What the steps are for, reported with each one: \"reset\", \"login\". */\n kind: string;\n scenario: ScenarioSpec;\n /** Resolved secret values for the steps' `${secret:...}` tokens. */\n secrets?: Record<string, any>;\n /**\n * After the steps have run, look for this element on the device. When it shows within `timeoutMs` the setup is over; when it\n * does not, `orElse` runs in its place. It is how a restore avoids replaying a login the app is still in.\n */\n probe?: { locator: unknown; timeoutMs: number };\n orElse?: ScenarioSetup[];\n}\n\n/** A device lookup slower than this is reported with its step. */\nconst SLOW_CALL_REPORT_MS = 2000;\n\nexport class TestingEngine {\n private readonly registry: StepRegistry;\n private readonly defaults?: { timeoutMs?: number; retries?: number };\n\n constructor(\n registry: StepRegistry,\n defaults?: { timeoutMs?: number; retries?: number },\n ) {\n this.registry = registry;\n this.defaults = defaults;\n }\n\n async runScenario(\n scenario: ScenarioSpec,\n ctxBase: Omit<TestContext, \"scenarioId\" | \"scenarioType\" | \"params\">,\n setup: ScenarioSetup[] = [],\n ): Promise<void> {\n const retries = scenario.retries ?? this.defaults?.retries ?? 0;\n const maxAttempts = Math.max(0, retries) + 1;\n const scenarioTimeoutMs =\n scenario.timeoutMs ?? this.defaults?.timeoutMs;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n const ctx: TestContext = {\n ...ctxBase,\n scenarioId: scenario.id,\n scenarioType: scenario.type,\n params: scenario.params ?? {},\n };\n\n const reporter = ctx.reporter;\n const scenarioStart = Date.now();\n let scenarioError: unknown;\n\n reporter.onScenarioStart(scenario);\n // Start a clean capture window for this scenario (UI adapter buffers console/network\n // events; they're only flushed to the reporter if the scenario fails below).\n ctx.ui?.resetCapture();\n const usesMobile = scenarioNeedsMobile(scenario) && !!ctx.mobile?.isStarted();\n if (usesMobile) await ctx.mobile?.resetCapture();\n\n try {\n const execute = async () => {\n for (const part of setup) {\n await this.runSetup(part, ctx);\n // A probe is a question, not a step: a missing element is an answer, and is not reported as a failure.\n if (part.probe) {\n // Showing is what counts, as for an expectVisible. Any failure to find it, or to get an answer in time, is a \"no\".\n const there = await ctx.mobile?.findDisplayed(part.probe.locator, part.probe.timeoutMs).then(() => true, () => false);\n if (!there) for (const fallback of part.orElse ?? []) await this.runSetup(fallback, ctx);\n }\n }\n for (const [blockIndex, block] of scenario.steps.entries()) {\n const normalized = normalizeBlock(block);\n for (const [stepIndex, step] of normalized.steps.entries()) {\n await this.runStep(normalized.phase, step, ctx, stepPathFor(block, blockIndex, stepIndex));\n }\n }\n };\n\n if (scenarioTimeoutMs !== undefined) {\n await withTimeout(\n execute(),\n scenarioTimeoutMs,\n `Scenario timeout after ${scenarioTimeoutMs}ms: \"${scenario.id}\"`,\n );\n } else {\n await execute();\n }\n } catch (err: any) {\n scenarioError = err;\n } finally {\n // On failure, flush the UI adapter's captured artifacts (console + network) BEFORE\n // onScenarioEnd — the lifecycle reporter snapshots the attached artifacts inside\n // onScenarioEnd. No page (e.g. API scenarios) → nothing captured.\n if (scenarioError && ctx.ui?.page && reporter.attach) {\n try {\n const artifacts = await ctx.ui.collectFailureArtifacts();\n for (const a of artifacts) {\n reporter.attach({\n scenarioId: ctx.scenarioId,\n name: a.name,\n contentType: a.contentType,\n data: a.data,\n });\n }\n } catch {\n // Artifact capture is best-effort; never let it mask the scenario error.\n }\n }\n\n // Same for a mobile scenario: device log and a screenshot of the failing screen.\n if (scenarioError && usesMobile && reporter.attach) {\n try {\n const artifacts = (await ctx.mobile?.collectFailureArtifacts()) ?? [];\n for (const a of artifacts) {\n reporter.attach({\n scenarioId: ctx.scenarioId,\n name: a.name,\n contentType: a.contentType,\n data: a.data,\n });\n }\n } catch {\n // Best-effort, like the UI artifacts above.\n }\n }\n\n const durationMs = Date.now() - scenarioStart;\n const heals = [...(ctx.ui?.getHeals() ?? []), ...(ctx.mobile?.getHeals() ?? [])];\n reporter.onScenarioEnd(scenario, {\n ok: !scenarioError,\n error: scenarioError,\n durationMs,\n ...(heals.length ? { heals } : {}),\n });\n }\n\n if (!scenarioError) {\n return;\n }\n\n if (attempt >= maxAttempts) {\n throw scenarioError;\n }\n }\n }\n\n /** Runs one setup part's steps in the part's own scenario context, and names the part when one of them fails. */\n private async runSetup(part: ScenarioSetup, ctx: TestContext): Promise<void> {\n const partCtx: TestContext = {\n ...ctx,\n scenarioId: part.scenario.id,\n scenarioType: part.scenario.type,\n params: part.scenario.params ?? {},\n secrets: part.secrets,\n };\n for (const [blockIndex, block] of part.scenario.steps.entries()) {\n const normalized = normalizeBlock(block);\n for (const [stepIndex, step] of normalized.steps.entries()) {\n const stepPath = stepPathFor(block, blockIndex, stepIndex);\n try {\n await this.runStep(normalized.phase, step, partCtx, stepPath, part.kind);\n } catch (err: any) {\n const failure = new Error(`Setup \"${part.kind}\" (scenario \"${part.scenario.id}\") failed at ${stepPath}: ${err?.message ?? err}`);\n (failure as Error & { cause?: unknown }).cause = err;\n throw failure;\n }\n }\n }\n }\n\n // Interpolates the step, except the `with` fields its op takes as written (StepOptions.rawWith).\n private resolveStep(step: OpStep, ctx: TestContext): OpStep {\n const raw = this.registry\n .rawWithFields(step.op)\n .filter((field) => step.with && typeof step.with === \"object\" && field in step.with);\n if (!raw.length) {\n return interpolateDeep(step, ctx);\n }\n const rest = { ...step.with };\n for (const field of raw) delete rest[field];\n const resolved = interpolateDeep({ ...step, with: rest }, ctx);\n const kept = Object.fromEntries(raw.map((field) => [field, step.with![field]]));\n return { ...resolved, with: { ...resolved.with, ...kept } };\n }\n\n /**\n * Run one step exactly as a scenario would: interpolate, dispatch, honor `timeoutMs`,\n * store `saveAs`, and report start/end. Throws the step's error.\n */\n async runStep(\n phase: StepPhase,\n step: OpStep,\n ctx: TestContext,\n stepPath?: string,\n setup?: string,\n ): Promise<unknown> {\n const reporter = ctx.reporter;\n const stepStart = Date.now();\n let stepError: unknown;\n let resolvedStep: OpStep | undefined;\n let result: unknown;\n\n ctx.stepPath = stepPath;\n reporter.onStepStart({ scenarioId: ctx.scenarioId, phase, step, stepPath, ...(setup ? { setup } : {}) });\n\n try {\n resolvedStep = this.resolveStep(step, ctx);\n const handler = this.registry.get(resolvedStep.op);\n const run = handler(ctx, resolvedStep);\n result =\n resolvedStep.timeoutMs !== undefined\n ? await withTimeout(\n run,\n resolvedStep.timeoutMs,\n `Step timeout after ${resolvedStep.timeoutMs}ms: \"${resolvedStep.op}\"`,\n )\n : await run;\n\n if (resolvedStep.saveAs) {\n ctx.resources.set(resolvedStep.saveAs, result);\n }\n return result;\n } catch (err: any) {\n stepError = err;\n throw err;\n } finally {\n const durationMs = Date.now() - stepStart;\n // Taken for every mobile step so the figure never carries over; only a slow one is worth reporting.\n const slowestCallMs = ctx.mobile?.takeSlowestCallMs() ?? 0;\n reporter.onStepEnd({\n scenarioId: ctx.scenarioId,\n phase,\n step: resolvedStep ?? step,\n ok: !stepError,\n error: stepError,\n durationMs,\n stepPath,\n ...(slowestCallMs >= SLOW_CALL_REPORT_MS ? { slowestCallMs } : {}),\n ...(setup ? { setup } : {}),\n });\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"testing-engine.js","sourceRoot":"","sources":["../../../src/testing/core/testing-engine.ts"],"names":[],"mappings":";;;AAYA,kCASC;AAnBD,mDAAkD;AAClD,uDAAmD;AAEnD,mDAA0D;AAC1D,uCAAwC;AAMxC,SAAgB,WAAW,CAAC,KAAgB,EAAE,UAAkB,EAAE,SAAiB;IACjF,MAAM,IAAI,GAAG,SAAS,UAAU,GAAG,CAAC;IACpC,IAAI,OAAO,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,QAAQ,CAAC;IAC7C,IAAI,MAAM,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,OAAO,CAAC;IAC3C,IAAI,KAAK,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,MAAM,CAAC;IACzC,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,S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AAY,CAAC,MAAM,EAAE,CAAC;gBACxB,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,SAAS,GAAG,GAAG,CAAC;YAChB,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YAE1C,MAAM,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC;YAC3D,QAAQ,CAAC,SAAS,CAAC;gBACjB,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,KAAK;gBACL,IAAI,EAAE,YAAY,IAAI,IAAI;gBAC1B,EAAE,EAAE,CAAC,SAAS;gBACd,KAAK,EAAE,SAAS;gBAChB,UAAU;gBACV,QAAQ;gBACR,GAAG,CAAC,aAAa,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF;AA1OD,sCA0OC","sourcesContent":["import type { TestContext, StepPhase } from \"../contracts/runtime-context.types\";\nimport type { OpStep, ScenarioSpec, StepBlock } from \"../contracts/testing-metadata.types\";\nimport { interpolateDeep } from \"./interpolation\";\nimport { normalizeBlock } from \"./normalize-steps\";\nimport { StepRegistry } from \"./step-registry\";\nimport { scenarioNeedsMobile } from \"../runner/lifecycle\";\nimport { withTimeout } from \"./timeout\";\n\n/**\n * Path of a step inside `scenario.steps`, matching the file layout so a consumer can\n * patch the exact step: `steps[2]`, `steps[3].when`, `steps[5].then[1]`.\n */\nexport function stepPathFor(block: StepBlock, blockIndex: number, stepIndex: number): string {\n const base = `steps[${blockIndex}]`;\n if (\"given\" in block) return `${base}.given`;\n if (\"when\" in block) return `${base}.when`;\n if (\"and\" in block) return `${base}.and`;\n if (\"then\" in block) {\n return Array.isArray(block.then) ? `${base}.then[${stepIndex}]` : `${base}.then`;\n }\n return base;\n}\n\n/**\n * Steps that run before a scenario's own, as part of that scenario's report: bringing a phone back to its start screen,\n * or logging in again, so the scenario does not depend on what ran before it. They keep the scenario they come from\n * (`scenario.id`, and `steps[n]` paths inside it), so a heal found in them can be applied to that scenario's file.\n */\nexport interface ScenarioSetup {\n /** What the steps are for, reported with each one: \"reset\", \"login\". */\n kind: string;\n scenario: ScenarioSpec;\n /** Resolved secret values for the steps' `${secret:...}` tokens. */\n secrets?: Record<string, any>;\n /**\n * After the steps have run, look for this element on the device. When it shows within `timeoutMs` the setup is over; when it\n * does not, `orElse` runs in its place. It is how a restore avoids replaying a login the app is still in.\n */\n probe?: { locator: unknown; timeoutMs: number };\n orElse?: ScenarioSetup[];\n}\n\n/**\n * `step` with the scenario's step timeout, unless it sets its own. Browser and device steps take it as their wait\n * (`with.timeoutMs`, which their Playwright and Appium calls use); any other step is cut off after it.\n */\nfunction withStepTimeout(step: OpStep, stepTimeoutMs?: number): OpStep {\n if (typeof stepTimeoutMs !== \"number\" || !Number.isFinite(stepTimeoutMs) || stepTimeoutMs <= 0) return step;\n if (step.timeoutMs !== undefined || step.with?.timeoutMs !== undefined) return step;\n if (step.op.startsWith(\"ui.\") || step.op.startsWith(\"mobile.\")) {\n return { ...step, with: { ...(step.with ?? {}), timeoutMs: stepTimeoutMs } };\n }\n return { ...step, timeoutMs: stepTimeoutMs };\n}\n\n/** A device lookup slower than this is reported with its step. */\nconst SLOW_CALL_REPORT_MS = 2000;\n\nexport class TestingEngine {\n private readonly registry: StepRegistry;\n private readonly defaults?: { timeoutMs?: number; retries?: number };\n\n constructor(\n registry: StepRegistry,\n defaults?: { timeoutMs?: number; retries?: number },\n ) {\n this.registry = registry;\n this.defaults = defaults;\n }\n\n async runScenario(\n scenario: ScenarioSpec,\n ctxBase: Omit<TestContext, \"scenarioId\" | \"scenarioType\" | \"params\">,\n setup: ScenarioSetup[] = [],\n ): Promise<void> {\n const retries = scenario.retries ?? this.defaults?.retries ?? 0;\n const maxAttempts = Math.max(0, retries) + 1;\n const scenarioTimeoutMs =\n scenario.timeoutMs ?? this.defaults?.timeoutMs;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n const ctx: TestContext = {\n ...ctxBase,\n scenarioId: scenario.id,\n scenarioType: scenario.type,\n params: scenario.params ?? {},\n };\n\n const reporter = ctx.reporter;\n const scenarioStart = Date.now();\n let scenarioError: unknown;\n\n reporter.onScenarioStart(scenario);\n // Start a clean capture window for this scenario (UI adapter buffers console/network\n // events; they're only flushed to the reporter if the scenario fails below).\n ctx.ui?.resetCapture();\n const usesMobile = scenarioNeedsMobile(scenario) && !!ctx.mobile?.isStarted();\n if (usesMobile) await ctx.mobile?.resetCapture();\n\n try {\n const execute = async () => {\n for (const part of setup) {\n await this.runSetup(part, ctx);\n // A probe is a question, not a step: a missing element is an answer, and is not reported as a failure.\n if (part.probe) {\n // Showing is what counts, as for an expectVisible. Any failure to find it, or to get an answer in time, is a \"no\".\n const there = await ctx.mobile?.findDisplayed(part.probe.locator, part.probe.timeoutMs).then(() => true, () => false);\n if (!there) for (const fallback of part.orElse ?? []) await this.runSetup(fallback, ctx);\n }\n }\n for (const [blockIndex, block] of scenario.steps.entries()) {\n const normalized = normalizeBlock(block);\n for (const [stepIndex, step] of normalized.steps.entries()) {\n await this.runStep(normalized.phase, step, ctx, stepPathFor(block, blockIndex, stepIndex), undefined, scenario.stepTimeoutMs);\n }\n }\n };\n\n if (scenarioTimeoutMs !== undefined) {\n await withTimeout(\n execute(),\n scenarioTimeoutMs,\n `Scenario timeout after ${scenarioTimeoutMs}ms: \"${scenario.id}\"`,\n );\n } else {\n await execute();\n }\n } catch (err: any) {\n scenarioError = err;\n } finally {\n // On failure, flush the UI adapter's captured artifacts (console + network) BEFORE\n // onScenarioEnd — the lifecycle reporter snapshots the attached artifacts inside\n // onScenarioEnd. No page (e.g. API scenarios) → nothing captured.\n if (scenarioError && ctx.ui?.page && reporter.attach) {\n try {\n const artifacts = await ctx.ui.collectFailureArtifacts();\n for (const a of artifacts) {\n reporter.attach({\n scenarioId: ctx.scenarioId,\n name: a.name,\n contentType: a.contentType,\n data: a.data,\n });\n }\n } catch {\n // Artifact capture is best-effort; never let it mask the scenario error.\n }\n }\n\n // Same for a mobile scenario: device log and a screenshot of the failing screen.\n if (scenarioError && usesMobile && reporter.attach) {\n try {\n const artifacts = (await ctx.mobile?.collectFailureArtifacts()) ?? [];\n for (const a of artifacts) {\n reporter.attach({\n scenarioId: ctx.scenarioId,\n name: a.name,\n contentType: a.contentType,\n data: a.data,\n });\n }\n } catch {\n // Best-effort, like the UI artifacts above.\n }\n }\n\n const durationMs = Date.now() - scenarioStart;\n ctx.ui?.recordScenario({\n scenarioId: scenario.id,\n name: scenario.name,\n attempt,\n ok: !scenarioError,\n startedAt: scenarioStart,\n endedAt: scenarioStart + durationMs,\n });\n const heals = [...(ctx.ui?.getHeals() ?? []), ...(ctx.mobile?.getHeals() ?? [])];\n reporter.onScenarioEnd(scenario, {\n ok: !scenarioError,\n error: scenarioError,\n durationMs,\n ...(heals.length ? { heals } : {}),\n });\n }\n\n if (!scenarioError) {\n return;\n }\n\n if (attempt >= maxAttempts) {\n throw scenarioError;\n }\n }\n }\n\n /** Runs one setup part's steps in the part's own scenario context, and names the part when one of them fails. */\n private async runSetup(part: ScenarioSetup, ctx: TestContext): Promise<void> {\n const partCtx: TestContext = {\n ...ctx,\n scenarioId: part.scenario.id,\n scenarioType: part.scenario.type,\n params: part.scenario.params ?? {},\n secrets: part.secrets,\n };\n for (const [blockIndex, block] of part.scenario.steps.entries()) {\n const normalized = normalizeBlock(block);\n for (const [stepIndex, step] of normalized.steps.entries()) {\n const stepPath = stepPathFor(block, blockIndex, stepIndex);\n try {\n await this.runStep(normalized.phase, step, partCtx, stepPath, part.kind, part.scenario.stepTimeoutMs);\n } catch (err: any) {\n const failure = new Error(`Setup \"${part.kind}\" (scenario \"${part.scenario.id}\") failed at ${stepPath}: ${err?.message ?? err}`);\n (failure as Error & { cause?: unknown }).cause = err;\n throw failure;\n }\n }\n }\n }\n\n // Interpolates the step, except the `with` fields its op takes as written (StepOptions.rawWith).\n private resolveStep(step: OpStep, ctx: TestContext): OpStep {\n const raw = this.registry\n .rawWithFields(step.op)\n .filter((field) => step.with && typeof step.with === \"object\" && field in step.with);\n if (!raw.length) {\n return interpolateDeep(step, ctx);\n }\n const rest = { ...step.with };\n for (const field of raw) delete rest[field];\n const resolved = interpolateDeep({ ...step, with: rest }, ctx);\n const kept = Object.fromEntries(raw.map((field) => [field, step.with![field]]));\n return { ...resolved, with: { ...resolved.with, ...kept } };\n }\n\n /**\n * Run one step exactly as a scenario would: interpolate, dispatch, honor `timeoutMs`\n * (the step's own, else the scenario's `stepTimeoutMs`), store `saveAs`, and report\n * start/end. Throws the step's error.\n */\n async runStep(\n phase: StepPhase,\n step: OpStep,\n ctx: TestContext,\n stepPath?: string,\n setup?: string,\n stepTimeoutMs?: number,\n ): Promise<unknown> {\n const reporter = ctx.reporter;\n const stepStart = Date.now();\n let stepError: unknown;\n let resolvedStep: OpStep | undefined;\n let result: unknown;\n\n ctx.stepPath = stepPath;\n reporter.onStepStart({ scenarioId: ctx.scenarioId, phase, step, stepPath, ...(setup ? { setup } : {}) });\n\n try {\n resolvedStep = withStepTimeout(this.resolveStep(step, ctx), stepTimeoutMs);\n const handler = this.registry.get(resolvedStep.op);\n const run = handler(ctx, resolvedStep);\n result =\n resolvedStep.timeoutMs !== undefined\n ? await withTimeout(\n run,\n resolvedStep.timeoutMs,\n `Step timeout after ${resolvedStep.timeoutMs}ms: \"${resolvedStep.op}\"`,\n )\n : await run;\n\n if (resolvedStep.saveAs) {\n ctx.resources.set(resolvedStep.saveAs, result);\n }\n return result;\n } catch (err: any) {\n stepError = err;\n throw err;\n } finally {\n const durationMs = Date.now() - stepStart;\n // Taken for every mobile step so the figure never carries over; only a slow one is worth reporting.\n const slowestCallMs = ctx.mobile?.takeSlowestCallMs() ?? 0;\n reporter.onStepEnd({\n scenarioId: ctx.scenarioId,\n phase,\n step: resolvedStep ?? step,\n ok: !stepError,\n error: stepError,\n durationMs,\n stepPath,\n ...(slowestCallMs >= SLOW_CALL_REPORT_MS ? { slowestCallMs } : {}),\n ...(setup ? { setup } : {}),\n });\n }\n }\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import type { HealEvent } from "../contracts/runtime-context.types";
|
|
|
2
2
|
import type { ScenarioType } from "../contracts/testing-metadata.types";
|
|
3
3
|
export type LifecycleEventType = "run.start" | "scenario.start" | "scenario.end" | "run.end";
|
|
4
4
|
export interface ArtifactRef {
|
|
5
|
-
kind: "console" | "network" | "screenshot" | "video" | "har" | "api-log";
|
|
5
|
+
kind: "console" | "network" | "screenshot" | "video" | "har" | "api-log" | "timeline";
|
|
6
6
|
name: string;
|
|
7
7
|
contentType: string;
|
|
8
8
|
transport: "inline" | "storage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-events.types.d.ts","sourceRoot":"","sources":["../../../src/testing/reporter/lifecycle-events.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAOxE,MAAM,MAAM,kBAAkB,GAC1B,WAAW,GACX,gBAAgB,GAChB,cAAc,GACd,SAAS,CAAC;AAOd,MAAM,WAAW,WAAW;
|
|
1
|
+
{"version":3,"file":"lifecycle-events.types.d.ts","sourceRoot":"","sources":["../../../src/testing/reporter/lifecycle-events.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OA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ot":"","sources":["../../../src/testing/reporter/lifecycle-events.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HealEvent } from \"../contracts/runtime-context.types\";\nimport type { ScenarioType } from \"../contracts/testing-metadata.types\";\n\n/**\n * Incremental lifecycle events emitted by {@link LifecycleWebhookReporter} so an\n * external consumer (e.g. testingHub) can persist run progress live, instead of\n * only receiving a single final payload (as the legacy WebhookReporter does).\n */\nexport type LifecycleEventType =\n | \"run.start\"\n | \"scenario.start\"\n | \"scenario.end\"\n | \"run.end\";\n\n/**\n * Reference to a captured artifact (console/network/api log, screenshot, video, HAR).\n * Text artifacts travel inline; binary artifacts are uploaded to shared storage and\n * referenced by `storageKey`/`url` to keep webhook payloads small.\n */\nexport interface ArtifactRef {\n kind: \"console\" | \"network\" | \"screenshot\" | \"video\" | \"har\" | \"api-log\";\n name: string;\n contentType: string;\n transport: \"inline\" | \"storage\";\n /** base64 (binary) or raw text/JSON (text); present when transport === 'inline'. */\n inlineData?: string;\n /** file-service key; present when transport === 'storage'. */\n storageKey?: string;\n /** resolved getUrl(); present when transport === 'storage'. */\n url?: string;\n sizeBytes?: number;\n}\n\nexport interface StepResultData {\n phase: string;\n operation: string;\n name?: string;\n /** Position in the scenario file, e.g. `steps[3].when`. */\n stepPath?: string;\n /** Mobile only: the longest single device lookup in the step, reported when it was slow (a stalled device). */\n slowestCallMs?: number;\n /** Set for a step that ran as setup for the scenario (\"reset\", \"login\"), not as one of its own. */\n setup?: string;\n ok: boolean;\n durationMs: number;\n error?: string;\n}\n\n/** Minimal descriptor of a scenario in the run, so consumers can snapshot the full suite at run time. */\nexport interface ScenarioDescriptor {\n id: string;\n name?: string;\n type: ScenarioType;\n}\n\nexport interface RunStartData {\n total: number;\n scenarioIds: string[];\n scenarios: ScenarioDescriptor[];\n startedAt: string;\n}\n\nexport interface ScenarioStartData {\n scenarioId: string;\n name?: string;\n type: ScenarioType;\n index: number;\n total: number;\n}\n\nexport interface ScenarioEndData {\n scenarioId: string;\n name?: string;\n ok: boolean;\n /**\n * Absent from older runners, where `ok` alone decides passed/failed. A skipped\n * scenario has `ok: false` so a consumer that ignores `status` never counts it as passed.\n */\n status?: \"passed\" | \"failed\" | \"skipped\";\n /** Set when `status` is `skipped`. */\n skip?: { reason: \"dependency_failed\"; dependency: string };\n durationMs: number;\n error?: string;\n steps: StepResultData[];\n /** console/network/api-log/screenshot/video for THIS scenario. */\n artifacts: ArtifactRef[];\n /** Selectors replaced by a fallback or fingerprint while the scenario ran. */\n heals?: HealEvent[];\n}\n\nexport interface RunEndData {\n ok: boolean;\n total: number;\n passed: number;\n failed: number;\n skipped?: number;\n durationMs: number;\n exitCode?: number;\n error?: string;\n /** run-level artifacts (e.g. the whole-run video). */\n artifacts?: ArtifactRef[];\n}\n\n/**\n * Envelope wrapping every lifecycle event. `externalRunId` correlates the event to\n * the caller's own record (e.g. a testingHub TestRun id); `seq` lets an out-of-order\n * receiver reorder/deduplicate.\n */\nexport interface LifecycleEnvelope<T = unknown> {\n event: LifecycleEventType;\n /** correlation id supplied by the caller (e.g. testingHub TestRun id). */\n externalRunId?: string;\n /** runner-generated uuid for this process run. */\n runId: string;\n runName: string;\n /** 0-based, increments per emitted event. */\n seq: number;\n emittedAt: string;\n data: T;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"lifecycle-events.types.js","sourceRoot":"","sources":["../../../src/testing/reporter/lifecycle-events.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { HealEvent } from \"../contracts/runtime-context.types\";\nimport type { ScenarioType } from \"../contracts/testing-metadata.types\";\n\n/**\n * Incremental lifecycle events emitted by {@link LifecycleWebhookReporter} so an\n * external consumer (e.g. testingHub) can persist run progress live, instead of\n * only receiving a single final payload (as the legacy WebhookReporter does).\n */\nexport type LifecycleEventType =\n | \"run.start\"\n | \"scenario.start\"\n | \"scenario.end\"\n | \"run.end\";\n\n/**\n * Reference to a captured artifact (console/network/api log, screenshot, video, HAR).\n * Text artifacts travel inline; binary artifacts are uploaded to shared storage and\n * referenced by `storageKey`/`url` to keep webhook payloads small.\n */\nexport interface ArtifactRef {\n /** `timeline`: where each scenario is in the run video (run-timeline.json). */\n kind: \"console\" | \"network\" | \"screenshot\" | \"video\" | \"har\" | \"api-log\" | \"timeline\";\n name: string;\n contentType: string;\n transport: \"inline\" | \"storage\";\n /** base64 (binary) or raw text/JSON (text); present when transport === 'inline'. */\n inlineData?: string;\n /** file-service key; present when transport === 'storage'. */\n storageKey?: string;\n /** resolved getUrl(); present when transport === 'storage'. */\n url?: string;\n sizeBytes?: number;\n}\n\nexport interface StepResultData {\n phase: string;\n operation: string;\n name?: string;\n /** Position in the scenario file, e.g. `steps[3].when`. */\n stepPath?: string;\n /** Mobile only: the longest single device lookup in the step, reported when it was slow (a stalled device). */\n slowestCallMs?: number;\n /** Set for a step that ran as setup for the scenario (\"reset\", \"login\"), not as one of its own. */\n setup?: string;\n ok: boolean;\n durationMs: number;\n error?: string;\n}\n\n/** Minimal descriptor of a scenario in the run, so consumers can snapshot the full suite at run time. */\nexport interface ScenarioDescriptor {\n id: string;\n name?: string;\n type: ScenarioType;\n}\n\nexport interface RunStartData {\n total: number;\n scenarioIds: string[];\n scenarios: ScenarioDescriptor[];\n startedAt: string;\n}\n\nexport interface ScenarioStartData {\n scenarioId: string;\n name?: string;\n type: ScenarioType;\n index: number;\n total: number;\n}\n\nexport interface ScenarioEndData {\n scenarioId: string;\n name?: string;\n ok: boolean;\n /**\n * Absent from older runners, where `ok` alone decides passed/failed. A skipped\n * scenario has `ok: false` so a consumer that ignores `status` never counts it as passed.\n */\n status?: \"passed\" | \"failed\" | \"skipped\";\n /** Set when `status` is `skipped`. */\n skip?: { reason: \"dependency_failed\"; dependency: string };\n durationMs: number;\n error?: string;\n steps: StepResultData[];\n /** console/network/api-log/screenshot/video for THIS scenario. */\n artifacts: ArtifactRef[];\n /** Selectors replaced by a fallback or fingerprint while the scenario ran. */\n heals?: HealEvent[];\n}\n\nexport interface RunEndData {\n ok: boolean;\n total: number;\n passed: number;\n failed: number;\n skipped?: number;\n durationMs: number;\n exitCode?: number;\n error?: string;\n /** run-level artifacts (e.g. the whole-run video). */\n artifacts?: ArtifactRef[];\n}\n\n/**\n * Envelope wrapping every lifecycle event. `externalRunId` correlates the event to\n * the caller's own record (e.g. a testingHub TestRun id); `seq` lets an out-of-order\n * receiver reorder/deduplicate.\n */\nexport interface LifecycleEnvelope<T = unknown> {\n event: LifecycleEventType;\n /** correlation id supplied by the caller (e.g. testingHub TestRun id). */\n externalRunId?: string;\n /** runner-generated uuid for this process run. */\n runId: string;\n runName: string;\n /** 0-based, increments per emitted event. */\n seq: number;\n emittedAt: string;\n data: T;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle-webhook-reporter.d.ts","sourceRoot":"","sources":["../../../src/testing/reporter/lifecycle-webhook-reporter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAIV,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAgB,MAAM,qCAAqC,CAAC;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOzE,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,KAC3D,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9C,MAAM,WAAW,+BAA+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AAS,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,OAAO,CAAC;QACZ,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;IAeC,MAAM,CAAC,IAAI,EAAE;QACpB,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,GAAG,IAAI;IAwEC,aAAa,CACpB,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,cAAc,GACrB,IAAI;IAqBE,iBAAiB,CAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAuBhF,iBAAiB,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI;IAiErF,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBpE,OAAO,CAAC,IAAI;YAaE,OAAO;CAiBtB"}
|
|
@@ -23,6 +23,8 @@ const defaultPost = async (url, body, opts) => {
|
|
|
23
23
|
};
|
|
24
24
|
function classifyAttachment(name, contentType) {
|
|
25
25
|
const hint = `${name} ${contentType}`.toLowerCase();
|
|
26
|
+
if (name.toLowerCase().endsWith("timeline.json"))
|
|
27
|
+
return "timeline";
|
|
26
28
|
if (contentType.startsWith("video/") || hint.includes("video"))
|
|
27
29
|
return "video";
|
|
28
30
|
if (hint.includes("screenshot") || contentType.startsWith("image/"))
|