Merge branch 'MDL-59883-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2017-10-03 20:58:23 +02:00
3 changed files with 25 additions and 5 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ Feature: Perform basic calendar functionality
And I follow "This month"
And I click on "Really awesome event!" "link"
And "Course 1" "link" should exist in the "Really awesome event!" "dialogue"
And I click on ".close" "css_element" in the "Really awesome event!" "dialogue"
And I click on "Close" "button"
And I log out
And I log in as "student2"
And I follow "This month"
+23 -3
View File
@@ -45,13 +45,17 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
$this->registerNamedXpath($name, $xpath);
}
foreach (self::$customreplacements as $from => $tos) {
$this->registerReplacement($from, implode(' or ', $tos));
}
$this->registerReplacement('%iconMatch%', "(contains(concat(' ', @class, ' '), ' icon ') or name() = 'img')");
$this->registerReplacement('%imgAltMatch%', './/*[%iconMatch% and (%altMatch% or %titleMatch%)]');
parent::__construct();
}
/**
* @var Allowed types when using text selectors arguments.
* @var array Allowed types when using text selectors arguments.
*/
protected static $allowedtextselectors = array(
'activity' => 'activity',
@@ -73,7 +77,7 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
);
/**
* @var Allowed types when using selector arguments.
* @var array Allowed types when using selector arguments.
*/
protected static $allowedselectors = array(
'activity' => 'activity',
@@ -113,7 +117,7 @@ class behat_partial_named_selector extends \Behat\Mink\Selector\PartialNamedSele
* xpaths that represents that names and includes a placeholder that
* will be replaced by the locator. These are Moodle's own xpaths.
*
* @var XPaths for moodle elements.
* @var array XPaths for moodle elements.
*/
protected static $moodleselectors = array(
'activity' => <<<XPATH
@@ -203,6 +207,22 @@ XPATH
],
];
/**
* Mink comes with a number of named replacements.
* Sometimes we want to add our own.
*
* @var array XPaths for moodle elements.
*/
protected static $customreplacements = [
'%buttonMatch%' => [
'upstream' => '%idOrNameMatch% or %valueMatch% or %titleMatch%',
'aria' => '%ariaLabelMatch%',
],
'%ariaLabelMatch%' => [
'moodle' => 'contains(./@aria-label, %locator%)',
],
];
/**
* Allowed selectors getter.
*
@@ -23,7 +23,7 @@ Feature: A selected file can be cancelled
And I click on "Recent files" "link" in the ".fp-repo-area" "css_element"
And I click on "//a[contains(concat(' ', normalize-space(@class), ' '), ' fp-file ')][normalize-space(.)='empty.txt']" "xpath_element"
And I click on ".moodle-dialogue-focused .fp-select .fp-select-cancel" "css_element"
And I click on ".moodle-dialogue-focused.filepicker .yui3-button.closebutton" "css_element"
And I click on "Close" "button" in the "File picker" "dialogue"
And I press "Save and display"
Then I should see "upload_users.csv"
And I should not see "empty.txt"