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

Python marionette_harness.MarionetteTestCase类代码示例

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

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



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

示例1: setUp

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

        self.TEST_URL = "https://www.mediawiki.org/wiki/MediaWiki"

        self.ATTRIBUTES = {
                "navigationStart": 0,
                "unloadEventStart": 0,
                "unloadEventEnd": 0,
                "redirectStart": 0,
                "redirectEnd": 0,
                "fetchStart": 0,
                "domainLookupStart": 0,
                "domainLookupEnd": 0,
                "connectStart": 0,
                "connectEnd": 0,
                "secureConnectionStart": 0,
                "requestStart": 0,
                "responseStart": 0,
                "responseEnd": 0,
                "domLoading": 0,
                "domInteractive": 0,
                "domContentLoadedEventStart": 0,
                "domContentLoadedEventEnd": 0,
                "domComplete": 0,
                "loadEventStart": 0,
                "loadEventEnd": 0,
                }
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:28,代码来源:test_navigation-timing.py


示例2: tearDown

    def tearDown(self):
        self.logger.info("tearing down!")
        MarionetteTestCase.tearDown(self)
        self.logger.info("tearing down webservers!")
        self._webservers.stop()

        self.logger.info("processing data in %s!" % self._resultsDir)
        perf_blob = process_perf_data.create_perf_data(self._resultsDir)
        self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob))

        perf_file = os.path.join(self._resultsDir, "perfherder_data.json")
        with open(perf_file, 'w') as fp:
            json.dump(perf_blob, fp, indent=2)
        self.logger.info("Perfherder data written to %s" % perf_file)

        if self._dmd:
            self.cleanup_dmd()

        # copy it to moz upload dir if set
        if 'MOZ_UPLOAD_DIR' in os.environ:
            for file in os.listdir(self._resultsDir):
                file = os.path.join(self._resultsDir, file)
                if os.path.isfile(file):
                    shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])

        self.logger.info("done tearing down!")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:26,代码来源:test_memory_usage.py


示例3: 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
            self.runCode("""
              let name = arguments[0];
              let profile = global.profSvc.getProfileByName(name);
              profile.remove(false)
              global.profSvc.flush();
            """, script_args=(self.profileNameToRemove,))
            # And delete all the files.
            shutil.rmtree(self.reset_profile_path, ignore_errors=False, onerror=handleRemoveReadonly)
开发者ID:kinetiknz,项目名称:gecko-dev,代码行数:33,代码来源:test_refresh_firefox.py


示例4: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        self.URL = 'https://pinning-test.badssl.com/'
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:7,代码来源:test_pinning.py


示例5: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        self.URL = "file://%s/testfile.pdf" % ts.t['options']['test_data_dir']
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:7,代码来源:test_download_pdf.py


示例6: tearDown

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

        self.marionette.clear_pref("startup.homepage_welcome_url")

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


示例7: 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:luke-chang,项目名称:gecko-1,代码行数:8,代码来源:test_cookies.py


示例8: setUp

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

        self.reset_profile_path = None
        self.desktop_backup_path = None

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


示例9: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        self.http_url = "%s/noscript/" % ts.t['options']['test_data_url']
        self.https_url = "%s/noscript/" % ts.t['options']['test_data_url_https']
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:8,代码来源:test_noscript.py


示例10: 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:Wafflespeanut,项目名称:gecko-dev,代码行数:8,代码来源:test_profile_management.py


示例11: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        self.HTTP_URL = "http://httpbin.org/"
        self.HTTPS_URL = "https://httpbin.org/"
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:8,代码来源:test_https-everywhere.py


示例12: setUp

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

        # shortcuts to improve readability of these tests
        self.chrome = self.marionette.CONTEXT_CHROME
        self.content = self.marionette.CONTEXT_CONTENT

        test_url = self.marionette.absolute_url("empty.html")
        self.marionette.navigate(test_url)
        self.marionette.set_context(self.content)
        self.assertEquals(self.get_context(), self.content)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:11,代码来源:test_with_using_context.py


示例13: setUp

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

        self.pid = self.marionette.process_id
        self.session_id = self.marionette.session_id

        # Use a preference to check that the restart was successful. If its
        # value has not been forced, a restart will cause a reset of it.
        self.assertNotEqual(self.marionette.get_pref("startup.homepage_welcome_url"),
                            "about:")
        self.marionette.set_pref("startup.homepage_welcome_url", "about:")
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:11,代码来源:test_quit_restart.py


示例14: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        self.test_page_url = ts.t['test']['fpcentral_url']

        if 'timeout' in ts.t['test']:
            self.timeout = ts.t['test']['timeout']
        else:
            self.timeout = 50000
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:12,代码来源:test_fpcentral.py


示例15: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.max = self.marionette.execute_script("""
            return {
              width: window.screen.availWidth,
              height: window.screen.availHeight,
            }""", sandbox=None)

        # ensure window is not fullscreen
        actual = self.marionette.set_window_rect(
            width=self.max["width"] - 100, height=self.max["height"] - 100)
        self.assertNotEqual(actual["width"], self.max["width"])
        self.assertNotEqual(actual["height"], self.max["height"])

        self.original_size = actual
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:15,代码来源:test_window_fullscreen.py


示例16: setUp

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

        ts = testsuite.TestSuite()
        self.ts = ts

        if ts.t['test']['remote']:
            test_data_url = ts.t['options']['test_data_url']
        else:
            test_data_url = "file://%s" % ts.t['options']['test_data_dir']
        self.test_page_url = '%s/%s.html' % (test_data_url, ts.t['test']['name'])

        if ts.t['test']['timeout']:
            self.timeout = ts.t['test']['timeout']
        else:
            self.timeout = 50000
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:16,代码来源:test_page.py


示例17: setUp

    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.logger = mozlog.structured.structuredlog.get_default_logger()
        self.logger.info("setting up!")

        self.marionette.set_context('chrome')

        self._webroot_dir = self.testvars["webRootDir"]
        self._resultsDir = self.testvars["resultsDir"]
        # Be conservative in what we delete automatically.
        for f in glob.glob(os.path.join(self._resultsDir, 'memory-report-*.json.gz')):
            os.unlink(f)
        for f in glob.glob(os.path.join(self._resultsDir, 'perfherder_data.json')):
            os.unlink(f)
        for f in glob.glob(os.path.join(self._resultsDir, 'dmd-*.json.gz')):
            os.unlink(f)

        self._urls = []

        urls = None
        default_tp5n_manifest = os.path.join(self._webroot_dir, 'page_load_test', 'tp5n',
                                             'tp5n.manifest')
        tp5n_manifest = self.testvars.get("pageManifest", default_tp5n_manifest)
        with open(tp5n_manifest) as fp:
            urls = fp.readlines()
        urls = map(lambda x:x.replace('localhost', 'localhost:{}'), urls)

        # Optional testvars.
        self._pages_to_load = self.testvars.get("entities", len(urls))
        self._iterations = self.testvars.get("iterations", ITERATIONS)
        self._perTabPause = self.testvars.get("perTabPause", PER_TAB_PAUSE)
        self._settleWaitTime = self.testvars.get("settleWaitTime", SETTLE_WAIT_TIME)
        self._maxTabs = self.testvars.get("maxTabs", MAX_TABS)
        self._dmd = self.testvars.get("dmd", False)

        self._webservers = webservers.WebServers("localhost",
                                                 8001,
                                                 self._webroot_dir,
                                                 self._pages_to_load)
        self._webservers.start()
        for url, server in zip(urls, self._webservers.servers):
            self._urls.append(url.strip().format(server.port))

        self.logger.info("areweslimyet run by %d pages, %d iterations, %d perTabPause, %d settleWaitTime"
                         % (self._pages_to_load, self._iterations, self._perTabPause, self._settleWaitTime))
        self.reset_state()
        self.logger.info("done setting up!")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:47,代码来源:test_memory_usage.py


示例18: setUp

 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.timeout.implicit = 0
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:3,代码来源:test_element_retrieval.py


示例19: setUp

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

        self.TEST_URL = "https://www.mediawiki.org/wiki/MediaWiki"
        self.RESOURCE_URL = "https://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png"
开发者ID:boklm,项目名称:tbb-testsuite,代码行数:5,代码来源:test_user-timing.py


示例20: tearDown

 def tearDown(self):
     self.marionette.delete_all_cookies()
     MarionetteTestCase.tearDown(self)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_cookies.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python marionette_test.MarionetteTestCase类代码示例发布时间:2022-05-27
下一篇:
Python wait.Wait类代码示例发布时间: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