testing/marionette/harness/marionette/tests/unit/test_import_script_reuse_window.py
author Andreas Tolfsen <ato@mozilla.com>
Sat, 06 Feb 2016 17:34:10 +0000
changeset 285593 29caf02c0eb04ae7703b6dc18a6949ab74fae102
parent 231821 testing/marionette/client/marionette/tests/unit/test_import_script_reuse_window.py@8add60e27b0a9210a092058a1afe20f36cf21f43
permissions -rw-r--r--
Bug 1246407 - Rename parent directories for Marionette client and test harness; r=automatedtester This change moves testing/marionette/client to testing/marionette/harness, and testing/marionette/driver to testing/marionette/client. This parent directory name change reflects the true purpose of these Python packages. MozReview-Commit-ID: B0KrGzDTLlQ


# 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
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
from marionette import MarionetteTestCase

class TestImportScriptContent(MarionetteTestCase):

    def test_importing_script_then_reusing_it(self):
        test_html = self.marionette.absolute_url("test_windows.html")
        self.marionette.navigate(test_html)
        js = os.path.abspath(os.path.join(__file__, os.path.pardir, "importscript.js"))
        self.current_window = self.marionette.current_window_handle
        link = self.marionette.find_element("link text", "Open new window")
        link.click()

        windows = self.marionette.window_handles
        windows.remove(self.current_window)
        self.marionette.switch_to_window(windows[0])

        self.marionette.import_script(js)
        self.marionette.close()

        self.marionette.switch_to_window(self.current_window)
        self.assertEqual("i'm a test function!", self.marionette.execute_script("return testFunc();"))