Skip to content

Commit

Permalink
1190: CreateOrderBackendPartOneTest rework to support MSI reservation…
Browse files Browse the repository at this point in the history
… mechanism.
  • Loading branch information
nmalevanec committed Jun 15, 2018
1 parent 55256fa commit 2b8b9d5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 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 @@ -19,10 +19,10 @@
<item name="grandTotal" xsi:type="string">425.00</item>
</data>
<data name="payment/method" xsi:type="string">cashondelivery</data>
<data name="status" xsi:type="string">Pending</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Email, Hold, Invoice, Ship, Edit</data>
<data name="status" xsi:type="string">Processing</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Reorder, Cancel, Send Email, Invoice, Edit</data>
<data name="configData" xsi:type="string">cashondelivery</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
Expand All @@ -42,7 +42,6 @@
<data name="status" xsi:type="string">Pending</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Edit</data>
<data name="configData" xsi:type="string">checkmo_specificcountry_gb</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
Expand All @@ -59,10 +58,10 @@
<item name="grandTotal" xsi:type="string">565.00</item>
</data>
<data name="payment/method" xsi:type="string">banktransfer</data>
<data name="status" xsi:type="string">Pending</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Reorder, Invoice, Edit</data>
<data name="status" xsi:type="string">Processing</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Reorder, Invoice, Edit</data>
<data name="configData" xsi:type="string">banktransfer</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
Expand All @@ -84,7 +83,6 @@
<data name="status" xsi:type="string">Pending</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Edit</data>
<data name="configData" xsi:type="string">freeshipping_specificcountry_gb, banktransfer</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
Expand All @@ -103,10 +101,10 @@
</data>
<data name="payment/method" xsi:type="string">purchaseorder</data>
<data name="payment/po_number" xsi:type="string">123456</data>
<data name="status" xsi:type="string">Pending</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Hold, Invoice, Reorder, Edit</data>
<data name="status" xsi:type="string">Processing</data>
<data name="orderButtonsAvailable" xsi:type="string">Back, Cancel, Send Email, Invoice, Reorder, Edit</data>
<data name="configData" xsi:type="string">purchaseorder</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderButtonsAvailable" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderInOrdersGrid" />
Expand All @@ -127,7 +125,7 @@
<item name="grandTotal" xsi:type="string">21.91</item>
</data>
<data name="payment/method" xsi:type="string">checkmo</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
</variation>
<variation name="CreateOrderBackendTestVariation7" summary="Create Order for New Customer in Admin with Offline Payment Method" ticketId="MAGETWO-12520">
Expand All @@ -145,7 +143,7 @@
<item name="grandTotal" xsi:type="string">21.91</item>
</data>
<data name="payment/method" xsi:type="string">checkmo</data>
<constraint name="Magento\Sales\Test\Constraint\AssertOrderSuccessCreateMessage" />
<constraint name="Magento\Shipping\Test\Constraint\AssertShipmentSuccessCreateMessage" />
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
<constraint name="Magento\Customer\Test\Constraint\AssertCustomerForm" />
</variation>
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
<step name="fillShippingAddress" module="Magento_Sales" next="selectShippingMethodForOrder" />
<step name="selectShippingMethodForOrder" module="Magento_Sales" next="selectPaymentMethodForOrder" />
<step name="selectPaymentMethodForOrder" module="Magento_Sales" next="submitOrder" />
<step name="submitOrder" module="Magento_Sales" />
<step name="submitOrder" module="Magento_Sales" next="createShipment" />
<step name="createShipment" module="Magento_Sales"/>
</scenario>
<scenario name="VoidAuthorizationTest" firstStep="setupConfiguration">
<step name="setupConfiguration" module="Magento_Config" next="createProducts" />
Expand Down

0 comments on commit 2b8b9d5

Please sign in to comment.