Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #13580 from bebef1987/fix_wifi
Browse files Browse the repository at this point in the history
Bug 937105 - test_airplane_mode.py is failing
  • Loading branch information
Zac committed Nov 13, 2013
2 parents 02e8187 + f722214 commit e284dba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
15 changes: 10 additions & 5 deletions tests/python/gaia-ui-tests/gaiatest/apps/settings/app.py
Expand Up @@ -13,6 +13,7 @@ class Settings(Base):
_header_text_locator = (By.CSS_SELECTOR, '#root > header > h1')
_data_text_locator = (By.ID, 'data-desc')
_airplane_switch_locator = (By.XPATH, "//input[@id='airplaneMode-input']/..")
_airplane_checkbox_locator = (By.ID, "airplaneMode-input")
_wifi_text_locator = (By.ID, 'wifi-desc')
_gps_enabled_locator = (By.XPATH, "//input[@name='geolocation.enabled']")
_gps_switch_locator = (By.XPATH, "//input[@name='geolocation.enabled']/..")
Expand All @@ -30,13 +31,17 @@ class Settings(Base):

def launch(self):
Base.launch(self)
self.wait_for_element_displayed(*self._airplane_switch_locator)
checkbox = self.marionette.find_element(*self._airplane_checkbox_locator)
self.wait_for_condition(lambda m: checkbox.is_enabled())

def enable_airplane_mode(self):
self.marionette.find_element(*self._airplane_switch_locator).tap()
def toggle_airplane_mode(self):
checkbox = self.marionette.find_element(*self._airplane_checkbox_locator)
label = self.marionette.find_element(*self._airplane_switch_locator)

def disable_airplane_mode(self):
self.marionette.find_element(*self._airplane_switch_locator).tap()
checkbox_state = checkbox.is_selected()

label.tap()
self.wait_for_condition(lambda m: checkbox_state is not checkbox.is_selected())

def enable_gps(self):
self.marionette.find_element(*self._gps_switch_locator).tap()
Expand Down
Expand Up @@ -10,6 +10,7 @@ class TestAirplaneMode(GaiaTestCase):

def setUp(self):
GaiaTestCase.setUp(self)
self.data_layer.disable_wifi()
self.data_layer.connect_to_cell_data()
self.data_layer.connect_to_wifi()
self.data_layer.set_setting('geolocation.enabled', 'true')
Expand All @@ -20,7 +21,7 @@ def test_toggle_airplane_mode(self):
settings.launch()

# Switch on Airplane mode
settings.enable_airplane_mode()
settings.toggle_airplane_mode()

# wait for Cell Data to be disabled, this takes the longest when airplane mode is switched on
self.wait_for_condition(lambda s: 'SIM card not ready' in settings.cell_data_menu_item_description)
Expand All @@ -38,10 +39,10 @@ def test_toggle_airplane_mode(self):
self.apps.switch_to_displayed_app()

# Switch off Airplane mode
settings.disable_airplane_mode()
settings.toggle_airplane_mode()

#wait for wifi to be connected, because this takes the longest to connect after airplane mode is switched off
self.wait_for_condition(lambda s: 'Connected' in settings.wifi_menu_item_description)
# Wait for wifi to be connected, because this takes the longest to connect after airplane mode is switched off
self.wait_for_condition(lambda s: 'Connected' in settings.wifi_menu_item_description, timeout=40)

# check Wifi is enabled
self.assertTrue(self.data_layer.is_wifi_connected(self.testvars['wifi']), "WiFi was not connected after switching off Airplane mode")
Expand Down

0 comments on commit e284dba

Please sign in to comment.