Skip to content

Commit f7759d8

Browse files
authored
Merge pull request #6185 from magento-tsg/2.4-develop-sidecar-pr2
[Sidecar] Tests for 2.4 (pr2)
2 parents 45b2d44 + cf0ca09 commit f7759d8

24 files changed

+1644
-78
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<element name="shippingMethodLabel" type="text" selector="#co-shipping-method-form dl dt span"/>
3535
<element name="methodName" type="text" selector="#co-shipping-method-form label"/>
3636
<element name="shippingPrice" type="text" selector="#co-shipping-method-form span .price"/>
37-
<element name="shippingMethodElementId" type="radio" selector="#s_method_{{carrierCode}}_{{methodCode}}" parameterized="true"/>
37+
<element name="shippingMethodElementId" type="radio" selector="#s_method_{{carrierCode}}_{{methodCode}}" parameterized="true" timeout="30"/>
3838
<element name="estimateShippingAndTaxForm" type="block" selector="#shipping-zip-form"/>
3939
</section>
4040
</sections>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest">
10+
<test name="StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest" deprecated="Use StorefrontVerifyGuestCheckoutUsingFreeShippingAndTaxesTest">
1111
<annotations>
1212
<stories value="Checkout"/>
13-
<title value="Verify guest checkout using free shipping and tax variations"/>
13+
<title value="DEPRECATED. Verify guest checkout using free shipping and tax variations"/>
1414
<description value="Verify guest checkout using free shipping and tax variations"/>
1515
<severity value="CRITICAL"/>
1616
<testCaseId value="MC-14709"/>
1717
<group value="mtf_migrated"/>
1818
<skip>
19-
<issueId value="MC-18802"/>
19+
<issueId value="DEPRECATED">Use StorefrontVerifyGuestCheckoutUsingFreeShippingAndTaxesTest</issueId>
2020
</skip>
2121
</annotations>
2222

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontVerifyGuestCheckoutUsingFreeShippingAndTaxesTest">
11+
<annotations>
12+
<features value="Checkout"/>
13+
<stories value="Checkout via Guest Checkout"/>
14+
<title value="Verify guest checkout using free shipping and tax variations"/>
15+
<description value="Verify guest checkout using free shipping and tax variations"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-28285"/>
18+
<group value="mtf_migrated"/>
19+
<group value="checkout"/>
20+
<group value="tax"/>
21+
</annotations>
22+
<before>
23+
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
24+
<createData entity="FreeShippingMethodsSettingConfig" stepKey="freeShippingMethodsSettingConfig"/>
25+
<createData entity="MinimumOrderAmount100" stepKey="minimumOrderAmount"/>
26+
<createData entity="taxRate_US_NY_8_1" stepKey="createTaxRateUSNY"/>
27+
<createData entity="DefaultTaxRuleWithCustomTaxRate" stepKey="createTaxRuleUSNY">
28+
<requiredEntity createDataKey="createTaxRateUSNY" />
29+
</createData>
30+
<createData entity="defaultSimpleProduct" stepKey="simpleProduct">
31+
<field key="price">10.00</field>
32+
</createData>
33+
<createData entity="ApiCategory" stepKey="createCategory"/>
34+
<createData entity="ApiConfigurableProduct" stepKey="configurableProduct">
35+
<requiredEntity createDataKey="createCategory"/>
36+
</createData>
37+
<createData entity="productAttributeWithTwoOptions" stepKey="createProductAttribute"/>
38+
<createData entity="productAttributeOption1" stepKey="createProductAttributeOption">
39+
<requiredEntity createDataKey="createProductAttribute"/>
40+
</createData>
41+
<createData entity="AddToDefaultSet" stepKey="addToDefaultSet">
42+
<requiredEntity createDataKey="createProductAttribute"/>
43+
</createData>
44+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getProductAttributeOption">
45+
<requiredEntity createDataKey="createProductAttribute"/>
46+
</getData>
47+
<createData entity="ApiSimpleOne" stepKey="configurableChildProduct">
48+
<requiredEntity createDataKey="createProductAttribute"/>
49+
<requiredEntity createDataKey="getProductAttributeOption"/>
50+
<field key="price">10.00</field>
51+
</createData>
52+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
53+
<requiredEntity createDataKey="configurableProduct"/>
54+
<requiredEntity createDataKey="createProductAttribute"/>
55+
<requiredEntity createDataKey="getProductAttributeOption"/>
56+
</createData>
57+
<createData entity="ConfigurableProductAddChild" stepKey="configurableProductAddChild">
58+
<requiredEntity createDataKey="configurableProduct"/>
59+
<requiredEntity createDataKey="configurableChildProduct"/>
60+
</createData>
61+
<createData entity="SimpleProduct2" stepKey="firstBundleChildProduct">
62+
<field key="price">100.00</field>
63+
</createData>
64+
<createData entity="SimpleProduct2" stepKey="secondBundleChildProduct">
65+
<field key="price">200.00</field>
66+
</createData>
67+
<createData entity="BundleProductPriceViewRange" stepKey="bundleProduct">
68+
<requiredEntity createDataKey="createCategory"/>
69+
</createData>
70+
<createData entity="MultipleSelectOption" stepKey="bundleOption">
71+
<requiredEntity createDataKey="bundleProduct"/>
72+
<field key="required">True</field>
73+
</createData>
74+
<createData entity="ApiBundleLink" stepKey="firstLinkOptionToProduct">
75+
<requiredEntity createDataKey="bundleProduct"/>
76+
<requiredEntity createDataKey="bundleOption"/>
77+
<requiredEntity createDataKey="firstBundleChildProduct"/>
78+
</createData>
79+
<createData entity="ApiBundleLink" stepKey="secondLinkOptionToProduct">
80+
<requiredEntity createDataKey="bundleProduct"/>
81+
<requiredEntity createDataKey="bundleOption"/>
82+
<requiredEntity createDataKey="secondBundleChildProduct"/>
83+
</createData>
84+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
85+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
86+
<argument name="indices" value=""/>
87+
</actionGroup>
88+
<actionGroup ref="CliCacheFlushActionGroup" stepKey="flushCache">
89+
<argument name="tags" value=""/>
90+
</actionGroup>
91+
</before>
92+
<after>
93+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
94+
<deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/>
95+
<deleteData createDataKey="configurableChildProduct" stepKey="deleteConfigurableChildProduct"/>
96+
<deleteData createDataKey="configurableProduct" stepKey="deleteConfigurableProduct"/>
97+
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
98+
<deleteData createDataKey="firstBundleChildProduct" stepKey="deleteFirstBundleChild"/>
99+
<deleteData createDataKey="secondBundleChildProduct" stepKey="deleteSecondBundleChild"/>
100+
<deleteData createDataKey="bundleProduct" stepKey="deleteBundleProduct"/>
101+
<deleteData createDataKey="createTaxRuleUSNY" stepKey="deleteTaxRuleUSNY"/>
102+
<deleteData createDataKey="createTaxRateUSNY" stepKey="deleteTaxRateUSNY"/>
103+
<createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/>
104+
<createData entity="DefaultMinimumOrderAmount" stepKey="defaultMinimumOrderAmount"/>
105+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminPanel"/>
106+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
107+
</after>
108+
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyProduct">
109+
<argument name="product" value="$simpleProduct$"/>
110+
</actionGroup>
111+
<actionGroup ref="StorefrontAddProductToCartWithQtyActionGroup" stepKey="addSimpleProductToTheCart">
112+
<argument name="productQty" value="1"/>
113+
</actionGroup>
114+
<actionGroup ref="StorefrontAddConfigurableProductToTheCartActionGroup" stepKey="addConfigurableProductToCart">
115+
<argument name="urlKey" value="$configurableProduct.custom_attributes[url_key]$" />
116+
<argument name="productAttribute" value="$createProductAttribute.default_value$"/>
117+
<argument name="productOption" value="$getProductAttributeOption.label$"/>
118+
<argument name="qty" value="1"/>
119+
</actionGroup>
120+
<actionGroup ref="AssertProductNameAndSkuInStorefrontProductPageByCustomAttributeUrlKeyActionGroup" stepKey="openProductPageAndVerifyBundleProduct">
121+
<argument name="product" value="$bundleProduct$"/>
122+
</actionGroup>
123+
<actionGroup ref="StorefrontAddBundleProductFromProductToCartWithMultiOptionActionGroup" stepKey="addBundleProductToCart">
124+
<argument name="productName" value="$bundleProduct.name$"/>
125+
<argument name="optionName" value="$bundleOption.name$"/>
126+
<argument name="value" value="$firstBundleChildProduct.name$ +$100.00"/>
127+
</actionGroup>
128+
<actionGroup ref="ClickViewAndEditCartFromMiniCartActionGroup" stepKey="clickMiniCart"/>
129+
<actionGroup ref="CheckoutFillEstimateShippingAndTaxActionGroup" stepKey="fillEstimateShippingAndTaxFields">
130+
<argument name="address" value="US_Address_NY_Default_Shipping"/>
131+
</actionGroup>
132+
<click selector="{{CheckoutCartSummarySection.shippingMethodElementId('freeshipping', 'freeshipping')}}" stepKey="selectShippingMethod"/>
133+
<see selector="{{CheckoutCartSummarySection.taxAmount}}" userInput="$9.72" stepKey="seeTaxAmount"/>
134+
<reloadPage stepKey="reloadThePage"/>
135+
<waitForPageLoad stepKey="waitForPageToReload"/>
136+
<see selector="{{CheckoutCartSummarySection.taxAmount}}" userInput="$9.72" stepKey="seeTaxAmountAfterLoadPage"/>
137+
<scrollTo selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="scrollToProceedToCheckout" />
138+
<click selector="{{CheckoutCartSummarySection.proceedToCheckout}}" stepKey="goToCheckout"/>
139+
<waitForPageLoad stepKey="waitForPageToLoad"/>
140+
<actionGroup ref="FillGuestCheckoutShippingAddressFormActionGroup" stepKey="fillTheSignInForm">
141+
<argument name="customer" value="Simple_US_Customer"/>
142+
<argument name="customerAddress" value="US_Address_NY_Default_Shipping"/>
143+
</actionGroup>
144+
<actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickOnNextButton"/>
145+
<actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickOnPlaceOrder"/>
146+
<seeElement selector="{{StorefrontMinicartSection.emptyMiniCart}}" stepKey="assertEmptyCart" />
147+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumberWithoutLink}}" stepKey="orderId"/>
148+
<actionGroup ref="AdminOrdersPageOpenActionGroup" stepKey="goToOrders"/>
149+
<actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrderById">
150+
<argument name="orderId" value="$orderId"/>
151+
</actionGroup>
152+
<actionGroup ref="AdminAssertOrderAvailableButtonsActionGroup" stepKey="assertOrderButtons"/>
153+
<see selector="{{AdminOrderTotalSection.grandTotal}}" userInput="$129.72" stepKey="seeGrandTotal"/>
154+
<actionGroup ref="AdminOrderViewCheckStatusActionGroup" stepKey="seeOrderPendingStatus"/>
155+
<actionGroup ref="AdminShipThePendingOrderActionGroup" stepKey="shipTheOrder"/>
156+
<actionGroup ref="AssertOrderAddressInformationActionGroup" stepKey="assertCustomerInformation">
157+
<argument name="customer" value=""/>
158+
<argument name="shippingAddress" value="US_Address_NY_Default_Shipping"/>
159+
<argument name="billingAddress" value="US_Address_NY_Default_Shipping"/>
160+
<argument name="customerGroup" value=""/>
161+
</actionGroup>
162+
</test>
163+
</tests>

app/code/Magento/Tax/Test/Mftf/Data/TaxRuleData.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,17 @@
123123
<entity name="TaxRuleZeroRate" type="taxRule">
124124
<data key="name" unique="suffix">TaxNameZeroRate</data>
125125
</entity>
126+
<entity name="DefaultTaxRuleWithCustomTaxRate" type="taxRule">
127+
<data key="code" unique="suffix">TaxRule</data>
128+
<data key="position">0</data>
129+
<data key="priority">0</data>
130+
<array key="customer_tax_class_ids">
131+
<item>3</item>
132+
</array>
133+
<array key="product_tax_class_ids">
134+
<item>2</item>
135+
</array>
136+
<var key="tax_rate_ids" entityType="taxRate" entityKey="id"/>
137+
<data key="calculate_subtotal">false</data>
138+
</entity>
126139
</entities>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestFramework\MysqlMq;
9+
10+
use Magento\MysqlMq\Model\QueueManagement;
11+
use Magento\MysqlMq\Model\ResourceModel\Message;
12+
13+
/**
14+
* Delete messages from queue by topic
15+
*/
16+
class DeleteTopicRelatedMessages
17+
{
18+
/** @var Message */
19+
private $queueMessageResource;
20+
21+
/**
22+
* @param Message $queueMessageResource
23+
*/
24+
public function __construct(
25+
Message $queueMessageResource
26+
) {
27+
$this->queueMessageResource = $queueMessageResource;
28+
}
29+
30+
/**
31+
* Delete messages from queue
32+
*
33+
* @param string $topic
34+
* @return void
35+
*/
36+
public function execute(string $topic): void
37+
{
38+
$connection = $this->queueMessageResource->getConnection();
39+
$condition = $connection->quoteInto(QueueManagement::MESSAGE_TOPIC . '= ?', $topic);
40+
$connection->delete($this->queueMessageResource->getMainTable(), $condition);
41+
}
42+
}

0 commit comments

Comments
 (0)