This step asserts that the visible body text of the current page does not match a given regular expression pattern. It reads document.body.innerText, constructs a JavaScript RegExp from the supplied pattern, and fails immediately if a match is found. Like all negative assertion steps, it does not retry.
The pattern is treated as a standard JavaScript regular expression - case-sensitive by default. Use this step to confirm that admin-only UI strings, error indicators, or role-restricted text are completely absent from the page. Both I and we are accepted as the subject. For the positive regex match, see Then I should see text matching.
Accepted phrasings
Then I should not see text matching "pattern"
Then we should not see text matching "pattern"
And I should not see text matching "pattern"
And we should not see text matching "pattern"
Examples
Then I should not see text matching "^Ow+"
And I should not see text matching "Tasks"
And I should not see text matching "Delete"
And I should not see text matching "Manage display"
In a real scenario
Scenario: Check that a normal user does not see admin toolbar items on the homepage
Given I am a logged in user with the "Normal user" user
When I go to the homepage
And wait
Then I should see "Welcome"
And I should not see text matching "Tasks"
And I should not see text matching "Delete"
And I should not see text matching "Manage display"
And I should not see text matching "Revisions"