Then I should see "text in the page"

This step asserts that a given string of text is present anywhere in the <body> of the current page. It uses Playwright's filter({ hasText }) with a five-second auto-wait, so it will retry until the text appears or the timeout expires. This makes it suitable for pages where content loads asynchronously after navigation.

The match is a plain substring check - it is case-sensitive and looks for an exact sequence of characters anywhere in the visible body text. Both I and we are accepted as the subject, and the step can be introduced with Then, And, or But. If you need to assert text is absent, use the companion step Then I should not see instead.

Accepted phrasings

Then I should see "text"
Then we should see "text"
And I should see "text"
And we should see "text"

Examples

Then I should see "Welcome"
Then we should see "Your accounts for the group is public"
And I should see "Dashboard"
And I should see "Log in"

In a real scenario

Scenario: Check that the admin dashboard is accessible after login
  Given I am a logged in user with the "webmaster" user
   When I go to "/admin/dashboard"
    And wait
   Then I should see "Dashboard"
    And I should see "Recent pages"
    And I should see "Recent content"

Related steps

Back to Assertion Steps