Skip to content

Commit b635323

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-91412' into 2.2-develop-pr35
2 parents b2d2e78 + 72b0b7b commit b635323

File tree

5 files changed

+101
-4
lines changed

5 files changed

+101
-4
lines changed

dev/tests/functional/tests/app/Magento/Signifyd/Test/Block/SignifydConsole/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 $orderAmount = '[ng-bind*="currentCase.orderAmount"]';
76+
private $orderAmount = '[ng-bind*="currentCase.orderTotalAmount"]';
7777

7878
/**
7979
* Locator value for order amount currency.

dev/tests/functional/tests/app/Magento/Signifyd/Test/Block/SignifydConsole/CaseSearch.php

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ class CaseSearch extends Form
3333
*/
3434
private $selectCaseLink = 'ul[case-list=cases] li[case-list-case=case] a';
3535

36+
/**
37+
* Locator for resolving applied filters list.
38+
*
39+
* @var string
40+
*/
41+
private $appliedFilters = '.app-taglist > ul > li > a';
42+
43+
/**
44+
* Locator for loading spinner.
45+
*
46+
* @var string
47+
*/
48+
private $spinner = '.cases-loading-spinner';
49+
3650
/**
3751
* Fill search input with customer name and submit.
3852
*
@@ -41,8 +55,46 @@ class CaseSearch extends Form
4155
*/
4256
public function searchCaseByCustomerName($customerName)
4357
{
58+
$this->resetFilters();
4459
$this->_rootElement->find($this->searchBar)->setValue($customerName);
4560
$this->_rootElement->find($this->submitButton)->click();
61+
$this->waitLoadingSpinner();
62+
}
63+
64+
/**
65+
* Reset applied filters.
66+
*
67+
* @return void
68+
*/
69+
private function resetFilters()
70+
{
71+
$filters = $this->_rootElement->getElements($this->appliedFilters);
72+
if (!empty($filters)) {
73+
foreach ($filters as $filter) {
74+
$filter->click();
75+
$this->waitLoadingSpinner();
76+
}
77+
}
78+
}
79+
80+
/**
81+
* Wait until loading spinner disappeared.
82+
*
83+
* @return void
84+
*/
85+
private function waitLoadingSpinner()
86+
{
87+
$this->waitForElementNotVisible($this->spinner);
88+
}
89+
90+
/**
91+
* Checks if any case is visible.
92+
*
93+
* @return bool
94+
*/
95+
public function isAnyCaseVisible()
96+
{
97+
return $this->_rootElement->find($this->selectCaseLink)->isVisible();
4698
}
4799

48100
/**

dev/tests/functional/tests/app/Magento/Signifyd/Test/Block/SignifydConsole/SignifydLogin.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Signifyd\Test\Block\SignifydConsole;
77

88
use Magento\Mtf\Block\Form;
9+
use Magento\Mtf\Client\Element\SimpleElement;
10+
use Magento\Mtf\Fixture\FixtureInterface;
911

1012
/**
1113
* Signifyd login block.
@@ -19,13 +21,44 @@ class SignifydLogin extends Form
1921
*/
2022
private $loginButton = '[type=submit]';
2123

24+
/**
25+
* Locator for admin form notification window.
26+
*
27+
* @var string
28+
*/
29+
private $notificationCloseButton = '.wm-close-button';
30+
31+
/**
32+
* @inheritdoc
33+
*/
34+
public function fill(FixtureInterface $fixture, SimpleElement $element = null)
35+
{
36+
$this->closeNotification();
37+
38+
return parent::fill($fixture, $element);
39+
}
40+
2241
/**
2342
* Login to Signifyd.
2443
*
2544
* @return void
2645
*/
2746
public function login()
2847
{
48+
$this->closeNotification();
2949
$this->_rootElement->find($this->loginButton)->click();
3050
}
51+
52+
/**
53+
* Close notification popup.
54+
*
55+
* @return void
56+
*/
57+
private function closeNotification()
58+
{
59+
$notification = $this->browser->find($this->notificationCloseButton);
60+
if ($notification->isVisible()) {
61+
$notification->click();
62+
}
63+
}
3164
}

dev/tests/functional/tests/app/Magento/Signifyd/Test/TestCase/CreateSignifydGuaranteeAndCancelOrderTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
<constraint name="Magento\Sales\Test\Constraint\AssertCancelInCommentsHistory" />
6363
<constraint name="Magento\Signifyd\Test\Constraint\AssertSignifydCaseInCommentsHistory" />
6464
<constraint name="Magento\Signifyd\Test\Constraint\AssertAwaitingSignifydGuaranteeInCommentsHistory" />
65-
<constraint name="Magento\Signifyd\Test\Constraint\AssertSignifydGuaranteeCancelInCommentsHistory" />
6665
</variation>
6766
</testCase>
6867
</config>

dev/tests/functional/tests/app/Magento/Signifyd/Test/TestStep/SignifydObserveCaseStep.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class SignifydObserveCaseStep implements TestStepInterface
7575
*/
7676
private $testStepFactory;
7777

78+
/**
79+
* @var int
80+
*/
81+
private $searchAttempts = 10;
82+
7883
/**
7984
* @param AssertCaseInfoOnSignifydConsole $assertCaseInfoOnSignifydConsole
8085
* @param SignifydAddress $signifydAddress
@@ -111,8 +116,16 @@ public function __construct(
111116
public function run()
112117
{
113118
$this->signifydCases->open();
114-
$this->signifydCases->getCaseSearchBlock()
115-
->searchCaseByCustomerName($this->signifydAddress->getFirstname());
119+
// Search case few times because it can appear with delay.
120+
for ($attempts = $this->searchAttempts; $attempts > 0; $attempts--) {
121+
$this->signifydCases->getCaseSearchBlock()
122+
->searchCaseByCustomerName($this->signifydAddress->getFirstname());
123+
if ($this->signifydCases->getCaseSearchBlock()->isAnyCaseVisible()) {
124+
break;
125+
}
126+
sleep(3);
127+
}
128+
116129
$this->signifydCases->getCaseSearchBlock()->selectCase();
117130
$this->signifydCases->getCaseInfoBlock()->flagCase($this->signifydData->getCaseFlag());
118131

0 commit comments

Comments
 (0)