8 use Magento\Authorizenet\Test\Fixture\AuthorizenetSandboxCustomer;
9 use Magento\Authorizenet\Test\Fixture\TransactionSearch;
10 use Magento\Authorizenet\Test\Page\Sandbox\Main;
11 use Magento\Mtf\Client\BrowserInterface;
12 use Magento\Mtf\TestStep\TestStepInterface;
15 use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
16 use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
28 private $sandboxCustomer;
42 private $salesOrderView;
63 private $assertInvoiceStatusInOrdersGrid;
70 private $orderBeforeAccept;
77 private $assertOrderButtonsAvailable;
91 private $frame =
'frameset > frame';
98 private $transactionSearch;
115 AuthorizenetSandboxCustomer $sandboxCustomer,
116 TransactionSearch $transactionSearch,
118 SalesOrderView $salesOrderView,
119 OrderIndex $salesOrder,
122 BrowserInterface $browser,
123 array $orderBeforeAccept,
126 $this->sandboxCustomer = $sandboxCustomer;
127 $this->transactionSearch = $transactionSearch;
129 $this->salesOrderView = $salesOrderView;
130 $this->salesOrder = $salesOrder;
131 $this->assertInvoiceStatusInOrdersGrid = $assertInvoiceStatusInOrdersGrid;
132 $this->assertOrderButtonsAvailable = $assertOrderButtonsAvailable;
133 $this->browser = $browser;
134 $this->orderBeforeAccept = $orderBeforeAccept;
135 $this->orderId = $orderId;
144 public function run()
146 $this->assertInvoiceStatusInOrdersGrid->processAssert(
147 $this->salesOrderView,
148 $this->orderBeforeAccept[
'invoiceStatus'],
151 $this->assertOrderButtonsAvailable->processAssert(
152 $this->salesOrderView,
153 $this->orderBeforeAccept[
'buttonsAvailable']
155 $this->salesOrder->open();
156 $this->salesOrder->getSalesOrderGrid()->searchAndOpen([
'id' => $this->orderId]);
159 $infoTab = $this->salesOrderView->getOrderForm()->openTab(
'info')->getTab(
'info');
160 $latestComment = $infoTab->getCommentsHistoryBlock()->getLatestComment();
161 if (!preg_match(
'/"(\d+)"/', $latestComment[
'comment'], $matches)) {
162 throw new \Exception(
'Comment with transaction id cannot be found.');
164 $transactionId = $matches[1];
166 $this->browser->switchToFrame($this->browser->find($this->frame)->getLocator());
167 $this->
main->getLoginForm()->fill($this->sandboxCustomer)->login();
168 $this->
main->getModalBlock()->acceptNotification();
169 $this->
main->getMenuBlock()->openSearchMenu();
170 $this->
main->getSearchForm()->fill($this->transactionSearch)->search();
171 $this->
main->getTransactionsGridBlock()->openTransaction($transactionId)->approveTransaction();
__construct(AuthorizenetSandboxCustomer $sandboxCustomer, TransactionSearch $transactionSearch, Main $main, SalesOrderView $salesOrderView, OrderIndex $salesOrder, AssertInvoiceStatusInOrdersGrid $assertInvoiceStatusInOrdersGrid, AssertOrderButtonsAvailable $assertOrderButtonsAvailable, BrowserInterface $browser, array $orderBeforeAccept, $orderId)