<?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="EnableYotpoPluginWithCustomCredentials">
    <amOnPage url="admin/admin/system_config/edit/section/yotpo/store/1/" stepKey="navigateToYotpoConfigurationOnDefaultStoreView" />

    <!-- enable Yotpo plugin -->
    <selectOption userInput="1" selector="{{AdminLoginToYotpo.YotpoEnabled}}" stepKey="setYotpoAsActive"/>
    <seeOptionIsSelected userInput="Yes" selector="{{AdminLoginToYotpo.YotpoEnabled}}" stepKey="seeYotpoEnabled"/>

    <!-- set Yotpo credentials -->
    <fillField userInput="{{appKey}}" selector="{{AdminLoginToYotpo.yotpoAppKey}}" stepKey="fillAppKey"/>
    <fillField userInput="{{secret}}" selector="{{AdminLoginToYotpo.yotpoSecret}}" stepKey="fillSecret"/>

    <!-- save Yotpo configuration -->
    <click selector="{{AdminLoginToYotpo.SaveConfiguration}}" stepKey="ClickOnSaveConfig"/>

    <!-- Check that configuration was saved -->
    <waitForPageLoad stepKey="waitForSaveConfig"/>
  </actionGroup>
</actionGroups>
