7.4The steps you can use
obsrvly runs the steps from top to bottom. It stops at the first step that fails. A selector is a short text that points to one element on the page, such as a button (see 7.5).
| Step | Fields | What it does |
|---|---|---|
goto | url | Opens the page and waits until it has finished loading. Only http:// and https:// addresses work. |
click | selector | Waits for the element, then clicks it. |
fill | selector, value | Types the value into a field. It replaces what is already there. The value can be a team secret (see 7.8). |
wait_for | selector | Waits until the element is on the page and visible. |
assert_visible | selector | Checks that the element is visible. It waits for it, and fails if it does not appear in time. |
assert_text | selector, contains | Checks the text of an element. It reads the text of the first matching element. Passes if it contains the expected text. Capital letters must match. |
In the dashboard, pick the step from the list on each row. The list shows the names in the first column, such as wait_for and assert_text. Each row then asks for its fields:
goto: url.click,wait_for,assert_visible: selector.fill: selector and a value. If your team has secrets, a secret… list appears next to the value.assert_text: selector and the expected text.
Through the API, the steps are a JSON list. Each step has a kind and its fields, as in 7.6. Every step except goto can also take timeout_ms (see 7.7).
When a step fails#
These messages name the step, counting from 0 (see 7.9).
| Message | What it means |
|---|---|
text "Welcome back" does not contain "Dashboard" | assert_text found the element, but its text is different. The message shows up to 80 characters of what it found. |
| The step's error says it timed out | The element did not appear in time. Check the selector (7.5) and the timeouts (7.7). |
page answered 500 | A page the script opened answered with an error status. Check your site. |
status 503 | The first page opened answered with an error status (400 or higher). Check your site. |
after the last step: page answered 500 | The page answered with an error after the last step ended. |
only http and https URLs are allowed, got ftp: | A goto step uses another kind of address. |
not a valid URL: <url> | A goto step has an address that is not complete. |
If the script itself has a mistake, the check fails before any step runs. The message starts with script parse:. For example:
script parse: step 0 (goto): missing urlscript parse: step 1 (click): missing selectorscript parse: step 2 (fill): selector and value requiredscript parse: step 3 (assert_text): selector and contains requiredscript parse: step 4: unknown kind "hover"script parse: script must be a JSON array
Page checks after the last step (API only)#
Through the API, you can add page checks in assertions. obsrvly runs them after the last step. Browser monitors accept only these four types (see chapter 4):
| Type | What it checks | Message when it fails |
|---|---|---|
status_code | The status of the first page opened. Use eq, neq, gt or lt (as in chapter 4). | assertion status_code == 200: got 503 |
body | The visible text of the last page. Use eq, neq, contains or matches (a regular expression). | assertion body contains "Welcome" failed |
response_time_ms | The time the whole script took. Use eq, neq, gt or lt. | assertion response_time_ms < 5000: got 6120 |
no_console_errors | Fails if the page logged any error in the browser console. It needs no op or value. | 2 console error(s): <the first error> |
Any other type is refused when you save, for example assertions[0]: type "header" is not one of status_code, body, response_time_ms, no_console_errors.
If you add a status_code check, it decides whether the first page's status is good. Without one, a first page that answers with 400 or higher makes the check down.