mirror of
https://github.com/moodle/moodle.git
synced 2025-04-23 09:23:09 +02:00
Merge branch 'wip-mdl-57168' of https://github.com/rajeshtaneja/moodle
This commit is contained in:
commit
f59bab60c0
course/tests/behat
grade/tests/behat
lib/behat
theme/boost
@ -140,7 +140,7 @@ Feature: Test category management actions
|
||||
And I click on "Back to Category: Cat 1" "link"
|
||||
# Redirect
|
||||
And I should see the "Course categories and courses" management page
|
||||
And I should see "Cat 1" in the "#course-listing h3" "css_element"
|
||||
And I should see "Cat 1" in the "#course-listing" "css_element"
|
||||
|
||||
Scenario: Test clicking to manage cohorts for a category through the management interface.
|
||||
Given the following "categories" exist:
|
||||
|
@ -274,7 +274,7 @@ class behat_grade extends behat_base {
|
||||
|
||||
// If the first row of the grade-navigation tabs does not have $gradepath[0] as active tab, click on it.
|
||||
$link = '\'' . $this->escape($gradepath[0]) . '\'';
|
||||
$xpathrow1 = $xpath . '//ul[1]//*[contains(@class,\'active\') and text()=' . $link . ']';
|
||||
$xpathrow1 = $xpath . '//ul[1]//*[contains(@class,\'active\') and contains(normalize-space(.), ' . $link . ')]';
|
||||
if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow1)) {
|
||||
$this->find('xpath', $xpath . '//ul[1]/li/a[text()=' . $link . ']')->click();
|
||||
$this->wait_for_pending_js();
|
||||
@ -283,7 +283,7 @@ class behat_grade extends behat_base {
|
||||
if (isset($gradepath[1])) {
|
||||
// If the second row of the grade-navigation tabs does not have $gradepath[1] as active tab, click on it.
|
||||
$link = '\'' . $this->escape($gradepath[1]) . '\'';
|
||||
$xpathrow2 = $xpath . '//ul[2]//*[contains(@class,\'active\') and text()=' . $link . ']';
|
||||
$xpathrow2 = $xpath . '//ul[2]//*[contains(@class,\'active\') and contains(normalize-space(.), ' . $link . ')]';
|
||||
if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow2)) {
|
||||
$this->find('xpath', $xpath . '//ul[2]/li/a[text()=' . $link . ']')->click();
|
||||
$this->wait_for_pending_js();
|
||||
|
@ -573,6 +573,41 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the provided node has a attribute value set. This step can be used to check if specific
|
||||
* JS has finished modifying the node.
|
||||
*
|
||||
* @throws ExpectationException
|
||||
* @param NodeElement $node
|
||||
* @param string $attribute attribute name
|
||||
* @param string $attributevalue attribute value to check.
|
||||
* @return void Throws an exception if it times out without the element being visible
|
||||
*/
|
||||
protected function ensure_node_attribute_is_set($node, $attribute, $attributevalue) {
|
||||
|
||||
if (!$this->running_javascript()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Exception if it timesout and the element is still there.
|
||||
$msg = 'The "' . $node->getXPath() . '" xpath node is not visible and it should be visible';
|
||||
$exception = new ExpectationException($msg, $this->getSession());
|
||||
|
||||
// It will stop spinning once the $args[1]) == $args[2], and method returns true.
|
||||
$this->spin(
|
||||
function($context, $args) {
|
||||
if ($args[0]->getAttribute($args[1]) == $args[2]) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
array($node, $attribute, $attributevalue),
|
||||
self::EXTENDED_TIMEOUT,
|
||||
$exception,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the provided element is visible and we can interact with it.
|
||||
*
|
||||
|
@ -11,6 +11,19 @@ body.behat-site {
|
||||
.dropdown-item {
|
||||
margin-top: 4px !important; /* stylelint-disable declaration-no-important */
|
||||
}
|
||||
|
||||
// Remove following after MDL-57172 is fixed.
|
||||
&.drawer-ease {
|
||||
-webkit-transition: initial;
|
||||
-moz-transition: initial;
|
||||
transition: initial;
|
||||
}
|
||||
|
||||
[data-region="drawer"] {
|
||||
-webkit-transition: initial;
|
||||
-moz-transition: initial;
|
||||
transition: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.phpinfo table,
|
||||
|
@ -93,6 +93,7 @@ class behat_theme_boost_behat_navigation extends behat_navigation {
|
||||
$expanded = $node->getAttribute('aria-expanded');
|
||||
if ($expanded === 'false') {
|
||||
$node->click();
|
||||
$this->ensure_node_attribute_is_set($node, 'aria-expanded', 'true');
|
||||
$this->wait_for_pending_js();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user