Skip to content

Commit

Permalink
1334: CreateOrderBackendTest rework to support MSI 'Reorder button' n…
Browse files Browse the repository at this point in the history
…ew behaviour.
  • Loading branch information
nmalevanec committed Jun 13, 2018
1 parent 7c3d53f commit 0d06ad8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

/**
Expand Down

0 comments on commit 0d06ad8

Please sign in to comment.