Comment on page
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.

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 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 doeas 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 is | BugBug checks the URL of the page. You can verify that the redirect works fine |
Custom JavaScript | Run any JS function and if it returns true, the assertion is passed - learn more in custom javascript actions |
</> 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. |
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.

Example of changing an assertion after recording

Values can be confirmed with certain conditions
Assertion | Use it when |
---|---|
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. |
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. |
Custom JavaScript | You need to do an advanced assertion, ex. comparing the element text with variables, making an API request, or using localStorage . When your JS function returns true , the assertion will be marked as passed. Also see custom JS actions |
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 |
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. |
</> DOM element exists | You want to check if an element exists in the DOM (HTML structure), but not necessarily must be 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 it's not just set to "display: none" |
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 |
Last modified 4mo ago