コード例 #1
0
 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');"
     )
コード例 #2
0
 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)
コード例 #3
0
    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except (InvalidResponseException, IOError):
            if self.restart:
                pass

        self.environment = GaiaTestEnvironment(self.testvars)
        self.device = GaiaDevice(self.marionette, manager=self.device_manager, testvars=self.testvars)

        if self.restart and (self.device.is_android_build or self.marionette.instance):
            # Restart if it's a device, or we have passed a binary instance with --binary command arg
            self.device.stop_b2g()
            if self.device.is_android_build:
                self.cleanup_data()
            self.device.start_b2g()

        # Run the fake update checker
        FakeUpdateChecker(self.marionette).check_updates()

        # We need to set the default timeouts because we may have a new session
        if self.marionette.timeout is None:
            # if no timeout is passed in, we detect the hardware type and set reasonable defaults
            timeouts = {}
            if self.device.is_desktop_b2g:
                self.marionette.timeout = 5000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 5000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 10000
                timeouts[self.marionette.TIMEOUT_PAGE] = 10000
            elif self.device.is_emulator:
                self.marionette.timeout = 30000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 30000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 60000
                timeouts[self.marionette.TIMEOUT_PAGE] = 60000
            else:
                # else, it is a device, the type of which is difficult to detect
                self.marionette.timeout = 10000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 10000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 20000
                timeouts[self.marionette.TIMEOUT_PAGE] = 20000

            for k, v in timeouts.items():
                self.marionette.timeouts(k, v)

        else:
            # if the user has passed in --timeout then we override everything
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, self.marionette.timeout)

        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette, self.testvars)
        self.accessibility = Accessibility(self.marionette)

        self.cleanup_storage()

        if self.restart:
            self.cleanup_gaia(full_reset=False)
        else:
            self.cleanup_gaia(full_reset=True)
コード例 #4
0
ファイル: gaia_test.py プロジェクト: malini/gaia-ui-tests-1
    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()
コード例 #5
0
ファイル: gaia_test.py プロジェクト: pcheng13/gaia-ui-tests
    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()
コード例 #6
0
    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")
コード例 #7
0
    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()
コード例 #8
0
ファイル: gaia_test.py プロジェクト: PinZhang/gaia-ui-tests
    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)
コード例 #9
0
ファイル: gaia_test.py プロジェクト: AmyYLee/gaia
    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()
コード例 #10
0
ファイル: test_1_browser_call.py プロジェクト: Mardak/loop
    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")
コード例 #11
0
 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)
コード例 #12
0
 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');"
     )
コード例 #13
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.enforce_gecko_prefs({
         "marionette.test.bool": True,
         "marionette.test.string": "testing",
         "marionette.test.int": 3
     })
コード例 #14
0
    def setUp(self, *args, **kwargs):
        MarionetteTestCase.setUp(self, *args, **kwargs)
        Puppeteer.set_marionette(self, self.marionette)

        self._start_handle_count = len(self.marionette.window_handles)
        self.marionette.set_context('chrome')
        self.browser = self.windows.current
コード例 #15
0
ファイル: gaia_test.py プロジェクト: klrmn/gaia-ui-tests
    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()
コード例 #16
0
 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)
コード例 #17
0
 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)
コード例 #18
0
 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)
コード例 #19
0
ファイル: test_cookies.py プロジェクト: AtulKumar2/gecko-dev
 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}
コード例 #20
0
    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.setUpScriptData()

        self.reset_profile_path = None
        self.desktop_backup_path = None

        self.createProfileData()
コード例 #21
0
    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.setUpScriptData()

        self.reset_profile_path = None
        self.desktop_backup_path = None

        self.createProfileData()
コード例 #22
0
 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")
コード例 #23
0
    def setUp(self):
        MarionetteTestCase.setUp(self)

        self.pid = self.marionette.process_id
        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)
コード例 #24
0
ファイル: test_shadow_dom.py プロジェクト: MekliCZ/positron
    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")
コード例 #25
0
    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)
コード例 #26
0
    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)
コード例 #27
0
    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)
コード例 #28
0
    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
コード例 #29
0
    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("id", "host")
        self.marionette.switch_to_shadow_root(self.host)
        self.button = self.marionette.find_element("id", "button")
コード例 #30
0
 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
     }
コード例 #31
0
    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
コード例 #32
0
ファイル: gaia_test.py プロジェクト: yurenju/gaia-ui-tests
    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.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette)
コード例 #33
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     if self.marionette.session_capabilities["platformName"] == "darwin":
         self.mod_key = Keys.META
     else:
         self.mod_key = Keys.CONTROL
     test_html = self.marionette.absolute_url("javascriptPage.html")
     self.marionette.navigate(test_html)
     self.reporter_element = self.marionette.find_element(By.ID, "keyReporter")
     self.reporter_element.click()
     self.key_action = Actions(self.marionette)
コード例 #34
0
    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)
コード例 #35
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     if self.marionette.session_capabilities["platformName"] == "Darwin":
         self.mod_key = Keys.META
     else:
         self.mod_key = Keys.CONTROL
     test_html = self.marionette.absolute_url("javascriptPage.html")
     self.marionette.navigate(test_html)
     self.reporter_element = self.marionette.find_element(By.ID, "keyReporter")
     self.reporter_element.click()
     self.key_action = Actions(self.marionette)
コード例 #36
0
    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except InvalidResponseException:
            if self.restart:
                pass

        if self.yocto:
            """ with the yocto ammeter we only get amp measurements
            so we also need to use the linux kernel voltage device to
            sample the voltage at the start of each test so we can
            calculate watts."""
            try:
                self.ammeter = YoctoAmmeter()
            except:
                self.ammeter = None

        self.device = GaiaDevice(self.marionette, self.testvars)
        if self.device.is_android_build:
            self.device.add_device_manager(
                self.get_device_manager(
                    deviceSerial=self.marionette.device_serial))
        if self.restart and (self.device.is_android_build
                             or self.marionette.instance):
            self.device.stop_b2g()
            if self.device.is_android_build:
                self.cleanup_data()
            self.device.start_b2g()

        # we need to set the default timeouts because we may have a new session
        if self.marionette.timeout is not None:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH,
                                     self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT,
                                     self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE,
                                     self.marionette.timeout)
        else:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, 10000)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, 30000)

        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)

        if self.device.is_android_build:
            self.cleanup_sdcard()

        if self.restart:
            self.cleanup_gaia(full_reset=False)
        else:
            self.cleanup_gaia(full_reset=True)
コード例 #37
0
    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)
コード例 #38
0
ファイル: gaia_test.py プロジェクト: tallowen/gaia-ui-tests
    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.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette)

        self.apps.kill_all()
コード例 #39
0
ファイル: testcase.py プロジェクト: mjzffr/firefox-ui-tests
    def setUp(self, *args, **kwargs):
        MarionetteTestCase.setUp(self, *args, **kwargs)
        Puppeteer.set_marionette(self, self.marionette)

        self._start_handle_count = len(self.marionette.window_handles)
        self.marionette.set_context('chrome')

        self.browser = self.windows.current
        self.browser.focus()
        with self.marionette.using_context(self.marionette.CONTEXT_CONTENT):
            # Ensure that we have a default page opened
            self.marionette.navigate(self.prefs.get_pref('browser.newtab.url'))
コード例 #40
0
ファイル: test_memory_usage.py プロジェクト: EricRahm/atsy
    def setUp(self):
        MarionetteTestCase.setUp(self)

        self.marionette.set_context('chrome')
        self.logger = mozlog.structured.structuredlog.get_default_logger()

        self.urls = self.testvars["urls"]
        self.pages_to_load = self.testvars.get("entities", len(self.urls))
        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.stats = self.testvars.get("stats")
コード例 #41
0
    def setUp(self):
        # start server
        self.loop_test_servers = LoopTestServers()

        MarionetteTestCase.setUp(self)

        # Unfortunately, enforcing preferences currently comes with the side
        # effect of launching and restarting the browser before running the
        # real functional tests.  Bug 1048554 has been filed to track this.
        self.marionette.enforce_gecko_prefs(FIREFOX_PREFERENCES)

        # this is browser chrome, kids, not the content window just yet
        self.marionette.set_context("chrome")
コード例 #42
0
    def setUp(self):
        # start server
        self.loop_test_servers = LoopTestServers()

        MarionetteTestCase.setUp(self)

        # Unfortunately, enforcing preferences currently comes with the side
        # effect of launching and restarting the browser before running the
        # real functional tests.  Bug 1048554 has been filed to track this.
        self.marionette.enforce_gecko_prefs(FIREFOX_PREFERENCES)

        # this is browser chrome, kids, not the content window just yet
        self.marionette.set_context("chrome")
コード例 #43
0
ファイル: gaia_test.py プロジェクト: AnandMoorthy/gaia
    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except InvalidResponseException:
            if self.restart:
                pass

        if self.yocto:
            """ with the yocto ammeter we only get amp measurements
            so we also need to use the linux kernel voltage device to
            sample the voltage at the start of each test so we can
            calculate watts."""
            try:
                self.ammeter = YoctoAmmeter()
            except:
                self.ammeter = None

        self.device = GaiaDevice(self.marionette, self.testvars)
        if self.device.is_android_build:
            self.device.add_device_manager(
                self.get_device_manager(deviceSerial = self.marionette.device_serial))
        if self.restart and (self.device.is_android_build or self.marionette.instance):
            self.device.stop_b2g()
            if self.device.is_android_build:
                self.cleanup_data()
            self.device.start_b2g()

        # we need to set the default timeouts because we may have a new session
        if self.marionette.timeout is not None:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, self.marionette.timeout)
        else:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, 10000)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, 30000)

        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.accessibility = Accessibility(self.marionette)

        if self.device.is_android_build:
            self.cleanup_sdcard()

        if self.restart:
            self.cleanup_gaia(full_reset=False)
        else:
            self.cleanup_gaia(full_reset=True)
コード例 #44
0
ファイル: MtbfTestCase.py プロジェクト: ypwalter/MTBF-Driver
    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()

       # we need to set the default timeouts because we may have a new session
        if self.marionette.timeout is not None:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, self.marionette.timeout)
        else:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, 10000)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, 30000)

        self.marionette.switch_to_frame()
        time.sleep(1)
        if len(self.marionette.find_elements("css selector", "iframe[data-frame-origin*=ftu]")) != 0:
            js = os.path.abspath(os.path.join(__file__, os.path.pardir, 'atoms', "gaia_apps.js"))
            self.marionette.import_script(js)
            result = self.marionette.execute_async_script("GaiaApps.kill('app://communications.gaiamobile.org/ftu/index.html');")

        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)

        # unlock screen and go back to home screen
        self.lockscreen.unlock()
        self.data_layer.set_setting("keyboard.ftu.enabled", False)
        self.marionette.execute_script("window.wrappedJSObject.dispatchEvent(new Event('home'));")
        self.marionette.execute_script("window.wrappedJSObject.dispatchEvent(new Event('home'));")

        if self.restart:
            self.cleanup_gaia(full_reset=False)
        else:
            self.cleanup_gaia(full_reset=True)
コード例 #45
0
ファイル: gaia_test.py プロジェクト: skopp/gaia-ui-tests
    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.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(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')

        self.cleanUp()
コード例 #46
0
ファイル: gaia_test.py プロジェクト: jedp/gaia-ui-tests
    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.__class__ = type('Marionette', (Marionette, MarionetteTouchMixin), {})

        self.device = GaiaDevice(self.marionette)
        if self.device.is_android_build:
            self.device.restart_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)
        self.keyboard = Keyboard(self.marionette, self)

        self.cleanUp()
コード例 #47
0
    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.lockscreen = LockScreen(self.marionette)
        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(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')

        self.cleanUp()
コード例 #48
0
    def setUp(self):
        MarionetteTestCase.setUp(self)

        self.marionette.set_context('chrome')
        self.logger = mozlog.structured.structuredlog.get_default_logger()

        self._urls = self.testvars.get("urls", TEST_SITES)
        self._pages_to_load = self.testvars.get("entities", len(self._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)

        # workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1128773
        js = os.path.abspath(os.path.join(__file__, os.path.pardir, "checkpoint.js"))
        with open(js) as f:
          self._checkpoint_script = f.read()

        self.reset_state()
コード例 #49
0
ファイル: gaia_test.py プロジェクト: Leanstuka/gaia
    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except InvalidResponseException:
            if self.restart:
                pass

        if self.yocto:
            """ with the yocto ammeter we only get amp measurements
            so we also need to use the linux kernel voltage device to
            sample the voltage at the start of each test so we can
            calculate watts."""
            try:
                self.ammeter = YoctoAmmeter()
            except:
                self.ammeter = None

        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()

        # we need to set the default timeouts because we may have a new session
        if self.marionette.timeout is not None:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT, self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, self.marionette.timeout)
        else:
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH, 10000)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE, 30000)

        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()
コード例 #50
0
    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.__class__ = type('Marionette',
                                         (Marionette, MarionetteTouchMixin),
                                         {})

        self.device = GaiaDevice(self.marionette)
        if self.device.is_android_build:
            self.device.restart_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)
        self.keyboard = Keyboard(self.marionette, self)

        self.cleanUp()
コード例 #51
0
    def setUp(self):
        MarionetteTestCase.setUp(self)

        self.marionette.set_context('chrome')
        self.logger = mozlog.structured.structuredlog.get_default_logger()

        self._urls = self.testvars.get("urls", TEST_SITES)
        self._pages_to_load = self.testvars.get("entities", len(self._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)

        # workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=1128773
        js = os.path.abspath(
            os.path.join(__file__, os.path.pardir, "checkpoint.js"))
        with open(js) as f:
            self._checkpoint_script = f.read()

        self.reset_state()
コード例 #52
0
ファイル: gaia_test.py プロジェクト: mariogarbi/gaia-ui-tests
    def setUp(self):
        MarionetteTestCase.setUp(self)
        self.marionette.__class__ = type('Marionette', (Marionette, MarionetteTouchMixin), {})

        self.device = GaiaDevice(self.marionette)
        if self.device.is_android_build:
            self.device.restart_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.keyboard = Keyboard(self.marionette, self)

        # 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')

        self.cleanUp()
コード例 #53
0
ファイル: test_navigation.py プロジェクト: rugby110/gecko-dev
 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.navigate("about:")
     self.test_doc = self.marionette.absolute_url("test.html")
     self.iframe_doc = self.marionette.absolute_url("test_iframe.html")
コード例 #54
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.set_context(self.marionette.CONTEXT_CHROME)
コード例 #55
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.delete_session()
     self.marionette.start_session()
コード例 #56
0
 def setUp(self):
     MarionetteTestCase.setUp(self)
     self.marionette.set_script_timeout(30000)
     self.marionette.set_context("chrome")
コード例 #57
0
ファイル: gaia_test.py プロジェクト: jm-gailis/gaia
    def setUp(self):
        try:
            MarionetteTestCase.setUp(self)
        except (InvalidResponseException, IOError):
            if self.restart:
                pass

        self.device = GaiaDevice(self.marionette,
                                 manager=self.device_manager,
                                 testvars=self.testvars)

        if self.restart and (self.device.is_android_build
                             or self.marionette.instance):
            # Restart if it's a device, or we have passed a binary instance with --binary command arg
            self.device.stop_b2g()
            if self.device.is_android_build:
                self.cleanup_data()
            self.device.start_b2g()

        # Run the fake update checker
        FakeUpdateChecker(self.marionette).check_updates()

        # We need to set the default timeouts because we may have a new session
        if self.marionette.timeout is None:
            # if no timeout is passed in, we detect the hardware type and set reasonable defaults
            timeouts = {}
            if self.device.is_desktop_b2g:
                self.marionette.timeout = 5000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 5000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 10000
                timeouts[self.marionette.TIMEOUT_PAGE] = 10000
            elif self.device.is_emulator:
                self.marionette.timeout = 30000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 30000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 60000
                timeouts[self.marionette.TIMEOUT_PAGE] = 60000
            else:
                # else, it is a device, the type of which is difficult to detect
                self.marionette.timeout = 10000
                timeouts[self.marionette.TIMEOUT_SEARCH] = 10000
                timeouts[self.marionette.TIMEOUT_SCRIPT] = 20000
                timeouts[self.marionette.TIMEOUT_PAGE] = 20000

            for k, v in timeouts.items():
                self.marionette.timeouts(k, v)

        else:
            # if the user has passed in --timeout then we override everything
            self.marionette.timeouts(self.marionette.TIMEOUT_SEARCH,
                                     self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_SCRIPT,
                                     self.marionette.timeout)
            self.marionette.timeouts(self.marionette.TIMEOUT_PAGE,
                                     self.marionette.timeout)

        self.apps = GaiaApps(self.marionette)
        self.data_layer = GaiaData(self.marionette, self.testvars)
        self.accessibility = Accessibility(self.marionette)

        self.cleanup_storage()

        if self.restart:
            self.cleanup_gaia(full_reset=False)
        else:
            self.cleanup_gaia(full_reset=True)
コード例 #58
0
 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)