assertFailure

suspend fun assertFailure(messageContains: String, block: suspend E2ETestScope.() -> Unit)

Asserts that executing block fails with an AssertionError containing messageContains.

Useful for testing negative scenarios or verifying custom validation errors.

Example Usage

assertFailure("Expected 'Submit' to be visible") {
click("Submit")
}

Parameters

messageContains

Substring expected in the thrown error message.

block

Test code block expected to fail.