<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * Copyright 2024 Adobe
  * All Rights Reserved.
  */
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <actionGroup name="AdminImportDataCheckActionGroup">
        <annotations>
            <description>Goes to the Admin Import page, uploads the provided file, and clicks on the Check Data button. Validates that the notice message is present and correct.</description>
        </annotations>
        <arguments>
            <argument name="behavior" type="string"/>
            <argument name="validationStrategy" type="string" defaultValue="Stop on Error"/>
            <argument name="allowedErrorsCount" type="string" defaultValue="10"/>
            <argument name="importFile" type="string"/>
            <argument name="importValidationMessage" type="string" defaultValue=""/>
        </arguments>
        <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="goToImportIndexPage"/>
        <waitForPageLoad stepKey="adminImportMainSectionLoad"/>
        <selectOption selector="{{AdminImportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
        <waitForElementVisible selector="{{AdminImportMainSection.importBehavior}}" stepKey="waitForImportBehaviorElementVisible"/>
        <selectOption selector="{{AdminImportMainSection.importBehavior}}" userInput="{{behavior}}" stepKey="selectImportBehaviorOption"/>
        <selectOption selector="{{AdminImportMainSection.validationStrategy}}" userInput="{{validationStrategy}}" stepKey="selectValidationStrategyOption"/>
        <fillField selector="{{AdminImportMainSection.allowedErrorsCount}}" userInput="{{allowedErrorsCount}}" stepKey="fillAllowedErrorsCountField"/>
        <attachFile selector="{{AdminImportMainSection.selectFileToImport}}" userInput="{{importFile}}" stepKey="attachFileForImport"/>
        <click selector="{{AdminImportHeaderSection.checkDataButton}}" stepKey="clickCheckDataButton"/>
        <see selector="{{AdminImportValidationMessagesSection.validationNotice}}" userInput="{{importValidationMessage}}" stepKey="seeValidationMessage"/>
        <waitForElementVisible selector="{{AdminImportMainSection.importButton}}" stepKey="waitForImportButtonElementVisible"/>
    </actionGroup>
</actionGroups>
