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:
Daniel Calviño Sánchez 2021-03-05 22:02:46 +01:00
parent 7b6946d2d2
commit ee1f8104a0
1 changed files with 1 additions and 8 deletions

View File

@ -81,14 +81,7 @@ class AppSettingsContext implements Context, ActorAwareInterface {
* @Given I toggle the :id checkbox in the settings
*/
public function iToggleTheCheckboxInTheSettingsTo($id) {
$locator = self::CheckboxInTheSettings($id);
// 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();
$this->actor->find(self::checkboxLabelInTheSettings($id), 10)->click();
}
/**