Skip to content

Commit bdcd81e

Browse files
authored
Merge pull request #87 from magento-pangolin/MC-4571-4575
MC-4571-4575
2 parents 492d2e3 + 063a684 commit bdcd81e

9 files changed

+136
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<wait time="10" stepKey="waitForTotalPrice"/>
21+
<see selector="{{CheckoutCartSummarySection.total}}" userInput="${{total}}" stepKey="assertTotal"/>
22+
</actionGroup>
23+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<element name="shippingMethodForm" type="text" selector="#co-shipping-method-form"/>
1515
<element name="shippingMethod" type="text" selector="//*[@id='cart-totals']//tr[@class='totals shipping excl']//th//span[@class='value']"/>
1616
<element name="shipping" type="text" selector="//*[@id='cart-totals']//tr[@class='totals shipping excl']//td//span[@class='price']"/>
17-
<element name="total" type="text" selector="//*[@id='cart-totals']//tr[@class='grand totals']//td//span[@class='price']"/>
17+
<element name="total" type="text" selector="//*[@id='cart-totals']//tr[@class='grand totals']//td//span[@class='price']" timeout="10"/>
1818
<element name="proceedToCheckout" type="button" selector=".action.primary.checkout span" timeout="30"/>
1919
<element name="discountAmount" type="text" selector="td[data-th='Discount']"/>
2020
<element name="shippingHeading" type="button" selector="#block-shipping-heading"/>

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

+13
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/Newsletter/Test/Mftf/Section/StorefrontNewsletterManageSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontNewsletterManageSection">
1212
<element name="subscriptionCheckbox" type="checkbox" selector="#subscription" />
13+
<element name="saveButton" type="button" selector="div.primary>button"/>
1314
</section>
1415
</sections>

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

+5
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"/>
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,46 @@
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+
<!--Set condition for Customer Segment-->
11+
<actionGroup name="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
12+
<arguments>
13+
<argument name="attributeName" type="string"/>
14+
<argument name="value" type="entity"/>
15+
</arguments>
16+
17+
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/>
18+
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/>
19+
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/>
20+
21+
<waitForPageLoad stepKey="waitForDropDownOpened"/>
22+
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/>
23+
24+
<waitForPageLoad time="20" stepKey="waitForOperator"/>
25+
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/>
26+
<click selector="{{AdminCartPriceRulesFormSection.openList}}" stepKey="openList" />
27+
<waitForPageLoad time="20" stepKey="waitForGrid"/>
28+
<fillField selector="{{AdminCartPriceRulesFormSection.searchSegmentName}}" userInput="{{value.name}}" stepKey="fillSegmentName"/>
29+
<click selector="{{AdminCartPriceRulesFormSection.searchButton}}" stepKey="clickButtonSearch"/>
30+
31+
<waitForPageLoad stepKey="waitForResults"/>
32+
<checkOption selector="{{AdminCartPriceRulesFormSection.selectAll}}" stepKey="checkAll"/>
33+
<waitForPageLoad stepKey="waitForChecking"/>
34+
<moveMouseOver selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="moveOnButton"/>
35+
<click selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="setCustomerSegment"/>
36+
<click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
37+
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
38+
</actionGroup>
39+
<actionGroup name="SetCartAttributeConditionWhenMatchForCartPriceRuleActionGroup" extends="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
40+
<arguments>
41+
<argument name="operatorType" type="string" defaultValue="matches"/>
42+
</arguments>
43+
<click selector="{{AdminCartPriceRulesFormSection.condition('matches')}}" stepKey="clickToChooseOption" after="waitForOperator"/>
44+
<selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType" after="clickToChooseOption"/>
45+
</actionGroup>
46+
</actionGroups>

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

+16
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

+9-1
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"/>
@@ -85,4 +93,4 @@
8593
<element name="generateCouponsButton" type="button" selector="#coupons_generate_button" timeout="30"/>
8694
<element name="generatedCouponByIndex" type="text" selector="#couponCodesGrid_table > tbody > tr:nth-child({{var}}) > td.col-code" parameterized="true"/>
8795
</section>
88-
</sections>
96+
</sections>

0 commit comments

Comments
 (0)