When I set the wikitext to:

Replace the wikitext in the source editor.

Examples

When I set the wikitext to:
And I set the wikitext to:
When we set the wikitext to:
Then I set the wikitext to:
When I set the wikitext to:

Pattern

When(/^(I |we )*set the wikitext to:$/, …)

Part of @webship-js/mediawiki-steps (github.com/webship/mediawiki-steps), a step pack for Webship-js 2.0.x.