Appearance
TEST.log.fail()
Logs a failure message to the test report and fails the test run.
You can pass one or more arguments, and each argument will be automatically converted to a string and logged to the test report.
Usage
js
TEST.log.fail(message: string, ...args[]: any[])Parameters
| Parameter | Type | Description |
|---|---|---|
message | string | The message to log |
args | any[] | Additional values to log. |
Example
js
I.click("Add to cart")
var cart = UI.LocalStorage.get("cart")
if (cart && cart.items.length === 10) {
TEST.log.pass("Cart contains 10 items.")
} else {
TEST.log.fail("Cart does not contain 10 items.")
}In this example, the test explicitly fails if the cart does not contain the expected number of items.