当前位置: 首页>>代码示例>>Python>>正文


Python Ftu.toggle_geolocation方法代码示例

本文整理汇总了Python中gaiatest.apps.ftu.app.Ftu.toggle_geolocation方法的典型用法代码示例。如果您正苦于以下问题:Python Ftu.toggle_geolocation方法的具体用法?Python Ftu.toggle_geolocation怎么用?Python Ftu.toggle_geolocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gaiatest.apps.ftu.app.Ftu的用法示例。


在下文中一共展示了Ftu.toggle_geolocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestFtu

# 需要导入模块: from gaiatest.apps.ftu.app import Ftu [as 别名]
# 或者: from gaiatest.apps.ftu.app.Ftu import toggle_geolocation [as 别名]
class TestFtu(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        # Reset timezone.user-selected setting as we change this in our testvars
        self.data_layer.set_setting('time.timezone.user-selected', None)

        self.ftu = Ftu(self.marionette)
        self.ftu.launch()

        # If mozWifiManager is not initialised an exception may be thrown
        Wait(self.marionette).until(lambda m: self.data_layer.is_wifi_enabled)

    def test_ftu_skip_tour(self):
        """
        https://moztrap.mozilla.org/manage/case/6119/
        """
        ssid = self.testvars['wifi']['ssid']
        psk = self.testvars['wifi'].get('psk')
        keymanagement = self.testvars['wifi'].get('keyManagement')
        share_data_default = True
        geolocation_default = True

        # Assume a SIM is present if we assigned a phone number
        # Don't trust internal API for this, since it's an external condition
        has_a_sim = bool(self.environment.phone_numbers)

        self.wait_for_condition(lambda m: self.ftu.languages_list > 0, message="No languages listed on screen")

        # select en-US due to the condition of this test is only for en-US
        self.ftu.tap_language("en-US")

        # If a SIM is present, the cell data screen comes up
        if has_a_sim:
            self.ftu.tap_next_to_cell_data_section()
            # Tap enable data if connection is also present. You might have
            # a SIM, but without a valid connection.
            if self.device.has_mobile_connection:
                self.ftu.enable_data()
                self.wait_for_condition(
                    lambda m: self.data_layer.is_cell_data_connected,
                    message='Cell data was not connected by FTU app')

        # Tap next
        self.ftu.tap_next_to_wifi_section()
        self.ftu.wait_for_networks_available()
        self.ftu.connect_to_wifi(ssid, psk, keymanagement)
        Wait(self.marionette, timeout=60, ignored_exceptions=StaleElementException).until(
            lambda m: 'connected' in m.find_element(
                By.CSS_SELECTOR,
                '#networks-list li[data-ssid="%s"] aside' %
                self.testvars['wifi']['ssid']).get_attribute('class'))

        self.assertTrue(self.data_layer.is_wifi_connected(self.testvars['wifi']),
                        "WiFi was not connected via FTU app")

        self.apps.switch_to_displayed_app()

        # Set timezone if there's no connection
        if not self.device.has_mobile_connection:
            self.ftu.tap_next_to_timezone_section()
            # UTC-05:00 America/New York is the default info if no network is detected
            self.assertEqual(self.ftu.timezone_title, "UTC-05:00 America/New York")
            self.ftu.set_timezone_continent("Asia")
            self.ftu.set_timezone_city("Almaty")
            self.assertEqual(self.ftu.timezone_title, "UTC+06:00 Asia/Almaty")

        # Verify Geolocation section appears
        self.ftu.tap_next_to_geolocation_section()

        # Verify the "geolocation" option matches expected initial state
        # There's a very small lag on this after the dialog appears.
        Wait(self.marionette).until(
            lambda m: self.ftu.is_geolocation_enabled == geolocation_default,
            message="Geolocation state should match initial internal state")

        # Verify that internal state matches UI state
        self.assertEqual(self.data_layer.get_setting(
            'geolocation.enabled'), self.ftu.is_geolocation_enabled,
            msg='Geolocation internal state should match UI state')

        # Toggle geolocation and verify that it also toggled internal state
        self.ftu.toggle_geolocation()
        self.assertEqual(self.data_layer.get_setting(
            'geolocation.enabled'), not geolocation_default,
            msg='Geolocation internal state should be changed by UI')
        self.ftu.tap_next_to_import_contacts_section()

        # If there's a SIM, try importing from it
        if has_a_sim:
            # You can do this as many times as you like without db conflict
            self.ftu.tap_import_from_sim()
            self.ftu.wait_for_contacts_imported()
            self.assertEqual(self.ftu.count_imported_contacts, len(self.data_layer.all_contacts))

            # all_contacts switches to top frame; Marionette needs to be switched back to ftu
            self.apps.switch_to_displayed_app()

        self.ftu.tap_next_to_firefox_accounts_section()
#.........这里部分代码省略.........
开发者ID:WilliamMolina,项目名称:gaia,代码行数:103,代码来源:test_ftu_skip_tour.py


注:本文中的gaiatest.apps.ftu.app.Ftu.toggle_geolocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。