Skip to content

Commit

Permalink
MDL-67813 core: Add a manual 'enter' key press behat action step
Browse files Browse the repository at this point in the history
  • Loading branch information
vmdef authored and Mihail Geshoski committed May 28, 2020
1 parent 8bb55dd commit 7a82ee7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/tests/behat/behat_general.php
Original file line number Diff line number Diff line change
Expand Up @@ -1898,4 +1898,19 @@ public function i_should_see_occurrences_of_in_element($elementscount, $text, $e
$this->getSession());
}
}

/**
* Manually press enter key.
*
* @When /^I press enter/
* @throws DriverException
*/
public function i_manually_press_enter() {
if (!$this->running_javascript()) {
throw new DriverException('Enter press step is not available with Javascript disabled');
}

$value = [\WebDriver\Key::ENTER];
$this->getSession()->getDriver()->getWebDriverSession()->activeElement()->postValue(['value' => $value]);
}
}

0 comments on commit 7a82ee7

Please sign in to comment.