B2G/QA/Automation/Style Guide/Howtos: Difference between revisions

Line 78: Line 78:


== Switching frames and system frame ==
== Switching frames and system frame ==
TBD - mwargers
A frame is basically the context where marionette operates on.  If marionette is on a frame that does not contain currently displayed UI elements, marionette will not find those UI elements, even if the user can see them on the phone at the time of the test.
<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 python>
# switch to the system frame
self.marionette.switch_to_frame()
# look for camera frame on the system frame
secure_camera_frame = self.marionette.find_element(*self._secure_camera_frame_locator)
# switch to the found camera frame
self.marionette.switch_to_frame(secure_camera_frame)
self.wait_for_capture_ready()
</source>
gaia_test.py has a helper app to switch to the displayed app, switch_to_displayed_app(). 
<source python>
def switch_to_settings_app(self):
    # wait until settings app is displayed
    self.wait_to_be_displayed()
    # now switch to the settings app
    self.apps.switch_to_displayed_app()
</source>
 
== Handling browser instances  ==
== Handling browser instances  ==
TBD - mwargers
TBD - mwargers
352

edits