Skip to content

Commit 9e2eb99

Browse files
authored
Merge pull request #8576 from magento-gl/ACQE-5651-functional-mainline
Acqe 5651 functional mainline
2 parents c333d32 + db645f1 commit 9e2eb99

File tree

10 files changed

+117
-8
lines changed

10 files changed

+117
-8
lines changed

app/code/Magento/CatalogInventory/Test/Mftf/Test/StoreFrontAddOutOfStockProductToShoppingCartTest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<!-- Mouse Hover Product On Category Page-->
6363
<actionGroup ref="StorefrontHoverProductOnCategoryPageActionGroup" stepKey="hoverProduct"/>
6464
<!-- Select Add to cart-->
65+
<waitForElementClickable selector="{{StorefrontCategoryMainSection.addToCartProductBySku($$simpleProductOne.sku$$)}}" stepKey="waitForAddToCartButton"/>
6566
<click selector="{{StorefrontCategoryMainSection.addToCartProductBySku($$simpleProductOne.sku$$)}}" stepKey="toCategory"/>
6667
<waitForElementVisible selector="{{StorefrontProductPageSection.errorMsg}}" stepKey="wait"/>
6768
<!-- Assert the Error Message-->

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

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
</arguments>
1919

2020
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
21+
<waitForElementVisible selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="waitForBillingAddressFirstNameVisible"/>
2122
<see userInput="{{customerVar.firstName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressFirstName"/>
2223
<see userInput="{{customerVar.lastName}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressLastName"/>
2324
<see userInput="{{customerAddressVar.street[0]}}" selector="{{CheckoutPaymentSection.billingAddress}}" stepKey="assertBillingAddressStreet"/>

app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<argument name="importNoticeMessage" value="Created: 10, Updated: 0, Deleted: 0"/>
4141
<argument name="validationNoticeMessage" value="Checked rows: 10, checked entities: 10, invalid rows: 0, total errors: 0"/>
4242
</actionGroup>
43-
<see selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 1, 2, 3, 4, 5, 6, 7, 8, 9, 10" stepKey="seeTenImportError"/>
43+
<waitForText selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 10" stepKey="seeTenImportError"/>
4444

4545
<!--Import products with "Stop on Error" and "Allowed Errors Count" equals 5-->
4646
<actionGroup ref="AdminImportProductsWithCheckValidationResultActionGroup" stepKey="importProductsWithAllowedErrorsCountFive">
@@ -52,7 +52,7 @@
5252
<argument name="importMessage" value="Maximum error count has been reached or system error is occurred!"/>
5353
<argument name="validationNoticeMessage" value="Checked rows: 10, checked entities: 10, invalid rows: 0, total errors: 0"/>
5454
</actionGroup>
55-
<see selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 1, 2, 3, 4, 5, 6" stepKey="seeAboutFiveImportError"/>
55+
<waitForText selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 6" stepKey="seeAboutFiveImportError"/>
5656

5757
<!--Import products with "Stop on Error" and "Allowed Errors Count" equals 11-->
5858
<actionGroup ref="AdminImportProductsWithCheckValidationResultActionGroup" stepKey="importProductsWithAllowedErrorsCountEleven">
@@ -62,6 +62,6 @@
6262
<argument name="importNoticeMessage" value="Created: 0, Updated: 10, Deleted: 0"/>
6363
<argument name="validationNoticeMessage" value="Checked rows: 10, checked entities: 10, invalid rows: 0, total errors: 0"/>
6464
</actionGroup>
65-
<see selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 1, 2, 3, 4, 5, 6, 7, 8, 9, 10" stepKey="seeAboutTenImportError"/>
65+
<waitForText selector="{{AdminImportValidationMessagesSection.importErrorList}}" userInput="row(s): 10" stepKey="seeAboutTenImportError"/>
6666
</test>
6767
</tests>

app/code/Magento/OrderCancellation/Test/Mftf/Section/AdminOrderCancellationConfigSection.xml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<section name="AdminOrderCancellationConfigSection">
1010
<element name="valueForSalesCancellation" type="select" selector="#sales_cancellation_enabled"/>
1111
<element name="systemValueForSalesCancellation" type="checkbox" selector="#sales_cancellation_enabled_inherit"/>
12+
<element name="salesCancellationHead" type="select" selector="#sales_cancellation-head"/>
1213
<element name="systemValueForSalesCancellationReasons" type="checkbox" selector="#sales_cancellation_reasons_inherit"/>
1314
<element name="deleteReasonRow" type="button" selector="#sales_cancellation_reasons #item{{row}} td.col-actions button.action-delete" parameterized="true"/>
1415
<element name="deleteFirstReason" type="button" selector="#sales_cancellation_reasons tbody tr:first-child td.col-actions button.action-delete" />

app/code/Magento/OrderCancellation/Test/Mftf/Test/AdminOrderCancellationConfigTest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
<after>
2525
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
2626
</after>
27-
<amOnPage url="{{AdminOrderCancellationConfigPage.url('#sales_cancellation-head')}}" stepKey="navigateToConfigurationPage"/>
27+
<amOnPage url="{{AdminOrderCancellationConfigPage.url}}" stepKey="navigateToConfigurationPage"/>
2828
<waitForPageLoad time="30" stepKey="waitForAdminSalesConfigPageLoad"/>
29+
<conditionalClick selector="{{AdminOrderCancellationConfigSection.salesCancellationHead}}" dependentSelector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellationReasons}}" visible="false" stepKey="clickElementToExpand"/>
2930
<uncheckOption selector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellation}}" stepKey="uncheckUseSystemValue"/>
3031
<selectOption selector="{{AdminOrderCancellationConfigSection.valueForSalesCancellation}}" userInput="1" stepKey="valueForSalesCancellation"/>
3132
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>

app/code/Magento/OrderCancellation/Test/Mftf/Test/AdminOrderCancellationReasonsConfigCreateEditTest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
<after>
2525
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
2626
</after>
27-
<amOnPage url="{{AdminOrderCancellationConfigPage.url('#sales_cancellation-head')}}" stepKey="navigateToConfigurationPage"/>
27+
<amOnPage url="{{AdminOrderCancellationConfigPage.url}}" stepKey="navigateToConfigurationPage"/>
2828
<waitForPageLoad time="30" stepKey="waitForAdminSalesConfigPageLoad"/>
29+
<conditionalClick selector="{{AdminOrderCancellationConfigSection.salesCancellationHead}}" dependentSelector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellationReasons}}" visible="false" stepKey="clickElementToExpand"/>
2930
<uncheckOption selector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellationReasons}}" stepKey="uncheckUseSystemValue"/>
3031
<click selector="{{AdminOrderCancellationConfigSection.deleteFirstReason}}" stepKey="deleteDefaultReason"/>
3132
<fillField selector="{{AdminOrderCancellationConfigSection.editFirstReason}}" userInput="Modified reason" stepKey="editDefaultReason"/>

app/code/Magento/OrderCancellation/Test/Mftf/Test/AdminOrderCancellationReasonsConfigRemoveAllTest.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
<after>
2525
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
2626
</after>
27-
<amOnPage url="{{AdminOrderCancellationConfigPage.url('#sales_cancellation-head')}}" stepKey="navigateToConfigurationPage"/>
27+
<amOnPage url="{{AdminOrderCancellationConfigPage.url}}" stepKey="navigateToConfigurationPage"/>
2828
<waitForPageLoad time="30" stepKey="waitForAdminSalesConfigPageLoad"/>
29+
<conditionalClick selector="{{AdminOrderCancellationConfigSection.salesCancellationHead}}" dependentSelector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellationReasons}}" visible="false" stepKey="clickElementToExpand"/>
2930
<uncheckOption selector="{{AdminOrderCancellationConfigSection.systemValueForSalesCancellationReasons}}" stepKey="uncheckUseSystemValue"/>
3031
<click selector="{{AdminOrderCancellationConfigSection.deleteFirstReason}}" stepKey="deleteDefaultReason1"/>
3132
<click selector="{{AdminOrderCancellationConfigSection.deleteFirstReason}}" stepKey="deleteDefaultReason2"/>

app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<arguments>
1616
<argument name="storeView" defaultValue="customStore"/>
1717
</arguments>
18-
18+
<waitForElementClickable selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="waitForStoreViewSwitcher"/>
1919
<click selector="{{StorefrontHeaderSection.storeViewSwitcher}}" stepKey="clickStoreViewSwitcher"/>
2020
<waitForElementVisible selector="{{StorefrontHeaderSection.storeViewDropdown}}" stepKey="waitForStoreViewDropdown"/>
2121
<click selector="{{StorefrontHeaderSection.storeViewOption(storeView.code)}}" stepKey="clickSelectStoreView"/>

app/code/Magento/Translation/Test/Mftf/Section/InlineTranslationModeCheckoutSection.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<!-- Shipping Step -->
1313
<element name="progressBarActive" type="text" selector=".opc-progress-bar ._active span"/>
1414
<element name="stepTitleShipping" type="text" selector="#shipping div.step-title"/>
15-
<element name="buttonShippingHere" type="button" selector="button.action-select-shipping-item span"/>
15+
<element name="buttonShippingHere" type="button" selector="div.shipping-address-item.not-selected-item button.action-select-shipping-item span"/>
1616
<element name="buttonNewAddress" type="button" selector=".new-address-popup button span"/>
1717
<element name="titleShippingMethod" type="text" selector=".checkout-shipping-method .step-title"/>
1818
<element name="buttonNext" type="button" selector="#shipping-method-buttons-container button.primary span"/>

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteRepositoryTest.php

+103
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Quote\Model;
99

10+
use Magento\Customer\Api\CustomerRepositoryInterface;
1011
use Magento\Framework\Api\FilterBuilder;
1112
use Magento\Framework\Api\SearchCriteria;
1213
use Magento\Framework\Api\SearchCriteriaBuilder;
@@ -85,6 +86,21 @@ class QuoteRepositoryTest extends TestCase
8586
*/
8687
private $quote;
8788

89+
/**
90+
* @var \Magento\Quote\Model\QuoteFactory
91+
*/
92+
private $quoteFactorys;
93+
94+
/**
95+
* @var \Magento\Store\Model\Store
96+
*/
97+
private $store;
98+
99+
/**
100+
* @var CustomerRepositoryInterface
101+
*/
102+
private $customerRepository;
103+
88104
/**
89105
* @inheritdoc
90106
*/
@@ -101,6 +117,9 @@ protected function setUp(): void
101117
$this->addressFactory = $this->objectManager->get(AddressInterfaceFactory::class);
102118
$this->quoteFactory = $this->objectManager->get(CartInterfaceFactory::class);
103119
$this->itemFactory = $this->objectManager->get(CartItemInterfaceFactory::class);
120+
$this->quoteFactorys = $this->objectManager->get(\Magento\Quote\Model\QuoteFactory::class);
121+
$this->store = $this->objectManager->get(\Magento\Store\Model\Store::class);
122+
$this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
104123
}
105124

106125
/**
@@ -278,4 +297,88 @@ private function performAssertions(CartSearchResultsInterface $searchResult): vo
278297
$this->assertEquals($expectedExtensionAttributes['lastname'], $testAttribute->getLastName());
279298
$this->assertEquals($expectedExtensionAttributes['email'], $testAttribute->getEmail());
280299
}
300+
301+
/**
302+
* @magentoDataFixture Magento/Customer/_files/customer.php
303+
* @magentoDataFixture Magento/Checkout/_files/quote_with_simple_product.php
304+
* @magentoDbIsolation disabled
305+
* @return void
306+
* @throws \Exception
307+
*/
308+
public function testDeleteAllQuotesOnStoreViewDeletion(): void
309+
{
310+
$storeData = [
311+
[
312+
'code' => 'store1',
313+
'website_id' => 1,
314+
'group_id' => 1,
315+
'name' => 'Store 1',
316+
'sort_order' => 0,
317+
'is_active' => 1,
318+
],
319+
[
320+
'code' => 'store2',
321+
'website_id' => 1,
322+
'group_id' => 1,
323+
'name' => 'Store 2',
324+
'sort_order' => 1,
325+
'is_active' => 1,
326+
],
327+
];
328+
329+
foreach ($storeData as $storeInfo) {
330+
$this->objectManager->create(\Magento\Store\Model\Store::class)
331+
->setData($storeInfo)
332+
->save();
333+
}
334+
335+
// Fetching the store id
336+
$firstStoreId = $this->store->load('store1')->getId();
337+
$secondStoreId = $this->store->load('store2')->getId();
338+
339+
// Create a quote for guest user with store id 2
340+
$quote = $this->quoteFactorys->create();
341+
$quote->setStoreId($firstStoreId);
342+
$quote->save();
343+
344+
// Assert that quote is created successfully.
345+
$this->assertNotNull($quote->getId());
346+
347+
// Create a quote for guest user with store id 3
348+
$secondQuote = $this->quoteFactorys->create();
349+
$secondQuote->setStoreId($secondStoreId);
350+
$secondQuote->save();
351+
352+
// Assert that second quote is created successfully.
353+
$this->assertNotNull($secondQuote->getId());
354+
355+
// load customer by id
356+
$customer = $this->customerRepository->getById(1);
357+
358+
// Create a quote for customer with store id 3
359+
$thirdQuote = $this->quoteFactorys->create();
360+
$thirdQuote->setStoreId($secondStoreId);
361+
$thirdQuote->setCustomer($customer);
362+
$thirdQuote->save();
363+
364+
// Loading the second store from the data fixture
365+
$this->store->load('store2', 'code');
366+
/** @var \Magento\TestFramework\Helper\Bootstrap $registry */
367+
$registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
368+
\Magento\Framework\Registry::class
369+
);
370+
$registry->unregister('isSecureArea');
371+
$registry->register('isSecureArea', true);
372+
373+
// Deleting the second store.
374+
$this->store->delete();
375+
376+
// asserting that quote associated with guest user is also deleted when store is deleted
377+
$afterDeletionQuote = $this->quoteFactorys->create()->load($secondQuote->getId());
378+
$this->assertNull($afterDeletionQuote->getId());
379+
380+
// asserting that quote associated with customer is also deleted when store is deleted
381+
$afterDeletionQuote = $this->quoteFactorys->create()->load($thirdQuote->getId());
382+
$this->assertNull($afterDeletionQuote->getId());
383+
}
281384
}

0 commit comments

Comments
 (0)