Find directly the label instead of falling back to it
The input element is always hidden, so the check always ended falling back to the label. Moreover, the label is the element that the user interacts with, so it must be the one used. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
7b6946d2d2
commit
ee1f8104a0
|
@ -81,14 +81,7 @@ class AppSettingsContext implements Context, ActorAwareInterface {
|
||||||
* @Given I toggle the :id checkbox in the settings
|
* @Given I toggle the :id checkbox in the settings
|
||||||
*/
|
*/
|
||||||
public function iToggleTheCheckboxInTheSettingsTo($id) {
|
public function iToggleTheCheckboxInTheSettingsTo($id) {
|
||||||
$locator = self::CheckboxInTheSettings($id);
|
$this->actor->find(self::checkboxLabelInTheSettings($id), 10)->click();
|
||||||
|
|
||||||
// If locator is not visible, fallback to label
|
|
||||||
if (!$this->actor->find(self::CheckboxInTheSettings($id), 10)->isVisible()) {
|
|
||||||
$locator = self::checkboxLabelInTheSettings($id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->actor->find($locator, 10)->click();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue