• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python marionette.MarionetteTestCase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中marionette.MarionetteTestCase的典型用法代码示例。如果您正苦于以下问题:Python MarionetteTestCase类的具体用法?Python MarionetteTestCase怎么用?Python MarionetteTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.__class__ = type('Marionette', (Marionette, MarionetteTouchMixin), {})

        self.device = GaiaDevice(self.marionette)
        if self.restart and (self.device.is_android_build or self.marionette.instance):
            self.device.stop_b2g()
            if self.device.is_android_build:
                # revert device to a clean state
                self.device.manager.removeDir('/data/local/indexedDB')
                self.device.manager.removeDir('/data/b2g/mozilla')
            self.device.start_b2g()

        self.marionette.setup_touch()

        # the emulator can be really slow!
        self.marionette.set_script_timeout(self._script_timeout)
        self.marionette.set_search_timeout(self._search_timeout)
        self.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette, self.testvars)
        from gaiatest.apps.keyboard.app import Keyboard
        self.keyboard = Keyboard(self.marionette)

        self.cleanUp()
开发者ID:malini,项目名称:gaia-ui-tests-1,代码行数:25,代码来源:gaia_test.py


示例2: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.set_context("chrome")
     self.win = self.marionette.current_window_handle
     self.marionette.execute_script(
         "window.open('chrome://marionette/content/test.xul', '_blank', 'chrome,centerscreen');"
     )
开发者ID:weinrank,项目名称:gecko-dev,代码行数:7,代码来源:test_selected_chrome.py


示例3: setUp

    def setUp(self):
        # start server
        self.loop_test_servers = LoopTestServers()

        MarionetteTestCase.setUp(self)
        LoopTestDriver.setUp(self, self.marionette)

        # Although some of these preferences might require restart, we don't
        # use enforce_gecko_prefs (which would restart), as we need to restart
        # for the add-on installation anyway.
        self.marionette.set_prefs(FIREFOX_PREFERENCES)

        xpi_file = os.environ.get("LOOP_XPI_FILE")

        if xpi_file:
            addons = Addons(self.marionette)
            # XXX We should really use temp=True here, but due to the later
            # restart to ensure the add-on is installed correctly, this won't work
            # at the moment. What we need is a fully restartless add-on - bug 1229352
            # at which point we should be able to make this install temporarily
            # and after the restart.
            addons.install(os.path.abspath(xpi_file))

        self.e10s_enabled = os.environ.get("TEST_E10S") == "1"

        # Restart the browser nicely, so the preferences and add-on installation
        # take full effect.
        self.marionette.restart(in_app=True)

        # this is browser chrome, kids, not the content window just yet
        self.marionette.set_context("chrome")
开发者ID:Mardak,项目名称:loop,代码行数:31,代码来源:test_1_browser_call.py


示例4: __init__

 def __init__(self, *args, **kwargs):
     self.restart = kwargs.pop('restart', False)
     self.yocto = kwargs.pop('yocto', False)
     kwargs.pop('iterations', None)
     kwargs.pop('checkpoint_interval', None)
     MarionetteTestCase.__init__(self, *args, **kwargs)
     B2GTestCaseMixin.__init__(self, *args, **kwargs)
开发者ID:AshayNeema,项目名称:gaia,代码行数:7,代码来源:gaia_test.py


示例5: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     if self.marionette.session_capabilities["platformName"] == "Darwin":
         self.mod_key = Keys.META
     else:
         self.mod_key = Keys.CONTROL
     self.action = Actions(self.marionette)
开发者ID:brendandahl,项目名称:positron,代码行数:7,代码来源:test_mouse_action.py


示例6: tearDown

    def tearDown(self):
        # Force yet another restart with a clean profile to disconnect from the
        # profile and environment changes we've made, to leave a more or less
        # blank slate for the next person.
        self.marionette.restart(clean=True, in_app=False)
        self.setUpScriptData()

        # Super
        MarionetteTestCase.tearDown(self)

        # Some helpers to deal with removing a load of files
        import errno, stat
        def handleRemoveReadonly(func, path, exc):
            excvalue = exc[1]
            if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES:
                os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777
                func(path)
            else:
                raise

        if self.desktop_backup_path:
            shutil.rmtree(self.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly)

        if self.reset_profile_path:
            # Remove ourselves from profiles.ini
            profileLeafName = os.path.basename(os.path.normpath(self.reset_profile_path))
            self.runCode("""
              let [salt, name] = arguments[0].split(".");
              let profile = global.profSvc.getProfileByName(name);
              profile.remove(false)
              global.profSvc.flush();
            """, script_args=[profileLeafName])
            # And delete all the files.
            shutil.rmtree(self.reset_profile_path, ignore_errors=False, onerror=handleRemoveReadonly)
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:34,代码来源:test_refresh_firefox.py


示例7: tearDown

    def tearDown(self):
        if any(sys.exc_info()):
            # test has failed, gather debug
            test_class, test_name = self.marionette.test_name.split()[-1].split('.')
            xml_output = self.testvars.get('xml_output', None)
            debug_path = os.path.join(xml_output and os.path.dirname(xml_output) or 'debug', test_class)
            if not os.path.exists(debug_path):
                os.makedirs(debug_path)

            # screenshot
            with open(os.path.join(debug_path, '%s_screenshot.png' % test_name), 'w') as f:
                # TODO: Bug 818287 - Screenshots include data URL prefix
                screenshot = self.marionette.screenshot()[22:]
                f.write(base64.decodestring(screenshot))

            # page source
            with open(os.path.join(debug_path, '%s_source.txt' % test_name), 'w') as f:
                f.write(self.marionette.page_source.encode('utf-8'))

            # settings
            with open(os.path.join(debug_path, '%s_settings.json' % test_name), 'w') as f:
                f.write(json.dumps(self.data_layer.all_settings))

        self.lockscreen = None
        self.apps = None
        self.data_layer = None
        MarionetteTestCase.tearDown(self)
开发者ID:kumar303,项目名称:gaia-ui-tests,代码行数:27,代码来源:gaia_test.py


示例8: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.set_context("chrome")
     self.win = self.marionette.current_window_handle
     self.marionette.execute_script("window.open('chrome://marionette/content/test.xul', 'foo', 'chrome,centerscreen');")
     self.marionette.switch_to_window('foo')
     self.assertNotEqual(self.win, self.marionette.current_window_handle)
开发者ID:MekliCZ,项目名称:positron,代码行数:7,代码来源:test_elementState_chrome.py


示例9: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.__class__ = type("Marionette", (Marionette, MarionetteTouchMixin), {})
        self.marionette.setup_touch()

        # the emulator can be really slow!
        self.marionette.set_script_timeout(60000)
        self.marionette.set_search_timeout(10000)
        self.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette)
        self.keyboard = Keyboard(self.marionette)

        # wifi is true if testvars includes wifi details and wifi manager is defined
        self.wifi = (
            self.testvars
            and "wifi" in self.testvars
            and self.marionette.execute_script("return window.navigator.mozWifiManager !== undefined")
        )

        # device manager
        dm_type = os.environ.get("DM_TRANS", "adb")
        if dm_type == "adb":
            self.device_manager = mozdevice.DeviceManagerADB()
        elif dm_type == "sut":
            host = os.environ.get("TEST_DEVICE")
            if not host:
                raise Exception("Must specify host with SUT!")
            self.device_manager = mozdevice.DeviceManagerSUT(host=host)
        else:
            raise Exception("Unknown device manager type: %s" % dm_type)

        self.cleanUp()
开发者ID:klrmn,项目名称:gaia-ui-tests,代码行数:33,代码来源:gaia_test.py


示例10: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)

        # the emulator can be really slow!
        self.marionette.set_script_timeout(60000)
        self.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
开发者ID:PinZhang,项目名称:gaia-ui-tests,代码行数:7,代码来源:gaia_test.py


示例11: setUp

    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except InvalidResponseException:
            if self.restart:
                pass

        self.device = GaiaDevice(self.marionette, self.testvars)
        if self.restart and (self.device.is_android_build or self.marionette.instance):
            self.device.stop_b2g()
            if self.device.is_android_build:
                # revert device to a clean state
                self.device.manager.removeDir('/data/local/storage/persistent')
                self.device.manager.removeDir('/data/b2g/mozilla')
            self.device.start_b2g()

        # the emulator can be really slow!
        self.marionette.set_script_timeout(self._script_timeout)
        self.marionette.set_search_timeout(self._search_timeout)
        self.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette, self.testvars)
        from gaiatest.apps.keyboard.app import Keyboard
        self.keyboard = Keyboard(self.marionette)

        self.cleanUp()
开发者ID:AmyYLee,项目名称:gaia,代码行数:26,代码来源:gaia_test.py


示例12: tearDown

 def tearDown(self):
     self.marionette.switch_to_frame()
     if self.device.is_desktop_b2g and self.device.storage_path:
         shutil.rmtree(self.device.storage_path, ignore_errors=True)
     self.apps = None
     self.data_layer = None
     MarionetteTestCase.tearDown(self)
开发者ID:strikeX100,项目名称:gaia,代码行数:7,代码来源:gaia_test.py


示例13: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.enforce_gecko_prefs({"dom.webcomponents.enabled": True})
        self.marionette.navigate(self.marionette.absolute_url("test_shadow_dom.html"))

        self.host = self.marionette.find_element(By.ID, "host")
        self.marionette.switch_to_shadow_root(self.host)
        self.button = self.marionette.find_element(By.ID, "button")
开发者ID:MekliCZ,项目名称:positron,代码行数:8,代码来源:test_shadow_dom.py


示例14: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.enforce_gecko_prefs(
         {"marionette.test.bool": True,
          "marionette.test.string": "testing",
          "marionette.test.int": 3
          })
     self.marionette.set_context("chrome")
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:8,代码来源:test_profile_management.py


示例15: tearDown

    def tearDown(self):
        # Ensure to restart a session if none exist for clean-up
        if not self.marionette.session:
            self.marionette.start_session()

        self.marionette.clear_pref("browser.startup.page")

        MarionetteTestCase.tearDown(self)
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:8,代码来源:test_quit_restart.py


示例16: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.setUpScriptData()

        self.reset_profile_path = None
        self.desktop_backup_path = None

        self.createProfileData()
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:8,代码来源:test_refresh_firefox.py


示例17: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)

        self.pid = self.marionette.session["processId"]
        self.session_id = self.marionette.session_id

        self.assertNotEqual(self.marionette.get_pref("browser.startup.page"), 3)
        self.marionette.set_pref("browser.startup.page", 3)
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:8,代码来源:test_quit_restart.py


示例18: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     test_url = self.marionette.absolute_url('test.html')
     self.marionette.navigate(test_url)
     self.COOKIE_A = {"name": "foo",
                      "value": "bar",
                      "path": "/",
                      "secure": False}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:8,代码来源:test_cookies.py


示例19: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        if self.marionette.session_capabilities['platformName'] == 'darwin':
            self.mod_key = Keys.META
        else:
            self.mod_key = Keys.CONTROL

        self.remote_uri = self.marionette.absolute_url("javascriptPage.html")
        self.marionette.navigate(self.remote_uri)
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:9,代码来源:test_about_pages.py


示例20: setUp

    def setUp(self):
        # Code to execute before a tests are run.
        MarionetteTestCase.setUp(self)
        self.actions = Actions(self.marionette)

        # The carets to be tested.
        self.carets_tested_pref = None

        # The carets to be disabled in this test suite.
        self.carets_disabled_pref = None
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:10,代码来源:test_selectioncarets2.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python marionette.MemoryEnduranceTestCaseMixin类代码示例发布时间:2022-05-27
下一篇:
Python marionette.Marionette类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap