Changes

Jump to: navigation, search

B2G/QA/Automation/Style Guide/Howtos

42 bytes added, 14:53, 10 November 2015
m
Minor typos corrections
= How-Tos =
== Using WebIDE to Define Locators ==
WebIDE can connect to firefox OS devices, and lets the user to view the locators of Firefox OS app. For basics of WebIDE, please refere refer to [https://developer.mozilla.org/en/docs/Tools/WebIDE this page].
'''Prerequisites:'''<br />
=== Example ===
[http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/apps/music/regions/ Music helper methods] contain a number of examples of shadow DOM usage.
<source lang="python">
def tap_cover_in_player_view(self):
# here, we switch to the active iframe view, and then switch into the shadow DOM within
<br><br>
[http://marionette-client.readthedocs.org/en/latest/reference.html?highlight=switch_to_frame#marionette_driver.marionette.Marionette.switch_to_frame switch_to_frame()] command lets you change the frame, and you may need to do this when you need to manipulate system dialog or browser window instance.
<source lang="python">
# switch to the system frame
self.marionette.switch_to_frame()
</source>
gaia_test.py has a helper app to switch to the displayed app, switch_to_displayed_app().
<source lang="python">
def switch_to_settings_app(self):
# wait until settings app is displayed
== Handling Browser Instances ==
As mentioned above, there is a difference between Browser and Browser Tabs. Also, the browser elements (URL bar, dialogs, buttons, etc.) are on a separate frame (system frame) from the displayed web contents. <br>In order to properly detect and manipulate all of them, it is necessary to switch between separate frames.
<source lang="python">
search = Search(self.marionette)
search.launch()
On a related note, each page should have its own class definition, where it lists methods that manipulates and checks the associated UI elements.
<br>
<source lang="python"> music_app.wait_for_music_tiles_displayed()
# tapping albums tab returns the list_view object,
== Use Python Debugger ==
You can stop the execution of the script and inject custom python statements by using pdb. just add below lines where you'd like to start debugging:
<source lang="python">
import pdb
pdb.set_trace()
</source>
[https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Here] is the informative tutorial regarding pdb.
Confirm
198
edits

Navigation menu