Skip to content

Assertion Steps

Source: src/tests/steps/validations/*.step.ts.

See shared placeholder rules in Step Parameter Conventions.

Signature: the element {string} should {boolean} contain the text {string}

What it does:

  • Resolves locator.
  • Reads textContent().
  • Asserts contains or does-not-contain based on boolean flag.

Parameters:

ParameterRepresentsExpected data
First {string}Element locator nameExisting locator key (for example toastMessage).
{boolean}Positive or negative assertiontrue for must contain, false for must not contain.
Second {string}Target textExpected literal/partial text value.

Example:

Then the element "toastMessage" should true contain the text "Saved successfully"

Signature: the element {string} should {boolean} equal the text {string}

What it does:

  • Resolves locator.
  • Reads textContent().
  • Asserts exact equality or inequality based on boolean flag.

Parameters:

ParameterRepresentsExpected data
First {string}Element locator nameExisting locator key (for example pageTitle).
{boolean}Positive or negative assertiontrue for must equal, false for must not equal.
Second {string}Expected exact textExact value expected in element.

Example:

Then the element "pageTitle" should true equal the text "Dashboard"

Signature: the visibility status of the {string} element should be {boolean}

What it does:

  • Resolves locator.
  • Uses Playwright visibility check.
  • Asserts visible/non-visible state.

Parameters:

ParameterRepresentsExpected data
{string}Element locator nameExisting locator key.
{boolean}Expected visibilitytrue for visible, false for hidden/not visible.

Example:

Then the visibility status of the "successBanner" element should be true

Signature: the element {string} should have active status {boolean}

What it does:

  • Resolves locator.
  • Uses Playwright enabled-state check.
  • Asserts enabled/disabled expectation.

Parameters:

ParameterRepresentsExpected data
{string}Element locator nameExisting locator key.
{boolean}Expected active statetrue for active/enabled, false for not active/disabled.

Example:

Then the element "submitButton" should have active status true

Signature: the url route should be equal to {string}

What it does:

  • Waits for network idle.
  • Extracts current pathname from URL.
  • Compares pathname to expected route.

Parameters:

ParameterRepresentsExpected data
{string}Expected pathnameRoute path (for example /dashboard).

Example:

Then the url route should be equal to "/dashboard"

The signature below exists but is currently stubbed (no implementation body):

  • the element {string} should contain the text inside the stored variable {string}