forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'qmt/develop' into develop
- Loading branch information
Showing
911 changed files
with
5,945 additions
and
5,657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
db_credentials: | ||
dbHost: {{db_host}} | ||
dbUser: {{db_user}} | ||
dbPassword: {{db_password}} | ||
dbName: {{db_name}} | ||
url: | ||
base_url: {{url}} | ||
backend_frontname: backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
{ | ||
"require": { | ||
"magento/mtf": "dev-master", | ||
"magento/mtf": "dev-develop", | ||
"php": ">=5.4.0", | ||
"phpunit/phpunit": "4.1.0", | ||
"phpunit/phpunit-selenium": ">=1.2", | ||
"netwing/selenium-server-standalone": ">=2.35" | ||
}, | ||
"autoload": { | ||
"psr-0": { | ||
"Mtf\\": "lib", | ||
"Magento\\": "", | ||
"": ["testsuites", "generated", "lib", "tests/app"] | ||
"psr-4": { | ||
"Mtf\\": ["lib/Mtf/", "generated/Mtf/", "testsuites/Mtf/"], | ||
"Magento\\": ["generated/Magento/", "tests/app/Magento/"], | ||
"Test\\": "generated/Test/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
db_credentials: | ||
dbHost: '127.0.0.1' | ||
dbUser: 'root' | ||
dbPassword: '123123q' | ||
dbName: 'default' | ||
url: | ||
base_url: 'http://127.0.0.1/magento2/' | ||
backend_frontname: 'backend' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 192 additions & 0 deletions
192
dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/GlobalsearchElement.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) | ||
*/ | ||
|
||
namespace Mtf\Client\Driver\Selenium\Element; | ||
|
||
use Mtf\Client\Element\Locator; | ||
use Mtf\Client\Driver\Selenium\Element; | ||
|
||
/** | ||
* Typified element class for global search element. | ||
*/ | ||
class GlobalsearchElement extends Element | ||
{ | ||
/** | ||
* Search icon selector. | ||
* | ||
* @var string | ||
*/ | ||
protected $searchIcon = '[for="search-global"]'; | ||
|
||
/** | ||
* Locator for initialized suggest container. | ||
* | ||
* @var string | ||
*/ | ||
protected $initializedSuggest = './/*[contains(@class,"search-global-field") and .//*[@class="mage-suggest"]]'; | ||
|
||
/** | ||
* Selector for search input element. | ||
* | ||
* @var string | ||
*/ | ||
protected $searchInput = '#search-global'; | ||
|
||
/** | ||
* Result dropdown selector. | ||
* | ||
* @var string | ||
*/ | ||
protected $searchResult = '.autocomplete-results'; | ||
|
||
/** | ||
* Item selector of search result. | ||
* | ||
* @var string | ||
*/ | ||
protected $resultItem = 'li'; | ||
|
||
/** | ||
* "Backspace" key code. | ||
*/ | ||
const BACKSPACE = "\xEE\x80\x83"; | ||
|
||
/** | ||
* Set value. | ||
* | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setValue($value) | ||
{ | ||
$this->_eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]); | ||
|
||
$this->waitInitElement(); | ||
|
||
if (!$this->find($this->searchInput)->isVisible()) { | ||
$this->find($this->searchIcon)->click(); | ||
} | ||
$this->selectWindow(); | ||
$this->clear(); | ||
$this->find($this->searchInput)->_getWrappedElement()->value($value); | ||
$this->selectWindow(); | ||
|
||
$this->waitResult(); | ||
} | ||
|
||
/** | ||
* Clear value of element. | ||
* | ||
* @return void | ||
*/ | ||
protected function clear() | ||
{ | ||
$element = $this->find($this->searchInput); | ||
while ('' != $element->getValue()) { | ||
$element->keys([self::BACKSPACE]); | ||
} | ||
} | ||
|
||
/** | ||
* Select to last window. | ||
* | ||
* @return void | ||
*/ | ||
protected function selectWindow() | ||
{ | ||
$windowHandles = $this->_driver->windowHandles(); | ||
$this->_driver->window(end($windowHandles)); | ||
} | ||
|
||
/** | ||
* Wait init search suggest container. | ||
* | ||
* @return void | ||
* @throws \Exception | ||
*/ | ||
protected function waitInitElement() | ||
{ | ||
$browser = clone $this; | ||
$selector = $this->initializedSuggest; | ||
|
||
$browser->waitUntil( | ||
function () use ($browser, $selector) { | ||
return $browser->find($selector, Locator::SELECTOR_XPATH)->isVisible() ? true : null; | ||
} | ||
); | ||
} | ||
|
||
/** | ||
* Wait for search result is visible. | ||
* | ||
* @return void | ||
*/ | ||
public function waitResult() | ||
{ | ||
$browser = clone $this; | ||
$selector = $this->searchResult; | ||
|
||
$browser->waitUntil( | ||
function () use ($browser, $selector) { | ||
if ($browser->find($selector)->isVisible()) { | ||
return true; | ||
} else { | ||
$browser->selectWindow(); | ||
return null; | ||
} | ||
} | ||
); | ||
} | ||
|
||
/** | ||
* Get value. | ||
* | ||
* @throws \BadMethodCallException | ||
*/ | ||
public function getValue() | ||
{ | ||
throw new \BadMethodCallException('Not applicable for this class of elements (GlobalSearch)'); | ||
} | ||
|
||
/** | ||
* Checking exist value in search result. | ||
* | ||
* @param string $value | ||
* @return bool | ||
*/ | ||
public function isExistValueInSearchResult($value) | ||
{ | ||
$searchResult = $this->find($this->searchResult); | ||
if (!$searchResult->isVisible()) { | ||
return false; | ||
} | ||
$searchResults = $this->getSearchResults(); | ||
return in_array($value, $searchResults); | ||
} | ||
|
||
/** | ||
* Get search results. | ||
* | ||
* @return array | ||
*/ | ||
protected function getSearchResults() | ||
{ | ||
/** @var Element $searchResult */ | ||
$searchResult = $this->find($this->searchResult); | ||
$resultItems = $searchResult->find($this->resultItem)->getElements(); | ||
$resultArray = []; | ||
|
||
/** @var Element $resultItem */ | ||
foreach ($resultItems as $resultItem) { | ||
$resultItemLink = $resultItem->find('a'); | ||
$resultText = $resultItemLink->isVisible() | ||
? trim($resultItemLink->getText()) | ||
: trim($resultItem->getText()); | ||
$resultArray[] = $resultText; | ||
} | ||
|
||
return $resultArray; | ||
} | ||
} |
Oops, something went wrong.