Closed dmitriim closed 3 years ago
Since this Scenario is testing the log out behaviour you should avoid using a step like “I log out” anyway. Where you are testing a specific behaviour you should avoid using custom steps to test that behaviour too much because they obscure failures and are prone to being rewritten as things which do not use the UI.
I’d also advise against writing a custom wrapper around the click handler - you should just be able to use:
When I click on “Log out” “link” in the “#page-footer” “css_element”
I need to double-check the exact usage (and possibly add an xpath selector for it) but this should really be in the “footer” “region”
too.
Also a word of warning: The step you have written is very generic in @Given
(should be a @When
technically) - steps are shared by all uses in Moodle. If someone else writes a step like this (or you do in another plugin) then both will match.
There’s also no need for the pending_js check - that’s built in to all steps in the Moodle behat extension.
thanks @andrewnicols Good point. I'll update my patch.
thanks @andrewnicols !
As part of https://tracker.moodle.org/browse/MDL-72173 log out step was changed in https://github.com/moodle/moodle/blob/master/auth/tests/behat/behat_auth.php#L74
This causes following tests to fail: