Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Errors
- This test gets skipped with pattern: !manage_instance
- This test failed 1 times in the preceding 30 days. quicksearch this test
- Manifest: testing/marionette/harness/marionette_harness/tests/unit/unit-tests.toml
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
import copy
import requests
from marionette_harness import MarionetteTestCase
class TestCommandLineArguments(MarionetteTestCase):
def setUp(self):
super(TestCommandLineArguments, self).setUp()
self.orig_arguments = copy.copy(self.marionette.instance.app_args)
def tearDown(self):
self.marionette.instance.app_args = self.orig_arguments
self.marionette.quit(in_app=False, clean=True)
super(TestCommandLineArguments, self).tearDown()
def test_debugger_address_cdp_status(self):
# By default Remote Agent is not enabled
debugger_address = self.marionette.session_capabilities.get(
"moz:debuggerAddress"
)
self.assertIsNone(debugger_address)
# With CDP enabled the capability has to be returned
self.marionette.set_pref("remote.active-protocols", 2)
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port")
self.marionette.start_session()
debugger_address = self.marionette.session_capabilities.get(
"moz:debuggerAddress"
)
self.assertEqual(debugger_address, "127.0.0.1:9222")
self.assertTrue(result.ok)
# With BiDi only enabled the capability shouldn't be returned
self.marionette.clear_pref("remote.active-protocols")
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port")
self.marionette.start_session()
debugger_address = self.marionette.session_capabilities.get(
"moz:debuggerAddress"
)
self.assertIsNone(debugger_address)
# Clean the profile so that the preference is definitely reset.
self.marionette.quit(in_app=False, clean=True)
def test_websocket_url(self):
# By default Remote Agent is not enabled
self.assertNotIn("webSocketUrl", self.marionette.session_capabilities)
# With CDP enabled the capability is not returned
self.marionette.set_pref("remote.active-protocols", 2)
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port")
self.marionette.start_session({"webSocketUrl": True})
self.assertNotIn("webSocketUrl", self.marionette.session_capabilities)
# With BiDi only enabled the capability is returned
self.marionette.clear_pref("remote.active-protocols")
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port")
self.marionette.start_session({"webSocketUrl": True})
session_id = self.marionette.session_id
websocket_url = self.marionette.session_capabilities.get("webSocketUrl")
self.assertEqual(
)
# Clean the profile so that the preference is definitely reset.
self.marionette.quit(in_app=False, clean=True)
# An issue in the command line argument handling lead to open Firefox on
# random URLs when remote-debugging-port is set to an explicit value, on macos.
def test_start_page_about_blank(self):
self.marionette.quit()
self.marionette.instance.app_args.append("-remote-debugging-port=0")
self.marionette.start_session({"webSocketUrl": True})
self.assertEqual(self.marionette.get_url(), "about:blank")
def test_startup_timeout(self):
try:
self.marionette.quit()
with self.assertRaisesRegex(IOError, "Process killed after 0s"):
# Use a small enough timeout which should always cause an IOError
self.marionette.start_session(timeout=0)
finally:
self.marionette.start_session()