Skip to content

Commit c229696

Browse files
committed
MC-4580: Convert CreateCustomerSegmentEntityWithCustomerConditionsTest to MFTF
1 parent 492d2e3 commit c229696

10 files changed

+149
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- Open the Minicart and check Summary -->
12+
<actionGroup name="StorefrontCheckCartDiscountAndSummaryActionGroup">
13+
<arguments>
14+
<argument name="total" type="string"/>
15+
<argument name="discount" type="string"/>
16+
</arguments>
17+
<waitForPageLoad stepKey="waitForPageLoad"/>
18+
<waitForLoadingMaskToDisappear stepKey="waitForPrices"/>
19+
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/>
20+
<see selector="{{CheckoutCartSummarySection.total}}" userInput="${{total}}" stepKey="assertTotal"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,17 @@
216216
<data key="store_id">0</data>
217217
<data key="website_id">0</data>
218218
</entity>
219+
<entity name="Retailer_Customer" type="customer">
220+
<data key="group_id">3</data>
221+
<data key="default_billing">true</data>
222+
<data key="default_shipping">true</data>
223+
<data key="email" unique="prefix">John.Doe@example.com</data>
224+
<data key="firstname">John</data>
225+
<data key="lastname">Doe</data>
226+
<data key="fullname">John Doe</data>
227+
<data key="password">pwdTest123!</data>
228+
<data key="store_id">0</data>
229+
<data key="website_id">0</data>
230+
<requiredEntity type="address">US_Address_CA</requiredEntity>
231+
</entity>
219232
</entities>

app/code/Magento/Customer/Test/Mftf/Page/StorefrontCustomerDashboardPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<section name="StorefrontCustomerDashboardAccountInformationSection" />
1313
<section name="StorefrontCustomerSidebarSection"/>
1414
<section name="StorefrontMinicartSection"/>
15+
<section name="StorefrontCustomerFooterSection"/>
1516
</page>
1617
</pages>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
<element name="firstNameRequiredMessage" type="text" selector="//input[@name='customer[firstname]']/../label[contains(.,'This is a required field.')]"/>
3232
<element name="lastNameRequiredMessage" type="text" selector="//input[@name='customer[lastname]']/../label[contains(.,'This is a required field.')]"/>
3333
<element name="emailRequiredMessage" type="text" selector="//input[@name='customer[email]']/../label[contains(.,'This is a required field.')]"/>
34+
<element name="customAttribute" type="select" selector="//select[contains(@name, 'customer[{{attribute_code}}]')]" parameterized="true"/>
3435
</section>
3536
</sections>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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="StorefrontCustomerFooterSection">
12+
<element name="footerBlock" type="block" selector="//footer"/>
13+
<element name="formSubscribe" type="input" selector="input#newsletter"/>
14+
<element name="buttonSubscribe" type="button" selector="//form[@id='newsletter-validate-detail']//button[contains(@class, 'subscribe')]" timeout="15"/>
15+
</section>
16+
</sections>

app/code/Magento/SalesRule/Test/Mftf/ActionGroup/AdminCreateCartPriceRuleActionGroup.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424
<see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
2525
</actionGroup>
2626

27+
<actionGroup name="AdminCreateCartPriceRuleAndStayOnEditActionGroup" extends="AdminCreateCartPriceRuleActionGroup" >
28+
<click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="setYesDiscardSubsequentRule" after="clickToExpandActions"/>
29+
<click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveButton"/>
30+
</actionGroup>
31+
2732
<actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup">
2833
<arguments>
2934
<argument name="couponCode" defaultValue="_defaultCoupon.code"/>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminDeleteCartPriceRuleActionGroup">
11+
<arguments>
12+
<argument name="ruleName" type="entity"/>
13+
</arguments>
14+
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToCartPriceRules"/>
15+
<waitForPageLoad stepKey="waitForCartPriceRules"/>
16+
<fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{ruleName.name}}" stepKey="filterByName"/>
17+
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
18+
<click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/>
19+
<click selector="{{AdminCartPriceRulesFormSection.delete}}" stepKey="clickDeleteButton"/>
20+
<click selector="{{AdminCartPriceRulesFormSection.modalAcceptButton}}" stepKey="confirmDelete"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
11+
<arguments>
12+
<argument name="attributeName" type="string"/>
13+
<argument name="value" type="entity"/>
14+
</arguments>
15+
16+
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/>
17+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/>
18+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/>
19+
20+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
21+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/>
22+
23+
<waitForPageLoad time="20" stepKey="waitForOperator"/>
24+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/>
25+
<click selector="{{AdminCartPriceRulesFormSection.openList}}" stepKey="openList" />
26+
<waitForPageLoad time="20" stepKey="waitForGrid"/>
27+
<fillField selector="{{AdminCartPriceRulesFormSection.searchSegmentName}}" userInput="{{value.name}}" stepKey="fillSegmentName"/>
28+
<click selector="{{AdminCartPriceRulesFormSection.searchButton}}" stepKey="clickButtonSearch"/>
29+
30+
<waitForPageLoad stepKey="waitForResults"/>
31+
<checkOption selector="{{AdminCartPriceRulesFormSection.selectAll}}" stepKey="checkAll"/>
32+
<waitForPageLoad stepKey="waitForChecking"/>
33+
<moveMouseOver selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="moveOnButton"/>
34+
<click selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="setCustomerSegment"/>
35+
<click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
36+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
37+
</actionGroup>
38+
<actionGroup name="SetCartAttributeConditionWhenMatchForCartPriceRuleActionGroup" extends="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
39+
<arguments>
40+
<argument name="operatorType" type="string" defaultValue="matches"/>
41+
</arguments>
42+
<click selector="{{AdminCartPriceRulesFormSection.condition('matches')}}" stepKey="clickToChooseOption" after="waitForOperator"/>
43+
<selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType" after="clickToChooseOption"/>
44+
</actionGroup>
45+
</actionGroups>

app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,20 @@
241241
<data key="apply">Percent of product price discount</data>
242242
<data key="discountAmount">50</data>
243243
</entity>
244+
245+
<entity name="RetailerCartPriceRule" type="SalesRule">
246+
<data key="name" unique="suffix">Cart Price Rule</data>
247+
<data key="websites">Main Website</data>
248+
<data key="customerGroups">'Retailer'</data>
249+
<data key="apply">Percent of product price discount</data>
250+
<data key="discountAmount">50</data>
251+
</entity>
252+
253+
<entity name="SegmentCartPriceRule" type="SalesRule">
254+
<data key="name" unique="suffix">Cart Price Rule</data>
255+
<data key="websites">Main Website</data>
256+
<data key="customerGroups">'General'</data>
257+
<data key="apply">Percent of product price discount</data>
258+
<data key="discountAmount">50</data>
259+
</entity>
244260
</entities>

app/code/Magento/SalesRule/Test/Mftf/Section/AdminCartPriceRulesFormSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
<element name="ruleFieldByIndex" type="input" selector="[id='conditions__{{index}}__value']" parameterized="true"/>
4949
<element name="selectCountryDropdown" type="select" selector="(//*[contains(@value,'country_id')]/..//select)[last()]"/>
5050

51+
<!--Conditions checker -->
52+
<element name="openList" type="button" selector="a.rule-chooser-trigger>img.v-middle.rule-chooser-trigger"/>
53+
<element name="searchSegmentName" type="input" selector="//div[@class='rule-chooser']//input[@name='grid_segment_name']"/>
54+
<element name="searchButton" type="button" selector="div.admin__filter-actions>button.action-default.scalable.action-secondary" timeout="10" />
55+
<element name="selectAll" type="checkbox" selector="//*[@class='rule-chooser']//input[contains(@class, 'admin__control-checkbox')]" timeout="10"/>
56+
<element name="resetSearchFilter" type="button" selector="//div[@class='admin__filter-actions']//button[@title='Reset Filter']"/>
57+
<element name="setSegment" type="button" selector="//*[@class='rule-tree-wrapper']//a[@class='rule-param-apply']"/>
58+
5159
<!-- Actions sub-form -->
5260
<element name="actionsTab" type="text" selector="//div[@data-index='actions']//span[contains(.,'Actions')][1]"/>
5361
<element name="actionsHeader" type="button" selector="div[data-index='actions']" timeout="30"/>

0 commit comments

Comments
 (0)