Skip to content

Commit b7fe546

Browse files
committed
MC-4538: Convert RegisterCustomerFrontendEntityTest to MFTF
1 parent 509ad72 commit b7fe546

7 files changed

+150
-3
lines changed

app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,21 @@
2424
<click stepKey="clickOnOk" selector="{{CustomersPageSection.ok}}"/>
2525
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/>
2626
</actionGroup>
27+
<actionGroup name="DeleteNewCustomerByEmailActionGroup">
28+
<arguments>
29+
<argument name="email" type="string"/>
30+
</arguments>
31+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
32+
<waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/>
33+
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/>
34+
<waitForPageLoad stepKey="waitForClearFilters"/>
35+
<fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{CustomerEntityOne.email}}" stepKey="filterEmail"/>
36+
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>
37+
<waitForPageLoad stepKey="waitForApplyFilters"/>
38+
<checkOption selector="{{CustomersPageSection.customerCheckbox(email)}}" stepKey="seeCustomerEmailInGrid"/>
39+
<click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/>
40+
<click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/>
41+
<click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/>
42+
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/>
43+
</actionGroup>
2744
</actionGroups>

app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,29 @@
2424
<see stepKey="seeLastName" userInput="{{Customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" />
2525
<see stepKey="seeEmail" userInput="{{Customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" />
2626
</actionGroup>
27-
27+
28+
<actionGroup name="StorefrontCreateCustomerSignedUpNewsletterActionGroup">
29+
<arguments>
30+
<argument name="customer" defaultValue="CustomerEntityOne"/>
31+
</arguments>
32+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/>
33+
<waitForPageLoad stepKey="waitForNavigateToCustomersPageLoad"/>
34+
<click stepKey="clickOnCreateAccountLink" selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}"/>
35+
<fillField stepKey="fillFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/>
36+
<fillField stepKey="fillLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/>
37+
<checkOption selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="checkSignUpForNewsletter"/>
38+
<fillField stepKey="fillEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/>
39+
<fillField stepKey="fillPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/>
40+
<fillField stepKey="fillConfirmPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/>
41+
<click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/>
42+
<waitForPageLoad stepKey="waitForCreateAccountButtonToLoad" />
43+
<see stepKey="seeThankYouMessage" userInput="Thank you for registering with Main Website Store."/>
44+
<see stepKey="seeFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" />
45+
<see stepKey="seeLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" />
46+
<see stepKey="seeEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}" />
47+
<seeInCurrentUrl url="{{StorefrontCustomerDashboardPage.url}}" stepKey="seeAssertInCurrentUrl"/>
48+
</actionGroup>
49+
2850
<actionGroup name="EnterCustomerAddressInfo">
2951
<arguments>
3052
<argument name="Address"/>
@@ -48,6 +70,6 @@
4870

4971
<actionGroup name="SignUpNewCustomerStorefrontActionGroup" extends="SignUpNewUserFromStorefrontActionGroup">
5072
<waitForPageLoad stepKey="waitForRegistered" after="clickCreateAccountButton"/>
51-
<remove keyForRemoval="seeThankYouMessage" after="waitForRegistered"/>
73+
<remove keyForRemoval="seeThankYouMessage"/>
5274
</actionGroup>
53-
</actionGroups>
75+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Section/AdminEditCustomerInformationSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<section name="AdminEditCustomerInformationSection">
1212
<element name="orders" type="button" selector="#tab_orders_content" timeout="30"/>
1313
<element name="addresses" type="button" selector="//a[@id='tab_address']" timeout="30"/>
14+
<element name="newsLetter" type="button" selector="//a[@class='admin__page-nav-link' and @id='tab_newsletter_content']" timeout="30"/>
1415
</section>
1516
</sections>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminEditCustomerNewsletterSection">
12+
<element name="subscribedToNewsletter" type="checkbox" selector="//div[@class='admin__field-control control']/input[@name='subscription']"/>
13+
</section>
14+
</sections>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerCreateFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<element name="firstnameField" type="input" selector="#firstname"/>
1313
<element name="lastnameField" type="input" selector="#lastname"/>
1414
<element name="lastnameLabel" type="text" selector="//label[@for='lastname']"/>
15+
<element name="signUpForNewsletter" type="checkbox" selector="//div/input[@name='is_subscribed']"/>
1516
<element name="emailField" type="input" selector="#email_address"/>
1617
<element name="passwordField" type="input" selector="#password"/>
1718
<element name="confirmPasswordField" type="input" selector="#password-confirmation"/>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCreateNewCustomerOnStorefrontSignupNewsletterTest">
12+
<annotations>
13+
<stories value="Create New Customer"/>
14+
<title value="Create New Customer on Storefront, Sign-up Newsletter"/>
15+
<description value="Test log in to Create New Customer and Create New Customer on Storefront, Sign-up Newsletter"/>
16+
<testCaseId value="MC-10914"/>
17+
<severity value="CRITICAL"/>
18+
<group value="customer"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="DeleteNewCustomerByEmailActionGroup" stepKey="deleteNewUser">
27+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
28+
</actionGroup>
29+
<actionGroup ref="logout" stepKey="logout"/>
30+
</after>
31+
32+
<!--Create new customer on storefront and signup news letter-->
33+
<actionGroup ref="StorefrontCreateCustomerSignedUpNewsletterActionGroup" stepKey="createCustomer">
34+
<argument name="customer" value="CustomerEntityOne" />
35+
</actionGroup>
36+
37+
<!--Verify created new customer in grid-->
38+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
39+
<waitForPageLoad stepKey="waitForNavigateToCustomersPageLoad"/>
40+
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/>
41+
<fillField userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerFiltersSection.emailInput}}" stepKey="filterEmail"/>
42+
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="clickApplyFilter"/>
43+
<see selector="{{AdminCustomerGridSection.customerGrid}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="seeAssertCustomerFirstNameInGrid"/>
44+
<see selector="{{AdminCustomerGridSection.customerGrid}}" userInput="{{CustomerEntityOne.lastname}}" stepKey="seeAssertCustomerLastNameInGrid"/>
45+
<see selector="{{AdminCustomerGridSection.customerGrid}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAssertCustomerEmailInGrid"/>
46+
47+
<!--Verify created new customer is subscribed to newsletter-->
48+
<click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickFirstRowEditLink"/>
49+
<waitForPageLoad stepKey="waitForEditLinkLoad"/>
50+
<click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickNewsLetter"/>
51+
<waitForPageLoad stepKey="waitForNewsletterTabToOpen"/>
52+
<seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedToNewsletter}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/>
53+
</test>
54+
</tests>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminCreateNewCustomerOnStorefrontTest">
12+
<annotations>
13+
<stories value="Create New Customer"/>
14+
<title value="Create New Customer on Storefront"/>
15+
<description value="Test log in to Create New Customer and Create New Customer on Storefront"/>
16+
<testCaseId value="MC-10915"/>
17+
<severity value="CRITICAL"/>
18+
<group value="customer"/>
19+
<group value="mtf_migrated"/>
20+
</annotations>
21+
22+
<before>
23+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
24+
</before>
25+
<after>
26+
<actionGroup ref="DeleteNewCustomerByEmailActionGroup" stepKey="deleteNewUser">
27+
<argument name="email" value="{{CustomerEntityOne.email}}"/>
28+
</actionGroup>
29+
<actionGroup ref="logout" stepKey="logout"/>
30+
</after>
31+
32+
<!--Create new customer on storefront-->
33+
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser">
34+
<argument name="Customer" value="CustomerEntityOne"/>
35+
</actionGroup>
36+
<seeInCurrentUrl url="{{StorefrontCustomerDashboardPage.url}}" stepKey="seeAssertInCurrentUrl"/>
37+
</test>
38+
</tests>

0 commit comments

Comments
 (0)