本文整理汇总了Python中gaiatest.apps.cost_control.app.CostControl.launch方法的典型用法代码示例。如果您正苦于以下问题:Python CostControl.launch方法的具体用法?Python CostControl.launch怎么用?Python CostControl.launch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaiatest.apps.cost_control.app.CostControl
的用法示例。
在下文中一共展示了CostControl.launch方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cost_control_reset_wifi
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_reset_wifi(self):
self.data_layer.connect_to_wifi()
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
cost_control.toggle_mobile_data_tracking(False)
cost_control.toggle_wifi_data_tracking(True)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch()
search.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')
self.data_layer.disable_wifi()
time.sleep(5)
# go back to Cost Control
cost_control.launch()
# if we can't trigger any data usage, there must be something wrong
self.assertNotEqual(cost_control.wifi_data_usage_figure, u'0.00 B', 'No data usage shown after browsing.')
# # go to settings section
settings = cost_control.tap_settings()
settings.reset_wifi_usage()
settings.tap_done()
# wait for usage to be refreshed
self.wait_for_condition(
lambda m: cost_control.wifi_data_usage_figure == u'0.00 B',
message='Wifi usage did not reset back to 0.00 B')
示例2: test_cost_control_data_alert_mobile
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_data_alert_mobile(self):
"""https://moztrap.mozilla.org/manage/case/8938/"""
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
self.assertFalse(cost_control.is_wifi_data_tracking_on)
settings = cost_control.tap_settings()
self.assertFalse(settings.is_data_alert_switch_checked)
settings.toggle_data_alert_switch()
self.assertTrue(settings.is_data_alert_switch_checked)
settings.reset_mobile_usage()
settings.select_when_use_is_above_unit_and_value(u'MB', '0.1')
settings.tap_done()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch(launch_timeout=30000)
browser = search.go_to_url('http://mozqa.com/qa-testcase-data/Images/sample_png_02.png')
browser.wait_for_page_to_load(180)
browser.switch_to_content()
Wait(self.marionette, timeout=60).until(lambda m: "sample_png_02.png" in m.title)
browser.switch_to_chrome()
system = System(self.marionette)
utility_tray = system.open_utility_tray()
utility_tray.wait_for_notification_container_displayed()
# switch to cost control widget
usage_iframe = self.marionette.find_element(*self._cost_control_widget_locator)
self.marionette.switch_to_frame(usage_iframe)
# make sure the color changed
# The timeout is increased, because for some reason, it takes some time
# before the limit view is shown (the browser has to finish loading?)
usage_view = self.marionette.find_element(*self._data_usage_view_locator)
Wait(self.marionette, timeout=40).until(lambda m: 'reached-limit' in usage_view.get_attribute('class'),
message='Data usage bar did not breach limit')
usage_view.tap()
self.wait_for_condition(lambda m: self.apps.displayed_app.name == cost_control.name)
示例3: test_cost_control_ftu
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_ftu(self):
cost_control = CostControl(self.marionette)
cost_control.launch()
ftu_step1 = cost_control.ftu_step1
ftu_step2 = ftu_step1.tap_next()
ftu_step2.select_reset_report_value('Weekly')
ftu_step3 = ftu_step2.tap_next()
ftu_step3.toggle_data_alert_switch(True)
ftu_step3.select_when_use_is_above_unit_and_value('MB', '0.1')
ftu_step3.tap_lets_go()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
示例4: test_cost_control_ftu
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_ftu(self):
cost_control = CostControl(self.marionette)
cost_control.launch()
# This will switch to ftu iframe
cost_control.switch_to_ftu()
ftu_step1 = cost_control.ftu_step1
ftu_step2 = ftu_step1.tap_next()
ftu_step2.select_reset_report_value('Weekly')
ftu_step3 = ftu_step2.tap_next()
ftu_step3.toggle_data_alert_switch(True)
ftu_step3.select_when_use_is_above_unit_and_value(u'MB', '0.1')
ftu_step3.tap_lets_go()
self.marionette.switch_to_frame(self.apps.displayed_app.frame)
self.assertTrue(cost_control.is_mobile_data_tracking_on)
示例5: test_cost_control_data_alert_mobile
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_data_alert_mobile(self):
"""https://moztrap.mozilla.org/manage/case/8938/"""
self.data_layer.connect_to_cell_data()
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
self.assertFalse(cost_control.is_wifi_data_tracking_on)
settings = cost_control.tap_settings()
settings.toggle_data_alert_switch(True)
settings.select_when_use_is_above_unit_and_value(u'MB', '0.1')
settings.reset_mobile_usage()
settings.tap_done()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
# open browser to get some data downloaded
browser = Browser(self.marionette)
browser.launch()
browser.go_to_url('http://developer.mozilla.org/', timeout=120)
browser.switch_to_content()
self.wait_for_element_present(*self._page_body_locator, timeout=120)
browser.switch_to_chrome()
# get the notification bar
self.marionette.switch_to_frame()
self.marionette.execute_script("window.wrappedJSObject.UtilityTray.show()")
# switch to cost control widget
usage_iframe = self.marionette.find_element(*self._cost_control_widget_locator)
self.marionette.switch_to_frame(usage_iframe)
# make sure the color changed
self.wait_for_condition(
lambda m: 'reached-limit' in self.marionette.find_element(
*self._data_usage_view_locator).get_attribute('class'),
message='Data usage bar did not breach limit')
示例6: test_cost_control_reset_wifi
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_reset_wifi(self):
self.data_layer.connect_to_wifi()
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.run_ftu_accepting_defaults()
cost_control.toggle_mobile_data_tracking(False)
cost_control.toggle_wifi_data_tracking(True)
# open browser to get some data downloaded
# please remove this once there is a better way than launching browser app/obj to do so
browser = Browser(self.marionette)
browser.launch()
browser.go_to_url('http://mozqa.com/data/firefox/layout/mozilla.html')
browser.switch_to_content()
self.wait_for_element_present(*self._page_title_locator)
# go back to Cost Control
cost_control.launch()
# if we can't trigger any data usage, there must be something wrong
self.assertNotEqual(cost_control.wifi_data_usage_figure, u'0.00 B', 'No data usage shown after browsing.')
# disable wifi before reset data, wait for wifi to be closed, and switch back to the app
self.data_layer.disable_wifi()
time.sleep(1)
cost_control.launch()
# # go to settings section
settings = cost_control.tap_settings()
settings.reset_data_usage()
settings.tap_done()
# wait for usage to be refreshed
self.wait_for_condition(lambda m: cost_control.wifi_data_usage_figure == u'0.00 B', message='Wifi usage did not reset back to 0.00 B')
示例7: test_cost_control_reset_wifi
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_reset_wifi(self):
self.data_layer.connect_to_wifi()
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
cost_control.toggle_mobile_data_tracking(False)
cost_control.toggle_wifi_data_tracking(True)
# If we don't kill the app manually it might get killed by the oom process.
# In that case when we re-launch the app it has a hash attached at the end of the src. - Bug 1091676
self.apps.kill(cost_control.app)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch()
search.go_to_url(self.marionette.absolute_url('mozilla.html'))
self.data_layer.disable_wifi()
time.sleep(5)
# go back to Cost Control
cost_control.launch()
# if we can't trigger any data usage, there must be something wrong
self.assertNotEqual(cost_control.wifi_data_usage_figure, u'0.00 B', 'No data usage shown after browsing.')
# # go to settings section
settings = cost_control.tap_settings()
settings.reset_wifi_usage()
settings.tap_done()
# wait for usage to be refreshed
self.wait_for_condition(
lambda m: cost_control.wifi_data_usage_figure == u'0.00 B',
message='Wifi usage did not reset back to 0.00 B')
示例8: test_cost_control_ftu
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_ftu(self):
cost_control = CostControl(self.marionette)
cost_control.launch()
# This will switch to ftu iframe
cost_control.switch_to_ftu()
from gaiatest.apps.cost_control.regions.ftu_step1 import FTUStep1
ftu_step1 = FTUStep1(self.marionette)
ftu_step2 = ftu_step1.tap_next()
ftu_step2.select_reset_report_value('Weekly')
ftu_step3 = ftu_step2.tap_next()
ftu_step3.enable_data_alert_toggle()
ftu_step3.select_when_use_is_above_unit_and_value(u'MB', '0.1')
ftu_step3.tap_lets_go()
self.apps.switch_to_displayed_app()
self.wait_for_condition(
lambda m: cost_control.is_mobile_data_tracking_on)
示例9: test_cost_control_data_alert_mobile
# 需要导入模块: from gaiatest.apps.cost_control.app import CostControl [as 别名]
# 或者: from gaiatest.apps.cost_control.app.CostControl import launch [as 别名]
def test_cost_control_data_alert_mobile(self):
"""https://moztrap.mozilla.org/manage/case/8938/"""
cost_control = CostControl(self.marionette)
cost_control.launch()
cost_control.switch_to_ftu()
cost_control.run_ftu_accepting_defaults()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
self.assertFalse(cost_control.is_wifi_data_tracking_on)
settings = cost_control.tap_settings()
self.assertFalse(settings.is_data_alert_switch_checked)
settings.toggle_data_alert_switch()
self.assertTrue(settings.is_data_alert_switch_checked)
settings.reset_mobile_usage()
settings.select_when_use_is_above_unit_and_value(u'MB', '0.1')
settings.tap_done()
self.assertTrue(cost_control.is_mobile_data_tracking_on)
# open browser to get some data downloaded
search = Search(self.marionette)
search.launch(launch_timeout=30000)
search.go_to_url('http://mozqa.com/qa-testcase-data/Images/sample_png_02.png')
system = System(self.marionette)
# We could have waited on the page to be loaded, but the toaster can appear before
# the end of the load. That's why the timeout is expanded, the webpage loaded just above
# might take longer.
system.wait_for_notification_toaster_displayed(timeout=180)
system.wait_for_notification_toaster_not_displayed()
utility_tray = system.open_utility_tray()
utility_tray.wait_for_notification_container_displayed()
cost_control_widget = utility_tray.cost_control_widget
cost_control_widget.wait_for_limit_to_be_reached()
cost_control_widget.tap()
Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == cost_control.name)