From a19c9018e5a4b172f8beadb78cc8888c15bbbc62 Mon Sep 17 00:00:00 2001 From: natalia Date: Wed, 14 Aug 2019 11:25:28 +0300 Subject: [PATCH 01/10] MC-18825: Increase test coverage for Promotion and Loyalty functional area - Integration test for MC-6347 --- ...simple_out_of_stock_without_categories.php | 52 +++++++++ ...t_of_stock_without_categories_rollback.php | 8 ++ .../_files/customer_for_second_store.php | 17 +++ .../customer_for_second_store_rollback.php | 8 ++ .../ProductAlert/Model/ObserverTest.php | 110 ++++++++++++++---- .../ProductAlert/_files/i18n/pt_BR.csv | 1 + .../_files/product_alert_with_store.php | 29 +++++ 7 files changed, 201 insertions(+), 24 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_for_second_store.php create mode 100644 dev/tests/integration/testsuite/Magento/Customer/_files/customer_for_second_store_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/ProductAlert/_files/i18n/pt_BR.csv create mode 100644 dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_with_store.php diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php new file mode 100644 index 000000000000..4bd534b4165b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php @@ -0,0 +1,52 @@ +reinitialize(); + +/** @var ObjectManager $objectManager */ +$objectManager = Bootstrap::getObjectManager(); + +/** @var $product Product */ +$product = $objectManager->create(Product::class); +$product->isObjectNew(true); +$product->setTypeId(Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds([1]) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setDescription('Description with html tag') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(Visibility::VISIBILITY_BOTH) + ->setStatus(Status::STATUS_ENABLED) + ->setStockData( + [ + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'is_qty_decimal' => 0, + 'is_in_stock' => 0, + ] + )->setCanSaveCustomOptions(true) + ->setHasOptions(true); + +/** @var ProductRepositoryInterface $productRepository */ +$productRepository = $objectManager->create(ProductRepositoryInterface::class); +$productRepository->save($product); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories_rollback.php new file mode 100644 index 000000000000..4c858f322f8a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories_rollback.php @@ -0,0 +1,8 @@ +create(CustomerRepositoryInterface::class); +$customer = $repository->get('customer@example.com'); +$customer->setStoreId(2); +$repository->save($customer); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/customer_for_second_store_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_for_second_store_rollback.php new file mode 100644 index 000000000000..61cce9dbcc8d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/customer_for_second_store_rollback.php @@ -0,0 +1,8 @@ +_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_customerSession = $this->_objectManager->get( - \Magento\Customer\Model\Session::class - ); - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Customer\Api\AccountManagementInterface::class - ); + Bootstrap::getInstance()->loadArea(Area::AREA_FRONTEND); + $this->_objectManager = Bootstrap::getObjectManager(); + $this->observer = $this->_objectManager->get(Observer::class); + $this->transportBuilder = $this->_objectManager->get(TransportBuilderMock::class); + $service = $this->_objectManager->create(AccountManagementInterface::class); $customer = $service->authenticate('customer@example.com', 'password'); - $this->_customerSession->setCustomerDataAsLoggedIn($customer); - $this->_customerViewHelper = $this->_objectManager->create(\Magento\Customer\Helper\View::class); + $customerSession = $this->_objectManager->get(Session::class); + $customerSession->setCustomerDataAsLoggedIn($customer); } /** - * @magentoConfigFixture current_store catalog/productalert/allow_price 1 + * Test process() method * + * @magentoConfigFixture current_store catalog/productalert/allow_price 1 * * @magentoDataFixture Magento/ProductAlert/_files/product_alert.php */ public function testProcess() { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND); - $observer = $this->_objectManager->get(\Magento\ProductAlert\Model\Observer::class); - $observer->process(); - - /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */ - $transportBuilder = $this->_objectManager->get( - \Magento\TestFramework\Mail\Template\TransportBuilderMock::class - ); + $this->observer->process(); $this->assertContains( 'John Smith,', - $transportBuilder->getSentMessage()->getRawMessage() + $this->transportBuilder->getSentMessage()->getRawMessage() ); } + + /** + * Check translations for product alerts + * + * @magentoDbIsolation enabled + * @magentoAppArea frontend + * @magentoConfigFixture current_store catalog/productalert/allow_price 1 + * @magentoDataFixture Magento/Store/_files/second_store.php + * @magentoConfigFixture fixture_second_store_store general/locale/code pt_BR + * @magentoDataFixture Magento/ProductAlert/_files/product_alert_with_store.php + */ + public function testProcessPortuguese() + { + // get second store + $storeRepository = $this->_objectManager->create(StoreRepository::class); + $secondStore = $storeRepository->get('fixture_second_store'); + + // check if Portuguese language is specified for the second store + CacheCleaner::cleanAll(); + $storeResolver = $this->_objectManager->get(Resolver::class); + $storeResolver->emulate($secondStore->getId()); + $this->assertEquals('pt_BR', $storeResolver->getLocale()); + + // set translation data and check it + $modulesReader = $this->createPartialMock(Reader::class, ['getModuleDir']); + $modulesReader->expects($this->any()) + ->method('getModuleDir') + ->willReturn(dirname(__DIR__) . '/_files/i18n'); + /** @var Translate $translator */ + $translator = $this->_objectManager->create(Translate::class, ['modulesReader' => $modulesReader]); + $translation = [ + 'Price change alert! We wanted you to know that prices have changed for these products:' => + 'Alerta de mudanca de preco! Queriamos que voce soubesse que os precos mudaram para esses produtos:' + ]; + $translator->loadData(); + $this->assertEquals($translation, $translator->getData()); + $this->_objectManager->addSharedInstance($translator, Translate::class); + $this->_objectManager->removeSharedInstance(PhraseRendererTranslate::class); + Phrase::setRenderer($this->_objectManager->create(RendererInterface::class)); + + // dispatch process() method and check sent message + $this->observer->process(); + $message = $this->transportBuilder->getSentMessage()->getRawMessage(); + $expectedText = array_shift($translation); + $this->assertContains('/frontend/Magento/luma/pt_BR/', $message); + $this->assertContains(substr($expectedText, 0, 50), $message); + } } diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/_files/i18n/pt_BR.csv b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/i18n/pt_BR.csv new file mode 100644 index 000000000000..0c8218a78923 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/i18n/pt_BR.csv @@ -0,0 +1 @@ +"Price change alert! We wanted you to know that prices have changed for these products:","Alerta de mudanca de preco! Queriamos que voce soubesse que os precos mudaram para esses produtos:",Magento_ProductAlert diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_with_store.php b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_with_store.php new file mode 100644 index 000000000000..38f00d49f1d4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/_files/product_alert_with_store.php @@ -0,0 +1,29 @@ +create(Price::class); +$price->setCustomerId($customer->getId()) + ->setProductId($product->getId()) + ->setPrice($product->getPrice()+1) + ->setWebsiteId(1) + ->setStoreId(2); +$price->save(); + +$stock = $objectManager->create(Stock::class); +$stock->setCustomerId($customer->getId()) + ->setProductId($product->getId()) + ->setWebsiteId(1) + ->setStoreId(2); +$stock->save(); From 1389445ed7e516baad6021695837f0df4f9e5fa8 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Thu, 27 Jun 2019 12:03:41 +0300 Subject: [PATCH 02/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window --- .../Section/CheckoutCartSummarySection.xml | 2 +- .../Multishipping/Block/Checkout/Shipping.php | 38 +++-- .../Model/Cart/Controller/CartPlugin.php | 65 ++++++--- ...efrontMultishippingCheckoutActionGroup.xml | 28 ++++ .../Mftf/Section/MultishippingSection.xml | 8 ++ ...eckoutShippingMultipleAddressesSection.xml | 15 ++ ...utWhenCartPageIsOpenedInAnotherTabTest.xml | 130 ++++++++++++++++++ .../Mftf/Section/AdminOrdersGridSection.xml | 1 + 8 files changed, 256 insertions(+), 31 deletions(-) create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml index 477451ef003c..69a4ebdadf18 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartSummarySection.xml @@ -20,7 +20,7 @@ - + diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index 77981c736b9e..a3b10aea9b42 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -3,10 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Multishipping\Block\Checkout; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Quote\Model\Quote\Address; +use Magento\Store\Model\ScopeInterface; /** * Mustishipping checkout shipping @@ -67,7 +70,7 @@ public function getCheckout() } /** - * @return $this + * @inheritDoc */ protected function _prepareLayout() { @@ -78,6 +81,8 @@ protected function _prepareLayout() } /** + * Retrieves addresses + * * @return Address[] */ public function getAddresses() @@ -86,6 +91,8 @@ public function getAddresses() } /** + * Returns count of addresses + * * @return mixed */ public function getAddressCount() @@ -99,6 +106,8 @@ public function getAddressCount() } /** + * Retrieves the address items + * * @param Address $address * @return \Magento\Framework\DataObject[] */ @@ -106,7 +115,7 @@ public function getAddressItems($address) { $items = []; foreach ($address->getAllItems() as $item) { - if ($item->getParentItemId()) { + if ($item->getParentItemId() || !$item->getQuoteItemId()) { continue; } $item->setQuoteItem($this->getCheckout()->getQuote()->getItemById($item->getQuoteItemId())); @@ -118,6 +127,8 @@ public function getAddressItems($address) } /** + * Retrieves the address shipping method + * * @param Address $address * @return mixed */ @@ -127,6 +138,8 @@ public function getAddressShippingMethod($address) } /** + * Retrieves address shipping rates + * * @param Address $address * @return mixed */ @@ -137,22 +150,23 @@ public function getShippingRates($address) } /** + * Retrieves the carrier name by the code + * * @param string $carrierCode * @return string */ public function getCarrierName($carrierCode) { - if ($name = $this->_scopeConfig->getValue( - 'carriers/' . $carrierCode . '/title', - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { + $name = $this->_scopeConfig->getValue('carriers/' . $carrierCode . '/title', ScopeInterface::SCOPE_STORE); + if ($name) { return $name; } return $carrierCode; } /** + * Retrieves the address edit url + * * @param Address $address * @return string */ @@ -162,6 +176,8 @@ public function getAddressEditUrl($address) } /** + * Retrieves the url for items edition + * * @return string */ public function getItemsEditUrl() @@ -170,6 +186,8 @@ public function getItemsEditUrl() } /** + * Retrieves the url for the post action + * * @return string */ public function getPostActionUrl() @@ -178,6 +196,8 @@ public function getPostActionUrl() } /** + * Retrieves the back url + * * @return string */ public function getBackUrl() @@ -186,6 +206,8 @@ public function getBackUrl() } /** + * Returns converted and formatted price + * * @param Address $address * @param float $price * @param bool $flag @@ -202,7 +224,7 @@ public function getShippingPrice($address, $price, $flag) } /** - * Retrieve text for items box + * Retrieves text for items box * * @param \Magento\Framework\DataObject $addressEntity * @return string diff --git a/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php b/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php index 4ef36a7c8b6f..40b6f0fa4d8f 100644 --- a/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php +++ b/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php @@ -3,34 +3,48 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Multishipping\Model\Cart\Controller; +use Magento\Checkout\Controller\Cart; +use Magento\Checkout\Model\Session; +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\Multishipping\Model\Checkout\Type\Multishipping\State; +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Quote\Model\Quote; + +/** + * Cleans shipping addresses and item assignments after MultiShipping flow + */ class CartPlugin { /** - * @var \Magento\Quote\Api\CartRepositoryInterface + * @var CartRepositoryInterface */ private $cartRepository; /** - * @var \Magento\Checkout\Model\Session + * @var Session */ private $checkoutSession; /** - * @var \Magento\Customer\Api\AddressRepositoryInterface + * @var AddressRepositoryInterface */ private $addressRepository; /** - * @param \Magento\Quote\Api\CartRepositoryInterface $cartRepository - * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository + * @param CartRepositoryInterface $cartRepository + * @param Session $checkoutSession + * @param AddressRepositoryInterface $addressRepository */ public function __construct( - \Magento\Quote\Api\CartRepositoryInterface $cartRepository, - \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Customer\Api\AddressRepositoryInterface $addressRepository + CartRepositoryInterface $cartRepository, + Session $checkoutSession, + AddressRepositoryInterface $addressRepository ) { $this->cartRepository = $cartRepository; $this->checkoutSession = $checkoutSession; @@ -38,20 +52,19 @@ public function __construct( } /** - * @param \Magento\Checkout\Controller\Cart $subject - * @param \Magento\Framework\App\RequestInterface $request + * Cleans shipping addresses and item assignments after MultiShipping flow + * + * @param Cart $subject + * @param RequestInterface $request * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws LocalizedException */ - public function beforeDispatch( - \Magento\Checkout\Controller\Cart $subject, - \Magento\Framework\App\RequestInterface $request - ) { - /** @var \Magento\Quote\Model\Quote $quote */ + public function beforeDispatch(Cart $subject, RequestInterface $request) + { + /** @var Quote $quote */ $quote = $this->checkoutSession->getQuote(); - - // Clear shipping addresses and item assignments after MultiShipping flow - if ($quote->isMultipleShippingAddresses()) { + if ($quote->isMultipleShippingAddresses() && $this->isCheckoutComplete()) { foreach ($quote->getAllShippingAddresses() as $address) { $quote->removeAddress($address->getId()); } @@ -59,12 +72,20 @@ public function beforeDispatch( $shippingAddress = $quote->getShippingAddress(); $defaultShipping = $quote->getCustomer()->getDefaultShipping(); if ($defaultShipping) { - $defaultCustomerAddress = $this->addressRepository->getById( - $defaultShipping - ); + $defaultCustomerAddress = $this->addressRepository->getById($defaultShipping); $shippingAddress->importCustomerAddressData($defaultCustomerAddress); } $this->cartRepository->save($quote); } } + + /** + * Checks whether the checkout flow is complete + * + * @return bool + */ + private function isCheckoutComplete() + { + return (bool) ($this->checkoutSession->getStepData(State::STEP_SHIPPING)['is_complete'] ?? true); + } } diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml new file mode 100644 index 000000000000..3ceb7c9a778e --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml index 45fafc3105c3..a3dfa9c53031 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml @@ -16,9 +16,17 @@
+
+
+ + + + + +
diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml new file mode 100644 index 000000000000..75bc7f64b292 --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml @@ -0,0 +1,15 @@ + + + + +
+ + +
+
diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml new file mode 100644 index 000000000000..1ba03a01951b --- /dev/null +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml @@ -0,0 +1,130 @@ + + + + + + + + + + <description value="Process multishipping checkout when Cart page is opened in another tab"/> + <severity value="MAJOR"/> + <testCaseId value="MC-17871"/> + <useCaseId value="MC-17469"/> + <group value="multishipping"/> + </annotations> + <before> + <!-- Login as Admin --> + <comment userInput="Login as Admin" stepKey="commentLoginAsAdmin"/> + <actionGroup ref="LoginAsAdmin" stepKey="login"/> + <!-- Set configurations --> + <comment userInput="Set configurations" stepKey="commentSetConfigurations"/> + <magentoCLI command="config:set multishipping/options/checkout_multiple 1" stepKey="allowShippingToMultipleAddresses"/> + <!-- Create two simple products --> + <comment userInput="Create two simple products" stepKey="commentCreateSimpleProducts"/> + <createData entity="ApiCategory" stepKey="createCategory"/> + <createData entity="_defaultProduct" stepKey="createFirstProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="_defaultProduct" stepKey="createSecondProduct"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="createCustomerWithMultipleAddresses"/> + </before> + <after> + <!-- Delete created data --> + <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> + <actionGroup ref="logout" stepKey="logout"/> + <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> + <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/> + </after> + <!-- Login to the Storefront as created customer --> + <comment userInput="Login to the Storefront as created customer" stepKey="commentLoginAsCustomer"/> + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> + <argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/> + </actionGroup> + <!-- Add two products to the Shopping Cart --> + <comment userInput="Add two products to the Cart" stepKey="commentAddProductsToTheCart"/> + <amOnPage url="{{StorefrontProductPage.url($$createFirstProduct.name$$)}}" stepKey="amOnStorefrontProductFirstPage"/> + <waitForPageLoad stepKey="waitForTheFirstProduct"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCart"> + <argument name="product" value="$$createFirstProduct$$"/> + <argument name="productCount" value="1"/> + </actionGroup> + <amOnPage url="{{StorefrontProductPage.url($$createSecondProduct.name$$)}}" stepKey="amOnStorefrontSecondProductPage"/> + <waitForPageLoad stepKey="waitForPageLoadForTheSecondProduct"/> + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddSecondProductToCart"> + <argument name="product" value="$$createSecondProduct$$"/> + <argument name="productCount" value="2"/> + </actionGroup> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> + <!-- Click 'Check Out with Multiple Addresses' --> + <comment userInput="Click 'Check Out with Multiple Addresses'" stepKey="commentClickToCheckOutWithMultipleAddress"/> + <waitForPageLoad stepKey="waitForSecondPageLoad"/> + <actionGroup ref="StorefrontGoCheckoutWithMultipleAddresses" stepKey="goCheckoutWithMultipleAddresses"/> + <!-- Select different addresses and click 'Go to Shipping Information' --> + <comment userInput="Select different addresses and click 'Go to Shipping Information'" stepKey="commentClickOnGoToShippingInformation"/> + <actionGroup ref="StorefrontCheckoutShippingSelectMultipleAddressesActionGroup" stepKey="selectMultipleAddresses"> + <argument name="firstAddress" value="{{UK_Not_Default_Address.street[0]}}"/> + <argument name="secondAddress" value="{{US_Address_NY.street[1]}}"/> + </actionGroup> + <waitForPageLoad stepKey="waitPageLoad"/> + <!-- Open the Cart page in another browser window and go back --> + <comment userInput="Open the Cart page in another browser window and go back" stepKey="commentOpenCartPageInAnotherTab"/> + <openNewTab stepKey="openNewTab"/> + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPageNewTab"/> + <actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertFirstProductItemInCheckOutCart"> + <argument name="productName" value="$$createFirstProduct.name$$"/> + <argument name="productSku" value="$$createFirstProduct.sku$$"/> + <argument name="productPrice" value="$$createFirstProduct.price$$"/> + <argument name="subtotal" value="$$createFirstProduct.price$$" /> + <argument name="qty" value="1"/> + </actionGroup> + <actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertSecondProductItemInCheckOutCart"> + <argument name="productName" value="$$createSecondProduct.name$$"/> + <argument name="productSku" value="$$createSecondProduct.sku$$"/> + <argument name="productPrice" value="$$createSecondProduct.price$$"/> + <argument name="subtotal" value="$$createSecondProduct.price$$" /> + <argument name="qty" value="1"/> + </actionGroup> + <switchToNextTab stepKey="switchToNextTab"/> + <!-- Click 'Continue to Billing Information' and 'Go to Review Your Order' --> + <comment userInput="Click 'Continue to Billing Information' > click 'Go to Review Your Order'" stepKey="commentGoToReviewYourOrder"/> + <actionGroup ref="StorefrontGoToBillingInformationActionGroup" stepKey="goToBillingInformation"/> + <see selector="{{ShipmentFormSection.shippingAddress}}" userInput="{{US_Address_NY.city}}" stepKey="seeBillingAddress"/> + <waitForElementVisible selector="{{StorefrontMultipleShippingMethodSection.goToReviewYourOrderButton}}" stepKey="waitForGoToReviewYourOrderVisible" /> + <click selector="{{StorefrontMultipleShippingMethodSection.goToReviewYourOrderButton}}" stepKey="clickToGoToReviewYourOrderButton"/> + <!-- Click 'Place Order' --> + <comment userInput="Click 'Place Order'" stepKey="commentPlaceOrder"/> + <actionGroup ref="PlaceOrderActionGroup" stepKey="placeOrder"/> + <see selector="{{StorefrontMultipleShippingMethodSection.successMessage}}" userInput="Successfully ordered" stepKey="seeSuccessMessage"/> + <grabTextFrom selector="{{StorefrontMultipleShippingMethodSection.orderId('1')}}" stepKey="grabFirstOrderId"/> + <grabTextFrom selector="{{StorefrontMultipleShippingMethodSection.orderId('2')}}" stepKey="grabSecondOrderId"/> + <!-- Go to My Account > My Orders --> + <comment userInput="Go to My Account > My Orders" stepKey="commentGoToMyOrders"/> + <amOnPage url="{{StorefrontCustomerOrdersHistoryPage.url}}" stepKey="goToMyOrdersPage"/> + <waitForPageLoad stepKey="waitForMyOrdersPageLoad"/> + <seeElement selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabFirstOrderId})}}" stepKey="seeFirstOrder"/> + <seeElement selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabSecondOrderId})}}" stepKey="seeSecondOrder"/> + <waitForPageLoad stepKey="waitForOrderPageLoad"/> + <!-- Go to Admin > Sales > Orders --> + <comment userInput="Go to Admin > Sales > Orders" stepKey="commentGoOrders"/> + <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> + <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchFirstOrder"> + <argument name="keyword" value="$grabFirstOrderId"/> + </actionGroup> + <see selector="{{AdminOrdersGridSection.firstLineOrderId}}" userInput="{$grabFirstOrderId}" stepKey="seeAdminFirstOrder"/> + <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchSecondOrder"> + <argument name="keyword" value="$grabSecondOrderId"/> + </actionGroup> + <see selector="{{AdminOrdersGridSection.firstLineOrderId}}" userInput="{$grabSecondOrderId}" stepKey="seeAdminSecondOrder"/> + </test> +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml index ace64cdaa103..ce777e5f9ca7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml @@ -39,5 +39,6 @@ <element name="changeOrderStatus" type="button" selector="//div[contains(concat(' ',normalize-space(@class),' '),' row-gutter ')]//span[text()='{{status}}']" parameterized="true" timeout="30"/> <element name="viewLink" type="text" selector="//td/div[contains(.,'{{orderID}}')]/../..//a[@class='action-menu-item']" parameterized="true"/> <element name="selectOrderID" type="checkbox" selector="//td/div[text()='{{orderId}}']/../preceding-sibling::td//input" parameterized="true" timeout="60"/> + <element name="firstLineOrderId" type="text" selector=".data-grid td:nth-of-type(2)"/> </section> </sections> From 1024f53d39890aed965301807c7df4dac344b285 Mon Sep 17 00:00:00 2001 From: natalia <natalia_marozava@epam.com> Date: Tue, 17 Sep 2019 08:17:55 +0300 Subject: [PATCH 03/10] MC-16333: Admin user with permission for 1 store can manage product quantity --- .../AdminAssertDisabledQtyActionGroup.xml | 19 ++++++++++++++ .../Form/Modifier/AdvancedInventory.php | 7 +++--- .../Product/Form/Modifier/ConfigurableQty.php | 25 ++++++++++++++++--- .../Block/Adminhtml/Product/ProductForm.xml | 2 +- 4 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminAssertDisabledQtyActionGroup.xml diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminAssertDisabledQtyActionGroup.xml b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminAssertDisabledQtyActionGroup.xml new file mode 100644 index 000000000000..27c4a93577a0 --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Mftf/ActionGroup/AdminAssertDisabledQtyActionGroup.xml @@ -0,0 +1,19 @@ +<?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="AdminAssertDisabledQtyActionGroup"> + <annotations> + <description>Goes to the 'Quantity' field and assert disabled attribute.</description> + </annotations> + + <seeElement selector="{{AdminProductFormSection.productQuantity}}" stepKey="assertProductQty"/> + <assertElementContainsAttribute selector="{{AdminProductFormSection.productQuantity}}" attribute="disabled" expectedValue="true" stepKey="checkIfQtyIsDisabled" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php index da465f5bdd3d..789befcfec8b 100644 --- a/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php +++ b/app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php @@ -1,11 +1,10 @@ <?php - -declare(strict_types=1); - /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\CatalogInventory\Ui\DataProvider\Product\Form\Modifier; use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter; @@ -238,7 +237,7 @@ private function prepareMeta() $this->meta = $this->arrayManager->merge( $fieldsetPath . '/children', $this->meta, - ['container_quantity_and_stock_status_qty' => $container] + ['quantity_and_stock_status_qty' => $container] ); } } diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php index 7d337c57d7e7..055891ff79c6 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/ConfigurableQty.php @@ -3,9 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier; use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; +use Magento\Catalog\Model\Locator\LocatorInterface; /** * Data provider for quantity in the Configurable products @@ -16,7 +19,22 @@ class ConfigurableQty extends AbstractModifier const CODE_QTY_CONTAINER = 'quantity_and_stock_status_qty'; /** - * {@inheritdoc} + * @var LocatorInterface + */ + private $locator; + + /** + * ConfigurableQty constructor + * + * @param LocatorInterface $locator + */ + public function __construct(LocatorInterface $locator) + { + $this->locator = $locator; + } + + /** + * @inheritdoc */ public function modifyData(array $data) { @@ -24,13 +42,14 @@ public function modifyData(array $data) } /** - * {@inheritdoc} + * @inheritdoc */ public function modifyMeta(array $meta) { if ($groupCode = $this->getGroupCodeByField($meta, self::CODE_QTY_CONTAINER)) { $parentChildren = &$meta[$groupCode]['children']; - if (!empty($parentChildren[self::CODE_QTY_CONTAINER])) { + $isConfigurable = $this->locator->getProduct()->getTypeId() === 'configurable'; + if (!empty($parentChildren[self::CODE_QTY_CONTAINER]) && $isConfigurable) { $parentChildren[self::CODE_QTY_CONTAINER] = array_replace_recursive( $parentChildren[self::CODE_QTY_CONTAINER], [ diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml index 525e6b47374a..028dfc6d109e 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/ProductForm.xml @@ -31,7 +31,7 @@ </category_ids> <quantity_and_stock_status composite="1"> <qty> - <selector>fieldset[data-index="container_quantity_and_stock_status_qty"] [name="product[quantity_and_stock_status][qty]"]</selector> + <selector>fieldset[data-index="quantity_and_stock_status_qty"] [name="product[quantity_and_stock_status][qty]"]</selector> </qty> <is_in_stock> <selector>[data-index="quantity_and_stock_status"] [name="product[quantity_and_stock_status][is_in_stock]"]</selector> From 80c2b7a16bdc47b88dc1512f28e9c7bbe15df1ad Mon Sep 17 00:00:00 2001 From: Evgeny Petrov <evgeny_petrov@epam.com> Date: Tue, 17 Sep 2019 14:24:57 +0300 Subject: [PATCH 04/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window --- .../Magento/Multishipping/Model/Cart/Controller/CartPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php b/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php index 40b6f0fa4d8f..b450232395b8 100644 --- a/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php +++ b/app/code/Magento/Multishipping/Model/Cart/Controller/CartPlugin.php @@ -84,7 +84,7 @@ public function beforeDispatch(Cart $subject, RequestInterface $request) * * @return bool */ - private function isCheckoutComplete() + private function isCheckoutComplete() : bool { return (bool) ($this->checkoutSession->getStepData(State::STEP_SHIPPING)['is_complete'] ?? true); } From b34a586a690d5ba2697baada60d33bf3e78b2687 Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Thu, 19 Sep 2019 17:01:33 +0400 Subject: [PATCH 05/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window - Updated automated test script --- ...StorefrontCheckoutCartGiftMessageSection.xml | 12 ++++++++++++ ...orefrontMultishippingCheckoutActionGroup.xml | 2 +- .../Test/Mftf/Section/MultishippingSection.xml | 2 +- ...CheckoutShippingMultipleAddressesSection.xml | 1 - ...koutWhenCartPageIsOpenedInAnotherTabTest.xml | 17 ++--------------- .../Mftf/Section/AdminOrdersGridSection.xml | 2 +- 6 files changed, 17 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/GiftMessage/Test/Mftf/Section/StorefrontCheckoutCartGiftMessageSection.xml diff --git a/app/code/Magento/GiftMessage/Test/Mftf/Section/StorefrontCheckoutCartGiftMessageSection.xml b/app/code/Magento/GiftMessage/Test/Mftf/Section/StorefrontCheckoutCartGiftMessageSection.xml new file mode 100644 index 000000000000..b1f6f35ba5d9 --- /dev/null +++ b/app/code/Magento/GiftMessage/Test/Mftf/Section/StorefrontCheckoutCartGiftMessageSection.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="StorefrontCheckoutCartGiftMessageSection"> + <element name="giftItemMessage" type="textarea" selector="tbody.cart:nth-of-type({{blockNumber}}) #gift-message-whole-message" parameterized="true"/> + </section> +</sections> \ No newline at end of file diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml index 3ceb7c9a778e..c5dee010239d 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontMultishippingCheckoutActionGroup.xml @@ -15,7 +15,7 @@ </arguments> <selectOption selector="{{StorefrontCheckoutShippingMultipleAddressesSection.selectedMultipleShippingAddress('1')}}" userInput="{{firstAddress}}" stepKey="selectShippingAddressForTheFirstItem"/> <selectOption selector="{{StorefrontCheckoutShippingMultipleAddressesSection.selectedMultipleShippingAddress('2')}}" userInput="{{secondAddress}}" stepKey="selectShippingAddressForTheSecondItem"/> - <click selector="{{StorefrontCheckoutShippingMultipleAddressesSection.goToShippingInformationButton}}" stepKey="clickToGoToInformationButton"/> + <click selector="{{CheckoutSuccessMainSection.continueShoppingButton}}" stepKey="clickToGoToInformationButton"/> </actionGroup> <actionGroup name="StorefrontGoCheckoutWithMultipleAddresses"> <click selector="{{MultishippingSection.shippingMultipleCheckout}}" stepKey="clickToMultipleAddressShippingButton"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml index a3dfa9c53031..c6fc44922737 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml @@ -23,7 +23,7 @@ <element name="secondShippingAddressOption" type="select" selector="//table//tbody//tr[position()=2]//td[position()=3]//div//select"/> </section> <section name="StorefrontMultipleShippingMethodSection"> - <element name="orderId" type="text" selector="(//div[@class='order-id'])[{{rowNum}}]" parameterized="true"/> + <element name="orderId" type="text" selector=".shipping-list:nth-child({{rowNum}}) .order-id" parameterized="true"/> <element name="placeOrderButton" type="button" selector="#review-button"/> <element name="goToReviewYourOrderButton" type="button" selector="#payment-continue"/> <element name="continueToBillingInformationButton" type="button" selector=".action.primary.continue"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml index 75bc7f64b292..34427bda9334 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/StorefrontCheckoutShippingMultipleAddressesSection.xml @@ -10,6 +10,5 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontCheckoutShippingMultipleAddressesSection"> <element name="selectedMultipleShippingAddress" type="select" selector=".table tr:nth-of-type({{selectNumber}}) select" parameterized="true"/> - <element name="goToShippingInformationButton" type="button" selector=".action.primary.continue"/> </section> </sections> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml index 1ba03a01951b..fd79d4d954cd 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml @@ -21,13 +21,10 @@ </annotations> <before> <!-- Login as Admin --> - <comment userInput="Login as Admin" stepKey="commentLoginAsAdmin"/> <actionGroup ref="LoginAsAdmin" stepKey="login"/> <!-- Set configurations --> - <comment userInput="Set configurations" stepKey="commentSetConfigurations"/> <magentoCLI command="config:set multishipping/options/checkout_multiple 1" stepKey="allowShippingToMultipleAddresses"/> <!-- Create two simple products --> - <comment userInput="Create two simple products" stepKey="commentCreateSimpleProducts"/> <createData entity="ApiCategory" stepKey="createCategory"/> <createData entity="_defaultProduct" stepKey="createFirstProduct"> <requiredEntity createDataKey="createCategory"/> @@ -39,7 +36,6 @@ </before> <after> <!-- Delete created data --> - <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> <actionGroup ref="logout" stepKey="logout"/> <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> @@ -47,12 +43,10 @@ <deleteData createDataKey="createCustomerWithMultipleAddresses" stepKey="deleteCustomer"/> </after> <!-- Login to the Storefront as created customer --> - <comment userInput="Login to the Storefront as created customer" stepKey="commentLoginAsCustomer"/> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer"> <argument name="Customer" value="$$createCustomerWithMultipleAddresses$$"/> </actionGroup> <!-- Add two products to the Shopping Cart --> - <comment userInput="Add two products to the Cart" stepKey="commentAddProductsToTheCart"/> <amOnPage url="{{StorefrontProductPage.url($$createFirstProduct.name$$)}}" stepKey="amOnStorefrontProductFirstPage"/> <waitForPageLoad stepKey="waitForTheFirstProduct"/> <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="cartAddProductToCart"> @@ -67,18 +61,15 @@ </actionGroup> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPage"/> <!-- Click 'Check Out with Multiple Addresses' --> - <comment userInput="Click 'Check Out with Multiple Addresses'" stepKey="commentClickToCheckOutWithMultipleAddress"/> <waitForPageLoad stepKey="waitForSecondPageLoad"/> <actionGroup ref="StorefrontGoCheckoutWithMultipleAddresses" stepKey="goCheckoutWithMultipleAddresses"/> <!-- Select different addresses and click 'Go to Shipping Information' --> - <comment userInput="Select different addresses and click 'Go to Shipping Information'" stepKey="commentClickOnGoToShippingInformation"/> <actionGroup ref="StorefrontCheckoutShippingSelectMultipleAddressesActionGroup" stepKey="selectMultipleAddresses"> <argument name="firstAddress" value="{{UK_Not_Default_Address.street[0]}}"/> <argument name="secondAddress" value="{{US_Address_NY.street[1]}}"/> </actionGroup> <waitForPageLoad stepKey="waitPageLoad"/> <!-- Open the Cart page in another browser window and go back --> - <comment userInput="Open the Cart page in another browser window and go back" stepKey="commentOpenCartPageInAnotherTab"/> <openNewTab stepKey="openNewTab"/> <amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnShoppingCartPageNewTab"/> <actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertFirstProductItemInCheckOutCart"> @@ -97,34 +88,30 @@ </actionGroup> <switchToNextTab stepKey="switchToNextTab"/> <!-- Click 'Continue to Billing Information' and 'Go to Review Your Order' --> - <comment userInput="Click 'Continue to Billing Information' > click 'Go to Review Your Order'" stepKey="commentGoToReviewYourOrder"/> <actionGroup ref="StorefrontGoToBillingInformationActionGroup" stepKey="goToBillingInformation"/> <see selector="{{ShipmentFormSection.shippingAddress}}" userInput="{{US_Address_NY.city}}" stepKey="seeBillingAddress"/> <waitForElementVisible selector="{{StorefrontMultipleShippingMethodSection.goToReviewYourOrderButton}}" stepKey="waitForGoToReviewYourOrderVisible" /> <click selector="{{StorefrontMultipleShippingMethodSection.goToReviewYourOrderButton}}" stepKey="clickToGoToReviewYourOrderButton"/> <!-- Click 'Place Order' --> - <comment userInput="Click 'Place Order'" stepKey="commentPlaceOrder"/> <actionGroup ref="PlaceOrderActionGroup" stepKey="placeOrder"/> <see selector="{{StorefrontMultipleShippingMethodSection.successMessage}}" userInput="Successfully ordered" stepKey="seeSuccessMessage"/> <grabTextFrom selector="{{StorefrontMultipleShippingMethodSection.orderId('1')}}" stepKey="grabFirstOrderId"/> <grabTextFrom selector="{{StorefrontMultipleShippingMethodSection.orderId('2')}}" stepKey="grabSecondOrderId"/> <!-- Go to My Account > My Orders --> - <comment userInput="Go to My Account > My Orders" stepKey="commentGoToMyOrders"/> <amOnPage url="{{StorefrontCustomerOrdersHistoryPage.url}}" stepKey="goToMyOrdersPage"/> <waitForPageLoad stepKey="waitForMyOrdersPageLoad"/> <seeElement selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabFirstOrderId})}}" stepKey="seeFirstOrder"/> <seeElement selector="{{StorefrontCustomerOrdersGridSection.orderView({$grabSecondOrderId})}}" stepKey="seeSecondOrder"/> <waitForPageLoad stepKey="waitForOrderPageLoad"/> <!-- Go to Admin > Sales > Orders --> - <comment userInput="Go to Admin > Sales > Orders" stepKey="commentGoOrders"/> <amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage"/> <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchFirstOrder"> <argument name="keyword" value="$grabFirstOrderId"/> </actionGroup> - <see selector="{{AdminOrdersGridSection.firstLineOrderId}}" userInput="{$grabFirstOrderId}" stepKey="seeAdminFirstOrder"/> + <seeElement selector="{{AdminOrdersGridSection.orderId({$grabFirstOrderId})}}" stepKey="seeAdminFirstOrder"/> <actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchSecondOrder"> <argument name="keyword" value="$grabSecondOrderId"/> </actionGroup> - <see selector="{{AdminOrdersGridSection.firstLineOrderId}}" userInput="{$grabSecondOrderId}" stepKey="seeAdminSecondOrder"/> + <seeElement selector="{{AdminOrdersGridSection.orderId({$grabSecondOrderId})}}" stepKey="seeAdminSecondOrder"/> </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml index ce777e5f9ca7..a18ca0c41556 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrdersGridSection.xml @@ -39,6 +39,6 @@ <element name="changeOrderStatus" type="button" selector="//div[contains(concat(' ',normalize-space(@class),' '),' row-gutter ')]//span[text()='{{status}}']" parameterized="true" timeout="30"/> <element name="viewLink" type="text" selector="//td/div[contains(.,'{{orderID}}')]/../..//a[@class='action-menu-item']" parameterized="true"/> <element name="selectOrderID" type="checkbox" selector="//td/div[text()='{{orderId}}']/../preceding-sibling::td//input" parameterized="true" timeout="60"/> - <element name="firstLineOrderId" type="text" selector=".data-grid td:nth-of-type(2)"/> + <element name="orderId" type="text" selector="//table[contains(@class, 'data-grid')]//div[contains(text(), '{{orderId}}')]" parameterized="true"/> </section> </sections> From b59a7a12e3f078eac3e1f50e053210d8e86c4b83 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov <evgeny_petrov@epam.com> Date: Tue, 24 Sep 2019 09:48:14 +0300 Subject: [PATCH 06/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window --- app/code/Magento/Multishipping/Block/Checkout/Shipping.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index a3b10aea9b42..9cfcb4b64794 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -158,10 +158,7 @@ public function getShippingRates($address) public function getCarrierName($carrierCode) { $name = $this->_scopeConfig->getValue('carriers/' . $carrierCode . '/title', ScopeInterface::SCOPE_STORE); - if ($name) { - return $name; - } - return $carrierCode; + return $name ?: $carrierCode; } /** From c7fc78186767522fec248fd041810b0240c6931a Mon Sep 17 00:00:00 2001 From: Lusine Papyan <Lusine_Papyan@epam.com> Date: Tue, 24 Sep 2019 11:29:51 +0400 Subject: [PATCH 07/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window - Updatetd automated test script --- .../Multishipping/Test/Mftf/Section/MultishippingSection.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml index c6fc44922737..b01e5b35b41a 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection.xml @@ -24,7 +24,6 @@ </section> <section name="StorefrontMultipleShippingMethodSection"> <element name="orderId" type="text" selector=".shipping-list:nth-child({{rowNum}}) .order-id" parameterized="true"/> - <element name="placeOrderButton" type="button" selector="#review-button"/> <element name="goToReviewYourOrderButton" type="button" selector="#payment-continue"/> <element name="continueToBillingInformationButton" type="button" selector=".action.primary.continue"/> <element name="successMessage" type="text" selector=".multicheckout.success"/> From f6afe4dd521c8b109c563f09de5232e297ea3b80 Mon Sep 17 00:00:00 2001 From: natalia <natalia_marozava@epam.com> Date: Tue, 24 Sep 2019 11:25:56 +0300 Subject: [PATCH 08/10] MC-18825: Increase test coverage for Promotion and Loyalty functional area - Fixes for MC-6347 --- .../_files/product_simple_out_of_stock_without_categories.php | 2 +- .../testsuite/Magento/ProductAlert/Model/ObserverTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php index 4bd534b4165b..6ae4af61bc51 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_out_of_stock_without_categories.php @@ -29,7 +29,7 @@ ->setSku('simple') ->setPrice(10) ->setWeight(1) - ->setShortDescription("Short description") + ->setShortDescription('Short description') ->setTaxClassId(0) ->setDescription('Description with <b>html tag</b>') ->setMetaTitle('meta title') diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php index 0a34711acde7..0f19edc349e8 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php @@ -63,7 +63,7 @@ public function setUp() /** * Test process() method * - * @magentoConfigFixture current_store catalog/productalert/allow_price 1 * + * @magentoConfigFixture current_store catalog/productalert/allow_price 1 * @magentoDataFixture Magento/ProductAlert/_files/product_alert.php */ public function testProcess() From 5bc1526f6bc4e5384c5c0c27d08b1d58b553fce0 Mon Sep 17 00:00:00 2001 From: Mikalai Shostka <Mikalai_Shostka@epam.com> Date: Thu, 3 Oct 2019 16:32:17 +0300 Subject: [PATCH 09/10] MC-17469: Fatal error is displayed during multishipping checkout when open Cart page in another window --- app/code/Magento/Multishipping/Block/Checkout/Shipping.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php index 9cfcb4b64794..99450fc53807 100644 --- a/app/code/Magento/Multishipping/Block/Checkout/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -70,7 +70,9 @@ public function getCheckout() } /** - * @inheritDoc + * Add page title and prepare layout + * + * @return $this */ protected function _prepareLayout() { From 2a3353ed32e957b1f2385f453eca8c221c0f230d Mon Sep 17 00:00:00 2001 From: Mikalai Shostka <Mikalai_Shostka@epam.com> Date: Fri, 4 Oct 2019 14:01:29 +0300 Subject: [PATCH 10/10] MC-18825: Increase test coverage for Promotion and Loyalty functional area - Stabilization for test AdminRemoveDefaultImageBundleProductTest --- .../Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml index 1438958b92b6..730df90b31be 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminRemoveDefaultImageBundleProductTest.xml @@ -24,6 +24,10 @@ <createData entity="SimpleProduct2" stepKey="simpleProduct2"/> </before> <after> + <!-- Delete the bundled product we created in the test body --> + <actionGroup ref="deleteProductBySku" stepKey="deleteBundleProduct"> + <argument name="sku" value="{{BundleProduct.sku}}"/> + </actionGroup> <amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>