<?xml version="1.0" encoding="UTF-8"?>
<!--
 /**
  * Copyright © Magento, Inc. All rights reserved.
  * See COPYING.txt for license details.
  */
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
    <actionGroup name="AdminCreateShipmentPackageActionGroup">
        <arguments>
            <argument name="bundleProductName" type="string"/>
            <argument name="configurableProductName" type="string"/>
        </arguments>
        <waitForElementClickable selector="{{AdminShipmentCreatePackageMainSection.addPackage}}" stepKey="waitForAddPackageButtonVisible"/>
        <click selector="{{AdminShipmentCreatePackageMainSection.addPackage}}" stepKey="clickOnAddPackageButton"/>
        <waitForElementClickable selector="{{AdminShipmentCreatePackageMainSection.addProductsToSecondPackage}}" stepKey="waitForAddProductsToPackageVisible"/>
        <click selector="{{AdminShipmentCreatePackageMainSection.addProductsToSecondPackage}}" stepKey="clickAddProducts"/>
        <waitForElementVisible selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('bundleProductName')}}" stepKey="waitForProductBeVisible"/>
        <checkOption selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('bundleProductName')}}" stepKey="selectBundleProductCheckbox"/>
        <checkOption selector="{{AdminShipmentCreatePackageProductGridSection.concreteProductCheckbox('configurableProductName')}}" stepKey="selectConfigurableProductCheckbox"/>
        <click selector="{{AdminShipmentCreatePackageMainSection.addSelectedProductToSecondPackage}}" stepKey="addingSecondPackageForMultipleProduct"/>
        <waitForElementNotVisible selector="{{AdminShipmentCreatePackageMainSection.saveButtonDisabled}}" stepKey="waitForBeEnabled"/>
        <click selector="{{AdminShipmentCreatePackageMainSection.save}}" stepKey="clickSave"/>
        <waitForPageLoad stepKey="waitForSaving"/>
        <waitForText selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created. You created the shipping label." stepKey="seeShipmentCreateSuccess"/>
    </actionGroup>
</actionGroups>
