QAbyAI logo
Tools

Assertion

Tools for verifying and validating your application state

Assertion tools help you verify that your application is working correctly. QAbyAI's AI-powered assertions understand what you want to check in plain English.

AI Assertion ✨

Verify conditions using natural language descriptions - the most powerful assertion tool.

Configuration:

  • assertion (required): Natural language assertion to verify

Assert URL

Verify that the current page URL matches a specific pattern.

Configuration:

  • urlRegex (required): Regular expression to match against current URL

Assert Text

Check that an element contains specific text content.

Configuration:

  • elementDescription (required): Description of element to check text in
  • textRegex (required): Regular expression to match element text
  • elementReference (optional): Direct element reference with DOM/UUID or XPath

Assert State

Verify the state of elements (visible, hidden, enabled, disabled).

Configuration:

  • elementDescription (required): Description of element to check state
  • state (required): Expected element state (enabled, disabled, visible, hidden)
  • elementReference (optional): Direct element reference with DOM/UUID or XPath

Assert Attribute

Check that elements have specific HTML attributes and values.

Configuration:

  • elementDescription (required): Description of element to check attribute
  • attributeName (required): Name of attribute to check
  • attributeValue (required): Expected attribute value
  • elementReference (optional): Direct element reference with DOM/UUID or XPath

Assert Download

Verify that files are downloaded with expected names.

Configuration:

  • downloadName (required): Expected download filename

Best Practices

When to Use AI-Powered Assertions:

Use AI Assertion ✨ for complex validations that require understanding:

  • Visual states: "The loading spinner disappeared" or "The success message is showing"
  • Dynamic content: "Search results updated" or "New items loaded when scrolling"
  • User experience: "The checkout flow feels complete" or "The form appears valid"
  • Context-dependent conditions: "The cart looks empty" or "The user seems logged in"

When to Use Traditional Assertions:

Assert URL - When you need to:

  • Verify exact page navigation after form submissions
  • Confirm redirects to specific paths (login → dashboard)
  • Validate URL parameters or query strings

Assert Text - When you need to:

  • Check exact error messages or success notifications
  • Validate specific data values (prices, quantities, IDs)
  • Confirm precise labels or headings

Assert State - When you need to:

  • Verify button states (enabled/disabled) for form validation
  • Check element visibility after user interactions
  • Confirm loading states and UI element availability

Assert Attribute - When you need to:

  • Validate HTML attributes for accessibility (aria-labels, roles)
  • Check CSS classes for styling verification
  • Confirm link targets and form action URLs

Assert Download - When you need to:

  • Verify file downloads with specific naming patterns
  • Confirm document exports (reports, invoices, receipts)
  • Validate file generation workflows

General Guidelines:

  • Start with AI Assertion ✨ for complex, context-dependent validations
  • Use traditional assertions for precise, technical validations
  • Combine both approaches for comprehensive test coverage
  • Write assertions as you would describe them to a colleague

Learn more about Assertions.