本文整理汇总了Python中marionette_harness.MarionetteTestCase类的典型用法代码示例。如果您正苦于以下问题:Python MarionetteTestCase类的具体用法?Python MarionetteTestCase怎么用?Python MarionetteTestCase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MarionetteTestCase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,
}
示例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!")
示例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)
示例4: setUp
def setUp(self):
MarionetteTestCase.setUp(self)
ts = testsuite.TestSuite()
self.ts = ts
self.URL = 'https://pinning-test.badssl.com/'
示例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']
示例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)
示例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}
示例8: setUp
def setUp(self):
MarionetteTestCase.setUp(self)
self.setUpScriptData()
self.reset_profile_path = None
self.desktop_backup_path = None
self.createProfileData()
示例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']
示例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")
示例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/"
示例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)
示例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:")
示例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
示例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