Skip to content

Commit ba65f93

Browse files
author
Dmytro Aponasenko
committed
Merge branch 'MTA-2319' of https://github.corp.ebay.com/magento-qmt/magento2ce into develop
2 parents 7f51de5 + b806482 commit ba65f93

File tree

4 files changed

+99
-42
lines changed

4 files changed

+99
-42
lines changed

dev/tests/functional/lib/Magento/Mtf/Client/Element/GlobalsearchElement.php

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
*/
1515
class GlobalsearchElement extends SimpleElement
1616
{
17-
/**
18-
* "Backspace" key code.
19-
*/
20-
const BACKSPACE = "\xEE\x80\x83";
21-
2217
/**
2318
* Search icon selector.
2419
*
@@ -63,43 +58,14 @@ class GlobalsearchElement extends SimpleElement
6358
public function setValue($value)
6459
{
6560
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]);
66-
6761
$this->waitInitElement();
68-
6962
if (!$this->find($this->searchInput)->isVisible()) {
7063
$this->find($this->searchIcon)->click();
7164
}
72-
$this->selectWindow();
73-
$this->clear();
74-
$this->find($this->searchInput)->setValue($value);
75-
$this->selectWindow();
76-
65+
$this->find($this->searchInput)->keys(str_split($value));
7766
$this->waitResult();
7867
}
7968

80-
/**
81-
* Clear value of element.
82-
*
83-
* @return void
84-
*/
85-
protected function clear()
86-
{
87-
$element = $this->find($this->searchInput);
88-
while ('' != $element->getValue()) {
89-
$element->setValue([self::BACKSPACE]);
90-
}
91-
}
92-
93-
/**
94-
* Select to last window.
95-
*
96-
* @return void
97-
*/
98-
protected function selectWindow()
99-
{
100-
$this->driver->selectWindow();
101-
}
102-
10369
/**
10470
* Wait init search suggest container.
10571
*
@@ -130,12 +96,7 @@ public function waitResult()
13096

13197
$this->driver->waitUntil(
13298
function () use ($browser, $selector) {
133-
if ($browser->find($selector)->isVisible()) {
134-
return true;
135-
} else {
136-
$browser->selectWindow();
137-
return null;
138-
}
99+
return $browser->find($selector)->isVisible() ? true : null;
139100
}
140101
);
141102
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Backend\Test\TestCase;
8+
9+
use Magento\Backend\Test\Fixture\GlobalSearch;
10+
use Magento\Backend\Test\Page\Adminhtml\Dashboard;
11+
use Magento\Mtf\TestCase\Injectable;
12+
13+
/**
14+
* Preconditions:
15+
* 1. Create customer
16+
* 2. Create two simple products
17+
* 3. Create order with one of created simple product
18+
*
19+
* Steps:
20+
* 1. Login to backend
21+
* 2. Click on Search button on the top of page
22+
* 3. Fill in data according dataSet
23+
* 4. Perform assertions
24+
*
25+
* @group Search_Core_(MX)
26+
* @ZephyrId MAGETWO-28457
27+
*/
28+
class GlobalSearchEntityTest extends Injectable
29+
{
30+
/* tags */
31+
const MVP = 'no';
32+
const DOMAIN = 'MX';
33+
/* end tags */
34+
35+
/**
36+
* Backend Dashboard page.
37+
*
38+
* @var Dashboard
39+
*/
40+
protected $dashboard;
41+
42+
/**
43+
* Preparing pages for test.
44+
*
45+
* @param Dashboard $dashboard
46+
* @return void
47+
*/
48+
public function __inject(Dashboard $dashboard)
49+
{
50+
$this->dashboard = $dashboard;
51+
}
52+
53+
/**
54+
* Run Global Search Entity Test.
55+
*
56+
* @param GlobalSearch $search
57+
* @return void
58+
*/
59+
public function test(GlobalSearch $search)
60+
{
61+
//Steps:
62+
$this->dashboard->open();
63+
$this->dashboard->getAdminPanelHeader()->search($search->getQuery());
64+
}
65+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. 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/variations.xsd">
9+
<testCase name="Magento\Backend\Test\TestCase\GlobalSearchEntityTest">
10+
<variation name="GlobalSearchEntityTestVariation2">
11+
<data name="description" xsi:type="string">search with 2 sign return no results</data>
12+
<data name="search/data/query" xsi:type="string">:)</data>
13+
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchNoRecordsFound" />
14+
</variation>
15+
<variation name="GlobalSearchEntityTestVariation3">
16+
<data name="description" xsi:type="string">search product by sku</data>
17+
<data name="search/data/query" xsi:type="string">orderInjectable::default::product::sku</data>
18+
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchProductName" />
19+
</variation>
20+
<variation name="GlobalSearchEntityTestVariation4">
21+
<data name="description" xsi:type="string">search existed customer</data>
22+
<data name="search/data/query" xsi:type="string">customer::johndoe_unique::lastname</data>
23+
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchCustomerName" />
24+
</variation>
25+
<variation name="GlobalSearchEntityTestVariation5">
26+
<data name="description" xsi:type="string">search order (by order id)</data>
27+
<data name="search/data/query" xsi:type="string">orderInjectable::default::id</data>
28+
<constraint name="Magento\Backend\Test\Constraint\AssertGlobalSearchOrderId" />
29+
</variation>
30+
</testCase>
31+
</config>

dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/NavigateMenuTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Steps:
1414
* 1. Log in to backend.
1515
* 2. Navigate throught menu to the page.
16-
* 6. Perform asserts.
16+
* 3. Perform asserts.
1717
*
1818
* @ZephyrId MAGETWO-34874
1919
*/

0 commit comments

Comments
 (0)