Leave a course the account in the browser enrolled itself in, the way a student does: the "More" menu of the course, "Unenrol me from this course", then "Continue".
Examples
When I unenrol myself from the course "Software Testing 101"
But I unenrol myself from the course "Software Testing 101"
And I unenrol myself from the course "TEST101"
Then I unenrol myself from the course "Software Testing 101"
Given I unenrol myself from the course "TEST101"
Pattern
When(/^I unenrol myself from the course "([^"]*)"$/, …)
Part of @webship-js/moodle-steps (github.com/webship/moodle-steps), a step pack for Webship-js 2.0.x.