Difference between revisions of "SeleniumFixtureReference"
(Created page with "<div style="font-size:180%"> <span style="color:red"> IN PROGRESS </span> </div> = '''Feature:''' Fitnesse Selenium Fixture Reference = '''Goal:''' Functional Testing '''S...") |
m (Add category) |
||
| (10 intermediate revisions by 2 users not shown) | |||
| Line 5: | Line 5: | ||
= '''Feature:''' Fitnesse Selenium Fixture Reference = | = '''Feature:''' Fitnesse Selenium Fixture Reference = | ||
| − | '''Goal:''' | + | '''Goal:''' UI Testing |
'''Sponsor:''' [[Sponsor:Trek_Global|Trek Global]] | '''Sponsor:''' [[Sponsor:Trek_Global|Trek Global]] | ||
| Line 12: | Line 12: | ||
In fitnesse, you can use the fitlibrary.zk.ZkFixture to create UI testing. | In fitnesse, you can use the fitlibrary.zk.ZkFixture to create UI testing. | ||
| + | |||
| + | ==Fixture Command Reference== | ||
| + | |||
| + | * Fixture command start and ends with | | ||
| + | * italic text is command, non italic text is parameter | ||
| + | |||
| + | ===Page Setup=== | ||
| + | |||
| + | Start test with phantomjs, firefox, chrome or ie: | ||
| + | : <code>|''start spider with''|phantomjs, firefox, chrome or ie|</code> | ||
| + | |||
| + | Auto shutdown browser after completion of test (must be true for phantomjs since it is headless): | ||
| + | : <code>|''shut down browser automatically''|true or false|</code> | ||
| + | |||
| + | ===Zk Widget=== | ||
| + | |||
| + | ====Combobox==== | ||
| + | |||
| + | Return selected value from combobox: | ||
| + | : <code>|''combobox''|zk locator|''selected value''|</code> | ||
| + | |||
| + | Set selected combobox item by label: | ||
| + | : <code>|''combobox''|zk locator|''select item''|label of item|</code> | ||
| + | |||
| + | Set selected combobox item by index: | ||
| + | : <code>|''combobox''|zk locator|''select item at''|item index|</code> | ||
| + | |||
| + | Enter text into combobox and fire the onChange event: | ||
| + | : <code>|''combobox''|zk locator|''set text''|text|</code> | ||
| + | |||
| + | ====Tabbox==== | ||
| + | Set selected tab by index: | ||
| + | : <code>|''tabbox''|zk locator|''select tab at''|tab index|</code> | ||
| + | |||
| + | Set selected tab by label: | ||
| + | : <code>|''tabbox''|zk locator|''select tab''|tab label|</code> | ||
| + | |||
| + | Return label of selected tab: | ||
| + | : <code>|''selected tab''|zk locator|</code> | ||
| + | |||
| + | ====Lookup==== | ||
| + | Perform lookup with value: | ||
| + | : <code>|''lookup''|zk locator|''search''|value|</code> | ||
| + | |||
| + | ====Window==== | ||
| + | Open window by menu label: | ||
| + | : <code>|''open window''|menu label|</code> | ||
| + | |||
| + | Click process button of a window: | ||
| + | : <code>|''window''|zk locator|''click process button''|button id|</code> | ||
| + | |||
| + | Click toolbar button of a window: | ||
| + | : <code>|''window''|zk locator|''click toolbar''|value|</code> | ||
| + | |||
| + | Click detail toolbar button of a window: | ||
| + | : <code>|''window''|zk locator|''click detail toolbar'|value|</code> | ||
| + | |||
| + | Return window message: | ||
| + | : <code>|''window message''|zk locator|</code> | ||
| + | |||
| + | Navigate to next record: | ||
| + | : <code>|''window''|zk locator|''next record''|value|</code> | ||
| + | |||
| + | Navigate to previous record: | ||
| + | : <code>|''window''|zk locator|''previous record''|value|</code> | ||
| + | |||
| + | ====Waiting for Response==== | ||
| + | Wait for Ajax response: | ||
| + | : <code>|''wait response''|</code> | ||
| + | |||
| + | Wait for Ajax response with timeout: | ||
| + | : <code>|''wait response with timeout''|timeout|</code> | ||
| + | |||
| + | Sleep for x milliseconds: | ||
| + | : <code>|''sleep''|millisecond|</code> | ||
| + | |||
| + | ====Widget Command==== | ||
| + | Set focus to a widget: | ||
| + | : <code>|''focus''|zk locator|</code> | ||
| + | |||
| + | Execute widget command: | ||
| + | : <code>|''with widget''|zk locator|''execute''|command|</code> | ||
| + | |||
| + | Execute widget command and return the result: | ||
| + | : <code>|''with widget''|zk locator|''eval''|command|</code> | ||
| + | |||
| + | ====Context Click==== | ||
| + | Open context menu: | ||
| + | : <code>|''context click''|zk locator|</code> | ||
| + | |||
| + | ===FitLibrary=== | ||
| + | |||
| + | ====Setting==== | ||
| + | |||
| + | Specify how long to wait for a page to load from a URL: | ||
| + | : <code>|''<i>poll url timeout</i>''|timeout in milliseconds|</code> | ||
| + | |||
| + | If true, changes to web elements are checked after they have been made: | ||
| + | : <code>|''<i>set checking</i>''|true or false|</code> | ||
| + | |||
| + | If checking that a change has been made to a web element, how long to wait for a change to be visible: | ||
| + | : <code>|''<i>checking timeout</i>''|timeout in milliseconds|</code> | ||
| + | |||
| + | ====Javascript==== | ||
| + | |||
| + | Execute the JavaScript code in the browser and return the result: | ||
| + | : <code>|''<i>execute JavaScript</i>''|JavaScript code|</code> | ||
| + | |||
| + | Execute the JavaScript code in the browser with the argument and return the result: | ||
| + | : <code>|''<i>execute JavaScript</i>''|JavaScript code|''<i>with</>''|web element|</code> | ||
| + | |||
| + | Find a element on the page using the locator specified and then execute the JavaScript code in the browser using the found element as the argument and return the result: | ||
| + | : <code>|''<i>execute JavaScript</i>''|JavaScript code|''<i>with element</>''|xpath, id or other locator|</code> | ||
| + | |||
| + | ====Text==== | ||
| + | |||
| + | Return the text of the given web element: | ||
| + | : <code>|''<i>text of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Return the plain text of the given web element. Tags are removed: | ||
| + | : <code> |''<i>plain text of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Checks that the lines in the given text element match each of the following rows in the table: | ||
| + | : <code> |''<i>text of</i>''|xpath, id or other locator|''<i>matches lines</i>''|</code> | ||
| + | |||
| + | Change the text of the given web element: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>set text</i>''|text|</code> | ||
| + | |||
| + | Add to the text of the given web element: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>add text</i>''|text|</code> | ||
| + | |||
| + | Return the html that's enclosed by the given web element: | ||
| + | : <code> |''<i>inner html of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Return only the text that is in the identified element, no text of any inner html will be returned: | ||
| + | : <code> |''<i>text of element only</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns the value of the given web element: | ||
| + | : <code> |''<i>element value</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | ====Find Element==== | ||
| + | |||
| + | Returns true if the given web element exists on the page: | ||
| + | : <code> |''<i>element exists</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns true if the given web element does not exist on the page: | ||
| + | : <code> |''<i>element does not exist</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns true if the given web element is displayed (visible to the user): | ||
| + | : <code> |''<i>element is visible</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns true if the given web element is not displayed (invisible to the user): | ||
| + | : <code> |''<i>element invisible</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns the count of elements that match the given locator: | ||
| + | : <code> |''<i>count of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | |||
| + | ====Attributes==== | ||
| + | |||
| + | Returns the value of the given attribute in the given web element: | ||
| + | : <code> |''<i>attribute</i>''|attribute name|''<i>of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns true if the given attribute exists in the given web element: | ||
| + | : <code> |''<i>attribute of</i>''|xpath, id or other locator|''<i>exists</i>''|</code> | ||
| + | |||
| + | Returns the value of the given css property of the given web element: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>css property of</i>''|css property name|</code> | ||
| + | |||
| + | Returns a list of information about the attributes of each of the children with the given tag contained by the given web element: | ||
| + | : <code> |''<i>attribute</i>''|attribute|''<i>of children of type</i>''|child tag|''<i>of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | ====Checkbox==== | ||
| + | |||
| + | Returns true if the given checkbox is currently selected: | ||
| + | : <code> |''<i>checkbox</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Either select (true) or unselect (false) the given checkbox: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>select</i>''|true or false|</code> | ||
| + | |||
| + | ====Options==== | ||
| + | |||
| + | Returns the name of the currently-selected option in the given select: | ||
| + | : <code> |''<i>option of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns a list of the names of the currently-selected options in the given multi-select.\nThis can be checked in the subsequent rows of the table: | ||
| + | : <code> |''<i>option list of</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Changes the option in the given select: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>select option</i>''|option|</code> | ||
| + | |||
| + | Changes the option to the nth one, in the given select: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>select option at</i>''|index|</code> | ||
| + | |||
| + | Changes the option to the one with the given text, in the given select: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>select text</i>''|text of option|</code> | ||
| + | |||
| + | Adds the given option to the given multi-select: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>add selection</i>''|option|</code> | ||
| + | |||
| + | Removes the given option from the given multi-select: | ||
| + | : <code> |''<i>with</i>''|xpath, id or other locator|''<i>remove selection</i>''|option|</code> | ||
| + | |||
| + | Returns a list of the values of the currently-selected options in the given multi-select: | ||
| + | : <code> |''<i>option values</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Returns a list of the elements for the options in the select or multi-select.\nThis list can be checked in the subsequent rows of the table: | ||
| + | : <code> |''<i>options</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | ====Table==== | ||
| + | |||
| + | Returns the elements of the given table as a TableFixture, which can be used to check the text of each of those elements: | ||
| + | : <code> |''<i>table values</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | ====Navigation==== | ||
| + | |||
| + | Retrieve the page at the url: | ||
| + | : <code>|''<i>get url</i>''|url|</code> | ||
| + | |||
| + | Click on the given element, such as a link or button: | ||
| + | : <code> |''<i>click</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Click on the given element and select the popup window that results: | ||
| + | : <code> |''<i>click and select resulting window</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Click on the first link with the given name: | ||
| + | : <code> |''<i>click on named link</i>''|link name|</code> | ||
| + | |||
| + | Click on the first link that contains the given name: | ||
| + | : <code> |''<i>click on partially named link</i>''|partial link name|</code> | ||
| + | |||
| + | Submit the given form: | ||
| + | : <code> |''<i>submit</i>''|xpath, id or other locator|</code> | ||
| + | |||
| + | Maximize current window: | ||
| + | : <code> |''<i>maximize window</i>''| | ||
| + | |||
| + | ====Cookie==== | ||
| + | |||
| + | Delete the cookie with the given name: | ||
| + | : <code> |''<i>delete cookie</i>''|name|</code> | ||
| + | |||
| + | ====Screen Shot==== | ||
| + | |||
| + | Take a screen shot and insert the result in the report | ||
| + | : <code> |''screen shot''|</code> | ||
| + | |||
| + | [[Category:UI Testing]] | ||
| + | [[Category:Fitnesse|U]] | ||
| + | [[Category:Developer documentation]] | ||
| + | [[Category:Development]] | ||
Latest revision as of 19:25, 27 October 2015
IN PROGRESS
Feature: Fitnesse Selenium Fixture Reference
Goal: UI Testing
Sponsor: Trek Global
Description:
In fitnesse, you can use the fitlibrary.zk.ZkFixture to create UI testing.
Fixture Command Reference
- Fixture command start and ends with |
- italic text is command, non italic text is parameter
Page Setup
Start test with phantomjs, firefox, chrome or ie:
|start spider with|phantomjs, firefox, chrome or ie|
Auto shutdown browser after completion of test (must be true for phantomjs since it is headless):
|shut down browser automatically|true or false|
Zk Widget
Combobox
Return selected value from combobox:
|combobox|zk locator|selected value|
Set selected combobox item by label:
|combobox|zk locator|select item|label of item|
Set selected combobox item by index:
|combobox|zk locator|select item at|item index|
Enter text into combobox and fire the onChange event:
|combobox|zk locator|set text|text|
Tabbox
Set selected tab by index:
|tabbox|zk locator|select tab at|tab index|
Set selected tab by label:
|tabbox|zk locator|select tab|tab label|
Return label of selected tab:
|selected tab|zk locator|
Lookup
Perform lookup with value:
|lookup|zk locator|search|value|
Window
Open window by menu label:
|open window|menu label|
Click process button of a window:
|window|zk locator|click process button|button id|
Click toolbar button of a window:
|window|zk locator|click toolbar|value|
Click detail toolbar button of a window:
|window|zk locator|click detail toolbar'|value|
Return window message:
|window message|zk locator|
Navigate to next record:
|window|zk locator|next record|value|
Navigate to previous record:
|window|zk locator|previous record|value|
Waiting for Response
Wait for Ajax response:
|wait response|
Wait for Ajax response with timeout:
|wait response with timeout|timeout|
Sleep for x milliseconds:
|sleep|millisecond|
Widget Command
Set focus to a widget:
|focus|zk locator|
Execute widget command:
|with widget|zk locator|execute|command|
Execute widget command and return the result:
|with widget|zk locator|eval|command|
Context Click
Open context menu:
|context click|zk locator|
FitLibrary
Setting
Specify how long to wait for a page to load from a URL:
|poll url timeout|timeout in milliseconds|
If true, changes to web elements are checked after they have been made:
|set checking|true or false|
If checking that a change has been made to a web element, how long to wait for a change to be visible:
|checking timeout|timeout in milliseconds|
Javascript
Execute the JavaScript code in the browser and return the result:
|execute JavaScript|JavaScript code|
Execute the JavaScript code in the browser with the argument and return the result:
|execute JavaScript|JavaScript code|with</>|web element|
Find a element on the page using the locator specified and then execute the JavaScript code in the browser using the found element as the argument and return the result:
|execute JavaScript|JavaScript code|with element</>|xpath, id or other locator|
Text
Return the text of the given web element:
|text of|xpath, id or other locator|
Return the plain text of the given web element. Tags are removed:
|plain text of|xpath, id or other locator|
Checks that the lines in the given text element match each of the following rows in the table:
|text of|xpath, id or other locator|matches lines|
Change the text of the given web element:
|with|xpath, id or other locator|set text|text|
Add to the text of the given web element:
|with|xpath, id or other locator|add text|text|
Return the html that's enclosed by the given web element:
|inner html of|xpath, id or other locator|
Return only the text that is in the identified element, no text of any inner html will be returned:
|text of element only|xpath, id or other locator|
Returns the value of the given web element:
|element value|xpath, id or other locator|
Find Element
Returns true if the given web element exists on the page:
|element exists|xpath, id or other locator|
Returns true if the given web element does not exist on the page:
|element does not exist|xpath, id or other locator|
Returns true if the given web element is displayed (visible to the user):
|element is visible|xpath, id or other locator|
Returns true if the given web element is not displayed (invisible to the user):
|element invisible|xpath, id or other locator|
Returns the count of elements that match the given locator:
|count of|xpath, id or other locator|
Attributes
Returns the value of the given attribute in the given web element:
|attribute|attribute name|of|xpath, id or other locator|
Returns true if the given attribute exists in the given web element:
|attribute of|xpath, id or other locator|exists|
Returns the value of the given css property of the given web element:
|with|xpath, id or other locator|css property of|css property name|
Returns a list of information about the attributes of each of the children with the given tag contained by the given web element:
|attribute|attribute|of children of type|child tag|of|xpath, id or other locator|
Checkbox
Returns true if the given checkbox is currently selected:
|checkbox|xpath, id or other locator|
Either select (true) or unselect (false) the given checkbox:
|with|xpath, id or other locator|select|true or false|
Options
Returns the name of the currently-selected option in the given select:
|option of|xpath, id or other locator|
Returns a list of the names of the currently-selected options in the given multi-select.\nThis can be checked in the subsequent rows of the table:
|option list of|xpath, id or other locator|
Changes the option in the given select:
|with|xpath, id or other locator|select option|option|
Changes the option to the nth one, in the given select:
|with|xpath, id or other locator|select option at|index|
Changes the option to the one with the given text, in the given select:
|with|xpath, id or other locator|select text|text of option|
Adds the given option to the given multi-select:
|with|xpath, id or other locator|add selection|option|
Removes the given option from the given multi-select:
|with|xpath, id or other locator|remove selection|option|
Returns a list of the values of the currently-selected options in the given multi-select:
|option values|xpath, id or other locator|
Returns a list of the elements for the options in the select or multi-select.\nThis list can be checked in the subsequent rows of the table:
|options|xpath, id or other locator|
Table
Returns the elements of the given table as a TableFixture, which can be used to check the text of each of those elements:
|table values|xpath, id or other locator|
Retrieve the page at the url:
|get url|url|
Click on the given element, such as a link or button:
|click|xpath, id or other locator|
Click on the given element and select the popup window that results:
|click and select resulting window|xpath, id or other locator|
Click on the first link with the given name:
|click on named link|link name|
Click on the first link that contains the given name:
|click on partially named link|partial link name|
Submit the given form:
|submit|xpath, id or other locator|
Maximize current window:
|maximize window|
Cookie
Delete the cookie with the given name:
|delete cookie|name|
Screen Shot
Take a screen shot and insert the result in the report
|screen shot|
