From 2b8b9d57bc556639614dc27d8346b7743ab34dd1 Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Fri, 15 Jun 2018 11:02:42 +0300 Subject: [PATCH] 1190: CreateOrderBackendPartOneTest rework to support MSI reservation mechanism. --- .../Test/Block/Adminhtml/Order/Actions.php | 10 ++++++++ .../CreateOrderBackendPartOneTest.xml | 24 +++++++++---------- .../Test/TestStep/CreateShipmentStep.php | 18 ++++++++++---- .../app/Magento/Sales/Test/etc/testcase.xml | 3 ++- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php index 573f28f09b78c..7a6903ef47aac 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php @@ -137,6 +137,16 @@ class Actions extends Block */ protected $confirmModal = '.confirm._show[data-role=modal]'; + /** + * Is shipment can be created. + * + * @return bool + */ + public function canShip() + { + return $this->_rootElement->find($this->ship)->isVisible(); + } + /** * Ship order. * diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendPartOneTest.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendPartOneTest.xml index f5646ac543213..0a5958b506a43 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendPartOneTest.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestCase/CreateOrderBackendPartOneTest.xml @@ -19,10 +19,10 @@ 425.00 cashondelivery - Pending - Back, Reorder, Cancel, Send Email, Hold, Invoice, Ship, Edit + Processing + Back, Reorder, Cancel, Send Email, Invoice, Edit cashondelivery - + @@ -42,7 +42,6 @@ Pending Back, Cancel, Send Email, Hold, Invoice, Edit checkmo_specificcountry_gb - @@ -59,10 +58,10 @@ 565.00 banktransfer - Pending - Back, Cancel, Send Email, Hold, Reorder, Invoice, Edit + Processing + Back, Cancel, Send Email, Reorder, Invoice, Edit banktransfer - + @@ -84,7 +83,6 @@ Pending Back, Cancel, Send Email, Hold, Invoice, Edit freeshipping_specificcountry_gb, banktransfer - @@ -103,10 +101,10 @@ purchaseorder 123456 - Pending - Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit + Processing + Back, Cancel, Send Email, Invoice, Reorder, Edit purchaseorder - + @@ -127,7 +125,7 @@ 21.91 checkmo - + @@ -145,7 +143,7 @@ 21.91 checkmo - + diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php index 79abd438a1f2e..dcee66b44646e 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php @@ -99,13 +99,21 @@ public function run() { $this->orderIndex->open(); $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]); - $this->salesOrderView->getPageActions()->ship(); - if (!empty($this->data)) { - $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + $shipmentIds = []; + /** + * As this step is used in general scenarios and not all test cases has shippable items(ex: virtual product) + * we need to check, if it possible to create shipment for given order. + */ + if ($this->salesOrderView->getPageActions()->canShip()) { + $this->salesOrderView->getPageActions()->ship(); + if (!empty($this->data)) { + $this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']); + } + $this->orderShipmentNew->getFormBlock()->submit(); + $shipmentIds = $this->getShipmentIds(); } - $this->orderShipmentNew->getFormBlock()->submit(); - return ['shipmentIds' => $this->getShipmentIds()]; + return ['shipmentIds' => $shipmentIds]; } /** diff --git a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml index c7c4a2276e4b7..f6cf65223e1de 100644 --- a/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml +++ b/dev/tests/functional/tests/app/Magento/Sales/Test/etc/testcase.xml @@ -54,7 +54,8 @@ - + +