Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AddTrackingNumberStep.php
Go to the documentation of this file.
1 <?php
7 
8 use Magento\Mtf\TestStep\TestStepInterface;
9 use Magento\Shipping\Test\Page\Adminhtml\SalesShipmentView;
10 use Magento\Shipping\Test\Page\Adminhtml\ShipmentIndex;
11 
15 class AddTrackingNumberStep implements TestStepInterface
16 {
20  private $shipmentIndex;
21 
25  private $salesShipmentView;
26 
30  private $shipmentIds;
31 
35  private $trackingData;
36 
43  public function __construct(
44  ShipmentIndex $shipmentIndex,
45  SalesShipmentView $salesShipmentView,
46  array $shipmentIds,
47  array $trackingData
48  ) {
49  $this->shipmentIndex = $shipmentIndex;
50  $this->salesShipmentView = $salesShipmentView;
51  $this->shipmentIds = $shipmentIds;
52  $this->trackingData = $trackingData;
53  }
54 
60  public function run()
61  {
62  $this->shipmentIndex->open();
63  $this->shipmentIndex->getShipmentsGrid()
64  ->searchAndOpen(['id' => array_pop($this->shipmentIds)]);
65 
66  $trackingInfoTable = $this->salesShipmentView->getTrackingInfoBlock();
67  $trackingInfoTable->addTrackingNumber($this->trackingData);
68  }
69 }
__construct(ShipmentIndex $shipmentIndex, SalesShipmentView $salesShipmentView, array $shipmentIds, array $trackingData)