Give a participant of the scenario's course a role there, the way a teacher does: the pencil of the "Roles" column of its row, the role chosen in the list, then "Save changes".
Examples
When I assign the role "Non-editing teacher" to "student" in the course
When we assign the role "Non-editing teacher" to "student" in the course
And I assign the role "Student" to "student2" in the course
Given I assign the role "Non-editing teacher" to "student" in the course
When we assign the role "Student" to "student" in the course
Pattern
When(/^(I |we )*assign the role "([^"]*)" to "([^"]*)" in the course$/, …)
Part of @webship-js/moodle-steps (github.com/webship/moodle-steps), a step pack for Webship-js 2.0.x.