<?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">
    <actionGroup name="SetDotmailerAccountData">
        <amOnPage url="{{AdminDotmailerAccountsPage.url}}" stepKey="navigateToDotmailerAccountPage"/>
        <waitForPageLoad stepKey="waitForPageLoad"/>
        <conditionalClick stepKey="expandAccountsTab" selector="{{AdminDotmailerAccountsSection.accountsFieldsetToggle}}" dependentSelector="{{AdminDotmailerAccountsSection.accountsFieldset}}" visible="false"/>
        <selectOption selector="{{AdminDotmailerAccountsSection.accountsEnabledOption}}" userInput="Yes" stepKey="setEnabled"/>
        <fillField selector="{{AdminDotmailerAccountsSection.accountsUsernameField}}" userInput="{{_CREDS.engagement_cloud_api_username}}" stepKey="setApiUserName"/>
        <fillField selector="{{AdminDotmailerAccountsSection.accountsPasswordField}}" userInput="{{_CREDS.engagement_cloud_api_password}}" stepKey="setApiPassword"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig" />
        <waitForPageLoad stepKey="waitForPageLoad1"/>
    </actionGroup>
    <actionGroup name="ResetDotmailerAccountData">
        <amOnPage url="{{AdminDotmailerAccountsPage.url}}" stepKey="navigateToDotmailerAccountPageReset"/>
        <waitForPageLoad stepKey="waitForPageLoadReset"/>
        <conditionalClick stepKey="expandAccountsTabReset" selector="{{AdminDotmailerAccountsSection.accountsFieldsetToggle}}" dependentSelector="{{AdminDotmailerAccountsSection.accountsFieldset}}" visible="false"/>
        <clearField selector="{{AdminDotmailerAccountsSection.accountsUsernameField}}" stepKey="setApiUserNameReset"/>
        <clearField selector="{{AdminDotmailerAccountsSection.accountsPasswordField}}" stepKey="setApiPasswordReset"/>
        <selectOption selector="{{AdminDotmailerAccountsSection.accountsEnabledOption}}" userInput="No" stepKey="setEnabledReset"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfigReset" />
        <waitForPageLoad stepKey="waitForPageLoad2"/>
    </actionGroup>
    <actionGroup name="SetDisableDotmailerAccount">
        <amOnPage url="{{AdminDotmailerAccountsPage.url}}" stepKey="navigateToDotmailerAccountPage1"/>
        <waitForPageLoad stepKey="waitForPageLoad3"/>
        <conditionalClick stepKey="expandAccountsTab1" selector="{{AdminDotmailerAccountsSection.accountsFieldsetToggle}}" dependentSelector="{{AdminDotmailerAccountsSection.accountsFieldset}}" visible="false"/>
        <selectOption selector="{{AdminDotmailerAccountsSection.accountsEnabledOption}}" userInput="No" stepKey="setEnabled1"/>
        <click selector="{{AdminMainActionsSection.save}}" stepKey="saveConfig1" />
        <waitForPageLoad stepKey="waitForPageLoad4"/>
    </actionGroup>
</actionGroups>