mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-39638_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
388b7d7d98
6 changed files with 41 additions and 9 deletions
|
@ -14,7 +14,7 @@ Feature: Upload users
|
|||
| Section 1 | math102 | S1 |
|
||||
| Section 3 | math102 | S3 |
|
||||
And I log in as "admin"
|
||||
And I expand "Front page settings" node
|
||||
And I collapse "Front page settings" node
|
||||
And I expand "Site administration" node
|
||||
And I expand "Users" node
|
||||
And I expand "Accounts" node
|
||||
|
|
|
@ -12,7 +12,7 @@ Feature: Add cohorts of users
|
|||
| user3 | Third | User | third@user.com |
|
||||
| user4 | Forth | User | forth@user.com |
|
||||
And I log in as "admin"
|
||||
And I expand "Front page settings" node
|
||||
And I collapse "Front page settings" node
|
||||
And I expand "Site administration" node
|
||||
And I expand "Users" node
|
||||
And I expand "Accounts" node
|
||||
|
|
|
@ -65,7 +65,7 @@ class behat_cohort extends behat_base {
|
|||
$steps = array_merge(
|
||||
array(
|
||||
new Given('I am on homepage'),
|
||||
new Given('I expand "Front page settings" node'),
|
||||
new Given('I collapse "Front page settings" node'),
|
||||
new Given('I expand "Site administration" node'),
|
||||
new Given('I expand "Users" node'),
|
||||
new Given('I expand "Accounts" node'),
|
||||
|
|
|
@ -22,7 +22,7 @@ Feature: Upload users to a cohort
|
|||
And I follow "Course 2"
|
||||
And I add "Cohort sync" enrolment method with:
|
||||
| Cohort | Cohort 2 |
|
||||
And I expand "Course administration" node
|
||||
And I collapse "Course administration" node
|
||||
And I expand "Site administration" node
|
||||
And I expand "Users" node
|
||||
And I expand "Accounts" node
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
require_once(__DIR__ . '/../../behat/behat_base.php');
|
||||
|
||||
use Behat\Behat\Context\Step\Given as Given,
|
||||
Behat\Mink\Exception\ExpectationException as ExpectationException;
|
||||
|
||||
/**
|
||||
* Steps definitions to navigate through the navigation tree nodes.
|
||||
*
|
||||
|
@ -41,7 +44,7 @@ class behat_navigation extends behat_base {
|
|||
* Expands the selected node of the navigation tree that matches the text.
|
||||
* @Given /^I expand "(?P<nodetext_string>(?:[^"]|\\")*)" node$/
|
||||
*
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @throws ExpectationException
|
||||
* @param string $nodetext
|
||||
*/
|
||||
public function i_expand_node($nodetext) {
|
||||
|
@ -54,18 +57,47 @@ class behat_navigation extends behat_base {
|
|||
}
|
||||
|
||||
$xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
|
||||
"/child::li" .
|
||||
"/child::li[contains(concat(' ', normalize-space(@class), ' '), ' collapsed ')]" .
|
||||
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
|
||||
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]" .
|
||||
"|" .
|
||||
"//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
|
||||
"/descendant::li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed'))]" .
|
||||
"/descendant::li" .
|
||||
"/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' collapsed')]" .
|
||||
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
|
||||
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]";
|
||||
|
||||
$node = $this->find('xpath', $xpath);
|
||||
$exception = new ExpectationException('The "' . $nodetext . '" node can not be expanded', $this->getSession());
|
||||
$node = $this->find('xpath', $xpath, $exception);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapses the selected node of the navigation tree that matches the text.
|
||||
*
|
||||
* @Given /^I collapse "(?P<nodetext_string>(?:[^"]|\\")*)" node$/
|
||||
* @throws ExpectationException
|
||||
* @param string $nodetext
|
||||
*/
|
||||
public function i_collapse_node($nodetext) {
|
||||
|
||||
// No collapsible nodes with non-JS browsers.
|
||||
if (!$this->running_javascript()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$xpath = "//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
|
||||
"/child::li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed '))]" .
|
||||
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
|
||||
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]" .
|
||||
"|" .
|
||||
"//ul[contains(concat(' ', normalize-space(@class), ' '), ' block_tree ')]" .
|
||||
"/descendant::li[not(contains(concat(' ', normalize-space(@class), ' '), ' collapsed'))]" .
|
||||
"/child::p[contains(concat(' ', normalize-space(@class), ' '), ' branch')]" .
|
||||
"/child::span[contains(concat(' ', normalize-space(.), ' '), '" . $nodetext . "')]";
|
||||
|
||||
$exception = new ExpectationException('The "' . $nodetext . '" node can not be collapsed', $this->getSession());
|
||||
$node = $this->find('xpath', $xpath, $exception);
|
||||
$node->click();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class behat_permissions extends behat_base {
|
|||
|
||||
return array(
|
||||
new Given('I am on homepage'),
|
||||
new Given('I expand "Front page settings" node'),
|
||||
new Given('I collapse "Front page settings" node'),
|
||||
new Given('I expand "Site administration" node'),
|
||||
new Given('I expand "Users" node'),
|
||||
new Given('I expand "Permissions" node'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue