Skip to content

Commit

Permalink
Merge pull request #87 from magento-pangolin/MC-4571-4575
Browse files Browse the repository at this point in the history
MC-4571-4575
  • Loading branch information
soumyau authored Apr 11, 2019
2 parents 492d2e3 + 063a684 commit bdcd81e
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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">
<!-- Open the Minicart and check Summary -->
<actionGroup name="StorefrontCheckCartDiscountAndSummaryActionGroup">
<arguments>
<argument name="total" type="string"/>
<argument name="discount" type="string"/>
</arguments>
<waitForPageLoad stepKey="waitForPageLoad"/>
<waitForLoadingMaskToDisappear stepKey="waitForPrices"/>
<see selector="{{CheckoutCartSummarySection.discountAmount}}" userInput="-${{discount}}" stepKey="assertDiscount"/>
<wait time="10" stepKey="waitForTotalPrice"/>
<see selector="{{CheckoutCartSummarySection.total}}" userInput="${{total}}" stepKey="assertTotal"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<element name="shippingMethodForm" type="text" selector="#co-shipping-method-form"/>
<element name="shippingMethod" type="text" selector="//*[@id='cart-totals']//tr[@class='totals shipping excl']//th//span[@class='value']"/>
<element name="shipping" type="text" selector="//*[@id='cart-totals']//tr[@class='totals shipping excl']//td//span[@class='price']"/>
<element name="total" type="text" selector="//*[@id='cart-totals']//tr[@class='grand totals']//td//span[@class='price']"/>
<element name="total" type="text" selector="//*[@id='cart-totals']//tr[@class='grand totals']//td//span[@class='price']" timeout="10"/>
<element name="proceedToCheckout" type="button" selector=".action.primary.checkout span" timeout="30"/>
<element name="discountAmount" type="text" selector="td[data-th='Discount']"/>
<element name="shippingHeading" type="button" selector="#block-shipping-heading"/>
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,17 @@
<data key="store_id">0</data>
<data key="website_id">0</data>
</entity>
<entity name="Retailer_Customer" type="customer">
<data key="group_id">3</data>
<data key="default_billing">true</data>
<data key="default_shipping">true</data>
<data key="email" unique="prefix">John.Doe@example.com</data>
<data key="firstname">John</data>
<data key="lastname">Doe</data>
<data key="fullname">John Doe</data>
<data key="password">pwdTest123!</data>
<data key="store_id">0</data>
<data key="website_id">0</data>
<requiredEntity type="address">US_Address_CA</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontNewsletterManageSection">
<element name="subscriptionCheckbox" type="checkbox" selector="#subscription" />
<element name="saveButton" type="button" selector="div.primary>button"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<see selector="{{AdminCartPriceRulesFormSection.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
</actionGroup>

<actionGroup name="AdminCreateCartPriceRuleAndStayOnEditActionGroup" extends="AdminCreateCartPriceRuleActionGroup" >
<click selector="{{AdminCartPriceRulesFormSection.discardSubsequentRules}}" stepKey="setYesDiscardSubsequentRule" after="clickToExpandActions"/>
<click selector="{{AdminCartPriceRulesFormSection.saveAndContinue}}" stepKey="clickSaveButton"/>
</actionGroup>

<actionGroup name="AdminCreateCartPriceRuleWithCouponCode" extends="AdminCreateCartPriceRuleActionGroup">
<arguments>
<argument name="couponCode" defaultValue="_defaultCoupon.code"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="AdminDeleteCartPriceRuleActionGroup">
<arguments>
<argument name="ruleName" type="entity"/>
</arguments>
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="goToCartPriceRules"/>
<waitForPageLoad stepKey="waitForCartPriceRules"/>
<fillField selector="{{AdminCartPriceRulesSection.filterByNameInput}}" userInput="{{ruleName.name}}" stepKey="filterByName"/>
<click selector="{{AdminCartPriceRulesSection.searchButton}}" stepKey="doFilter"/>
<click selector="{{AdminCartPriceRulesSection.rowByIndex('1')}}" stepKey="goToEditRulePage"/>
<click selector="{{AdminCartPriceRulesFormSection.delete}}" stepKey="clickDeleteButton"/>
<click selector="{{AdminCartPriceRulesFormSection.modalAcceptButton}}" stepKey="confirmDelete"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?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">
<!--Set condition for Customer Segment-->
<actionGroup name="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
<arguments>
<argument name="attributeName" type="string"/>
<argument name="value" type="entity"/>
</arguments>

<scrollTo selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" stepKey="scrollToActionTab"/>
<conditionalClick selector="{{AdminCartPriceRulesFormSection.conditionsHeader}}" dependentSelector="{{AdminCartPriceRulesFormSection.conditionsHeaderOpen}}" visible="false" stepKey="openActionTab"/>
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="applyRuleForConditions"/>

<waitForPageLoad stepKey="waitForDropDownOpened"/>
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="{{attributeName}}" stepKey="selectAttribute"/>

<waitForPageLoad time="20" stepKey="waitForOperator"/>
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption1"/>
<click selector="{{AdminCartPriceRulesFormSection.openList}}" stepKey="openList" />
<waitForPageLoad time="20" stepKey="waitForGrid"/>
<fillField selector="{{AdminCartPriceRulesFormSection.searchSegmentName}}" userInput="{{value.name}}" stepKey="fillSegmentName"/>
<click selector="{{AdminCartPriceRulesFormSection.searchButton}}" stepKey="clickButtonSearch"/>

<waitForPageLoad stepKey="waitForResults"/>
<checkOption selector="{{AdminCartPriceRulesFormSection.selectAll}}" stepKey="checkAll"/>
<waitForPageLoad stepKey="waitForChecking"/>
<moveMouseOver selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="moveOnButton"/>
<click selector="{{AdminCartPriceRulesFormSection.setSegment}}" stepKey="setCustomerSegment"/>
<click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="clickSaveButton"/>
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
</actionGroup>
<actionGroup name="SetCartAttributeConditionWhenMatchForCartPriceRuleActionGroup" extends="SetCartAttributeConditionWithSegmentForCartPriceRuleActionGroup">
<arguments>
<argument name="operatorType" type="string" defaultValue="matches"/>
</arguments>
<click selector="{{AdminCartPriceRulesFormSection.condition('matches')}}" stepKey="clickToChooseOption" after="waitForOperator"/>
<selectOption userInput="{{operatorType}}" selector="{{AdminCartPriceRulesFormSection.conditionsOperator}}" stepKey="setOperatorType" after="clickToChooseOption"/>
</actionGroup>
</actionGroups>
16 changes: 16 additions & 0 deletions app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,20 @@
<data key="apply">Percent of product price discount</data>
<data key="discountAmount">50</data>
</entity>

<entity name="RetailerCartPriceRule" type="SalesRule">
<data key="name" unique="suffix">Cart Price Rule</data>
<data key="websites">Main Website</data>
<data key="customerGroups">'Retailer'</data>
<data key="apply">Percent of product price discount</data>
<data key="discountAmount">50</data>
</entity>

<entity name="SegmentCartPriceRule" type="SalesRule">
<data key="name" unique="suffix">Cart Price Rule</data>
<data key="websites">Main Website</data>
<data key="customerGroups">'General'</data>
<data key="apply">Percent of product price discount</data>
<data key="discountAmount">50</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@
<element name="ruleFieldByIndex" type="input" selector="[id='conditions__{{index}}__value']" parameterized="true"/>
<element name="selectCountryDropdown" type="select" selector="(//*[contains(@value,'country_id')]/..//select)[last()]"/>

<!--Conditions checker -->
<element name="openList" type="button" selector="a.rule-chooser-trigger>img.v-middle.rule-chooser-trigger"/>
<element name="searchSegmentName" type="input" selector="//div[@class='rule-chooser']//input[@name='grid_segment_name']"/>
<element name="searchButton" type="button" selector="div.admin__filter-actions>button.action-default.scalable.action-secondary" timeout="10" />
<element name="selectAll" type="checkbox" selector="//*[@class='rule-chooser']//input[contains(@class, 'admin__control-checkbox')]" timeout="10"/>
<element name="resetSearchFilter" type="button" selector="//div[@class='admin__filter-actions']//button[@title='Reset Filter']"/>
<element name="setSegment" type="button" selector="//*[@class='rule-tree-wrapper']//a[@class='rule-param-apply']"/>

<!-- Actions sub-form -->
<element name="actionsTab" type="text" selector="//div[@data-index='actions']//span[contains(.,'Actions')][1]"/>
<element name="actionsHeader" type="button" selector="div[data-index='actions']" timeout="30"/>
Expand Down Expand Up @@ -85,4 +93,4 @@
<element name="generateCouponsButton" type="button" selector="#coupons_generate_button" timeout="30"/>
<element name="generatedCouponByIndex" type="text" selector="#couponCodesGrid_table > tbody > tr:nth-child({{var}}) > td.col-code" parameterized="true"/>
</section>
</sections>
</sections>

0 comments on commit bdcd81e

Please sign in to comment.