Actions are used to perform some activity on a component within the current page.

test

This action is used to specify the name of a test.

Format: test “test name goes here”

Example:

test "Reset Form"

[divider] [/divider]

url

This action is used to specify the URL that will be opened in the browser to start the test. Note that you can use the text  {base_url} here and it will be replaced by the base.url property from the properties file when the test is run.

Format: url http://yoursitehere

Example:

url {base_url}/form1.html

[divider] [/divider]

browsers

This action is used to specify one or more browsers in which the test will be executed.

Format: browsers browser1 browser2 browser3

Example:

browsers Chrome Firefox HtmlUnit Safari

For a list of supported browsers see Support Browsers.

[divider] [/divider]

begin test

This action is used to designate where a test starts.

Example:

begin test

[divider] [/divider]

end test

This action is used to designate where a test ends.

Example:

end test

[divider] [/divider]

screenshots after each action

This action is used to specify that a screenshot will be take after each action once the test begins.

Example:

screenshots after each action

[divider] [/divider]

wait

This action has several types in which you are specifying that you want to wait for something to occur. If that event does not occur within the timeout specified in the properties file using default.timeout, the test will fail.

to be clickable

This type of wait action waits for the specified element to be clickable.

Usage: wait to be clickable [locator expression]

Example:

wait to be clickable input by name "first"

This will wait until the input component located the name attribute of “first” is clickable before continuing.

for text

This type of wait action waits for the specified text to be present within the specified component.

Usage: wait for text “some text” [locator expression]

Example:

wait for text "Cherry" input by name "first"

This will wait for the text of “Cherry” to appear in the input identified by the name attribute of “first”.

until element gone

This type of wait action waits for the specified web element to be no longer on the page.

Usage: wait until element gone [locator expression]

Example:

wait until element gone tablerow by text "Charlie, Cherry"

This will wait for the table row containing the text “Charlie, Cherry” to be gone before continuing.

until element exists

This type of wait action waits until the specified elements exists before continuing.

Usage: wait until element exists [locator expression]

Example:

wait until element exists tablerow by text "Charlie, Cherry"

This will wait until the table row containing the text “Charlie, Cherry” before continuing.

[divider] [/divider]

screenshot

This action takes a screenshot of whatever is currently on the screen of the web browser during a test.

Example:

screenshot

[divider] [/divider]

type

This action will type whatever text you give it into the specified component, assuming it supports text entry.

Usage: type “some text” into [locator expression]

Example:

type "John" into input by name "first"

This action will type the text “John” into the input field identified by the name attribute of “first”.

[divider] [/divider]

assert that

There are several types of assertion statements that are used to specify that some condition is or is not true. If the condition is not met the test is failed.

is

This type of assertion is used to specify that in the specified component, its text matches the given value.

Usage: assert that [locator expression] is “some value”

Example:

assert that input by name "first" is "John"

This action will only pass if the input identified by the name attribute of “first” has the exact text of “John” in it.

is not

This type of assertion is used to specify that in the specified component, its next must NOT match the given value.

Usage: assert that [locator expression] is not “some value”

Example:

assert that input by name "first" is not "John"

This action will only pass if the input identified by the name attribute of “first” does not have the exact text of “John”.

contains

This type of assertion is used to specify that in the specified component, it must contain the specified text.

Usage: assert that [locator expression] contains “some value”

Example:

assert that input by name "first" contains "John"

This action will only pass if the input identified by the name attribute of “first” contains the text of “John”.

does not contain

This type of assertion is used to specify that in the specified component, it must NOT contain the specified text.

Usage: assert that [locator expression] does not contain “some value”

Example:

assert that input by name "first" does not contain "John"

This action will only pass if the input identified by the name attribute of “first” does NOT contain the text of “John”.

is selected

This type of assertion is used to state that the specified component must be in a selected state in order for this action to pass.

Usage: assert that [locator expression] is selected

Example:

assert that radio by value "Milk" is selected

This  action will only pass of the radio button identified by the value of “Milk” is in a selected state.

is not selected

This type of assertion is used to state that the specified component must NOT be in a selected state in order for this action to pass.

Usage: assert that [locator expression] is not selected

Example:

assert that radio by value "Milk" is not selected

This action will only pass if the radio button identified by the value of “Milk” is NOT selected.

[divider] [/divider]

click

This action is used to perform a mouse-click on the specified component.

Usage: click [locator expression]

Example:

click button by text "Submit"

This action will click the button containing the text of “Submit”.

[divider] [/divider]

clear

This action is used to clear any text within the specified component.

Usage: clear [locator expression]

Example:

clear input by name "first"

This action will clear any text in the input field identified by the name attribute of “first”.

[divider] [/divider]

switch

This action is used to switch control over to another popup or iframe. There are two ways to use this action:

  1. To switch the context to another component
  2. To switch the context back to the original

Usage: switch to [locator expression]

Example:

switch to extjshtmleditor by default method

This action will switch the context to that of the Ext JS HTML Editor component, located by the default method.

Example:

switch to default context

This action will switch the context back to default.

[divider] [/divider]

drag and drop

This action is used to execute a drag and drop on the specified component by the given X and Y values.

Usage: drag and drop by [x] and [y] [locator expression]

Example:

drag and drop by "30" and "0" extjsslider by default method

This action will execute and drag and drop by 30 X and 0 Y on the Ext JS slider located by the default method.

[divider] [/divider]

commandline

This action is used to execute a command at the command line. The purpose it to allow the test to call things outside of the test environment, such as a script to restore a server, refresh a database, or anything else that may be needed.

Usage: commandline “some command”

Example:

commandline "cmd /c dir /w"

In this example this command will do a directory listing on windows.

 

What next?

See Locating Components