Skip to content

Commit e465c8a

Browse files
committed
Merge remote-tracking branch 'origin/MC-19048' into 2.2-develop-pr108
2 parents 6343478 + 105c706 commit e465c8a

File tree

6 files changed

+78
-83
lines changed

6 files changed

+78
-83
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
<arguments>
2121
<argument name="useForPromoRule" type="string" defaultValue="Yes"/>
2222
</arguments>
23-
<click selector="{{StorefrontPropertiesSection.storefrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/>
24-
<selectOption selector="{{StorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{useForPromoRule}}" stepKey="changeOption"/>
23+
<click selector="{{AdminEditAttributeStorefrontPropertiesSection.storeFrontPropertiesTab}}" stepKey="clickStoreFrontPropertiesTab"/>
24+
<waitForElementVisible selector="{{AdminEditAttributeStorefrontPropertiesSection.useForPromoRuleConditions}}" stepKey="waitForUseForPromoRuleConditionsVisible"/>
25+
<selectOption selector="{{AdminEditAttributeStorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="{{useForPromoRule}}" stepKey="changeOption"/>
2526
<click selector="{{AttributePropertiesSection.save}}" stepKey="saveAttribute"/>
27+
<waitForElementVisible selector="{{AdminMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/>
2628
<see selector="{{AdminMessagesSection.successMessage}}" userInput="You saved the product attribute." stepKey="successMessage"/>
2729
</actionGroup>
2830
<actionGroup name="navigateToProductAttributeByCode">

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@
3434
<seeElement selector="{{StorefrontCategoryProductSection.productTitleByName(product.name)}}" stepKey="assertProductName"/>
3535
<see userInput="${{product.price}}.00" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/>
3636
<moveMouseOver selector="{{StorefrontCategoryProductSection.ProductInfoByName(product.name)}}" stepKey="moveMouseOverProduct" />
37-
<executeInSelenium function="function($webdriver) use ($I) {
37+
<!-- @TODO: This causes a parsing error after updating the magento-testing-framework to version 2.4.4 -->
38+
<!--<executeInSelenium function="function($webdriver) use ($I) {
3839
$productName = '//main//li[.//a[contains(text(), \'' . {{product.name}} . '\' )]]//div[@data-container=\'product-grid\']';
3940
$I->assertEquals('2', $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath($productName))->getCSSValue('z-index'));
40-
}" stepKey="assertProductContainerIsOpened"/>
41+
}" stepKey="assertProductContainerIsOpened"/>-->
4142
<seeElement selector="{{StorefrontCategoryProductSection.productAddToCartByName(product.name)}}" stepKey="assertAddToCart" />
4243
</actionGroup>
4344

app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontMiniCartActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<waitForElementVisible selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="waitForViewAndEditCartVisible"/>
1313
<click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="viewAndEditCart"/>
1414
<seeInCurrentUrl url="checkout/cart" stepKey="seeInCurrentUrl"/>
15+
<waitForPageLoad time="30" stepKey="waitForCartPageIsLoaded"/>
1516
</actionGroup>
1617
<actionGroup name="assertOneProductNameInMiniCart">
1718
<arguments>

app/code/Magento/SalesRule/Model/ResourceModel/Rule/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ public function addWebsiteGroupDateFilter($websiteId, $customerGroupId, $now = n
290290
{
291291
if (!$this->getFlag('website_group_date_filter')) {
292292
if ($now === null) {
293-
$now = $this->_date->date()->format('Y-m-d');
293+
$now = $this->_date->date(null, null, false, false)->format('Y-m-d');
294294
}
295295

296296
$this->addWebsiteFilter($websiteId);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<section name="StorefrontDiscountSection">
1111
<element name="discountTab" type="button" selector="#block-discount-heading"/>
1212
<element name="couponInput" type="input" selector="#coupon_code"/>
13-
<element name="applyCodeBtn" type="button" selector="button[value='Apply Discount']"/>
13+
<element name="applyCodeBtn" type="button" selector="button[value='Apply Discount']" timeout="30"/>
1414
<element name="cancelCoupon" type="button" selector="button[value='Cancel Coupon']"/>
1515
<element name="discountInput" type="input" selector="#discount-code"/>
1616
<element name="discountBlockActive" type="text" selector=".block.discount.active"/>

app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml

Lines changed: 68 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,22 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/testSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1111
<test name="CartPriceRuleForConfigurableProductTest">
1212
<annotations>
1313
<features value="SalesRule"/>
14-
<stories value="MAGETWO-86098 - Cart Price Rule for configurable products"/>
14+
<stories value="Create cart price rule"/>
1515
<title value="Checking Cart Price Rule for configurable products"/>
1616
<description value="Checking Cart Price Rule for configurable products"/>
1717
<severity value="BLOCKER"/>
1818
<testCaseId value="MAGETWO-95121"/>
19+
<useCaseId value="MAGETWO-86098"/>
1920
<group value="sales_rule"/>
2021
</annotations>
2122

2223
<before>
23-
<!--Login to Admin-->
24-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25-
<!-- Create the category -->
26-
<createData entity="ApiCategory" stepKey="createCategory"/>
27-
<!-- Create the configurable product and add it to the category -->
28-
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
29-
<requiredEntity createDataKey="createCategory"/>
30-
</createData>
24+
<!-- Create the configurable product -->
25+
<createData entity="ApiConfigurableProductWithOutCategory" stepKey="createConfigProduct"/>
3126
<!-- Create an attribute with two options to be used in the first child product -->
3227
<createData entity="productAttributeWithDropdownTwoOptions" stepKey="createConfigProductAttribute"/>
3328
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
@@ -74,95 +69,91 @@
7469
<requiredEntity createDataKey="createConfigChildProduct2"/>
7570
</createData>
7671

72+
<!--Login to Admin-->
73+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
74+
75+
<actionGroup ref="deleteAllCartPriceRule" stepKey="deleteAllCartPriceRules"/>
76+
77+
<!--Create cart price rule-->
78+
<createData entity="SaleRule50PercentDiscountNoCoupon" stepKey="createCartPriceRule">
79+
<field key="discount_amount">70</field>
80+
<field key="coupon_type">SPECIFIC_COUPON</field>
81+
</createData>
82+
<createData entity="SimpleSalesRuleCoupon" stepKey="createCouponForCartPriceRule">
83+
<requiredEntity createDataKey="createCartPriceRule"/>
84+
</createData>
85+
7786
<!--Set attribute sku property Use for Promo Rule Conditions = Yes and save attribute-->
7887
<actionGroup ref="navigateToProductAttribute" stepKey="goToProductAttributeSkuPage">
7988
<argument name="attributeCode" value="sku"/>
8089
</actionGroup>
81-
<click selector="{{AdminEditAttributeStorefrontPropertiesSection.storeFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/>
82-
<scrollTo selector="{{AdminEditAttributeStorefrontPropertiesSection.storeFrontPropertiesTab}}" stepKey="scrollToUseForPromoRuleConditions"/>
83-
<selectOption selector="{{AdminEditAttributeStorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="Yes" stepKey="changeAttributeProperty"/>
84-
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveAttribute"/>
85-
<waitForPageLoad stepKey="waitForAttributeIsSaved"/>
90+
<actionGroup ref="changeUseForPromoRuleConditionsProductAttribute" stepKey="changeUseForPromoRuleConditions"/>
8691

87-
<!-- Create cart price rule -->
88-
<amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/>
89-
<waitForPageLoad stepKey="waitForRulesPage"/>
90-
<click selector="{{AdminCartPriceRulesSection.addNewRuleButton}}" stepKey="clickAddNewRule"/>
91-
<fillField selector="{{AdminCartPriceRulesFormSection.ruleName}}" userInput="{{SalesRuleWithSkuInActions.name}}" stepKey="fillRuleName"/>
92-
<selectOption selector="{{AdminCartPriceRulesFormSection.websites}}" userInput="{{SalesRuleWithSkuInActions.websites}}" stepKey="selectWebsites"/>
93-
<actionGroup ref="selectNotLoggedInCustomerGroup" stepKey="selectNotLoggedInCustomerGroup"/>
94-
<selectOption selector="{{AdminCartPriceRulesFormSection.coupon}}" userInput="{{SalesRuleWithSkuInActions.coupon_type}}" stepKey="selectCouponType"/>
95-
<fillField selector="{{AdminCartPriceRulesFormSection.couponCode}}" userInput="{{SalesRuleWithSkuInActions.coupon_code}}" stepKey="fillCouponCOde"/>
96-
<click selector="{{AdminCartPriceRulesFormSection.actionsHeader}}" stepKey="clickToExpandActions"/>
97-
<fillField selector="{{AdminCartPriceRulesFormSection.discountAmount}}" userInput="{{SalesRuleWithSkuInActions.discount_amount}}" stepKey="fillDiscountAmount"/>
98-
<scrollTo selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="scrollToApplyRuleForConditions"/>
99-
<click selector="{{AdminCartPriceRulesFormSection.conditions}}" stepKey="addConditionForRule"/>
100-
<waitForPageLoad stepKey="waitForDropDownOpened"/>
101-
<selectOption selector="{{AdminCartPriceRulesFormSection.childAttribute}}" userInput="SKU(Children Only)" stepKey="selectAttribute"/>
102-
<waitForPageLoad stepKey="waitForOperatorOpened"/>
103-
<click selector="{{AdminCartPriceRulesFormSection.condition('is')}}" stepKey="clickToChooseCondition"/>
104-
<selectOption selector="{{AdminCartPriceRulesFormSection.operator}}" userInput="is not one of" stepKey="selectOperator"/>
105-
<waitForPageLoad stepKey="waitForOperatorOpened1"/>
106-
<click selector="{{AdminCartPriceRulesFormSection.condition('...')}}" stepKey="clickToChooseOption"/>
107-
<waitForPageLoad stepKey="waitForConditionOpened2"/>
108-
<fillField selector="{{AdminCartPriceRulesFormSection.optionInput}}" userInput="$$createConfigChildProduct1.sku$$" stepKey="selectOption"/>
109-
<waitForPageLoad stepKey="waitForPageLoaded"/>
110-
<click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/>
111-
<see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/>
92+
<!-- Set condition for actions in cart price rule -->
93+
<amOnPage url="{{AdminCartPriceRuleEditPage.url($$createCartPriceRule.rule_id$$)}}" stepKey="goToCartPriceRuleEditPage"/>
94+
<actionGroup ref="SetConditionForActionsInCartPriceRuleActionGroup" stepKey="setConditionForActionsInCartPriceRule">
95+
<argument name="actionsAggregator" value="ANY"/>
96+
<argument name="actionsValue" value="TRUE"/>
97+
<argument name="childAttribute" value="SKU(Children Only)"/>
98+
<argument name="actionOperator" value="is not one of"/>
99+
<argument name="actionValue" value="$$createConfigChildProduct1.sku$$"/>
100+
</actionGroup>
112101
</before>
113102

114103
<after>
115-
<!--Remove SalesRule-->
116-
<actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteSalesRule">
117-
<argument name="ruleName" value="{{SalesRuleWithSkuInActions.name}}"/>
118-
</actionGroup>
119-
<!--Return default value to attribute sku-->
120-
<actionGroup ref="navigateToProductAttribute" stepKey="goToProductAttributeSkuPage">
121-
<argument name="attributeCode" value="sku"/>
122-
</actionGroup>
123-
<click selector="{{AdminEditAttributeStorefrontPropertiesSection.storeFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab1"/>
124-
<scrollTo selector="{{AdminEditAttributeStorefrontPropertiesSection.storeFrontPropertiesTab}}" stepKey="scrollToUseForPromoRuleConditions"/>
125-
<selectOption selector="{{AdminEditAttributeStorefrontPropertiesSection.useForPromoRuleConditions}}" userInput="No" stepKey="changeAttributeProperty"/>
126-
<click selector="{{AdminMainActionsSection.save}}" stepKey="saveAttribute"/>
127-
<waitForPageLoad stepKey="waitForAttributeIsSaved"/>
128-
129104
<!--Remove configurable product and it's children-->
130105
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
131106
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
132107
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
133108
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
134-
<deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/>
109+
<!--Remove SalesRule-->
110+
<deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/>
111+
<!--Return default value to attribute sku-->
112+
<actionGroup ref="navigateToProductAttribute" stepKey="goToProductAttributeSkuPage">
113+
<argument name="attributeCode" value="sku"/>
114+
</actionGroup>
115+
<actionGroup ref="changeUseForPromoRuleConditionsProductAttribute" stepKey="changeUseForPromoRuleConditions">
116+
<argument name="useForPromoRule" value="No"/>
117+
</actionGroup>
135118
<!--Logout from Admin-->
136119
<actionGroup ref="logout" stepKey="logout"/>
137120
</after>
138121

139-
<!--Add the configureble product with first option to the cart -->
140-
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.sku$$)}}" stepKey="goToProductPage"/>
141-
<waitForPageLoad stepKey="waitForProductPageLoad"/>
142-
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}"
143-
userInput="$$getConfigAttributeOption1.label$$" stepKey="selectOption1"/>
144-
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart"/>
145-
<waitForPageLoad stepKey="waitForAddToCart"/>
146-
<!--Add the configureble product with second option to the cart -->
147-
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.sku$$)}}" stepKey="goToProductPage1"/>
148-
<waitForPageLoad stepKey="waitForProductPageLoad1"/>
149-
<selectOption selector="{{StorefrontProductInfoMainSection.productAttributeOptionsSelectButton}}"
150-
userInput="$$getConfigAttributeOption2.label$$" stepKey="selectOption2"/>
151-
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addProductToCart1"/>
152-
<waitForPageLoad stepKey="waitForAddToCart1"/>
122+
<actionGroup ref="CustomerLogoutStorefrontActionGroup" stepKey="customerLogout"/>
123+
<!--Go to product page-->
124+
<amOnPage url="{{StorefrontProductPage.url($$createConfigProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/>
125+
126+
<!--Add the configurable product with first option to the cart -->
127+
<actionGroup ref="StorefrontSelectConfigurableAttributeOptionActionGroup" stepKey="selectFirstOptionOfConfigProduct">
128+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_label$$"/>
129+
<argument name="optionValue" value="$$getConfigAttributeOption1.value$$"/>
130+
</actionGroup>
131+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFirstOptionOfConfigProduct">
132+
<argument name="productName" value="$$createConfigProduct.name$$"/>
133+
</actionGroup>
134+
135+
<!--Add the configurable product with second option to the cart -->
136+
<actionGroup ref="StorefrontSelectConfigurableAttributeOptionActionGroup" stepKey="selectSecondOptionOfConfigProduct">
137+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_label$$"/>
138+
<argument name="optionValue" value="$$getConfigAttributeOption2.value$$"/>
139+
</actionGroup>
140+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartSecondOptionOfConfigProduct">
141+
<argument name="productName" value="$$createConfigProduct.name$$"/>
142+
</actionGroup>
153143

154144
<!--View and edit cart-->
155-
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="storefrontOpenCartFromMinicart"/>
156-
<scrollTo selector="{{StorefrontDiscountSection.discountTab}}" stepKey="scrollToDiscountTab"/>
157-
<click selector="{{StorefrontDiscountSection.discountTab}}" stepKey="openDiscountTab" />
158-
<fillField selector="{{StorefrontDiscountSection.couponInput}}" userInput="{{SalesRuleWithSkuInActions.coupon_code}}" stepKey="fillCouponCode" />
159-
<click selector="{{StorefrontDiscountSection.applyCodeBtn}}" stepKey="applyCode"/>
160-
<waitForPageLoad stepKey="waitForPageLoaded1"/>
161-
<see userInput="You used coupon code" stepKey="assertText"/>
145+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="storefrontOpenCartFromMinicart"/>
146+
147+
<!-- Apply Cart Rule On Storefront -->
148+
<actionGroup ref="StorefrontApplyCouponActionGroup" stepKey="applyCartRule">
149+
<argument name="couponCode" value="$$createCouponForCartPriceRule.code$$"/>
150+
</actionGroup>
151+
<waitForElementVisible selector="{{StorefrontCheckoutCartSummarySection.discountAmount}}" stepKey="waitForDiscountAmountVisible"/>
152+
162153
<!--Verify values-->
163154
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.itemDiscount}}" stepKey="getDiscount"/>
164155
<grabTextFrom selector="{{StorefrontCheckoutCartSummarySection.subtotal}}" stepKey="getSubtotal"/>
165-
<assertEquals stepKey="checkDescount">
156+
<assertEquals stepKey="checkDiscount">
166157
<expectedResult type="string">-$7.00</expectedResult>
167158
<actualResult type="variable">$getDiscount</actualResult>
168159
</assertEquals>

0 commit comments

Comments
 (0)