Commit 95ef2429 authored by Robert Lyon's avatar Robert Lyon
Browse files

More fixes for @failed - getting the select2 ajax to run



Change-Id: I7ac36462c4695ba8bbcca6209c6808a1e69e82be
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent d3832ab0
......@@ -153,17 +153,11 @@ class BehatForms extends BehatBase {
*/
private function select2FillSearchField($page, $field, $value) {
$driver = $this->getSession()->getDriver();
if ('MaharaSelenium2Driver' === get_class($driver)) {
// Can't use $this->getSession()->getPage()->find() because of https://github.com/minkphp/MinkSelenium2Driver/issues/188
$select2Input = $this->getSession()->getDriver()->getWebDriverSession()->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]");
if (!$select2Input) {
throw new \Exception(sprintf('No field "%s" found', $field));
}
$select2Input->postValue(['value' => [$value]]);
}
else {
throw new \Exception(sprintf('Not able to select via ajax. Need MaharaSelenium2Driver'));
$select2Input = $this->getSession()->getDriver()->getWebDriverSession()->element('xpath', "//html/descendant-or-self::*[@class and contains(concat(' ', normalize-space(@class), ' '), ' select2-search__field ')]");
if (!$select2Input) {
throw new \Exception(sprintf('No field "%s" found', $field));
}
$select2Input->postValue(['value' => [$value]]);
$this->getSession()->wait(10000, "(jQuery('#select2-{$field}-results .loading-results').length === 0)");
}
/**
......
@javascript @core_messages
@javascript @core @core_messages
Feature: Select2 ajax test using sendmessage
In order to retrieve data via ajax and select it
As an admin I need to fill in a select2 box
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment