Appearance
I.seeAlert()
Asserts that the native browser alert is currently open, and optionally checks the alert text.
If no alert is open, the command fails.
If message is provided and the alert message does not match the expected text, the command fails.
Usage
js
// check alert is shown
I.seeAlert()
// check alert is shown with a specific message
I.seeAlert(message: string)| Parameter | Type | Description |
|---|---|---|
message | string | (optional) Expected alert message. |
Example
Check that an alert appears
js
// open alert
UI.execute("alert('hello world')")
// check that alert is open
I.seeAlert()This checks that the browser alert is open.
Check alert text
js
// open alert
UI.execute("alert('hello world')")
// check that alert is open with "hello world" message
I.seeAlert("hello world")This checks that the browser alert is open with the text "hello world".