Skip to content

Commit

Permalink
Merge branch 'wip-mdl-58056' of https://github.com/rajeshtaneja/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Mar 7, 2017
2 parents 58798ec + acdda4f commit 7ebe17f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/tests/behat/behat_forms.php
Expand Up @@ -241,8 +241,9 @@ public function i_set_the_field_to_multiline($field, PyStringNode $value) {
* @return void
*/
public function i_set_the_field_with_xpath_to($fieldxpath, $value) {
$fieldNode = $this->find('xpath', $fieldxpath);
$field = behat_field_manager::get_form_field($fieldNode, $this->getSession());
$fieldnode = $this->find('xpath', $fieldxpath);
$this->ensure_node_is_visible($fieldnode);
$field = behat_field_manager::get_form_field($fieldnode, $this->getSession());
$field->set_value($value);
}

Expand Down
13 changes: 10 additions & 3 deletions lib/tests/behat/behat_general.php
Expand Up @@ -624,8 +624,16 @@ public function assert_page_not_contains_text($text) {
function($context, $args) {

foreach ($args['nodes'] as $node) {
if ($node->isVisible()) {
throw new ExpectationException('"' . $args['text'] . '" text was found in the page', $context->getSession());
// If element is removed from dom, then just exit.
try {
// If element is visible then throw exception, so we keep spinning.
if ($node->isVisible()) {
throw new ExpectationException('"' . $args['text'] . '" text was found in the page',
$context->getSession());
}
} catch (WebDriver\Exception\NoSuchElement $e) {
// Do nothing just return, as element is no more on page.
return true;
}
}

Expand All @@ -637,7 +645,6 @@ function($context, $args) {
false,
true
);

}

/**
Expand Down

0 comments on commit 7ebe17f

Please sign in to comment.