Skip to content

Commit

Permalink
REFACTOR: Extract Action Groups to separate files (according to MFTF …
Browse files Browse the repository at this point in the history
…best practices)
  • Loading branch information
lbajsarowicz committed Nov 28, 2019
1 parent c7ca62e commit 14f95d9
Show file tree
Hide file tree
Showing 43 changed files with 593 additions and 404 deletions.
@@ -0,0 +1,20 @@
<?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="AdminClearCustomersFiltersActionGroup">
<annotations>
<description>Goes to the Admin Customers grid page. Clicks on 'Clear Filters'.</description>
</annotations>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="amOnCustomersPage"/>
<waitForPageLoad stepKey="WaitForPageToLoad"/>
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,34 @@
<?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="AdminCreateCustomerWithWebSiteAndGroupActionGroup">
<annotations>
<description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description>
</annotations>
<arguments>
<argument name="customerData" defaultValue="Simple_US_Customer"/>
<argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/>
<argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/>
</arguments>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/>
<click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/>
<selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/>
<selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/>
<fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/>
<fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/>
<fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/>
<selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/>
<waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/>
<click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/>
<waitForPageLoad stepKey="waitForCustomersPage"/>
<see stepKey="seeSuccessMessage" userInput="You saved the customer."/>
</actionGroup>
</actionGroups>
Expand Up @@ -47,28 +47,4 @@
<click stepKey="saveAddress" selector="{{AdminCustomerAddressesSection.saveAddress}}"/>
<waitForPageLoad stepKey="waitForAddressSave"/>
</actionGroup>

<actionGroup name="AdminCreateCustomerWithWebSiteAndGroup">
<annotations>
<description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description>
</annotations>
<arguments>
<argument name="customerData" defaultValue="Simple_US_Customer"/>
<argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/>
<argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/>
</arguments>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/>
<click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/>
<selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/>
<selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/>
<fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/>
<fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/>
<fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/>
<selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/>
<waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/>
<click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/>
<waitForPageLoad stepKey="waitForCustomersPage"/>
<see stepKey="seeSuccessMessage" userInput="You saved the customer."/>
</actionGroup>
</actionGroups>
Expand Up @@ -8,7 +8,7 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminEditCustomerAddressNoZipNoState" extends="AdminEditCustomerAddressesFrom">
<actionGroup name="AdminEditCustomerAddressNoZipNoStateActionGroup" extends="AdminEditCustomerAddressesFromActionGroup">
<annotations>
<description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.</description>
</annotations>
Expand Down
Expand Up @@ -8,7 +8,7 @@

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBilling" extends="AdminEditCustomerAddressesFrom">
<actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup" extends="AdminEditCustomerAddressesFromActionGroup">
<annotations>
<description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'.</description>
</annotations>
Expand Down
Expand Up @@ -9,7 +9,7 @@
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<!-- Same as "EditCustomerAddressesFromAdminActionGroup" but taking country and state from input "customerAddress" -->
<actionGroup name="AdminEditCustomerAddressesFrom">
<actionGroup name="AdminEditCustomerAddressesFromActionGroup">
<annotations>
<description>Adds the provided Address to a Customer from the Admin Customers creation/edit page.</description>
</annotations>
Expand All @@ -34,38 +34,4 @@
<click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/>
<waitForPageLoad stepKey="waitForAddressSaved"/>
</actionGroup>

<actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBilling" extends="AdminEditCustomerAddressesFrom">
<annotations>
<description>EXTENDS: AdminEditCustomerAddressesFrom. Clicks on 'Set Default' for Billing/Shipping.</description>
</annotations>

<click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/>
<click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/>
</actionGroup>

<actionGroup name="AdminEditCustomerAddressNoZipNoState" extends="AdminEditCustomerAddressesFrom">
<annotations>
<description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.</description>
</annotations>

<remove keyForRemoval="selectState"/>
<remove keyForRemoval="fillZipCode"/>
<click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/>
<click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/>
</actionGroup>

<actionGroup name="SelectDropdownCustomerAddressAttributeValueActionGroup">
<annotations>
<description>Selects the provided Option in the provided Customer Address Attribute drop down menu. Clicks on Save.</description>
</annotations>
<arguments>
<argument name="customerAddressAttribute"/>
<argument name="optionValue" type="string"/>
</arguments>

<selectOption selector="{{AdminEditCustomerAddressesSection.dropDownAttribute(customerAddressAttribute.code)}}" userInput="{{optionValue}}" stepKey="selectOptionValue"/>
<click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/>
<waitForPageLoad stepKey="waitForAddressSaved"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,26 @@
<?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="AssertSignedUpNewsletterActionGroup">
<annotations>
<description>Validates that the provided Customer details are present and correct on the Storefront Customer Dashboard page.</description>
</annotations>
<arguments>
<argument name="customer" defaultValue="CustomerEntityOne"/>
<argument name="storeName" defaultValue="Main Website" type="string"/>
</arguments>

<see stepKey="successMessage" userInput="Thank you for registering with {{storeName}} Store." selector="{{AdminCustomerMessagesSection.successMessage}}"/>
<see stepKey="seeFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/>
<see stepKey="seeLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/>
<see stepKey="seeEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/>
<seeInCurrentUrl url="{{StorefrontCustomerDashboardPage.url}}" stepKey="seeAssertInCurrentUrl"/>
</actionGroup>
</actionGroups>
Expand Up @@ -15,7 +15,7 @@
<arguments>
<argument name="lastName" defaultValue=""/>
</arguments>

<!--Clear filter if exist-->
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingCustomerFilters"/>
Expand All @@ -29,28 +29,4 @@
<click stepKey="clickOnOk" selector="{{CustomersPageSection.ok}}"/>
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/>
</actionGroup>

<actionGroup name="DeleteCustomerByEmailActionGroup">
<annotations>
<description>Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.</description>
</annotations>
<arguments>
<argument name="email" type="string"/>
</arguments>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
<waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/>
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/>
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
<waitForPageLoad stepKey="waitForClearFilters"/>
<fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{email}}" stepKey="filterEmail"/>
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<click selector="{{AdminCustomerGridSection.selectFirstRow}}" stepKey="clickOnEditButton1"/>
<click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/>
<click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/>
<waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/>
<click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/>
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="30"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,34 @@
<?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="DeleteCustomerByEmailActionGroup">
<annotations>
<description>Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.</description>
</annotations>
<arguments>
<argument name="email" type="string"/>
</arguments>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
<waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/>
<click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/>
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/>
<waitForPageLoad stepKey="waitForClearFilters"/>
<fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{email}}" stepKey="filterEmail"/>
<click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/>
<waitForPageLoad stepKey="waitForPageToLoad"/>
<click selector="{{AdminCustomerGridSection.selectFirstRow}}" stepKey="clickOnEditButton1"/>
<click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/>
<click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/>
<waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/>
<click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/>
<waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="30"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,31 @@
<?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="DeleteCustomerFromAdminActionGroup">
<annotations>
<description>Goes to the Admin Customers grid page. Deletes the provided Customer from the grid. Validates that the Success message is present and correct.</description>
</annotations>
<arguments>
<argument name="customer" defaultValue="CustomerEntityOne"/>
</arguments>

<amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/>
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/>
<fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{customer.email}}" stepKey="fillSearch"/>
<click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickSubmit"/>
<waitForAjaxLoad stepKey="waitForLoadAjax"/>
<click selector="{{AdminCustomerGridMainActionsSection.multicheck}}" stepKey="selectAll"/>
<click selector="{{AdminCustomerGridMainActionsSection.actions}}" stepKey="clickActions"/>
<click selector="{{AdminCustomerGridMainActionsSection.delete}}" stepKey="clickDelete"/>
<waitForAjaxLoad stepKey="waitForLoadConfirmation"/>
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/>
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) were deleted" stepKey="seeSuccess"/>
</actionGroup>
</actionGroups>
@@ -0,0 +1,33 @@
<?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="EnterCustomerAddressInfoActionGroup">
<annotations>
<description>Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.</description>
</annotations>
<arguments>
<argument name="Address"/>
</arguments>

<amOnPage url="customer/address/new/" stepKey="goToAddressPage"/>
<waitForPageLoad stepKey="waitForAddressPage"/>
<fillField stepKey="fillFirstName" selector="{{StorefrontCustomerAddressSection.firstName}}" userInput="{{Address.firstname}}"/>
<fillField stepKey="fillLastName" selector="{{StorefrontCustomerAddressSection.lastName}}" userInput="{{Address.lastname}}"/>
<fillField stepKey="fillCompany" selector="{{StorefrontCustomerAddressSection.company}}" userInput="{{Address.company}}"/>
<fillField stepKey="fillPhoneNumber" selector="{{StorefrontCustomerAddressSection.phoneNumber}}" userInput="{{Address.telephone}}"/>
<fillField stepKey="fillStreetAddress1" selector="{{StorefrontCustomerAddressSection.streetAddress1}}" userInput="{{Address.street[0]}}"/>
<fillField stepKey="fillStreetAddress2" selector="{{StorefrontCustomerAddressSection.streetAddress2}}" userInput="{{Address.street[1]}}"/>
<fillField stepKey="fillCityName" selector="{{StorefrontCustomerAddressSection.city}}" userInput="{{Address.city}}"/>
<selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/>
<selectOption stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvince}}" userInput="{{Address.state}}"/>
<fillField stepKey="fillZip" selector="{{StorefrontCustomerAddressSection.zip}}" userInput="{{Address.postcode}}"/>
<click stepKey="saveAddress" selector="{{StorefrontCustomerAddressSection.saveAddress}}"/>
</actionGroup>
</actionGroups>

0 comments on commit 14f95d9

Please sign in to comment.