How-to

URL assert (toHaveURL)

URL assert (toHaveURL)

Asserts the tab URL. Value is a path, a URL, or a /pattern/flags string (the worker compiles a regular expression). Otherwise the string goes to Playwright as a glob: a trailing ** glued to the last segment (listing**) does not match a URL that ends on that segment. A path-only assert does not see the host: the same path on the root and on a team subdomain is a different screen. No Target. INLINE only.

Step model

action_nametoHaveURL
GroupExpect
TargetUnused
ValueRequired (url)
expected_valueUnused
TEST_ACCOUNTForbidden
Do not confuse withwaitForURL, goto

Target/Value facts match the source-of-truth catalog and Autotest step.

Prerequisites

  1. Navigation already finished or will finish within the timeout.

Steps

  1. Add a toHaveURL step.
  2. Put the expected address or /pattern/flags in Value.
  3. Source must be INLINE.
  4. Save.

The step is stored on the autotest. Next - neighbouring steps or autotest run creation.

Examples

Exact path

Fields in the UI:

FieldValue
action_nametoHaveURL
Targetempty
Value**/settings/profile
value_source_typeINLINE

Step JSON fragment (copy-paste):

json
{
  "action_name": "toHaveURL",
  "value_text": "**/settings/profile",
  "value_source_type": "INLINE"
}

Regular expression

Fields in the UI:

FieldValue
action_nametoHaveURL
Targetempty
Value/\/projects\/\d+$/
value_source_typeINLINE

Step JSON fragment (copy-paste):

json
{
  "action_name": "toHaveURL",
  "value_text": "/\\/projects\\/\\d+$/",
  "value_source_type": "INLINE"
}

Common mistakes

  • Do not confuse with waitForURL: toHaveURL is an assert in the report.
  • Do not copy onto toHaveURL a glob with a trailing ** (**/web/ru/project/listing**) that worked on waitForURL. For the assert use /\/web\/ru\/project\/listing/ or a glob without the tail.
  • A path-only check can stay green on a 404 page on another host. Put the host in the pattern or keep a toBeVisible on unique screen text.
  • Breakdown: How to author autotest steps without false failures.

Screenshots

Screenshots of the step form for toHaveURL will be added here in a later pass.

Version 1.1.0 · Last updated 2026-09-14

Did this page help?