-
Improvement
-
Resolution: Fixed
-
Minor
-
3.8
-
MOODLE_38_STABLE
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
-
MDL-66559-master -
We have partial and exact named selectors in core.
These are defined in lib/behat/classes/*_named_selector.php and are essentially a mapping of human-readable things, to xpath replacements.
We use these quite a bit (as we should) to make things understandable.
For example, we have one to translate the "dialogue" xpath so that, instead of writing:
I click on "Cancel" "button' in the ".//div[contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue ') and
|
normalize-space(descendant::div[
|
contains(concat(' ', normalize-space(@class), ' '), ' moodle-dialogue-hd ')
|
]) = %locator%] |
|
.//div[contains(concat(' ', normalize-space(@class), ' '), ' yui-dialog ') and
|
normalize-space(descendant::div[@class='hd']) = %locator%]
|
|
|
.//div[@data-region='modal' and descendant::*[@data-region='title'] = %locator%]
|
|
|
.//div[
|
contains(concat(' ', normalize-space(@class), ' '), ' modal-content ')
|
and
|
normalize-space(descendant::*[self::h4 or self::h5][contains(concat(' ', normalize-space(@class), ' '), ' modal-title ')]) = %locator%
|
]
|
|
|
.//div[
|
contains(concat(' ', normalize-space(@class), ' '), ' modal ')
|
and
|
normalize-space(descendant::*[contains(concat(' ', normalize-space(@class), ' '), ' modal-header ')] = %locator%)
|
]
|
XPATH" "xpath_element"
|
We can instead write:
I click on "Cancel" "button' in the "Activity chooser" "dialogue"
|
We have several of these already, and we're beginning to see component-specific ones being introduced. For example, messaging introduced a number of selectors relating to group messaging.
I feel that we need to make it possible for components to do this.
This will allow much clearer steps and better re-use of existing step definitinos.
For example, it will be easy to write a named selector for "Discussion" and use all existing steps (And "Name your hobby" "mod_forum > Discussion" should exist")
- has a non-specific relationship to
-
MDL-48024 Plugins should be able to provide data generators for Behat
-
- Closed
-
-
MDL-66335 Behat: new steps to navigate directly to a pages for any plugin, possibly while logging in
-
- Closed
-
- is duplicated by
-
MDL-65600 Plugin should be able to define named selectors for Behat tests
-
- Closed
-