Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 8c6591d

Browse files
committed
MAGETWO-63855: Create functional automated for complete Signifyd flow
- code review fixes
1 parent 02c464c commit 8c6591d

File tree

6 files changed

+65
-50
lines changed

6 files changed

+65
-50
lines changed

Test/Block/Sandbox/CaseInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CaseInfo extends Block
7373
*
7474
* @var string
7575
*/
76-
private $cardHolder = '[data-dropdown="peopleLinks0"] span';
76+
private $cardHolder = '[data-dropdown="peopleLinks0"]';
7777

7878
/**
7979
* Css selector of displayed billing address.

Test/Constraint/AssertCaseInfoOnBackend.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Signifyd\Test\Constraint;
77

8-
use Magento\Signifyd\Test\Page\Adminhtml\OrderView;
8+
use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
99
use Magento\Mtf\Constraint\AbstractConstraint;
1010

1111
/**
@@ -16,7 +16,7 @@ class AssertCaseInfoOnBackend extends AbstractConstraint
1616
/**
1717
* Customized order view page.
1818
*
19-
* @var OrderView
19+
* @var SalesOrderView
2020
*/
2121
private $orderView;
2222

@@ -37,15 +37,15 @@ class AssertCaseInfoOnBackend extends AbstractConstraint
3737
/**
3838
* Assert that Signifyd Case information is correct on backend.
3939
*
40-
* @param OrderView $orderView
40+
* @param SalesOrderView $orderView
4141
* @param string $orderId
4242
* @param array $signifydData
4343
* @return void
4444
*/
4545
public function processAssert(
46-
OrderView $orderView,
46+
SalesOrderView $orderView,
4747
$orderId,
48-
$signifydData
48+
array $signifydData
4949
) {
5050
$this->orderView = $orderView;
5151
$this->orderView->open(['order_id' => $orderId]);

Test/Constraint/AssertSignifydCaseInOrdersGrid.php

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

77
namespace Magento\Signifyd\Test\Constraint;
88

9-
use Magento\Signifyd\Test\Page\Adminhtml\OrderView;
9+
use Magento\Signifyd\Test\Page\Adminhtml\OrdersGrid;
1010
use Magento\Mtf\Constraint\AbstractConstraint;
1111

1212
/**
@@ -19,14 +19,14 @@ class AssertSignifydCaseInOrdersGrid extends AbstractConstraint
1919
*
2020
* @param string $orderId
2121
* @param string $status
22-
* @param OrderView $orderView
22+
* @param OrdersGrid $ordersGrid
2323
* @param array $signifydData
2424
* @return void
2525
*/
2626
public function processAssert(
2727
$orderId,
2828
$status,
29-
OrderView $orderView,
29+
OrdersGrid $ordersGrid,
3030
array $signifydData
3131
) {
3232
$filter = [
@@ -37,11 +37,11 @@ public function processAssert(
3737

3838
$errorMessage = implode(', ', $filter);
3939

40-
$orderView->open();
40+
$ordersGrid->open();
4141

4242
\PHPUnit_Framework_Assert::assertTrue(
43-
$orderView->getSalesOrderGrid()->isRowVisible(array_filter($filter)),
44-
'Order with following data \'' . $errorMessage . '\' is absent in Orders grid.'
43+
$ordersGrid->getSignifydOrdersGrid()->isRowVisible(array_filter($filter)),
44+
'Order with following data \'' . $errorMessage . '\' is absent in orders grid.'
4545
);
4646
}
4747

Test/Page/Adminhtml/OrdersGrid.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd">
9+
<page name="ordersGrid" area="Adminhtml" mca="sales/order" module="Magento_Signifyd">
10+
<block name="signifydOrdersGrid" class="Magento\Signifyd\Test\Block\Adminhtml\Order\Grid" locator="//div[contains(@data-bind, 'sales_order_grid')]" strategy="xpath" />
11+
</page>
12+
</config>

Test/Page/Adminhtml/OrderView.xml renamed to Test/Page/Adminhtml/SalesOrderView.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../vendor/magento/mtf/etc/pages.xsd">
9-
<page name="OrderView" area="Adminhtml" mca="sales/order/view" module="Magento_Signifyd">
9+
<page name="SalesOrderView" area="Adminhtml" mca="sales/order/view">
1010
<block name="fraudProtectionBlock" class="Magento\Signifyd\Test\Block\Adminhtml\Order\View\FraudProtection" locator=".admin__page-section.order-case-info" strategy="css selector" />
11-
<block name="salesOrderGrid" class="Magento\Signifyd\Test\Block\Adminhtml\Order\Grid" locator="//div[contains(@data-bind, 'sales_order_grid')]" strategy="xpath" />
1211
</page>
1312
</config>

Test/TestStep/OpenOrderGridStep.php

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
*/
66
namespace Magento\Signifyd\Test\TestStep;
77

8-
use Magento\Sales\Test\Fixture\OrderInjectable;
9-
use Magento\Sales\Test\TestStep\OpenOrderStep;
8+
use Magento\Mtf\TestStep\TestStepInterface;
109
use Magento\Sales\Test\Page\Adminhtml\OrderIndex;
1110
use Magento\Sales\Test\Page\Adminhtml\SalesOrderView;
1211
use Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect as AssertOrderStatus;
1312
use Magento\Signifyd\Test\Constraint\AssertSignifydCaseInOrdersGrid as AssertOrdersGrid;
1413
use Magento\Signifyd\Test\Constraint\AssertCaseInfoOnBackend;
15-
use Magento\Signifyd\Test\Page\Adminhtml\OrderView;
14+
use Magento\Signifyd\Test\Page\Adminhtml\OrdersGrid;
1615

1716
/**
1817
* Open order grid step.
1918
*/
20-
class OpenOrderGridStep extends OpenOrderStep
19+
class OpenOrderGridStep implements TestStepInterface
2120
{
2221
/**
2322
* Magento order status assertion.
@@ -47,6 +46,14 @@ class OpenOrderGridStep extends OpenOrderStep
4746
*/
4847
private $orderStatus;
4948

49+
/**
50+
* Magento order id.
51+
*
52+
* @var int
53+
*/
54+
private $orderId;
55+
56+
5057
/**
5158
* Order View Page.
5259
*
@@ -55,11 +62,11 @@ class OpenOrderGridStep extends OpenOrderStep
5562
private $salesOrderView;
5663

5764
/**
58-
* Customized order view page.
65+
* Orders grid page.
5966
*
60-
* @var OrderView
67+
* @var OrdersGrid
6168
*/
62-
private $orderView;
69+
private $ordersGrid;
6370

6471
/**
6572
* Array of Signifyd config data.
@@ -70,35 +77,34 @@ class OpenOrderGridStep extends OpenOrderStep
7077

7178
/**
7279
* @param string $status
73-
* @param OrderInjectable $order
80+
* @param int $orderId
7481
* @param OrderIndex $orderIndex
7582
* @param SalesOrderView $salesOrderView
76-
* @param OrderView $orderView
83+
* @param OrdersGrid $ordersGrid
7784
* @param AssertOrderStatus $assertOrderStatus
7885
* @param AssertCaseInfoOnBackend $assertCaseInfo
7986
* @param AssertOrdersGrid $assertOrdersGrid
8087
* @param array $signifydData
8188
*/
8289
public function __construct(
8390
$status,
84-
OrderInjectable $order,
91+
$orderId,
8592
OrderIndex $orderIndex,
8693
SalesOrderView $salesOrderView,
87-
OrderView $orderView,
94+
OrdersGrid $ordersGrid,
8895
AssertOrderStatus $assertOrderStatus,
8996
AssertCaseInfoOnBackend $assertCaseInfo,
9097
AssertOrdersGrid $assertOrdersGrid,
9198
array $signifydData
9299
) {
93100
$this->orderStatus = $status;
101+
$this->orderId = $orderId;
102+
$this->orderIndex = $orderIndex;
103+
$this->salesOrderView = $salesOrderView;
104+
$this->ordersGrid = $ordersGrid;
94105
$this->assertOrderStatus = $assertOrderStatus;
95106
$this->assertCaseInfo = $assertCaseInfo;
96107
$this->assertOrdersGrid = $assertOrdersGrid;
97-
$this->salesOrderView = $salesOrderView;
98-
$this->orderView = $orderView;
99-
$this->orderIndex = $orderIndex;
100-
101-
parent::__construct($order, $this->orderIndex);
102108
$this->signifydData = $signifydData;
103109
}
104110

@@ -109,53 +115,51 @@ public function __construct(
109115
*/
110116
public function run()
111117
{
112-
parent::run();
113-
114118
$this->checkOrdersGrid();
115119
$this->checkOrderStatus();
116120
$this->checkCaseInfo();
117121
}
118122

119123
/**
120-
* Run assert to check order status is valid.
124+
* Run assert to check Signifyd Case Disposition status in orders grid.
121125
*
122126
* @return void
123127
*/
124-
private function checkOrderStatus()
128+
private function checkOrdersGrid()
125129
{
126-
$this->assertOrderStatus->processAssert(
130+
$this->assertOrdersGrid->processAssert(
131+
$this->orderId,
127132
$this->orderStatus,
128-
$this->order->getId(),
129-
$this->orderIndex,
130-
$this->salesOrderView
133+
$this->ordersGrid,
134+
$this->signifydData
131135
);
132136
}
133137

134138
/**
135-
* Run assert to check Signifyd Case information is correct on backend.
139+
* Run assert to check order status is valid.
136140
*
137141
* @return void
138142
*/
139-
private function checkCaseInfo()
143+
private function checkOrderStatus()
140144
{
141-
$this->assertCaseInfo->processAssert(
142-
$this->orderView,
143-
$this->order->getId(),
144-
$this->signifydData
145+
$this->assertOrderStatus->processAssert(
146+
$this->orderStatus,
147+
$this->orderId,
148+
$this->orderIndex,
149+
$this->salesOrderView
145150
);
146151
}
147152

148153
/**
149-
* Run assert to check Signifyd Case Disposition status in orders grid.
154+
* Run assert to check Signifyd Case information is correct on backend.
150155
*
151156
* @return void
152157
*/
153-
private function checkOrdersGrid()
158+
private function checkCaseInfo()
154159
{
155-
$this->assertOrdersGrid->processAssert(
156-
$this->order->getId(),
157-
$this->orderStatus,
158-
$this->orderView,
160+
$this->assertCaseInfo->processAssert(
161+
$this->salesOrderView,
162+
$this->orderId,
159163
$this->signifydData
160164
);
161165
}

0 commit comments

Comments
 (0)