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/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]; } /**