File tree 2 files changed +23
-5
lines changed
dev/tests/functional/tests/app/Magento/Sales/Test
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
137
137
*/
138
138
protected $ confirmModal = '.confirm._show[data-role=modal] ' ;
139
139
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
+
140
150
/**
141
151
* Ship order.
142
152
*
Original file line number Diff line number Diff line change @@ -99,13 +99,21 @@ public function run()
99
99
{
100
100
$ this ->orderIndex ->open ();
101
101
$ 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 ();
105
114
}
106
- $ this ->orderShipmentNew ->getFormBlock ()->submit ();
107
115
108
- return ['shipmentIds ' => $ this -> getShipmentIds () ];
116
+ return ['shipmentIds ' => $ shipmentIds ];
109
117
}
110
118
111
119
/**
You can’t perform that action at this time.
0 commit comments