Assertion commands
These are commands to assert if the elements on the page is in a expected state.
If the assertion fail, the command results in an error.
List of commands
Command | Description |
---|---|
I.see |
Assert that an text or element is visible |
I.dontSee |
Assert that an text or element is NOT visible |
I.count |
Assert the number of occurances for a text or element |
I.seePageTitle |
Assert the title of the current page |
I.see
Assert that an text or element is visible
Ignores casing and white-spaces. This behavior is not configurable at the moment.
Usage
I.see(target)
Parameters
Parameter | Type | Remarks |
---|---|---|
target | string | Text or element to find |
Example(s)
I.see("Welcome back, Bruce");
Asserts that the text "Welcome back, Bruce" is seen on the page.
I.dontSee
Assert that an text or element is NOT visible
Ignores casing and white-spaces. This behavior is not configurable at the moment.
Usage
I.dontSee(target)
Parameters
Parameter | Type | Remarks |
---|---|---|
target | string | Text or element to find |
I.count
Assert the number of occurances for a text or element
Aliases: I.seeCount
Ignores casing and white-spaces. This behavior is not configurable at the moment.
Usage
I.count(target, n)
Parameters
Parameter | Type | Remarks |
---|---|---|
target | string | Text or element to find |
n | number | Number of occurance expected |
Example(s)
I.count("Add to cart", 20);
Asserts that there's 20 occurances of the text "Add to cart".
I.count(".product", 20);
Asserts that there's 20 occurances of the element with the "product" CSS class.
I.seePageTitle
Assert the title of the current page
Usage
I.seePageTitle(title)
Parameters
Parameter | Type | Remarks |
---|---|---|
title | string | The expected page title |
Example(s)
I.goTo("https://www.wikipedia.org/")
I.seePageTitle("Wikipedia")
This example test navigates to the https://www.wikipedia.org/
and checks if the page title is "Wikipedia". The test will pass if the page title is exactly "Wikipedia".