Affects Version/s: 3.5.7, 3.6.5, 3.7.1, 3.8
Component/s: Automated functional tests (behat)
- Existing CI tests pass
- New CI tests pass
Affected Branches:MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
Fixed Branches:MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
Pull from Repository:
Pull 3.5 Branch:
Pull 3.5 Diff URL:
Pull Master Branch:
Pull Master Diff URL:
In some situations we will have fields which have the same name, in different sections of the form.
This will happen for repeated elements, as well as where we have multiple grading forms on a page.
It's pretty natural to use the labelled fieldset to distinguish between the different but similar fields on the form. We should support that.
There are several ways in which we can already do so:
However, it's not currently possible to interact with them using form steps in a meaningful way.
I'm proposing the following new format, which will work in all situations:
In order to do so it seems that we need to simplify the way in which we normalise selectors.
Right now it happens in two places:
- In some cases we call behat_selectors::get_behat_selector; and
- In other cases the find_all function did some of the same things.
So to solve this I have moved the normalisation of behat selectors to behat_base::normalise_selector() which takes the same arguments as get_behat_selector but also takes the $container and returns an associative array containing the combined container, and normalised selector and normalised locator. I've updated everywhere to use this normalisation.
This means that, going forward, the following exciting things are possible:
- I can select fields via their fieldset anywhere that I can specify a standard selector pair (selector + type)
- Any other type can do similar magic - i.e. we could define exactly the same kind of logic for a new "breadcrumb" type where it recursively finds the container depending on how many times the ">" character is used
It may also have additional uses in the future - I'm thinking for things like
MDL-66335 and similar.