Skip to content

Commit 0d06ad8

Browse files
committed
1334: CreateOrderBackendTest rework to support MSI 'Reorder button' new behaviour.
1 parent 7c3d53f commit 0d06ad8

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/Actions.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ class Actions extends Block
137137
*/
138138
protected $confirmModal = '.confirm._show[data-role=modal]';
139139

140+
/**
141+
* Is shipment can be created.
142+
*
143+
* @return bool
144+
*/
145+
public function canShip()
146+
{
147+
return $this->_rootElement->find($this->ship)->isVisible();
148+
}
149+
140150
/**
141151
* Ship order.
142152
*

dev/tests/functional/tests/app/Magento/Sales/Test/TestStep/CreateShipmentStep.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,21 @@ public function run()
9999
{
100100
$this->orderIndex->open();
101101
$this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
102-
$this->salesOrderView->getPageActions()->ship();
103-
if (!empty($this->data)) {
104-
$this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']);
102+
$shipmentIds = [];
103+
/**
104+
* As this step is used in general scenarios and not all test cases has shippable items(ex: virtual product)
105+
* we need to check, if it possible to create shipment for given order.
106+
*/
107+
if ($this->salesOrderView->getPageActions()->canShip()) {
108+
$this->salesOrderView->getPageActions()->ship();
109+
if (!empty($this->data)) {
110+
$this->orderShipmentNew->getFormBlock()->fillData($this->data, $this->order->getEntityId()['products']);
111+
}
112+
$this->orderShipmentNew->getFormBlock()->submit();
113+
$shipmentIds = $this->getShipmentIds();
105114
}
106-
$this->orderShipmentNew->getFormBlock()->submit();
107115

108-
return ['shipmentIds' => $this->getShipmentIds()];
116+
return ['shipmentIds' => $shipmentIds];
109117
}
110118

111119
/**

0 commit comments

Comments
 (0)