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

Commit 02c464c

Browse files
Dmytro Yushkiniivashchenko
authored andcommitted
MAGETWO-63855: Create functional automated for complete Signifyd flow
- Code review fixes
1 parent a337032 commit 02c464c

27 files changed

+586
-394
lines changed

Test/Block/Adminhtml/Order/Grid.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Signifyd\Test\Block\Adminhtml\Order;
87

9-
use Magento\Mtf\Client\Locator;
108
use Magento\Ui\Test\Block\Adminhtml\DataGrid;
119

1210
/**

Test/Block/Adminhtml/Order/View/FraudProtection.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Signifyd\Test\Block\Adminhtml\Order\View;
77

88
use Magento\Mtf\Block\Block;
9-
use Magento\Mtf\Client\Locator;
109

1110
/**
1211
* Information about fraud protection on order page.
@@ -41,7 +40,7 @@ class FraudProtection extends Block
4140
*/
4241
public function getCaseStatus()
4342
{
44-
return $this->_rootElement->find($this->caseStatus, Locator::SELECTOR_CSS)->getText();
43+
return $this->_rootElement->find($this->caseStatus)->getText();
4544
}
4645

4746
/**
@@ -51,7 +50,7 @@ public function getCaseStatus()
5150
*/
5251
public function getCaseGuaranteeDisposition()
5352
{
54-
return $this->_rootElement->find($this->caseGuaranteeDisposition, Locator::SELECTOR_CSS)->getText();
53+
return $this->_rootElement->find($this->caseGuaranteeDisposition)->getText();
5554
}
5655

5756
/**
@@ -61,6 +60,6 @@ public function getCaseGuaranteeDisposition()
6160
*/
6261
public function getCaseReviewDisposition()
6362
{
64-
return $this->_rootElement->find($this->caseReviewDisposition, Locator::SELECTOR_CSS)->getText();
63+
return $this->_rootElement->find($this->caseReviewDisposition)->getText();
6564
}
6665
}

Test/Block/Sandbox/CaseInfo.php

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,132 +6,167 @@
66
namespace Magento\Signifyd\Test\Block\Sandbox;
77

88
use Magento\Mtf\Block\Block;
9-
use Magento\Mtf\Client\Locator;
109

1110
/**
12-
* Block with case information.
11+
* Case information block.
1312
*/
1413
class CaseInfo extends Block
1514
{
1615
/**
16+
* Css selector of "Flag Case As Good" button.
17+
*
1718
* @var string
1819
*/
19-
private $flagGoodButton = '.flag-case-good';
20+
private $flagCaseAsGoodButton = '[class*="flag-case-good"]';
2021

2122
/**
23+
* Css selector of guarantee status.
24+
*
2225
* @var string
2326
*/
24-
private $guaranteeDisposition = '.guarantee-status';
27+
private $guaranteeDisposition = '[class*="guarantee-status"]';
2528

2629
/**
30+
* Css selector of CVV response description.
31+
*
2732
* @var string
2833
*/
29-
private $cvvResponseDescription = '//span[contains(@ng-bind, "caseOrderSummary.cvvResponseDescription")]';
34+
private $cvvResponseDescription = '[ng-bind="caseOrderSummary.cvvResponseDescription"]';
3035

3136
/**
37+
* Css selector of CVV response code.
38+
*
3239
* @var string
3340
*/
34-
private $cvvResponseCode = '//span[contains(@ng-bind, "caseOrderSummary.cvvResponseCode")]';
41+
private $cvvResponseCode = '[ng-bind="caseOrderSummary.cvvResponseCode"]';
3542

3643
/**
44+
* Css selector of AVS response description.
45+
*
3746
* @var string
3847
*/
39-
private $avsResponseDescription = '//span[contains(@ng-bind, "caseOrderSummary.avsResponseDescription")]';
48+
private $avsResponseDescription = '[ng-bind="caseOrderSummary.avsResponseDescription"]';
4049

4150
/**
51+
* Css selector of AVS response code.
52+
*
4253
* @var string
4354
*/
44-
private $avsResponseCode = '//span[contains(@ng-bind, "caseOrderSummary.avsResponseCode")]';
55+
private $avsResponseCode = '[ng-bind="caseOrderSummary.avsResponseCode"]';
4556

4657
/**
58+
* Css selector of displayed case order id.
59+
*
4760
* @var string
4861
*/
49-
private $orderId = '//span[contains(@ng-bind, "currentCase.caseIdDisplay")]';
62+
private $orderId = '[ng-bind="currentCase.caseIdDisplay"]';
5063

5164
/**
65+
* Css selector of displayed order amount.
66+
*
5267
* @var string
5368
*/
54-
private $orderAmount = '//span[contains(@ng-bind, "currentCase.orderAmount")]';
69+
private $orderAmount = '[ng-bind*="currentCase.orderAmount"]';
5570

5671
/**
72+
* Css selector of displayed card holder name.
73+
*
5774
* @var string
5875
*/
59-
private $cardHolder = '//a[contains(@data-dropdown, "peopleLinks0")]//span';
76+
private $cardHolder = '[data-dropdown="peopleLinks0"] span';
6077

6178
/**
79+
* Css selector of displayed billing address.
80+
*
6281
* @var string
6382
*/
64-
private $billingAddress = '//a[contains(@data-dropdown, "streetLinks0")]';
83+
private $billingAddress = '[data-dropdown="streetLinks0"]';
6584

6685
/**
86+
* Flags case as good.
87+
*
6788
* @return void
6889
*/
69-
public function flagCaseGood()
90+
public function flagCaseAsGood()
7091
{
71-
$this->_rootElement->find($this->flagGoodButton)->click();
92+
$this->_rootElement->find($this->flagCaseAsGoodButton)->click();
7293
}
7394

7495
/**
75-
* @return array|string
96+
* Gets guarantee disposition.
97+
*
98+
* @return string
7699
*/
77100
public function getGuaranteeDisposition()
78101
{
79102
return $this->_rootElement->find($this->guaranteeDisposition)->getText();
80103
}
81104

82105
/**
106+
* Gets CVV response.
107+
*
83108
* @return string
84109
*/
85110
public function getCvvResponse()
86111
{
87112
return sprintf(
88113
'%s (%s)',
89-
$this->_rootElement->find($this->cvvResponseDescription, Locator::SELECTOR_XPATH)->getText(),
90-
$this->_rootElement->find($this->cvvResponseCode, Locator::SELECTOR_XPATH)->getText()
114+
$this->_rootElement->find($this->cvvResponseDescription)->getText(),
115+
$this->_rootElement->find($this->cvvResponseCode)->getText()
91116
);
92117
}
93118

94119
/**
120+
* Gets AVS response.
121+
*
95122
* @return string
96123
*/
97124
public function getAvsResponse()
98125
{
99126
return sprintf(
100127
'%s (%s)',
101-
$this->_rootElement->find($this->avsResponseDescription, Locator::SELECTOR_XPATH)->getText(),
102-
$this->_rootElement->find($this->avsResponseCode, Locator::SELECTOR_XPATH)->getText()
128+
$this->_rootElement->find($this->avsResponseDescription)->getText(),
129+
$this->_rootElement->find($this->avsResponseCode)->getText()
103130
);
104131
}
105132

106133
/**
107-
* @return array|string
134+
* Gets displayed order id.
135+
*
136+
* @return string
108137
*/
109138
public function getOrderId()
110139
{
111-
return $this->_rootElement->find($this->orderId, Locator::SELECTOR_XPATH)->getText();
140+
return $this->_rootElement->find($this->orderId)->getText();
112141
}
113142

114143
/**
115-
* @return array|string
144+
* Gets displayed order amount.
145+
*
146+
* @return string
116147
*/
117148
public function getOrderAmount()
118149
{
119-
return $this->_rootElement->find($this->orderAmount, Locator::SELECTOR_XPATH)->getText();
150+
return $this->_rootElement->find($this->orderAmount)->getText();
120151
}
121152

122153
/**
123-
* @return array|string
154+
* Gets displayed card holder name.
155+
*
156+
* @return string
124157
*/
125158
public function getCardHolder()
126159
{
127-
return $this->_rootElement->find($this->cardHolder, Locator::SELECTOR_XPATH)->getText();
160+
return $this->_rootElement->find($this->cardHolder)->getText();
128161
}
129162

130163
/**
131-
* @return array|string
164+
* Gets displayed billing address.
165+
*
166+
* @return string
132167
*/
133168
public function getBillingAddress()
134169
{
135-
return $this->_rootElement->find($this->billingAddress, Locator::SELECTOR_XPATH)->getText();
170+
return $this->_rootElement->find($this->billingAddress)->getText();
136171
}
137172
}

Test/Block/Sandbox/CaseSearch.php

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,56 @@
1414
class CaseSearch extends Form
1515
{
1616
/**
17+
* Css selector of search input.
18+
*
1719
* @var string
1820
*/
19-
private $searchInput = '#queueSearchBar';
21+
private $searchBar = '[id=queueSearchBar]';
2022

2123
/**
24+
* Css selector of search submit button.
25+
*
2226
* @var string
2327
*/
24-
private $buttonSubmit = '[type=submit]';
28+
private $submitButton = '[type=submit]';
2529

2630
/**
31+
* XPath selector of first searched element in list.
32+
*
2733
* @var string
2834
*/
29-
private $buttonCase = '//ul//li[contains(@class, "app-sidebar-item")][1]//a';
35+
private $selectCaseLink = '//ul//li[contains(@class, "app-sidebar-item")][1]//a';
3036

3137
/**
32-
* @param $searchCriteria
38+
* Fill search input with customer name and submit.
39+
*
40+
* @param string $customerName
41+
* @return void
3342
*/
34-
public function fillSearchCriteria($searchCriteria)
43+
public function searchCaseByCustomerName($customerName)
3544
{
36-
$this->waitForElementVisible($this->searchInput);
37-
$this->_rootElement->find($this->searchInput)->setValue($searchCriteria);
45+
$this->_rootElement->find($this->searchBar)->setValue($customerName);
46+
$this->_rootElement->find($this->submitButton)->click();
3847
}
3948

4049
/**
50+
* Select searched case.
51+
*
4152
* @return void
4253
*/
43-
public function searchCase()
54+
public function selectCase()
4455
{
45-
$this->_rootElement->find($this->buttonSubmit)->click();
56+
$this->_rootElement->find($this->selectCaseLink, Locator::SELECTOR_XPATH)->click();
4657
}
4758

59+
4860
/**
61+
* Waiting of case page loading.
62+
*
4963
* @return void
5064
*/
51-
public function selectCase()
65+
public function waitForLoading()
5266
{
53-
$this->_rootElement->find($this->buttonCase, Locator::SELECTOR_XPATH)->click();
67+
$this->waitForElementVisible($this->searchBar);
5468
}
5569
}

Test/Block/Sandbox/SignifydLogin.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
class SignifydLogin extends Form
1414
{
1515
/**
16-
* Login button on Signifyd side.
16+
* Css selector of Signifyd login button.
1717
*
1818
* @var string
1919
*/
2020
private $loginButton = '[type=submit]';
2121

2222
/**
23-
* Login to Signifyd Sandbox.
23+
* Login to Signifyd.
2424
*
2525
* @return void
2626
*/
27-
public function sandboxLogin()
27+
public function login()
2828
{
2929
$this->_rootElement->find($this->loginButton)->click();
3030
}

0 commit comments

Comments
 (0)