General developer forum

How do I get a full Behat match instead of a partial

 
Tim at Lone Pine Koala Sanctuary
Re: How do I get a full Behat match instead of a partial
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Well, sometimes, if you have difficulty getting Behat to do what you want, it is a sign that you have an accessibility problem. If all you can see (or hear) are three choices: "Edit cohort name", "Edit cohort ID" and "Edit", because you cannot see the shape of the icon, do you have any idea what 'Edit' is going to do? Perhaps the best option is to use a better alt text on the icon, or add some class="accesshide" text to disambiguate.

Incidentally, I assume that at the moment, if you have multiple cohorts on the same page, the links to edit each cohort will be identical. That is also not great accessibility, although you found a way around that in Behat.

The other part of the answer is that you can teach Behat to be cleverer. For buttons, at least, it does prefer an exact match (since Behat 3.x which we have been using for ages). See MDL-44584 for some history. Perhaps a similar change should be implemented in the 'icon' selector? Also, not that "link" can often be used instead of "icon", and that probably gets the 'prefer exact match' logic right.

 
Average of ratings: -
Picture of Mike Churchward
Re: How do I get a full Behat match instead of a partial
Core developersParticularly helpful MoodlersPlugin developersPlugins guardiansTesters

Hi Tim -

I agree with the accessibility issue. Unfortunately the issue is in core code. I could figure out what needs to be changed and propose it, but it won't help in the short run.

I'll check that issue to see if it reveals any solutions. In this case, both "link" and "icon" seem to be interchangeable, and have the same problems.

Mike

 
Average of ratings: -