Skip to content

Instantly share code, notes, and snippets.

@AaronMT
Created November 26, 2012 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronMT/4150011 to your computer and use it in GitHub Desktop.
Save AaronMT/4150011 to your computer and use it in GitHub Desktop.
from gaiatest import GaiaTestCase
import time
class TestIMEI(GaiaTestCase):
# Dialer
_keyboard_container_locator = ('id', 'keyboard-container')
_call_bar_locator = ('id', 'keypad-callbar-call-action')
_phone_number_view_locator = ('id', 'phone-number-view')
_attention_frame_locator = ('xpath', '//*[@id="attention-screen"]/iframe')
# Information window
_close_button_locator = ('id', 'close')
_carrier_header_title = ('id', 'header-title')
# IMEI diagnostic number
_test_phone_number = "*#06#"
def setUp(self):
GaiaTestCase.setUp(self)
# Launch the app
self.app = self.apps.launch('Phone')
def test_dialer_IMEI(self):
self.wait_for_element_displayed(*self._keyboard_container_locator)
self._dial_number(self._test_phone_number)
self.marionette.find_element(*self._call_bar_locator).click()
# Switch to the information popup window
self.marionette.switch_to_frame()
attention_frame = self.marionette.find_element(*self._attention_frame_locator)
self.marionette.switch_to_frame(attention_frame)
# Close the information popup window
self.marionette.find_element(*self._close_button_locator).click()
def tearDown(self):
# close the app
if hasattr(self, 'app'):
self.apps.kill(self.app)
GaiaTestCase.tearDown(self)
def _dial_number(self, phone_number):
# dial the USSD number using the keypad
for i in phone_number:
self.marionette.find_element('css selector', 'div.keypad-key div[data-value="%s"]' % i).click()
time.sleep(0.25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment