Assertion Steps
Beginners: start with Viewing Reports or Creating Tests if you still need the workflow context first. This page is the exact assertion-step reference.
Source: src/tests/steps/validations/*.step.ts.
See shared placeholder rules in Step Parameter Conventions.
Prefer installing published steps with npx appraisejs@latest add step ...
instead of adding the package to your project with npm install.
Use this when
Section titled “Use this when”Use assertion steps when the scenario must validate page text, element state, or route state after an action.
Text assertion steps
Section titled “Text assertion steps”1. Contains text assertion
Section titled “1. Contains text assertion”Signature
Section titled “Signature”the element {string} should {boolean} contain the text {string}
Install with CLI
Section titled “Install with CLI”npx appraisejs@latest add step text-assertion/assert-element-contains-textWhat it does
Section titled “What it does”- Resolves locator.
- Reads
textContent(). - Asserts contains or does-not-contain based on boolean flag.
Parameters
Section titled “Parameters”| Parameter | Represents | Expected data |
|---|---|---|
First {string} | Element locator name | Existing locator key (for example toastMessage). |
{boolean} | Positive or negative assertion | true for must contain, false for must not contain. |
Second {string} | Target text | Expected literal/partial text value. |
Example
Section titled “Example”Then the element "toastMessage" should true contain the text "Saved successfully"2. Equals text assertion
Section titled “2. Equals text assertion”Signature
Section titled “Signature”the element {string} should {boolean} equal the text {string}
Install with CLI
Section titled “Install with CLI”npx appraisejs@latest add step text-assertion/assert-element-equals-textWhat it does
Section titled “What it does”- Resolves locator.
- Reads
textContent(). - Asserts exact equality or inequality based on boolean flag.
Parameters
Section titled “Parameters”| Parameter | Represents | Expected data |
|---|---|---|
First {string} | Element locator name | Existing locator key (for example pageTitle). |
{boolean} | Positive or negative assertion | true for must equal, false for must not equal. |
Second {string} | Expected exact text | Exact value expected in element. |
Example
Section titled “Example”Then the element "pageTitle" should true equal the text "Dashboard"State assertion steps
Section titled “State assertion steps”3. Visibility assertion
Section titled “3. Visibility assertion”Signature
Section titled “Signature”the visibility status of the {string} element should be {boolean}
Install with CLI
Section titled “Install with CLI”npx appraisejs@latest add step visibility-assertion/assert-element-visibleWhat it does
Section titled “What it does”- Resolves locator.
- Uses Playwright visibility check.
- Asserts visible/non-visible state.
Parameters
Section titled “Parameters”| Parameter | Represents | Expected data |
|---|---|---|
{string} | Element locator name | Existing locator key. |
{boolean} | Expected visibility | true for visible, false for hidden/not visible. |
Example
Section titled “Example”Then the visibility status of the "successBanner" element should be true4. Active/enabled assertion
Section titled “4. Active/enabled assertion”Signature
Section titled “Signature”the element {string} should have active status {boolean}
Install with CLI
Section titled “Install with CLI”npx appraisejs@latest add step active-state-assertion/assert-element-activeWhat it does
Section titled “What it does”- Resolves locator.
- Uses Playwright enabled-state check.
- Asserts enabled/disabled expectation.
Parameters
Section titled “Parameters”| Parameter | Represents | Expected data |
|---|---|---|
{string} | Element locator name | Existing locator key. |
{boolean} | Expected active state | true for active/enabled, false for not active/disabled. |
Example
Section titled “Example”Then the element "submitButton" should have active status true5. URL route equality assertion
Section titled “5. URL route equality assertion”Signature
Section titled “Signature”the url route should be equal to {string}
Install with CLI
Section titled “Install with CLI”npx appraisejs@latest add step navigation-assertion/assert-url-route-equalsWhat it does
Section titled “What it does”- Waits for network idle.
- Extracts current pathname from URL.
- Compares pathname to expected route.
Parameters
Section titled “Parameters”| Parameter | Represents | Expected data |
|---|---|---|
{string} | Expected pathname | Route path (for example /dashboard). |
Example
Section titled “Example”Then the url route should be equal to "/dashboard"Common failures
Section titled “Common failures”- Assertions fail when the locator is missing, the expected state is wrong, or the page has not reached the required state yet.
- Route assertions can fail when the environment or navigation step did not land where you expected.
Related steps
Section titled “Related steps”Known limitation
Section titled “Known limitation”The signature below exists but is currently stubbed (no implementation body):
the element {string} should contain the text inside the stored variable {string}- Install with CLI:
npx appraisejs@latest add step text-assertion/assert-element-contains-stored-variable-text