bl expect
Assert page state; exits 0 on pass, 1 on failure
Assert page state; exits 0 on pass, 1 on failure
Usage
bl expect [OPTIONS]
bl expect <command>Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
bl expect url
Assert the current page URL
Usage
bl expect url <operator> <text> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<operator> | Comparison: contains (substring) or equals (exact match) |
<text> | Expected URL or URL substring |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect url contains "/dashboard"
# Pass if the URL contains /dashboard
bl expect url equals "https://example.com/"
# Pass if the URL matches exactlybl expect title
Assert the current page title
Usage
bl expect title <operator> <text> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<operator> | Comparison: contains (substring) or equals (exact match) |
<text> | Expected title or title substring |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect title contains "Dashboard"
# Pass if the title contains Dashboardbl expect text
Assert the text content of the page or an element
Usage
bl expect text <operator> <text> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<operator> | Comparison: contains (substring) or equals (exact match) |
<text> | Expected text or text substring |
Options
| Option | Description |
|---|---|
--selector <value> | CSS selector to scope the check to one element (defaults to full page text) |
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect text contains "Welcome back"
# Pass if the page text contains it
bl expect text equals "Logout" --selector "#nav button"
# Pass if the element's text matches exactlybl expect visible
Assert an element is visible
Usage
bl expect visible <selector> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector of the element |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect visible "#save"
# Pass if the element is visiblebl expect hidden
Assert an element is absent or not visible
Usage
bl expect hidden <selector> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector of the element |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect hidden ".spinner"
# Pass if the element is missing or not visiblebl expect enabled
Assert an element is enabled
Usage
bl expect enabled <selector> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector of the element |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect enabled "button[type=submit]"
# Pass if the button is enabledbl expect checked
Assert a checkbox or radio is checked (or unchecked with --not)
Usage
bl expect checked <selector> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector of the checkbox or radio |
Options
| Option | Description |
|---|---|
--not | Assert the element is NOT checked |
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect checked "#terms"
# Pass if the box is checked
bl expect checked "#terms" --not
# Pass if the box is uncheckedbl expect value
Assert the value of a form element
Usage
bl expect value <selector> <operator> <text> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector of the form element |
<operator> | Comparison: contains (substring) or equals (exact match) |
<text> | Expected value or value substring |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect value "input[name=email]" equals "a@b.com"
# Pass if the input holds exactly that valuebl expect count
Assert the number of elements matching a selector
Usage
bl expect count <selector> <number> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<selector> | CSS selector to count matches for |
<number> | Expected number of matches |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect count "li.item" 3
# Pass if exactly 3 items matchbl expect js
Assert a JavaScript expression evaluates truthy
Usage
bl expect js <expression> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<expression> | JS expression; false, null, empty string, and 0 fail |
Options
| Option | Description |
|---|---|
--headless | Hide browser window (visible by default) |
--json | Output as JSON |
Global options
| Option | Description |
|---|---|
-v, --verbose | Enable debug logging |
Examples
bl expect js "document.querySelectorAll('.error').length === 0"
# Pass if no error elements are on the page