<?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="AssertStoreFrontendActionGroup">
        <annotations>
            <description>Goes to the Storefront. Selects the provided Store in the Store View dropdown menu. Validates that the provided Store View #1 is selected. Validates that the provided Store View 2 is present in the dropdown menu.</description>
        </annotations>
        <arguments>
            <argument name="customStore" type="string"/>
            <!-- defaultValue is blank so that it can be used in cases where there is only one store view -->
            <argument name="storeView1" type="string" defaultValue=""/>
            <argument name="storeView2" type="string" defaultValue=""/>
        </arguments>

        <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/>
        <waitForPageLoad stepKey="waitForStorefrontHomePageLoad"/>
        <click selector="{{StorefrontFooterSection.switchStoreButton}}" stepKey="clickSwitchStoreButton"/>
        <waitForElementVisible selector="{{StorefrontFooterSection.storeLink(customStore)}}" stepKey="waitForStoreLinkToVosible"/>
        <click selector="{{StorefrontFooterSection.storeLink(customStore)}}"  stepKey="clickStoreLinkCustomStore"/>
        <waitForPageLoad stepKey="waitForCustomStoreToLoad"/>
        <see selector="{{StorefrontHeaderSection.storeViewName}}" userInput="{{storeView1}}" stepKey="seeAssertFirstStoreViewOnStorefront"/>
        <click selector="{{StorefrontHeaderSection.storeViewName}}" stepKey="clickStoreViewName"/>
        <see selector="{{StorefrontHeaderSection.storeViewDropdown}}" userInput="{{storeView2}}" stepKey="seeAssertSecondStoreViewOnStorefront"/>
    </actionGroup>
</actionGroups>
