Assert that specific text does not appear during your automated test
In a full end-to-end test you often need to confirm that something shouldn’t be there just as much as confirming that something should be. The Check Text Not Contain pattern lets your test assert that particular text is not present on the page at that moment.
This is useful when you want to verify that:
Error messages do not appear incorrectly
Unwanted content isn’t visible
Sensitive or deprecated text isn’t shown
Previous state has been cleared
Conditional content stays hidden
By asserting text absence, you improve confidence that the application is not showing something unexpected.
How it works
The underlying mechanism is the same as the regular Check Text step, but with the logic inverted:
The test targets an element or the entire page
It looks for the specified text string
It passes if the text is not found
It fails only if the text is present
This lets your automation confirm negative conditions in a clear and readable way.
Common use cases
Negative text assertions are commonly used when:
Confirming that error messaging is cleared after fixes
Ensuring that a feature flag does not expose experimental text
Validating that admin-only options don’t appear for regular users
Verifying that deprecated UI instructions have been removed
Checking that a “Loading…” message disappears once content loads
These kinds of negative checks help catch unintended states that functional asserts might miss.
Combine with other steps
Negative text checks are especially powerful when used with other assertions and actions:
Touch an element to trigger a change
Wait for element to synchronise timing
Check Text Not Contain to ensure unwanted text is gone
Check Text to confirm expected content
Check Title to validate navigation context
This gives you rich, expressive tests that validate both presence and absence of UI signals.
Improve clarity and maintainability
Because Check Text Not Contain spells out exactly what should not be there, it makes your test intent clearer to anyone reading the flow. Instead of requiring complex logic or indirect workarounds, this step lets you state the negative expectation explicitly.
This improves:
Test readability
Clarity of intent
Maintenance over time
Diagnostic feedback when failures occur
Validating absence is a first-class check in modern automated testing. Including it ensures that your flows not only confirm what should happen, but also what should never happen.