There are three groups of commands in Pangolin: those that act on an element, those that arrange your position on a page and those that assert or expect an outcome.
There are method overload for most of commands, take a look at Pangolin precondition commands to see different types of arguments, default values and method types.
Arrange commands include the following:
Act commands include:
Assert commands include:
Command | Example | Description |
---|---|---|
Set | Set("Password").To("test"); |
The set command defines inputs to be entered into a HTML element on a page. |
Click | Click("Save"); |
Performs the click action on a click-able html element such as a button or link or input |
CheckMailBox | CheckMailBox("email_address"); |
The CheckMailbox command accesses the email queue items in an application. |
Goto | Goto("/"); |
The Goto command redirects the current page to another URL within the same domain. |
CheckBackgroundTasks | CheckBackgroundTasks(); |
Redirect the current page to the page with the list of all Automated Tasks implemented in the application |
RefreshPage | RefreshPage(); |
The RefreshPage command refreshes the current page. |
Press | Press(Keys.Escape); |
Simulates pressing the key on the keyboard to click on an elememt. |
Type | Type("text"); |
Set a text to current focused element. |
WaitForPopup | WaitForPopup(); |
The execution of the next command is delayed until the pop up has loaded. |
WaitForNewPage | WaitForNewPage(); |
The execution of the next command is delayed until the new page has loaded. |
WaitToSee | WaitToSee("text"); |
The execution of the next command is delayed until the element with the text matched in quotation has loaded. |
Topic | Example | Description |
---|---|---|
Expect | Expect("text"); |
Searches the current page or pop-up window for the text matched within quotation marks. |
ExpectNo | ExpectNo("text"); |
Searches the current page to ensure the text matched in quotation marks is not found |
ExpectHeader | ExpectHeader("text"); |
This command searches the current page for an HTML header with the text matched in quotation marks on it. |
ExpectNoHeader | ExpectNoHeader("text"); |
This command searches the current page in focus to ensure that a HTML header with the text matched in quotation marks is not found. |
ExpectButton | ExpectButton("text"); |
This command searches the current page for an HTML button with the text matched in quotation marks on it. |
ExpectNoButton | ExpectNoButton("text"); |
This command searches the current page to ensure no HTML buttons are found with the text matched in quotation marks on them. |
ExpectField | ExpectField("text"); |
This command searches the current page for an HTML field with the text matched in quotation marks on it. |
ExpectNoField | ExpectNoField("text"); |
This command searches the current page in focus to ensure that a HTML field with the text matchedin quotation marks is not found. |
ExpectRow | ExpectRow("text"); |
This command searches the current page for a row in a list (or table) with the text matched in quotation marks in it. |
ExpectNoRow | ExpectNoRow("text"); |
This command searches the current page in focus to ensure a HTML table row with the text matched in quotation marks is not found. |
ExpectUrl | ExpectUrl("url"); |
This command confirms that the URL specified in quotation marks is the current page that Pangolin has in focus. |
Topic | Example | Description |
---|---|---|
Run<T> |
Run<Test>(); |
This command enables testers to run one test within the same project on Dashboard within another. |
LoginAs<T> |
LoginAs<User>(); |
Is actually a shortcut to a bunch of Pangolin code defined in the Users feature. |
AssumeDate | AssumeDate("01/01/2018"); |
This command forces the application to assume a specified date. |
AssumeTime | AssumeTime("12:00"); |
This command forces applications to assume a specified time. |
Logout | Logout(); |
The Logout command clears certain cookies from the browser’s memory. |
This is a very important concept, and a key differentiator of Pangolin from other UI testing tools. On web pages, there can be multiple elements all corresponding to the same label or textual representation. For example you might have multiple buttons named “Save” on the same page, for different forms. To disambiguiate your purpose, in most UI testing frameworks, you have to use exact CSS selectors or hard-code element IDs and Names. That makes your test code fragile and brittle, as every time that a small implementation detail is changed, your test will break.
But in Pangolin
Locator | Example | Description |
---|---|---|
AtRow | AtRow("text") |
This command searches anywhere in the row for the text matched within the quotation marks. |
Above | Above("text") |
The Above command will find page elements above the text matched in quotation marks. |
AboveButton | AboveButton("text") |
This command will find an element above a button labelled with the text matched within quotation marks. |
AboveField | AboveField("text") |
The AboveField command finds an element above a field labelled with text matched within quotation marks. |
AboveHeader | AboveHeader("text") |
The AboveHeader command finds an element above an HTML header with text matched within quotation marks. |
Below | Below("text") |
This command searches below the specified text in the command for something on a web page. |
BelowButton | BelowButton("text") |
This command searches below a HTML button with the text matched within quotation marks. |
BelowField | BelowField("text") |
This command searches below a HTML field with text matched within quotation marks. |
BelowHeader | BelowHeader("text") |
This command searches below a HTML header with text matched within quotation marks. |
Near | Near("text") |
The Near command identifies an HTML element below text matched within quotation marks. |
NearButton | NearButton("text") |
This command tells Sanity to find any element below a HTML button with the text matched within quotation marks. |
NearField | NearField("text") |
This command finds any element below a HTML field with text matched within quotation marks. |
NearHeader | NearHeader("text") |
This command finds a HTML header with text matched within quotation marks. |