parameters:
    comm_panel_api_url: 'http://localhost:8088' # avoid to call the external service in the CI
    env(EXPERIMENTAL_TEST_DATABASE): false

imports:
    # Akeneo/Connectivity/Connection
    - { resource: ../../../src/Akeneo/Connectivity/Connection/tests/Resources/config/services.yml }
    # FeatureFlag
    - { resource: ../../../src/Akeneo/Platform/Bundle/FeatureFlagBundle/Resources/config/test_behat_services.yml }

services:
    _defaults:
        public: true

    akeneo_legacy_behat_tests.doctrine.connection.connection_closer:
        class: Akeneo\Test\IntegrationTestsBundle\Doctrine\Connection\ConnectionCloser
        arguments:
            - '@doctrine'

    akeneo_legacy_behat_tests.loader.database_schema_handler:
        class: 'Akeneo\Test\IntegrationTestsBundle\Loader\DatabaseSchemaHandler'
        arguments:
            - '@database_connection'

    akeneo_legacy_behat_tests.security.system_user_authenticator:
        class: 'Akeneo\Test\IntegrationTestsBundle\Security\SystemUserAuthenticator'
        arguments:
            - '@pim_user.factory.user'
            - '@pim_user.repository.group'
            - '@pim_user.repository.role'
            - '@security.token_storage'

    akeneo_legacy_behat_tests.loader.reference_data_loader:
        class: 'Akeneo\Test\IntegrationTestsBundle\Loader\ReferenceDataLoader'
        arguments:
            - '@doctrine.orm.entity_manager'
            - '%kernel.bundles%'
            - 'AcmeAppBundle'
            - '\Acme\Bundle\AppBundle\Entity\Fabric'
            - '\Acme\Bundle\AppBundle\Entity\Color'

    akeneo_legacy_behat_tests.loader.fixtures_loader:
        class: 'Akeneo\Test\IntegrationTestsBundle\Loader\FixturesLoader'
        arguments:
            - '@kernel'
            - '@akeneo_legacy_behat_tests.loader.database_schema_handler'
            - '@akeneo_legacy_behat_tests.security.system_user_authenticator'
            - '@akeneo_legacy_behat_tests.loader.reference_data_loader'
            - '@oneup_flysystem.archivist_filesystem'
            - '@akeneo_batch.job_repository'
            - '@pim_installer.fixture_loader.job_loader'
            - '@oro_security.acl.manager'
            - '@pim_catalog.elasticsearch.indexer.product'
            - '@pim_catalog.elasticsearch.indexer.product_model'
            - '@akeneo_elasticsearch.registry.clients'
            - '@database_connection'
            - '@akeneo_measure.installer.measurement_installer'
            - '@messenger.transport.business_event'
            - '@event_dispatcher'
            - '@akeneo_integration_tests.launcher.job_launcher'
            - '%env(APP_DATABASE_HOST)%'
            - '%env(APP_DATABASE_NAME)%'
            - '%env(APP_DATABASE_USER)%'
            - '%env(APP_DATABASE_PASSWORD)%'
            - '%kernel.cache_dir%/sql-dump/'
            - '%index_hosts%'
            - '@Akeneo\Connectivity\Connection\Application\Apps\Command\GenerateAsymmetricKeysHandler'
            - '@Akeneo\Test\IntegrationTestsBundle\Helper\ExperimentalTransactionHelper'

    akeneo_integration_tests.launcher.job_launcher:
        class: Akeneo\Test\IntegrationTestsBundle\Launcher\JobLauncher
        arguments:
            - '@kernel'
            - '@database_connection'
            - !tagged akeneo.pim.tests.pub_sub_queue_status.job
            - '@logger'
            - '@feature_flags'

    akeneo_integration_tests.pub_sub_queue_status.ui_job:
        class: AkeneoTest\Integration\IntegrationTestsBundle\Launcher\PubSubQueueStatus
        arguments:
            - '@Akeneo\Tool\Bundle\MessengerBundle\Transport\GooglePubSub\PubSubClientFactory'
            - '%env(GOOGLE_CLOUD_PROJECT)%'
            - '%env(PUBSUB_TOPIC_JOB_QUEUE_UI)%'
            - '%env(PUBSUB_SUBSCRIPTION_JOB_QUEUE_UI)%'
        tags:
            - { name: 'akeneo.pim.tests.pub_sub_queue_status.job' }

    akeneo_integration_tests.pub_sub_queue_status.import_export_job:
        class: AkeneoTest\Integration\IntegrationTestsBundle\Launcher\PubSubQueueStatus
        arguments:
            - '@Akeneo\Tool\Bundle\MessengerBundle\Transport\GooglePubSub\PubSubClientFactory'
            - '%env(GOOGLE_CLOUD_PROJECT)%'
            - '%env(PUBSUB_TOPIC_JOB_QUEUE_IMPORT_EXPORT)%'
            - '%env(PUBSUB_SUBSCRIPTION_JOB_QUEUE_IMPORT_EXPORT)%'
        tags:
            - { name: 'akeneo.pim.tests.pub_sub_queue_status.job' }

    akeneo_integration_tests.pub_sub_queue_status.data_maintenance_job:
        class: AkeneoTest\Integration\IntegrationTestsBundle\Launcher\PubSubQueueStatus
        arguments:
            - '@Akeneo\Tool\Bundle\MessengerBundle\Transport\GooglePubSub\PubSubClientFactory'
            - '%env(GOOGLE_CLOUD_PROJECT)%'
            - '%env(PUBSUB_TOPIC_JOB_QUEUE_DATA_MAINTENANCE)%'
            - '%env(PUBSUB_SUBSCRIPTION_JOB_QUEUE_DATA_MAINTENANCE)%'
        tags:
            - { name: 'akeneo.pim.tests.pub_sub_queue_status.job' }

    akeneo_integration_tests.pub_sub_queue_status.scheduled_job:
        class: AkeneoTest\Integration\IntegrationTestsBundle\Launcher\PubSubQueueStatus
        arguments:
            - '@Akeneo\Tool\Bundle\MessengerBundle\Transport\GooglePubSub\PubSubClientFactory'
            - '%env(GOOGLE_CLOUD_PROJECT)%'
            - '%env(PUBSUB_TOPIC_JOB_QUEUE_SCHEDULED_JOB)%'
            - '%env(PUBSUB_SUBSCRIPTION_JOB_QUEUE_SCHEDULED_JOB)%'
        tags:
            - { name: 'akeneo.pim.tests.pub_sub_queue_status.job' }

    Context\FeatureContext:
        -   base_url: 'http://httpd-behat/'
            timeout: 25000
            window_width: 1280
            window_height: 1024
        - '@kernel'

    Context\FixturesContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\CatalogConfigurationContext:
        - 'Context\FeatureContext'
        - '@kernel'
        - '@akeneo_legacy_behat_tests.loader.fixtures_loader'
        - '@pim_connector.doctrine.cache_clearer'

    Context\WebUser:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\DataGridContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\CommandContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\NavigationContext:
        - 'Context\FeatureContext'
        - 'http://httpd-behat/'
        - '@kernel'

    Context\TransformationContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\AssertionContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\ViewSelectorContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\SecurityContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\UserContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\AttributeValidationContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Collect\ImportProfilesContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Enrich\AttributeTabContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Enrich\CompletenessContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Enrich\ProductGroupContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Enrich\ProductModelContext:
        - 'Context\FeatureContext'
        - '@kernel'
        - '@pim_catalog.repository.product_model'
        - '@doctrine.orm.entity_manager'
        - '@pim_catalog.updater.product_model'
        - '@pim_catalog.saver.product_model'
        - '@pim_catalog.validator.product'
        - '@pim_versioning.repository.version'

    Pim\Behat\Context\Domain\Enrich\ProductContext:
        - '@pim_catalog.repository.product'
        - '@pim_catalog.updater.product'
        - '@pim_catalog.saver.product'
        - '@pim_catalog.validator.product'
        - '@doctrine.orm.entity_manager'
        - '@pim_versioning.repository.version'

    Pim\Behat\Context\Domain\Enrich\VariantNavigationContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Spread\ExportBuilderContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Spread\ExportProfilesContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Spread\XlsxFileContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\System\PermissionsContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\SecondaryActionsContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\TreeContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\HookContext:
        - 'Context\FeatureContext'
        - '@kernel'
        - 1280
        - 1024

    Pim\Behat\Context\JobContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\ImportExportFileContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Storage\FileInfoStorage:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Storage\ProductStorage:
        - '@pim_connector.array_converter.flat_to_standard.product.attribute_column_info_extractor'
        - '@pim_catalog.repository.product'
        - '@doctrine.orm.default_entity_manager'

    Pim\Behat\Context\Storage\ProductModelStorage:
        - '@pim_connector.array_converter.flat_to_standard.product.attribute_column_info_extractor'
        - '@pim_catalog.repository.product_model'
        - '@pim_catalog.repository.family_variant'
        - '@pim_catalog.factory.product_model'
        - '@pim_catalog.updater.product_model'
        - '@pim_catalog.validator.product_model'
        - '@pim_catalog.saver.product_model'
        -
    Pim\Behat\Context\Domain\Enrich\FamilyVariantConfigurationContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Enrich\ItemPickerContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Storage\VariantProductStorage:
        - '@pim_catalog.repository.product'
        - '@kernel'

    Pim\Behat\Context\Storage\AttributeOptionStorage:
        - '@pim_catalog.repository.attribute_option'
        - '@doctrine.orm.default_entity_manager'

    Pim\Behat\Context\MassEditJobContext:
        - 'Context\FeatureContext'
        - '@kernel'
        - '@pim_catalog.repository.product'
        - '@pim_catalog.repository.product_model'

    Akeneo\Connectivity\Connection\Tests\EndToEnd\Context\SettingsContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Akeneo\Connectivity\Connection\Tests\EndToEnd\Context\AppActivateContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Context\ConnectivityContext:
        - '@messenger.transport.business_event'

    Pim\Behat\Context\Domain\Structure\AssociationTypeContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\Domain\Structure\CategoryContext:
        - 'Context\FeatureContext'
        - '@kernel'

    Pim\Behat\Context\FeatureFlagContext:
        - '@feature_flags'

    Akeneo\Test\IntegrationTestsBundle\Helper\ExperimentalTransactionHelper:
        arguments:
            - '@doctrine'
            - '@akeneo_legacy_behat_tests.loader.database_schema_handler'
            - '%env(bool:EXPERIMENTAL_TEST_DATABASE)%'
