<?xml version="1.0" encoding="UTF-8"?>

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <!-- Disable the shipping method -->
    <actionGroup name="AdminDisableShippingMethod">
        <magentoCLI stepKey="disableShippingMethod" command="config:set carriers/temando/active 0" />
        <magentoCLI stepKey="removeEndpoint" command="config:set carriers/temando/session_endpoint ''" />
        <magentoCLI stepKey="removeAccountId" command="config:set carriers/temando/account_id ''" />
        <magentoCLI stepKey="removeBearerToken" command="config:set carriers/temando/bearer_token ''" />
        <magentoCLI stepKey="removeClickAndCollect" command="config:set carriers/temando/clickandcollect_enabled 0" />
        <magentoCLI stepKey="removeCollectionPoints" command="config:set carriers/temando/collectionpoints_enabled 0" />
    </actionGroup>
    <actionGroup name="AdminDisableShippingMethodFlushConfigCache" extends="AdminDisableShippingMethod">
        <magentoCLI stepKey="flushCache" command="cache:flush config" after="removeCollectionPoints" />
    </actionGroup>
    <!-- Enable the shipping method -->
    <actionGroup name="AdminEnableShippingMethod" extends="AdminNavigateToShippingConfiguration">
        <scrollTo stepKey="scrollToEnabled" y="85" selector="{{MagentoShippingSection.isTemandoActive}}" after="waitForShippingConfigurationToLoad" />
        <selectOption selector="{{MagentoShippingSection.isTemandoActive}}" stepKey="seeShippingEnabled" userInput="1" />
        <fillField stepKey="fillApiEndpoint" selector="{{MagentoShippingSection.sessionEndpoint}}" userInput="{{_CREDS.carriers_temando_session_endpoint}}" />
        <fillField stepKey="fillAccountId" selector="{{MagentoShippingSection.accountId}}" userInput="{{_CREDS.carriers_temando_account_id}}" />
        <fillField stepKey="fillBearerToken" selector="{{MagentoShippingSection.bearerToken}}" userInput="{{_CREDS.carriers_temando_bearer_token}}" />

        <click stepKey="clickSave" selector="{{MagentoShippingSection.ButtonSave}}" />
        <seeInCurrentUrl stepKey="returnToConfigurationPage" url="{{TemandoAdminConfigPage.url}}" />
        <waitForPageLoad stepKey="waitForSuccess" />
        <see stepKey="seeSuccessMessage" userInput="{{ConfigurationMessages.saved}}" />
    </actionGroup>
    <!-- Admin menu links -->
    <actionGroup name="AdminShippingModuleMenuLinks">
        <click selector="{{TemandoAdminMenuSection.StoresMenuItem}}" stepKey="clickStoresMenuItem" />
        <seeElement selector="{{TemandoAdminMenuSection.CarriersMenuItemLink}}" stepKey="seeCarriersMenuItem" />
        <seeElement selector="{{TemandoAdminMenuSection.LocationsMenuItemLink}}" stepKey="seeLocationsMenuItem" />
        <seeElement selector="{{TemandoAdminMenuSection.PackagingMenuItemLink}}" stepKey="seePackagingMenuItem" />
        <seeElement selector="{{TemandoAdminMenuSection.ExperiencesMenuItemLink}}" stepKey="seeExperiencesMenuItem" />
    </actionGroup>
    <!-- Activate shipping method link -->
    <actionGroup name="ActivateShippingLink">
        <see stepKey="seeActivationMessage" userInput="Activate Magento Shipping" />
        <seeLink stepKey="seeActivationLink" userInput="Activate Magento Shipping" />
        <click stepKey="clickActivateShippinglink" userInput="Activate Magento Shipping" />
        <seeInCurrentUrl stepKey="seeShippingConfigurationUrl" url="system_config/edit/section/carriers" />
    </actionGroup>
    <!-- Navigate to the packaging configuration page -->
    <actionGroup name="AdminNavigateToPackagingConfiguration">
        <click stepKey="clickStoresMenuItem" selector="{{TemandoAdminMenuSection.StoresMenuItem}}" />
        <seeElement selector="{{TemandoAdminMenuSection.StoresSubMenu}}" stepKey="waitForStoresSubMenu" />
        <seeElement stepKey="seePackagingMenuItem" selector="{{TemandoAdminMenuSection.PackagingMenuItemLink}}" />
        <click stepKey="clickPackagingConfigurationLink" selector="{{TemandoAdminMenuSection.PackagingMenuItemLink}}" />
        <waitForPageLoad stepKey="waitForPackagingConfigurationPage" />
    </actionGroup>
    <!-- Navigate to the shipping configuration page -->
    <actionGroup name="AdminNavigateToShippingConfiguration">
        <amOnPage url="{{TemandoAdminConfigPage.url}}" stepKey="navigateToShippingConfiguration" />
        <waitForPageLoad stepKey="waitForShippingConfigurationToLoad" />
        <conditionalClick selector="{{MagentoShippingSection.sectionHead}}" dependentSelector="{{MagentoShippingSection.isTemandoActive}}" visible="false" stepKey="expandMagentoShipping" />
    </actionGroup>
    <!-- Navigate to the advanced settings page -->
    <actionGroup name="AdminNavigateToAdvancedSettings">
        <amOnPage url="{{TemandoAdvancedSettingsPage.url}}" stepKey="navigateToAdvancedSettings" />
        <waitForPageLoad stepKey="waitForAdvancedSettingsToLoad" />
        <see stepKey="seeAdvancedSettings" userInput="Advanced Settings" />
    </actionGroup>
    <!-- Navigate to the checkout view settings page -->
    <actionGroup name="AdminNavigateToCheckoutViewSettings">
        <amOnPage url="{{TemandoCheckoutViewSettingsPage.url}}" stepKey="navigateToCheckoutViewSettings" />
        <waitForPageLoad stepKey="waitForCheckoutViewSettings" />
        <see stepKey="seeCheckoutViewSettings" userInput="Show Fields At Checkout" />
    </actionGroup>
    <!-- Disabled getting started buttons -->
    <actionGroup name="AdminGettingStartedButtonsDisabled">
        <scrollTo stepKey="scrollToSectionConfiguration" selector="{{MagentoShippingSection.GettingStartedSection}}" />
        <see stepKey="seeActivateMessage" userInput="Once you have activated Magento Shipping, configure these sections to get up and running" />
        <seeElement stepKey="seeLocationsConfigureButtonDisabled" selector="{{MagentoShippingSection.GettingStartedLocationsButtonDisabled}}" />
        <seeElement stepKey="seeCarriersConfigureButtonDisabled" selector="{{MagentoShippingSection.GettingStartedCarriersButtonDisabled}}" />
        <seeElement stepKey="seePackagingConfigureButtonDisabled" selector="{{MagentoShippingSection.GettingStartedPackagingButtonDisabled}}" />
        <seeElement stepKey="seeShippingExperiencesConfigureButtonDisabled" selector="{{MagentoShippingSection.GettingStartedShippingExperiencesButtonDisabled}}" />
    </actionGroup>
    <!-- Update configuration -->
    <actionGroup name="AdminUpdateShippingConfiguration">
        <arguments>
            <argument name="isActive" defaultValue="0" type="string" />
            <argument name="apiEndpoint" defaultValue="" type="string" />
            <argument name="apiAccountId" defaultValue="" type="string" />
            <argument name="apiBearerToken" defaultValue="" type="string" />
        </arguments>
        <scrollTo stepKey="scrollToEnabled" y="-85" selector="{{MagentoShippingSection.isTemandoActive}}" />
        <selectOption selector="{{MagentoShippingSection.isTemandoActive}}" stepKey="seeShippingEnabled" userInput="{{isActive}}" />
        <fillField stepKey="fillApiEndpoint" selector="{{MagentoShippingSection.sessionEndpoint}}" userInput="{{apiEndpoint}}" />
        <fillField stepKey="fillAccountId" selector="{{MagentoShippingSection.accountId}}" userInput="{{apiAccountId}}" />
        <fillField stepKey="fillBearerToken" selector="{{MagentoShippingSection.bearerToken}}" userInput="{{apiBearerToken}}" />
    </actionGroup>
    <actionGroup name="AdminUpdateShippingConfigurationWithSave" extends="AdminUpdateShippingConfiguration">
        <click stepKey="clickSave" selector="{{MagentoShippingSection.ButtonSave}}" />
        <seeInCurrentUrl stepKey="returnToConfigurationPage" url="{{TemandoAdminConfigPage.url}}" />
        <waitForPageLoad stepKey="waitForSuccess" />
        <see stepKey="seeSuccessMessage" userInput="{{ConfigurationMessages.saved}}" />
    </actionGroup>
    <!-- Enable collection points -->
    <actionGroup name="AdminEnableCollectionPoints">
        <arguments>
            <argument name="isActive" defaultValue="0" type="string" />
            <argument name="countries" defaultValue="" type="string" />
        </arguments>

        <scrollTo stepKey="scrollToCollectionPoints" selector="{{MagentoShippingSection.CollectionPointsEnabled}}" y="85" />
        <selectOption selector="{{MagentoShippingSection.CollectionPointsEnabled}}" stepKey="setCollectionPointsEnabled" userInput="{{isActive}}" />
        <selectOption selector="{{MagentoShippingSection.CollectionPointCountries}}" stepKey="setCollectionPointCountries" parameterArray="{{countries}}" />
    </actionGroup>
    <!-- Enable click and collect -->
    <actionGroup name="AdminEnableClickAndCollect">
        <arguments>
            <argument name="isActive" defaultValue="0" type="string" />
        </arguments>
        <scrollTo stepKey="scrollToClickAndCollect" selector="{{MagentoShippingSection.ClickAndCollectionEnabled}}" y="85" />
        <selectOption selector="{{MagentoShippingSection.ClickAndCollectionEnabled}}" stepKey="enableClickAndCollect" userInput="{{isActive}}"/>
    </actionGroup>

    <!-- Enable sync -->
    <actionGroup name="AdminAdvancedSettingsEnableSync">
        <waitForElement selector="{{AdvancedSettingsSection.SyncEnabled}}" stepKey="waitForSyncButtonToLoad" />
        <checkOption selector="{{AdvancedSettingsSection.SyncEnabled}}" stepKey="clickEnableSync" />
        <checkOption selector="{{AdvancedSettingsSection.SyncShipment}}" stepKey="enableSyncShipment" />
    </actionGroup>
    <actionGroup name="AdminAdvancedSettingsEnableSyncWithSave" extends="AdminAdvancedSettingsEnableSync">
        <click stepKey="clickAdvancedSettingsSave" selector="{{AdvancedSettingsSection.ButtonSave}}" after="enableSyncShipment" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromAdvancedSettings" url="{{TemandoAdminConfigPage.url}}" />
        <see stepKey="seeAdvancedSettingsSuccessMessage" userInput="Settings saved successfully" />
    </actionGroup>

    <!-- Save shipping configuration -->
    <actionGroup name="SaveConfiguration">
        <click stepKey="clickSave" selector="{{MagentoShippingSection.ButtonSave}}" />
        <seeInCurrentUrl stepKey="returnToConfigurationPage" url="{{TemandoAdminConfigPage.url}}" />
        <see stepKey="seeSuccessMessage" userInput="{{ConfigurationMessages.saved}}" />
    </actionGroup>
    <!-- Enable address type -->
    <actionGroup name="AdminEnableAddressType">
        <checkOption selector="{{CheckoutViewSettingsSection.AddressType}}" stepKey="checkAddressType" />
        <selectOption selector="{{CheckoutViewSettingsSection.DropdownOptions}}" parameterArray="['Residential','Business']" stepKey="selectDropdownValues" />
        <selectOption selector="{{CheckoutViewSettingsSection.DefaultValue}}" userInput="Residential" stepKey="selectDefaultValue" />
    </actionGroup>
    <actionGroup name="AdminEnableAddressTypeWithSave" extends="AdminEnableAddressType">
        <click stepKey="clickSaveAddressType" selector="button.save" after="selectDefaultValue" />
        <waitForPageLoad stepKey="waitForAddressTypeSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromAddressTypeSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Disable address type -->
    <actionGroup name="AdminDisableAddressType">
        <uncheckOption selector="{{CheckoutViewSettingsSection.AddressType}}" stepKey="uncheckAddressType" />
    </actionGroup>
    <!-- Disable address type with save -->
    <actionGroup name="AdminDisableAddressTypeWithSave" extends="AdminDisableAddressType">
        <click stepKey="clickSaveAddressType" selector="button.save" after="uncheckAddressType" />
        <waitForPageLoad stepKey="waitForAddressTypeSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromAddressTypeSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Verify address type save -->
    <actionGroup name="verifyAdressTypeActive">
        <seeCheckboxIsChecked selector="{{CheckoutViewSettingsSection.AddressType}}" stepKey="seeAddressTypeChecked" />
        <seeInField stepKey="seeDropdownLabel" selector="{{CheckoutViewSettingsSection.DropdownLabel}}" userInput="Address Type" />
        <seeOptionIsSelected selector="{{CheckoutViewSettingsSection.DropdownOptions}}" stepKey="seeResidentialOptionIsSelected" userInput="Residential" />
        <seeOptionIsSelected selector="{{CheckoutViewSettingsSection.DropdownOptions}}" stepKey="seeBusinessOptionIsSelected" userInput="Business" />
        <seeOptionIsSelected selector="{{CheckoutViewSettingsSection.DefaultValue}}" stepKey="seeDefaultValueIsSelected" userInput="Residential" />
    </actionGroup>
    <!-- Enable authority to leave -->
    <actionGroup name="AdminEnableAuthorityToLeave">
        <checkOption selector="{{CheckoutViewSettingsSection.AuthorityToLeave}}" stepKey="checkAddressType" />
        <seeElement stepKey="seeCheckboxLabel" selector="{{CheckoutViewSettingsSection.AuthorityToLeaveCheckboxLabel}}" />
    </actionGroup>
    <actionGroup name="AdminEnableAuthorityToLeaveWithSave" extends="AdminEnableAuthorityToLeave">
        <click stepKey="clickSaveAuthorityToLeave" selector="button.save" after="seeCheckboxLabel" />
        <waitForPageLoad stepKey="waitForAuthorityToLeaveSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromAuthorityToLeaveSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Disable authority to leave -->
    <actionGroup name="AdminDisableAuthorityToLeave">
        <uncheckOption selector="{{CheckoutViewSettingsSection.AuthorityToLeave}}" stepKey="uncheckAddressType" />
    </actionGroup>
    <actionGroup name="AdminDisableAuthorityToLeaveWithSave" extends="AdminDisableAuthorityToLeave">
        <click stepKey="clickSaveAuthorityToLeave" selector="button.save" after="uncheckAddressType" />
        <waitForPageLoad stepKey="waitForAuthorityToLeaveSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromAuthorityToLeaveSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Verify authority to leave save -->
    <actionGroup name="VerifyAuthorityToLeaveActive">
        <seeCheckboxIsChecked selector="{{CheckoutViewSettingsSection.AuthorityToLeave}}" stepKey="seeAuthorityToLeaveCheckboxChecked" />
        <seeInField stepKey="seeCheckboxLabel" userInput="Authority To Leave" selector="{{CheckoutViewSettingsSection.AuthorityToLeaveCheckboxLabel}}" />
    </actionGroup>
    <!-- Enable signature required -->
    <actionGroup name="AdminEnableSignatureRequired">
        <checkOption selector="{{CheckoutViewSettingsSection.SignatureRequired}}" stepKey="enableSignatureRequired" />
        <seeElement stepKey="seeCheckboxLabel" selector="{{CheckoutViewSettingsSection.SignatureRequiredCheckboxLabel}}" />
    </actionGroup>
    <actionGroup name="AdminEnableSignatureRequiredWithSave" extends="AdminEnableSignatureRequired">
        <click stepKey="clickSaveSignatureRequired" selector="button.save" after="seeCheckboxLabel" />
        <waitForPageLoad stepKey="waitForSignatureRequiredSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromSignatureRequiredSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Disable signature required -->
    <actionGroup name="AdminDisableSignatureRequired">
        <uncheckOption selector="{{CheckoutViewSettingsSection.SignatureRequired}}" stepKey="uncheckSignatureRequired" />
    </actionGroup>
    <actionGroup name="AdminDisableSignatureRequiredWithSave" extends="AdminDisableSignatureRequired">
        <click stepKey="clickSaveSignatureRequired" selector="button.save" after="uncheckSignatureRequired" />
        <waitForPageLoad stepKey="waitForSignatureRequiredSave" />
        <seeInCurrentUrl stepKey="returnToConfigurationPageFromSignatureRequiredSave" url="{{TemandoAdminConfigPage.url}}" />
    </actionGroup>
    <!-- Verify signature required -->
    <actionGroup name="VerifySignatureRequiredActive">
        <seeCheckboxIsChecked selector="{{CheckoutViewSettingsSection.SignatureRequired}}" stepKey="seeSignatureRequiredCheckboxChecked" />
        <seeInField stepKey="seeCheckboxLabel" userInput="Signature Required" selector="{{CheckoutViewSettingsSection.SignatureRequiredCheckboxLabel}}" />
    </actionGroup>
    <!-- Navigate to product shipping section -->
    <actionGroup name="NavigateToProductShippingSection">
        <arguments>
            <argument name="product" type="entity" defaultValue="{{SimpleProduct}}" />
        </arguments>
        <amOnPage url="{{AdminProductEditPage.url(product.id)}}" stepKey="navigateToProductEditPage" />
        <scrollTo stepKey="scrollToShippingSection" selector="{{TemandoProductView.ShippingSection}}" y="-85" />
        <click stepKey="expandShipping" selector="{{TemandoProductView.ShippingSection}}" />
    </actionGroup>
    <!-- Verify product dimension fields -->
    <actionGroup name="VerifyProductDimensionFields">
        <seeElement stepKey="seeLength" selector="{{TemandoProductView.DimensionsLength}}" />
        <seeElement stepKey="seeWidth" selector="{{TemandoProductView.DimensionsWidth}}" />
        <seeElement stepKey="seeHeight" selector="{{TemandoProductView.DimensionsHeight}}" />
    </actionGroup>
    <!-- Set packaging type -->
    <actionGroup name="SetPackagingType">
        <arguments>
            <argument name="product" type="entity" defaultValue="{{SimpleProduct}}" />
            <argument name="packagingType" type="string" defaultValue="{{TemandoPackagingType.None}}" />
        </arguments>
        <seeElement stepKey="seePackagingType" selector="{{TemandoProductView.PackagingType}}" />
        <selectOption stepKey="selectPackagingType" selector="{{TemandoProductView.PackagingType}}" userInput="{{packagingType}}" />

        <click stepKey="clickSaveProduct" selector="{{TemandoProductView.ButtonSave}}" />
        <waitForPageLoad stepKey="waitForProductSave" />

        <seeInCurrentUrl url="{{AdminProductEditPage.url(product.id)}}" stepKey="seeProductPage" />
        <seeElement stepKey="seeSaveSuccessful" selector="{{TemandoProductView.MessageSuccess}}" />
    </actionGroup>
    <actionGroup name="SetPackagingTypeAndResetSizeFields" extends="SetPackagingType">
        <clearField stepKey="clearLength" selector="{{TemandoProductView.DimensionsLength}}" after="seePackagingType" />
        <clearField stepKey="clearWidth" selector="{{TemandoProductView.DimensionsWidth}}" after="clearLength" />
        <clearField stepKey="clearHeight" selector="{{TemandoProductView.DimensionsHeight}}" after="clearWidth" />
        <clearField stepKey="clearWeight" selector="{{TemandoProductView.Weight}}" before="selectPackagingType" />
    </actionGroup>
    <!-- Set packaging type to assigned -->
    <actionGroup name="SetPackagingTypeAssigned" extends="SetPackagingType">
        <arguments>
            <argument name="packagingType" type="string" defaultValue="{{TemandoPackagingType.Assigned}}" />
            <argument name="packageId" type="string" defaultValue="{{TemandoPackageLabels.SmallBox}}" />
        </arguments>
        <grabAttributeFrom selector="{{TemandoProductView.DimensionsLength}}" stepKey="lengthId" userInput="id" after="selectPackagingType" />
        <dontSeeElement stepKey="dontSeeLengthRequired" selector="{{TemandoProductView.FieldValidation({$lengthId})}}" after="lengthId" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsWidth}}" stepKey="widthId" userInput="id" after="dontSeeLengthRequired" />
        <dontSeeElement stepKey="dontSeeWidthRequired" selector="{{TemandoProductView.FieldValidation({$widthId})}}" after="widthId" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsHeight}}" stepKey="heightId" userInput="id" after="dontSeeWidthRequired" />
        <dontSeeElement stepKey="seeHeightRequired" selector="{{TemandoProductView.FieldValidation({$heightId})}}" after="heightId" />

        <grabAttributeFrom selector="{{TemandoProductView.Weight}}" stepKey="weightId" userInput="id" after="seeHeightRequired" />
        <dontSeeElement stepKey="dontSeeWeightRequired" selector="{{TemandoProductView.FieldValidation({$weightId})}}" after="weightId" />

        <seeElement stepKey="seePackages" selector="{{TemandoProductView.PackageId}}" after="dontSeeWeightRequired" />
        <selectOption stepKey="selectPackageId" selector="{{TemandoProductView.PackageId}}" userInput="{{packageId}}" before="clickSaveProduct" />
    </actionGroup>
    <!-- Set packaging type to pre-packaged -->
    <actionGroup name="SetPackagingTypePrepackaged" extends="SetPackagingType">
        <arguments>
            <argument name="packagingType" type="string" defaultValue="{{TemandoPackagingType.Prepackaged}}" />
            <argument name="length" type="string" defaultValue="10" />
            <argument name="width" type="string" defaultValue="10" />
            <argument name="height" type="string" defaultValue="10" />
            <argument name="weight" type="string" defaultValue="1" />
        </arguments>

        <seeElement stepKey="seeLength" selector="{{TemandoProductView.DimensionsLength}}" after="selectPackagingType" />
        <seeElement stepKey="seeWidth" selector="{{TemandoProductView.DimensionsWidth}}" after="seeLength" />
        <seeElement stepKey="seeHeight" selector="{{TemandoProductView.DimensionsHeight}}" after="seeWidth" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsLength}}" stepKey="lengthId" userInput="id" after="seeHeight" />
        <seeElement stepKey="seeLengthRequired" selector="{{TemandoProductView.FieldValidation({$lengthId})}}" after="lengthId" />
        <fillField stepKey="fillLength" selector="{{TemandoProductView.DimensionsLength}}" userInput="{{length}}" after="seeLengthRequired" />
        <pressKey stepKey="tabOutOfLengthField" selector="{{TemandoProductView.DimensionsLength}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillLength" />
        <dontSeeElement stepKey="dontSeeLengthRequired" selector="{{TemandoProductView.FieldValidation({$lengthId})}}" after="tabOutOfLengthField" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsWidth}}" stepKey="widthId" userInput="id" after="dontSeeLengthRequired" />
        <seeElement stepKey="seeWidthRequired" selector="{{TemandoProductView.FieldValidation({$widthId})}}" after="widthId" />
        <fillField stepKey="fillWidth" selector="{{TemandoProductView.DimensionsWidth}}" userInput="{{width}}" after="seeWidthRequired" />
        <pressKey stepKey="tabOutOfWidthField" selector="{{TemandoProductView.DimensionsWidth}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillWidth" />
        <dontSeeElement stepKey="dontSeeWidthRequired" selector="{{TemandoProductView.FieldValidation({$widthId})}}" after="tabOutOfWidthField" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsHeight}}" stepKey="heightId" userInput="id" after="dontSeeWidthRequired" />
        <seeElement stepKey="seeHeightRequired" selector="{{TemandoProductView.FieldValidation({$heightId})}}" after="heightId" />
        <fillField stepKey="fillHeight" selector="{{TemandoProductView.DimensionsHeight}}" userInput="{{height}}" after="seeHeightRequired" />
        <pressKey stepKey="tabOutOfHeighthField" selector="{{TemandoProductView.DimensionsHeight}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillHeight" />
        <dontSeeElement stepKey="dontSeeHeightRequired" selector="{{TemandoProductView.FieldValidation({$heightId})}}" after="tabOutOfHeighthField" />

        <grabAttributeFrom selector="{{TemandoProductView.Weight}}" stepKey="weightId" userInput="id" after="dontSeeHeightRequired" />
        <seeElement stepKey="seeWeightRequired" selector="{{TemandoProductView.FieldValidation({$weightId})}}" after="weightId" />
        <fillField stepKey="fillWeight" selector="{{TemandoProductView.Weight}}" userInput="{{weight}}" after="seeWeightRequired" />
        <pressKey stepKey="tabOutOfWeightField" selector="{{TemandoProductView.Weight}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillWeight" />
        <dontSeeElement stepKey="dontSeeWeightRequired" selector="{{TemandoProductView.FieldValidation({$weightId})}}" before="clickSaveProduct" />
    </actionGroup>
    <!-- Set packaging type to pre-packaged for bundled products -->
    <actionGroup name="SetBundledProductPackagingTypePrepackaged" extends="SetPackagingType">
        <arguments>
            <argument name="packagingType" type="string" defaultValue="{{TemandoPackagingType.Prepackaged}}" />
            <argument name="length" type="string" defaultValue="10" />
            <argument name="width" type="string" defaultValue="10" />
            <argument name="height" type="string" defaultValue="10" />
        </arguments>

        <seeElement stepKey="seeLength" selector="{{TemandoProductView.DimensionsLength}}" after="selectPackagingType" />
        <seeElement stepKey="seeWidth" selector="{{TemandoProductView.DimensionsWidth}}" after="seeLength" />
        <seeElement stepKey="seeHeight" selector="{{TemandoProductView.DimensionsHeight}}" after="seeWidth" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsLength}}" stepKey="lengthId" userInput="id" after="seeHeight" />
        <seeElement stepKey="seeLengthRequired" selector="{{TemandoProductView.FieldValidation({$lengthId})}}" after="lengthId" />
        <fillField stepKey="fillLength" selector="{{TemandoProductView.DimensionsLength}}" userInput="{{length}}" after="seeLengthRequired" />
        <pressKey stepKey="tabOutOfLengthField" selector="{{TemandoProductView.DimensionsLength}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillLength" />
        <dontSeeElement stepKey="dontSeeLengthRequired" selector="{{TemandoProductView.FieldValidation({$lengthId})}}" after="tabOutOfLengthField" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsWidth}}" stepKey="widthId" userInput="id" after="dontSeeLengthRequired" />
        <seeElement stepKey="seeWidthRequired" selector="{{TemandoProductView.FieldValidation({$widthId})}}" after="widthId" />
        <fillField stepKey="fillWidth" selector="{{TemandoProductView.DimensionsWidth}}" userInput="{{width}}" after="seeWidthRequired" />
        <pressKey stepKey="tabOutOfWidthField" selector="{{TemandoProductView.DimensionsWidth}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillWidth" />
        <dontSeeElement stepKey="dontSeeWidthRequired" selector="{{TemandoProductView.FieldValidation({$widthId})}}" after="tabOutOfWidthField" />

        <grabAttributeFrom selector="{{TemandoProductView.DimensionsHeight}}" stepKey="heightId" userInput="id" after="dontSeeWidthRequired" />
        <seeElement stepKey="seeHeightRequired" selector="{{TemandoProductView.FieldValidation({$heightId})}}" after="heightId" />
        <fillField stepKey="fillHeight" selector="{{TemandoProductView.DimensionsHeight}}" userInput="{{height}}" after="seeHeightRequired" />
        <pressKey stepKey="tabOutOfHeighthField" selector="{{TemandoProductView.DimensionsHeight}}" parameterArray="[\Facebook\WebDriver\WebDriverKeys::TAB]" after="fillHeight" />
        <dontSeeElement stepKey="dontSeeHeightRequired" selector="{{TemandoProductView.FieldValidation({$heightId})}}" after="tabOutOfHeighthField" />
    </actionGroup>
    <!-- Verify packaging type -->
    <actionGroup name="VerifyPackagingType">
        <arguments>
            <argument name="packagingType" type="string" defaultValue="{{TemandoPackagingType.Assigned}}" />
        </arguments>
        <scrollTo stepKey="scrollToShippingSectionAfterSave" selector="{{TemandoProductView.ShippingSection}}" y="-85" />
        <click stepKey="expandShippingAfterSave" selector="{{TemandoProductView.ShippingSection}}" />
        <seeOptionIsSelected stepKey="seePackagingTypeSelected" selector="{{TemandoProductView.PackagingType}}" userInput="{{packagingType}}" />
    </actionGroup>
    <actionGroup name="VerifyPackagingTypeAndPackage" extends="VerifyPackagingType">
        <arguments>
            <argument name="packageId" type="string" defaultValue="{{TemandoPackageLabels.SmallBox}}" />
        </arguments>
        <seeOptionIsSelected stepKey="seePackageSelected" selector="{{TemandoProductView.PackageId}}" userInput="{{packageId}}" after="seePackagingTypeSelected" />
    </actionGroup>
</actionGroups>
