<?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="StorefrontCreateCustomerSignedUpNewsletterActionGroup">
        <annotations>
            <description>Goes to the Storefront. Clicks on 'Create Account'. Fills in the provided Customer details, including Newsletter Sign-Up. Clicks on 'Create Account' button.</description>
        </annotations>
        <arguments>
            <argument name="customer" defaultValue="CustomerEntityOne"/>
        </arguments>

        <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/>
        <waitForPageLoad stepKey="waitForNavigateToCustomersPageLoad"/>
        <waitForElementClickable selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}" stepKey="waitForCreateAnAccountLink"/>
        <click stepKey="clickOnCreateAccountLink" selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}"/>
        <fillField  stepKey="fillFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/>
        <fillField  stepKey="fillLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/>
        <checkOption selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="checkSignUpForNewsletter"/>
        <fillField  stepKey="fillEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/>
        <fillField  stepKey="fillPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/>
        <fillField  stepKey="fillConfirmPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/>
        <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/>
        <waitForPageLoad stepKey="waitForCreateAccountButtonToLoad"/>
    </actionGroup>
</actionGroups>
