LogoLogo
BugBug HomepageContact SupportLoginSign up free
  • Documentation
  • Tutorial for beginners
  • Best practices
  • BugBug App FAQ
  • Quick Start
    • What is test automation?
    • Start for free
    • Create your first project
    • Install Chrome extension
    • Create and run the tests
  • Creating Tests
    • Your first test
    • Independent tests
    • Duplicating tests
    • New test from here
  • Recording tests steps
    • BugBug overlay
    • Recording clicks
    • Recording hover
    • Recording keyboard typing
    • Recording assertions
    • Recording drag & drop
    • Record from here
    • Re-recording steps
    • Recording pop-up window actions
    • Using keyboard shortcuts
  • Editing tests
    • Grouping steps
    • Components
    • Manually editing steps
    • Actions
    • Assertions
    • Tabs & iframes
    • Variables
    • Local variables
    • Profiles
    • Custom JavaScript actions
  • Running tests
    • Running the tests
    • Statuses
    • Run (locally)
    • Run and pause here
    • Run in cloud
    • Schedules
    • Parallel runs
    • Running via API
    • Test your local build or protected web page using ngrok
  • Preventing failed tests
    • Waiting conditions
    • Smart click
    • Smart scroll
    • Selectors
    • Timeout
    • Delay / Sleep
    • Project settings
  • Debugging Tests
    • Runs history
    • Screenshots
    • Debug in Chrome
    • Breakpoint (run step-by-step)
  • Organizing tests
    • Naming your tests
    • Searching tests
    • Suites
    • Components
    • Projects
  • Workflow Tips
    • Edit & Rewind
    • Changing the test screen size
    • Multiple environments
    • Testing registration & login
    • Integrating with build systems
    • Mobile version testing
  • Collaboration
    • Organizations
    • Inviting team members
    • Alerts
      • Sending email notification
      • Sending webhook
      • Sending Slack message
      • Sending Teams message
  • Integrations
    • CLI
    • Zapier
    • Slack
    • GitHub
    • Bitbucket
    • Gitlab
    • Trello
    • Jira
  • Your account
    • Account settings
    • Edit your name and email
    • Forgot password
    • Manage Subscriptions
    • Account FAQ
  • Troubleshooting
    • Prohibited behaviors
    • Updating Chrome extension
    • Clear cookies and site data for BugBug
    • Testing basic auth password protected websites
    • Common selectors issues
    • CAPTCHA in automation testing
    • Cloud tests sometimes failing
    • IPs list of cloud runners
    • VPN or a Firewall
    • A/B tests
    • Report a bug
  • IN-DEPTH GUIDES
    • Beginners tutorial to automation testing
    • XPath Selectors without coding
    • Tech Leader's Guide to Automation Testing
    • Test automation guides
  • FREE TOOLS
    • BugBug Testing Inbox
    • Example SaaS App
    • No-code XPath Selector Builder
  • Other links
    • BugBug Homepage
    • Pricing
    • Terms & conditions
    • Privacy Policy
Powered by GitBook
On this page
  • Why add assertions?
  • Types of assertions
  • Editing assertions

Was this helpful?

  1. Editing tests

Assertions

PreviousActionsNextTabs & iframes

Last updated 1 year ago

Was this helpful?

Why add assertions?

Use assertions to observe if everything works as it should.

An assertion is a check that does not interact with your page, for example, you can check if your page shows a specific text without clicking anything.

you can read about how to record assertions for a test.

Types of assertions

By default, BugBug records two types of assertions:

  1. Element is visible

  2. Element has text

which you can edit later in your recorded test details view, and switch between a wider list of available ones, such as:

Select one of the following assertion types.

We are regularly adding more assertion types to this list - please contact us if you need a new assertion type.

Type of assertion
What happens

Element is visible

BugBug checks if the element is actually visible on the screen, if the element is not covered or scrolled outside of the viewport

Element is not visible

BugBug checks if the element isn't visible on the screen

Element has text

BugBug checks if the element is visible, but also checks if it has a specific text

Form field has value

BugBug checks if any form input has a specific value, for example, you can check if your radio buttons group is selected to "No" after the user clicks "No" button

Form input is checked

BugBug checks if the checkbox is checked. You can claim that your radio button was checked after the user clicked it

Form input is not checked

BugBug checks if the checkbox is unchecked. You can claim that your radio button was disabled after the user clicked it twice

Page shows specific text

BugBug checks if there is text anywhere on the page

Page does not show specific text

BugBug checks if there is no text anywhere on the page. Helpful with negative assertions

Page has title

BugBug checks the document.title

URL address

BugBug checks the URL of the page. You can verify that the redirect works fine

Download started

BugBug checks if the download process for a selected file has started within the browser (however, there is no verification that the download has been successful)

Custom JavaScript

</> DOM element does exist

BugBug checks if there is an element on the page you're looking for

</> DOM element does not exist

BugBug checks if there is no element on the page you're looking for. Helpful with negative assertions

Number of elements in DOM

BugBug checks if there are a certain number of elements on the page you're looking for

Variable value

BugBug checks if the variable's output value matches the set condition

Editing assertions

By default, BugBug records assertions that are best suited to what you are looking for. But you can also create advanced assertions, such as checking if a number is greater than a certain value. Select options from the drop-down menu to perform a more thorough check of your test case.

Assertion
Use it when

Element is visible

You want to check if an element is visible, meaning that it's in the viewport, opacity is not 0, and its visibility is not set to hidden. For example, you can assert that some error message is shown and visible to the user

Element is not visible

You want to check if an element is in DOM but not visible, meaning that it's not in the viewport or opacity is 0 or its visibility is set to hidden

Element has text

You want to assert the text in an element, for example, if a registration button contains a "Sign up" text. This is the most common type of assertion

Form input has value

You want to check if the value of the form element matches specific conditions. Only works with form elements like input, select, checkbox, radio, etc.

Form input is checked

You want to check if a checkbox or radio button is checked, meaning that it is selected, enabled

Form input is not checked

You want to check if a checkbox or radio button is unselected, unchecked

Download started

You want to check whether the download process for a selected file has started from the server. Additional settings for this assertion focus on the file name

Custom JavaScript

</> DOM element exists

You want to check if an element exists in the DOM (HTML structure), but not necessarily is visible

</> DOM element does not exists

You want to check if an element is not present in the DOM (HTML structure), ex. you want to make sure that some element disappeared completely from the page, and that it's not just set to "display: none"

Number of elements in DOM

You want to check the number of elements that match a given selector, for example, you want to assert that a list shows 10 elements

Variable value

You want to check if its computed value matches the set condition between: is/is not/contains/does not contain/matches regex

Run any JS function and if it returns true, the assertion is passed - learn more in

You need to do an advanced assertion, ex. comparing the element text with , making an API request, or using localStorage. When your JS function returns true, the assertion will be marked as passed. Also see

custom javascript actions
variables
custom JS actions
Here
List of available assertions
Example of assertion modification after recording
Values can be confirmed under certain conditions