File tree Expand file tree Collapse file tree 2 files changed +23
-5
lines changed
dev/tests/functional/tests/app/Magento/Sales/Test Expand file tree Collapse file tree 2 files changed +23
-5
lines changed Original file line number Diff line number Diff 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 *
Original file line number Diff line number Diff 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 /**
You can’t perform that action at this time.
0 commit comments