-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sergey Shvets
committed
Feb 28, 2017
1 parent
54c2a0e
commit 0137aaf
Showing
101 changed files
with
320 additions
and
37 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
dev/tests/functional/lib/Magento/Mtf/Client/Element/RadiobuttonElement.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,55 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Mtf\Client\Element; | ||
|
||
use Magento\Mtf\Client\Locator; | ||
|
||
/** | ||
* Class provides ability to work with page element radio button. | ||
*/ | ||
class RadiobuttonElement extends SimpleElement | ||
{ | ||
/** | ||
* Label for radio button selector. | ||
* | ||
* @var string | ||
*/ | ||
protected $labelSelector = './..//label[contains(., "%s")]'; | ||
|
||
/** | ||
* Selector for selected label. | ||
* | ||
* @var string | ||
*/ | ||
protected $selectedLabelSelector = 'input[type=radio]:checked + label'; | ||
|
||
/** | ||
* Get value of the required element. | ||
* | ||
* @return string | ||
*/ | ||
public function getValue() | ||
{ | ||
$this->eventManager->dispatchEvent(['get_value'], [$this->getAbsoluteSelector()]); | ||
return $this->find($this->selectedLabelSelector)->getText(); | ||
} | ||
|
||
/** | ||
* Select radio button based on label value. | ||
* | ||
* @param string $value | ||
* @return void | ||
*/ | ||
public function setValue($value) | ||
{ | ||
$this->eventManager->dispatchEvent(['set_value'], [__METHOD__, $this->getAbsoluteSelector()]); | ||
$radioButtonLabel = $this->find(sprintf($this->labelSelector, $value), Locator::SELECTOR_XPATH); | ||
if (!$this->isSelected()) { | ||
$radioButtonLabel->click(); | ||
} | ||
} | ||
} |
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
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
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
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
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
Oops, something went wrong.