Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FillShippingMethodOnEstimateStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Checkout\Test\Page\CheckoutCart;
10 use Magento\Customer\Test\Fixture\Address;
11 use Magento\Mtf\TestStep\TestStepInterface;
12 
16 class FillShippingMethodOnEstimateStep implements TestStepInterface
17 {
23  private $checkoutCart;
24 
30  private $address;
31 
37  private $shipping;
38 
44  public function __construct(
45  CheckoutCart $checkoutCart,
46  Address $address,
47  array $shipping = []
48  ) {
49  $this->checkoutCart = $checkoutCart;
50  $this->address = $address;
51  $this->shipping = $shipping;
52  }
53 
59  public function run()
60  {
61  $this->checkoutCart->open();
62  $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
63  $this->checkoutCart->getShippingBlock()->resetAddress();
64  $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($this->address);
65  if (!empty($this->shipping)) {
66  $this->checkoutCart->getShippingBlock()->selectShippingMethod($this->shipping);
67  }
68  $this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
69  }
70 }
__construct(CheckoutCart $checkoutCart, Address $address, array $shipping=[])
$address
Definition: customer.php:38