Skip to content

Commit 2566f8d

Browse files
committed
MAGETWO-75612: [FT] CreateShipmentEntityTest and CreateInvoiceEntityTest are failed on Jenkins
1 parent a9c765c commit 2566f8d

File tree

4 files changed

+54
-11
lines changed

4 files changed

+54
-11
lines changed

dev/tests/functional/tests/app/Magento/Sales/Test/Block/Adminhtml/Order/View/Tab/Shipments/Grid.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@
66

77
namespace Magento\Sales\Test\Block\Adminhtml\Order\View\Tab\Shipments;
88

9+
use Magento\Ui\Test\Block\Adminhtml\DataGrid;
10+
911
/**
10-
* Class Grid
11-
* Shipments grid on order view page
12+
* Shipments grid on order view page.
1213
*/
13-
class Grid extends \Magento\Backend\Test\Block\Widget\Grid
14+
class Grid extends DataGrid
1415
{
1516
/**
16-
* Locator value for link in action column
17+
* Locator value for link in action column.
1718
*
1819
* @var string
1920
*/
2021
protected $editLink = '[data-column="real_shipment_id"]';
2122

2223
/**
23-
* Locator for shipment ids
24+
* Locator for shipment ids.
2425
*
2526
* @var string
2627
*/
2728
protected $shipmentId = 'tbody td:nth-child(2)';
2829

2930
/**
30-
* Filters array mapping
31+
* Filters array mapping.
3132
*
3233
* @var array
3334
*/
@@ -44,12 +45,14 @@ class Grid extends \Magento\Backend\Test\Block\Widget\Grid
4445
];
4546

4647
/**
47-
* Get shipment ids
48+
* Get shipment ids.
4849
*
4950
* @return array
5051
*/
5152
public function getIds()
5253
{
54+
$this->waitLoader();
55+
$this->resetFilter();
5356
$result = [];
5457
$shipmentIds = $this->_rootElement->getElements($this->shipmentId);
5558
foreach ($shipmentIds as $shipmentId) {

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Sales\Test\TestStep;
88

9+
use Magento\Mtf\Fixture\FixtureInterface;
910
use Magento\Sales\Test\Fixture\OrderInjectable;
1011
use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
1112
use Magento\Sales\Test\Page\Adminhtml\OrderInvoiceNew;
@@ -134,8 +135,11 @@ public function run()
134135
$this->data,
135136
$this->order->getEntityId()['products']
136137
);
137-
$this->orderInvoiceNew->getFormBlock()->updateQty();
138+
138139
$this->orderInvoiceNew->getFormBlock()->fillFormData($this->data);
140+
if ($this->compare($this->order->getEntityId()['products'], $this->data)) {
141+
$this->orderInvoiceNew->getFormBlock()->updateQty();
142+
}
139143
if (isset($this->isInvoicePartial)) {
140144
$this->orderInvoiceNew->getFormBlock()->submit();
141145
$this->salesOrderView->getPageActions()->invoice();
@@ -176,4 +180,31 @@ protected function getShipmentIds()
176180
$this->salesOrderView->getOrderForm()->openTab('shipments');
177181
return $this->salesOrderView->getOrderForm()->getTab('shipments')->getGridBlock()->getIds();
178182
}
183+
184+
/**
185+
* Compare items.
186+
*
187+
* @param FixtureInterface[] $products
188+
* @param array $data
189+
* @return bool
190+
*/
191+
private function compare(array $products, array $data)
192+
{
193+
if (empty($data['items_data'])) {
194+
return false;
195+
}
196+
197+
$count = 0;
198+
foreach ($data['items_data'] as $key => $item) {
199+
if (!isset($products[$key])) {
200+
continue;
201+
}
202+
203+
if (is_numeric($item['qty']) && $products[$key]->getData('qty') !== $item['qty']) {
204+
++$count;
205+
}
206+
}
207+
208+
return $count !== 0;
209+
}
179210
}

dev/tests/functional/tests/app/Magento/Shipping/Test/Block/Adminhtml/Shipment/Grid.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ class Grid extends GridInterface
3333
'selector' => 'input[name="order_increment_id"]',
3434
],
3535
'total_qty_from' => [
36-
'selector' => 'input[name="total_qty[from]"',
36+
'selector' => 'input[name="total_qty[from]"]',
3737
],
3838
'total_qty_to' => [
39-
'selector' => 'input[name="total_qty][to]"',
39+
'selector' => 'input[name="total_qty[to]"]',
4040
],
4141
];
4242
}

dev/tests/functional/tests/app/Magento/Shipping/Test/Constraint/AssertShipmentInShipmentsTab.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,21 @@ public function processAssert(
3939

4040
foreach ($ids['shipmentIds'] as $key => $shipmentId) {
4141
$filter = [
42+
'id' => $shipmentId,
43+
'qty' => number_format($totalQty[$key], 4, '.', ''),
44+
];
45+
$filterQty = [
4246
'id' => $shipmentId,
4347
'qty_from' => $totalQty[$key],
4448
'qty_to' => $totalQty[$key],
4549
];
50+
$salesOrderView->getOrderForm()->getTab('shipments')->getGridBlock()->search($filterQty);
4651
\PHPUnit_Framework_Assert::assertTrue(
47-
$salesOrderView->getOrderForm()->getTab('shipments')->getGridBlock()->isRowVisible($filter),
52+
$salesOrderView
53+
->getOrderForm()
54+
->getTab('shipments')
55+
->getGridBlock()
56+
->isRowVisible($filter, false),
4857
'Shipment is absent on shipments tab.'
4958
);
5059
}

0 commit comments

Comments
 (0)