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 #30904 from mwargers/1182284
Browse files Browse the repository at this point in the history
Bug 1182284 - Fix failure in test_settings_bluetooth.py
  • Loading branch information
mwargers committed Jul 10, 2015
2 parents 8b2b38f + dc35b76 commit c4c2164
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@

class Bluetooth(Base):

_bluetooth_checkbox_locator = (By.CSS_SELECTOR, '#bluetooth-status input')
_bluetooth_label_locator = (By.CSS_SELECTOR, '#bluetooth-status span')
_bluetooth_checkbox_locator = (By.CSS_SELECTOR, '#bluetooth_v2 .bluetooth-status input')
_bluetooth_label_locator = (By.CSS_SELECTOR, '#bluetooth_v2 .bluetooth-status span')

_visible_to_all_checkbox_locator = (By.CSS_SELECTOR, '#device-visible input')
_visible_to_all_label_locator = (By.CSS_SELECTOR, '#device-visible span')
_visible_to_all_checkbox_locator = (By.CSS_SELECTOR, '#bluetooth_v2 .device-visible input')
_visible_to_all_label_locator = (By.CSS_SELECTOR, '#bluetooth_v2 .device-visible label')

_device_name_locator = (By.ID, 'bluetooth-device-name')
_rename_my_device_button_locator = (By.ID, 'rename-device')
_update_device_name_form_locator = (By.ID, 'update-device-name')
_update_device_name_input_locator = (By.ID, 'update-device-name-input')
_update_device_name_ok_locator = (By.ID, 'update-device-name-confirm')
_device_name_locator = (By.CSS_SELECTOR, '.bluetooth-device-name')
_rename_my_device_button_locator = (By.CSS_SELECTOR, 'button.rename-device')
_update_device_name_input_locator = (By.CSS_SELECTOR, 'input.settings-dialog-input')
_update_device_name_ok_locator = (By.CSS_SELECTOR, 'button[data-l10n-id="ok"]')

@property
def is_bluetooth_enabled(self):
Expand Down Expand Up @@ -49,7 +48,7 @@ def enable_visible_to_all(self):
def tap_rename_my_device(self):
self.marionette.find_element(*self._rename_my_device_button_locator).tap()
Wait(self.marionette).until(
expected.element_displayed(*self._update_device_name_form_locator))
expected.element_displayed(*self._update_device_name_input_locator))

def type_phone_name(self, name):
element = self.marionette.find_element(
Expand All @@ -58,7 +57,6 @@ def type_phone_name(self, name):
element.send_keys(name)

def tap_update_device_name_ok(self):
element = Wait(self.marionette).until(
expected.element_present(*self._update_device_name_form_locator))
self.marionette.find_element(*self._update_device_name_ok_locator).tap()
element = self.marionette.find_element(*self._update_device_name_ok_locator)
element.tap()
Wait(self.marionette).until(expected.element_not_displayed(element))
5 changes: 0 additions & 5 deletions tests/python/gaia-ui-tests/gaiatest/gaia_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,26 +319,21 @@ def set_volume(self, value):
self.set_setting('audio.volume.%s' % channel, value)

def bluetooth_enable(self):
self.marionette.switch_to_frame()
return self.marionette.execute_async_script("return GaiaDataLayer.enableBluetooth()")

def bluetooth_disable(self):
self.marionette.switch_to_frame()
return self.marionette.execute_async_script("return GaiaDataLayer.disableBluetooth()")

@property
def bluetooth_is_enabled(self):
self.marionette.switch_to_frame()
return self.marionette.execute_script("return GaiaDataLayer.getBluetoothDefaultAdapter().state === 'enabled'")

@property
def bluetooth_is_discoverable(self):
self.marionette.switch_to_frame()
return self.marionette.execute_script("return GaiaDataLayer.getBluetoothDefaultAdapter().discoverable")

@property
def bluetooth_name(self):
self.marionette.switch_to_frame()
return self.marionette.execute_script("return GaiaDataLayer.getBluetoothDefaultAdapter().name")

@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def test_toggle_bluetooth_settings(self):
settings.launch()

self.assertFalse(self.data_layer.bluetooth_is_enabled)
self.assertFalse(self.data_layer.get_setting('bluetooth.visible'))

bluetooth_settings = settings.open_bluetooth_settings()
bluetooth_settings.enable_bluetooth()
Expand All @@ -36,6 +35,5 @@ def test_toggle_bluetooth_settings(self):

bluetooth_settings.enable_visible_to_all()

self.assertTrue(self.data_layer.get_setting('bluetooth.visible'))
self.assertTrue(self.data_layer.bluetooth_is_discoverable)
self.assertEquals(self.data_layer.bluetooth_name, device_name)

0 comments on commit c4c2164

Please sign in to comment.