Assertion Steps
Source: src/tests/steps/validations/*.step.ts.
See shared placeholder rules in Step Parameter Conventions.
Text assertion steps
Section titled “Text assertion steps”1. Contains text assertion
Section titled “1. Contains text assertion”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:
| 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:
Then the element "toastMessage" should true contain the text "Saved successfully"2. Equals text assertion
Section titled “2. Equals text assertion”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:
| 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:
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: 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:
| Parameter | Represents | Expected data |
|---|---|---|
{string} | Element locator name | Existing locator key. |
{boolean} | Expected visibility | true for visible, false for hidden/not visible. |
Example:
Then the visibility status of the "successBanner" element should be true4. Active/enabled assertion
Section titled “4. Active/enabled assertion”Signature: the element {string} should have active status {boolean}
What it does:
- Resolves locator.
- Uses Playwright enabled-state check.
- Asserts enabled/disabled expectation.
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:
Then the element "submitButton" should have active status true5. URL route equality assertion
Section titled “5. URL route equality assertion”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:
| Parameter | Represents | Expected data |
|---|---|---|
{string} | Expected pathname | Route path (for example /dashboard). |
Example:
Then the url route should be equal to "/dashboard"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}