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

Commit 9f5d932

Browse files
committed
MAGETWO-72467: Move Signifyd to CE
- Move functional tests
2 parents 85bdbbd + 0236c65 commit 9f5d932

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2677
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Signifyd\Test\Block\Adminhtml\Order;
7+
8+
use Magento\Ui\Test\Block\Adminhtml\DataGrid;
9+
10+
/**
11+
* Admin Data Grid for managing "Sales Order" entities.
12+
*/
13+
class Grid extends DataGrid
14+
{
15+
/**
16+
* Filters array mapping.
17+
*
18+
* @var array
19+
*/
20+
protected $filters = [
21+
'id' => [
22+
'selector' => '[name="increment_id"]',
23+
],
24+
'status' => [
25+
'selector' => '[name="status"]',
26+
'input' => 'select',
27+
],
28+
'signifyd_guarantee_status' => [
29+
'selector' => '[name="signifyd_guarantee_status"]',
30+
'input' => 'select'
31+
]
32+
];
33+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Signifyd\Test\Block\Adminhtml\Order\View;
7+
8+
use Magento\Mtf\Block\Block;
9+
10+
/**
11+
* Information about fraud protection on order page.
12+
*/
13+
class FraudProtection extends Block
14+
{
15+
/**
16+
* Case Guarantee Disposition.
17+
*
18+
* @var string
19+
*/
20+
private $caseGuaranteeDisposition = 'td.col-guarantee-disposition';
21+
22+
/**
23+
* Get Case Guarantee Disposition status.
24+
*
25+
* @return string
26+
*/
27+
public function getCaseGuaranteeDisposition()
28+
{
29+
return $this->_rootElement->find($this->caseGuaranteeDisposition)->getText();
30+
}
31+
}
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Signifyd\Test\Block\SignifydConsole;
7+
8+
use Magento\Mtf\Block\Block;
9+
10+
/**
11+
* Case information block.
12+
*/
13+
class CaseInfo extends Block
14+
{
15+
/**
16+
* Css selector of "Flag Case As Good" button.
17+
*
18+
* @var string
19+
*/
20+
private $flagCaseAsGoodButton = '[class*="flag-case-good"]';
21+
22+
/**
23+
* Css selector of "Flag Case As Bad" button.
24+
*
25+
* @var string
26+
*/
27+
private $flagCaseAsBadButton = '[class*="flag-case-bad"]';
28+
29+
/**
30+
* Css selector of guarantee status.
31+
*
32+
* @var string
33+
*/
34+
private $guaranteeDisposition = '[class*="guarantee-status"]';
35+
36+
/**
37+
* Css selector of CVV response description.
38+
*
39+
* @var string
40+
*/
41+
private $cvvResponseDescription = '[ng-bind="caseOrderSummary.cvvResponseDescription"]';
42+
43+
/**
44+
* Css selector of CVV response code.
45+
*
46+
* @var string
47+
*/
48+
private $cvvResponseCode = '[ng-bind="caseOrderSummary.cvvResponseCode"]';
49+
50+
/**
51+
* Css selector of AVS response description.
52+
*
53+
* @var string
54+
*/
55+
private $avsResponseDescription = '[ng-bind="caseOrderSummary.avsResponseDescription"]';
56+
57+
/**
58+
* Css selector of AVS response code.
59+
*
60+
* @var string
61+
*/
62+
private $avsResponseCode = '[ng-bind="caseOrderSummary.avsResponseCode"]';
63+
64+
/**
65+
* Css selector of displayed case order id.
66+
*
67+
* @var string
68+
*/
69+
private $orderId = '[ng-bind="currentCase.caseIdDisplay"]';
70+
71+
/**
72+
* Css selector of displayed order amount.
73+
*
74+
* @var string
75+
*/
76+
private $orderAmount = '[ng-bind*="currentCase.orderAmount"]';
77+
78+
/**
79+
* Locator value for order amount currency.
80+
*
81+
* @var string
82+
*/
83+
private $orderAmountCurrency = '[ng-bind*="currentCase.currency"]';
84+
85+
/**
86+
* Css selector of displayed card holder name.
87+
*
88+
* @var string
89+
*/
90+
private $cardHolder = '[data-dropdown="peopleLinks0_card_holders"]';
91+
92+
/**
93+
* Css selector of displayed billing address.
94+
*
95+
* @var string
96+
*/
97+
private $billingAddress = '[data-dropdown="streetLinks0"]';
98+
99+
/**
100+
* Locator value for "No analysis available" block in "Device" container.
101+
*
102+
* @var string
103+
*/
104+
private $noDeviceAnalysisAvailable = '[ng-hide^="caseAnalysis.deviceAnalysis.details.length"]';
105+
106+
/**
107+
* Locator value for "Shipping Price" block.
108+
*
109+
* @var string
110+
*/
111+
private $shippingPrice = '[ng-if$="caseOrderSummary.shipments[0].shippingPrice"]';
112+
113+
/**
114+
* Check if device data are present.
115+
*
116+
* @return bool
117+
*/
118+
public function isAvailableDeviceData()
119+
{
120+
return !$this->_rootElement->find($this->noDeviceAnalysisAvailable)->isVisible();
121+
}
122+
123+
/**
124+
* Returns shipping price.
125+
*
126+
* @return string
127+
*/
128+
public function getShippingPrice()
129+
{
130+
return $this->_rootElement->find($this->shippingPrice)->getText();
131+
}
132+
133+
/**
134+
* Flags case as good or bad.
135+
*
136+
* @param string $flagType
137+
* @return void
138+
*/
139+
public function flagCase($flagType)
140+
{
141+
$flagSelector = ($flagType === 'Good')
142+
? $this->flagCaseAsGoodButton
143+
: $this->flagCaseAsBadButton;
144+
145+
$this->_rootElement->find($flagSelector)->click();
146+
}
147+
148+
/**
149+
* Flags case as bad.
150+
*
151+
* @return void
152+
*/
153+
public function flagCaseAsBad()
154+
{
155+
$this->_rootElement->find($this->flagCaseAsBadButton)->click();
156+
}
157+
158+
/**
159+
* Gets guarantee disposition.
160+
*
161+
* @return string
162+
*/
163+
public function getGuaranteeDisposition()
164+
{
165+
return $this->_rootElement->find($this->guaranteeDisposition)->getText();
166+
}
167+
168+
/**
169+
* Gets CVV response.
170+
*
171+
* @return string
172+
*/
173+
public function getCvvResponse()
174+
{
175+
return sprintf(
176+
'%s (%s)',
177+
$this->_rootElement->find($this->cvvResponseDescription)->getText(),
178+
$this->_rootElement->find($this->cvvResponseCode)->getText()
179+
);
180+
}
181+
182+
/**
183+
* Gets AVS response.
184+
*
185+
* @return string
186+
*/
187+
public function getAvsResponse()
188+
{
189+
return sprintf(
190+
'%s (%s)',
191+
$this->_rootElement->find($this->avsResponseDescription)->getText(),
192+
$this->_rootElement->find($this->avsResponseCode)->getText()
193+
);
194+
}
195+
196+
/**
197+
* Gets displayed order id.
198+
*
199+
* @return string
200+
*/
201+
public function getOrderId()
202+
{
203+
return $this->_rootElement->find($this->orderId)->getText();
204+
}
205+
206+
/**
207+
* Gets displayed order amount.
208+
*
209+
* @return string
210+
*/
211+
public function getOrderAmount()
212+
{
213+
return $this->_rootElement->find($this->orderAmount)->getText();
214+
}
215+
216+
/**
217+
* Returns displayed order amount currency.
218+
*
219+
* @return string
220+
*/
221+
public function getOrderAmountCurrency()
222+
{
223+
return $this->_rootElement->find($this->orderAmountCurrency)->getText();
224+
}
225+
226+
/**
227+
* Gets displayed card holder name.
228+
*
229+
* @return string
230+
*/
231+
public function getCardHolder()
232+
{
233+
return $this->_rootElement->find($this->cardHolder)->getText();
234+
}
235+
236+
/**
237+
* Gets displayed billing address.
238+
*
239+
* @return string
240+
*/
241+
public function getBillingAddress()
242+
{
243+
return $this->_rootElement->find($this->billingAddress)->getText();
244+
}
245+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Signifyd\Test\Block\SignifydConsole;
7+
8+
use Magento\Mtf\Block\Form;
9+
10+
/**
11+
* Side block with case search and cases list.
12+
*/
13+
class CaseSearch extends Form
14+
{
15+
/**
16+
* Css selector of search input.
17+
*
18+
* @var string
19+
*/
20+
private $searchBar = '[id=queueSearchBar]';
21+
22+
/**
23+
* Css selector of search submit button.
24+
*
25+
* @var string
26+
*/
27+
private $submitButton = '[type=submit]';
28+
29+
/**
30+
* Css selector of searched element in cases list.
31+
*
32+
* @var string
33+
*/
34+
private $selectCaseLink = 'ul[case-list=cases] li[case-list-case=case] a';
35+
36+
/**
37+
* Fill search input with customer name and submit.
38+
*
39+
* @param string $customerName
40+
* @return void
41+
*/
42+
public function searchCaseByCustomerName($customerName)
43+
{
44+
$this->_rootElement->find($this->searchBar)->setValue($customerName);
45+
$this->_rootElement->find($this->submitButton)->click();
46+
}
47+
48+
/**
49+
* Select searched case.
50+
*
51+
* @return void
52+
*/
53+
public function selectCase()
54+
{
55+
$this->_rootElement->find($this->selectCaseLink)->click();
56+
}
57+
58+
/**
59+
* Waiting of case page loading.
60+
*
61+
* @return void
62+
*/
63+
public function waitForLoading()
64+
{
65+
$this->waitForElementVisible($this->searchBar);
66+
}
67+
}

0 commit comments

Comments
 (0)