Auto-tools/Projects/Robocop/WritingTests
< Auto-tools | Projects | Robocop
Setup
Writing a test for Robocop shouldn't be very hard, but there is a very limited API as of yet. Copying a test from the examples is the best way to start. The flow of the test will go from starting the application to killing it. Your test should be in the file test[Case].java.in It will have three methods in the class test[Case]: setUp(), test[Case](), and tearDown(). setUp gets called at the beginning and starts fennec inside what
APIs
The two main interfaces that are used are Driver and Element. Driver finds elements, and has a direct relation to the Gecko. Element represents each of the available UI objects in Fennec including the Awesomebar, the 'tabs' button, and different lists and menus.
Driver //This is used to find elements given their id's name. Element findElement(String name); //This will cause this process to spin until the gecko fires a specific JSON event, such as DOMContentLoaded void waitForGeckoEvent(String geckoEvent); //This is used for getting information on scrolls. NOTE: It must be used for the next three methods to return useful information void setupScrollHandling(); int getPageHeight(); //The total height of the page. int getScrollHeight(); //How far down the screen the client has scrolled. int getHeight(); //The height of the client's view. //The following are used to give information on the graphical location of the Gecko view on the screen. int getGeckoTop(); int getGeckoLeft(); int getGeckoHeight(); int getGeckoWidth();