9 use Magento\Checkout\Test\Page\CheckoutOnepage;
10 use Magento\Checkout\Test\Page\CheckoutOnepageSuccess;
11 use Magento\Mtf\Fixture\FixtureFactory;
12 use Magento\Mtf\Fixture\FixtureInterface;
13 use Magento\Mtf\TestStep\TestStepInterface;
14 use Magento\Payment\Test\Fixture\CreditCard;
27 private $checkoutOnepage;
34 private $fixtureFactory;
60 private $checkoutOnepageSuccess;
79 CheckoutOnepage $checkoutOnepage,
80 FixtureFactory $fixtureFactory,
81 CreditCard $creditCard,
82 CheckoutOnepageSuccess $checkoutOnepageSuccess,
85 OrderInjectable $order =
null 87 $this->checkoutOnepage = $checkoutOnepage;
88 $this->fixtureFactory = $fixtureFactory;
89 $this->creditCard = $creditCard;
92 $this->checkoutOnepageSuccess = $checkoutOnepageSuccess;
93 $this->order = $order;
101 public function run()
104 $this->checkoutOnepage->getPaymentBlock()->selectPaymentMethod($this->payment);
105 $this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
106 $this->checkoutOnepage->getHostedProBlock()->fillPaymentData($this->creditCard);
108 while ($this->checkoutOnepage->getHostedProBlock()->isErrorMessageVisible() && $attempts <= 3) {
109 $this->checkoutOnepage->getHostedProBlock()->fillPaymentData($this->creditCard);
113 $orderId = $this->checkoutOnepageSuccess->getSuccessBlock()->getGuestOrderId();
117 'entity_id' => [
'products' => $this->products]
119 $orderData = $this->order !==
null ? $this->order->getData() : [];
120 $order = $this->fixtureFactory->createByCode(
122 [
'data' => array_merge(
$data, $orderData)]
126 'orderId' => $orderId,
__construct(CheckoutOnepage $checkoutOnepage, FixtureFactory $fixtureFactory, CreditCard $creditCard, CheckoutOnepageSuccess $checkoutOnepageSuccess, array $payment, array $products, OrderInjectable $order=null)