Confirmed users
905
edits
No edit summary |
|||
| Line 39: | Line 39: | ||
* If your tests extends BaseTest then you will not need to add the methods setUp() and tearDown() as they are already defined in BaseTest | * If your tests extends BaseTest then you will not need to add the methods setUp() and tearDown() as they are already defined in BaseTest | ||
* If you need to do extra clean-up, like removing entries you added in a database for e.g., the tearDown() method can be overwrittern but make sure to call '''super.tearDown()''' as needed in the method. The same is applicable for setUp(). | * If you need to do extra clean-up, like removing entries you added in a database for e.g., the tearDown() method can be overwrittern but make sure to call '''super.tearDown()''' as needed in the method. The same is applicable for setUp(). | ||
= Basic code sequences to do different actions = | |||
== Load page == | |||
* Using an URL | |||
String url = "<insert_link_here>"; | |||
loadURL(url); | |||
* Using the robocop tests blank page | |||
String url = getAbsoluteUrl("/robocop/robocop_blank_01.html"); | |||
loadUrl(url); | |||
== Check Title == | |||
Element awesomebar = mDriver.findElement(getActivity(), "awesome_bar_title"); // search the awesomebar title | |||
mAsserter.isnot(awesomebar, null, "Got the awesomebar"); // log "Got the awesomebar" in the logs | |||
assertMatches(awesomebar.getText(), "<insert_title_here", "page title match"); // do a match between expected and actual title | |||
== Open the app menu (Custom Menu) == | |||
mActions.sendSpecialKey(Actions.SpecialKey.MENU); | |||
//Open the More menu for devices with old style menues | |||
if (mSolo.waitForText("^More$")) { | |||
mSolo.clickOnText("^More$"); | |||
} | |||
== Open Menu item == | |||
mSolo.waitForText("^Settings$"); | |||
mSolo.clickOnText("^Settings$"); | |||
== Set up listeners to catch the page load == | |||
Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added"); | |||
Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded"); | |||
== Wait for the new tab and page to load == | |||
tabEventExpecter.blockForEvent(); | |||
contentEventExpecter.blockForEvent(); | |||