--- a/testing/marionette/client/marionette/tests/unit/single_finger_functions.py
+++ b/testing/marionette/client/marionette/tests/unit/single_finger_functions.py
@@ -1,10 +1,10 @@
-from marionette_driver.marionette import Actions
-from marionette_driver.errors import TimeoutException
+from marionette import Actions
+from errors import TimeoutException
def wait_for_condition_else_raise(marionette, wait_for_condition, expected, script):
try:
wait_for_condition(lambda m: expected in m.execute_script(script))
except TimeoutException as e:
raise TimeoutException(e.msg + " got %s instead of %s" % (marionette.execute_script(script), expected))
def press_release(marionette, times, wait_for_condition, expected):
--- a/testing/marionette/client/marionette/tests/unit/test_anonymous_content.py
+++ b/testing/marionette/client/marionette/tests/unit/test_anonymous_content.py
@@ -1,18 +1,17 @@
# 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/.
+from marionette import HTMLElement
from marionette_test import MarionetteTestCase
-
-from marionette_driver.errors import NoSuchElementException
-from marionette_driver.expected import element_present
-from marionette_driver.marionette import HTMLElement
-from marionette_driver.wait import Wait
+from errors import NoSuchElementException
+from expected import element_present
+from wait import Wait
class TestAnonymousContent(MarionetteTestCase):
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_anonymous_content.xul', 'foo', 'chrome,centerscreen');")
self.marionette.switch_to_window('foo')
--- a/testing/marionette/client/marionette/tests/unit/test_appcache.py
+++ b/testing/marionette/client/marionette/tests/unit/test_appcache.py
@@ -8,24 +8,24 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
-from marionette_driver.application_cache import ApplicationCache
+from application_cache import ApplicationCache
from marionette_test import MarionetteTestCase
class AppCacheTests(MarionetteTestCase):
def testWeCanGetTheStatusOfTheAppCache(self):
test_url = self.marionette.absolute_url('html5Page')
self.marionette.navigate(test_url)
app_cache = self.marionette.application_cache
- status = app_cache.status
+ status = app_cache.status
while status == ApplicationCache.DOWNLOADING:
status = app_cache.status
self.assertEquals(ApplicationCache.UNCACHED, app_cache.status)
--- a/testing/marionette/client/marionette/tests/unit/test_clearing.py
+++ b/testing/marionette/client/marionette/tests/unit/test_clearing.py
@@ -1,14 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import InvalidElementStateException
+from errors import InvalidElementStateException
class TestClear(MarionetteTestCase):
def testWriteableTextInputShouldClear(self):
test_html = self.marionette.absolute_url("test_clearing.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element("id", "writableTextInput")
element.clear()
self.assertEqual("", element.get_attribute("value"))
@@ -51,17 +51,17 @@ class TestClear(MarionetteTestCase):
pass
def testContentEditableAreaShouldClear(self):
test_html = self.marionette.absolute_url("test_clearing.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element("id","content-editable")
element.clear()
self.assertEqual("", element.text)
-
+
def testTextInputShouldNotClearWhenDisabled(self):
test_html = self.marionette.absolute_url("test_clearing.html")
self.marionette.navigate(test_html)
try:
element = self.marionette.find_element("id","textInputnotenabled")
self.assertFalse(element.is_enabled())
element.clear()
self.fail("Should not have been able to clear")
--- a/testing/marionette/client/marionette/tests/unit/test_click.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click.py
@@ -1,16 +1,16 @@
# 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/.
-from marionette_driver.by import By
-from marionette_driver.errors import NoSuchElementException, ElementNotVisibleException
+from by import By
+from errors import NoSuchElementException, ElementNotVisibleException
from marionette_test import MarionetteTestCase
-from marionette_driver.wait import Wait
+from wait import Wait
class TestClick(MarionetteTestCase):
def test_click(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
link = self.marionette.find_element(By.ID, "mozLink")
link.click()
--- a/testing/marionette/client/marionette/tests/unit/test_click_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click_chrome.py
@@ -1,14 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.by import By
+from by import By
class TestClickChrome(MarionetteTestCase):
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');")
--- a/testing/marionette/client/marionette/tests/unit/test_click_scrolling.py
+++ b/testing/marionette/client/marionette/tests/unit/test_click_scrolling.py
@@ -1,14 +1,14 @@
# 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/.
-from marionette_driver.by import By
-from marionette_driver.errors import MoveTargetOutOfBoundsException
+from by import By
+from errors import MoveTargetOutOfBoundsException
from marionette_test import MarionetteTestCase, skip
class TestClickScrolling(MarionetteTestCase):
def test_clicking_on_anchor_scrolls_page(self):
scrollScript = """
var pageY;
--- a/testing/marionette/client/marionette/tests/unit/test_date_time_value.py
+++ b/testing/marionette/client/marionette/tests/unit/test_date_time_value.py
@@ -1,15 +1,15 @@
# 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/.
from marionette_test import MarionetteTestCase
from datetime import datetime
-from marionette_driver.date_time_value import DateTimeValue
+from date_time_value import DateTimeValue
class TestDateTime(MarionetteTestCase):
def test_set_date(self):
test_html = self.marionette.absolute_url("datetimePage.html")
self.marionette.navigate(test_html)
element = self.marionette.find_element("id", "date-test")
--- a/testing/marionette/client/marionette/tests/unit/test_errors.py
+++ b/testing/marionette/client/marionette/tests/unit/test_errors.py
@@ -1,17 +1,18 @@
# 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 sys
+import errors
import marionette_test
-from marionette_driver import errors
-from marionette_driver.errors import ErrorCodes
+
+from errors import ErrorCodes
def fake_cause():
try:
raise ValueError("bar")
except ValueError as e:
return sys.exc_info()
message = "foo"
--- a/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
@@ -1,16 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import ( JavascriptException,
- MarionetteException,
- ScriptTimeoutException )
+from errors import JavascriptException, MarionetteException, ScriptTimeoutException
import time
class TestExecuteAsyncContent(MarionetteTestCase):
def setUp(self):
super(TestExecuteAsyncContent, self).setUp()
self.marionette.set_script_timeout(1000)
--- a/testing/marionette/client/marionette/tests/unit/test_execute_isolate.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_isolate.py
@@ -1,16 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase, skip_if_b2g
-from marionette_driver.errors import (JavascriptException,
- MarionetteException,
- ScriptTimeoutException)
+from errors import JavascriptException, MarionetteException, ScriptTimeoutException
class TestExecuteIsolationContent(MarionetteTestCase):
def setUp(self):
super(TestExecuteIsolationContent, self).setUp()
self.content = True
def test_execute_async_isolate(self):
# Results from one execute call that has timed out should not
--- a/testing/marionette/client/marionette/tests/unit/test_execute_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_script.py
@@ -1,16 +1,16 @@
# 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 urllib
-from marionette_driver.by import By
-from marionette_driver.errors import JavascriptException, MarionetteException
+from by import By
+from errors import JavascriptException, MarionetteException
from marionette_test import MarionetteTestCase
def inline(doc):
return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
elements = inline("<p>foo</p> <p>bar</p>")
class TestExecuteContent(MarionetteTestCase):
--- a/testing/marionette/client/marionette/tests/unit/test_expected.py
+++ b/testing/marionette/client/marionette/tests/unit/test_expected.py
@@ -1,19 +1,18 @@
# 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 urllib
-from marionette_driver import expected
-from marionette_driver.by import By
-
+import expected
import marionette_test
+from by import By
def inline(doc):
return "data:text/html;charset=utf-8,%s" % urllib.quote(doc)
static_element = inline("""<p>foo</p>""")
static_elements = static_element + static_element
remove_element_by_tag_name = \
--- a/testing/marionette/client/marionette/tests/unit/test_findelement.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement.py
@@ -1,16 +1,16 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.marionette import HTMLElement
-from marionette_driver.by import By
-from marionette_driver.errors import NoSuchElementException, InvalidSelectorException
+from marionette import HTMLElement
+from by import By
+from errors import NoSuchElementException, InvalidSelectorException
class TestElements(MarionetteTestCase):
def test_id(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
el = self.marionette.execute_script("return window.document.getElementById('mozLink');")
found_el = self.marionette.find_element(By.ID, "mozLink")
--- a/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_findelement_chrome.py
@@ -1,16 +1,16 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.marionette import HTMLElement
-from marionette_driver.by import By
-from marionette_driver.errors import NoSuchElementException
+from marionette import HTMLElement
+from by import By
+from errors import NoSuchElementException
class TestElementsChrome(MarionetteTestCase):
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');")
--- a/testing/marionette/client/marionette/tests/unit/test_implicit_waits.py
+++ b/testing/marionette/client/marionette/tests/unit/test_implicit_waits.py
@@ -1,14 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import NoSuchElementException
+from errors import NoSuchElementException
class TestImplicitWaits(MarionetteTestCase):
def testShouldImplicitlyWaitForASingleElement(self):
test_html = self.marionette.absolute_url("test_dynamic.html")
self.marionette.navigate(test_html)
add = self.marionette.find_element("id", "adder")
self.marionette.set_search_timeout("30000")
add.click()
--- a/testing/marionette/client/marionette/tests/unit/test_import_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_import_script.py
@@ -1,36 +1,36 @@
# 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_test import MarionetteTestCase
-from marionette_driver.errors import JavascriptException
+from errors import JavascriptException
class TestImportScript(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
def clear_other_context(self):
self.marionette.set_context("chrome")
self.marionette.clear_imported_scripts()
self.marionette.set_context("content")
def check_file_exists(self):
return self.marionette.execute_script("""
let FileUtils = SpecialPowers.Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
+ let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
return importedScripts.exists();
""", special_powers=True)
def get_file_size(self):
return self.marionette.execute_script("""
let FileUtils = SpecialPowers.Cu.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
+ let importedScripts = FileUtils.getFile('TmpD', ['marionetteContentScripts']);
return importedScripts.fileSize;
""", special_powers=True)
def test_import_script(self):
js = os.path.abspath(os.path.join(__file__, os.path.pardir, "importscript.js"))
self.marionette.import_script(js)
self.assertEqual("i'm a test function!", self.marionette.execute_script("return testFunc();"))
self.assertEqual("i'm a test function!", self.marionette.execute_async_script("marionetteScriptFinished(testFunc());"))
@@ -104,17 +104,17 @@ class TestImportScript(MarionetteTestCas
firstjs = os.path.abspath(
os.path.join(__file__, os.path.pardir, "importscript.js"))
secondjs = os.path.abspath(
os.path.join(__file__, os.path.pardir, "importanotherscript.js"))
self.marionette.import_script(firstjs)
self.marionette.import_script(secondjs)
- self.assertEqual("i'm a test function!",
+ self.assertEqual("i'm a test function!",
self.marionette.execute_script("return testFunc();"))
self.assertEqual("i'm yet another test function!",
self.marionette.execute_script("return testAnotherFunc();"))
class TestImportScriptChrome(TestImportScript):
def setUp(self):
MarionetteTestCase.setUp(self)
@@ -124,19 +124,19 @@ class TestImportScriptChrome(TestImportS
def clear_other_context(self):
self.marionette.set_context("content")
self.marionette.clear_imported_scripts()
self.marionette.set_context("chrome")
def check_file_exists(self):
return self.marionette.execute_async_script("""
let FileUtils = Components.utils.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
+ let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
marionetteScriptFinished(importedScripts.exists());
""")
def get_file_size(self):
return self.marionette.execute_async_script("""
let FileUtils = Components.utils.import("resource://gre/modules/FileUtils.jsm", {}).FileUtils;
- let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
+ let importedScripts = FileUtils.getFile('TmpD', ['marionetteChromeScripts']);
marionetteScriptFinished(importedScripts.fileSize);
""")
--- a/testing/marionette/client/marionette/tests/unit/test_navigation.py
+++ b/testing/marionette/client/marionette/tests/unit/test_navigation.py
@@ -1,17 +1,20 @@
# 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/.
+from marionette_test import MarionetteTestCase, skip_if_b2g, skip_if_e10s
+from errors import MarionetteException, TimeoutException
class TestNavigate(MarionetteTestCase):
def test_navigate(self):
self.assertTrue(self.marionette.execute_script("window.location.href = 'about:blank'; return true;"))
self.assertEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
+ test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.assertNotEqual("about:blank", self.marionette.execute_script("return window.location.href;"))
self.assertEqual("Marionette Test", self.marionette.title)
@skip_if_b2g # we currently allow this in b2g
def test_navigate_chrome_error(self):
with self.marionette.using_context("chrome"):
self.assertRaisesRegexp(MarionetteException, "Cannot navigate in chrome context",
@@ -69,25 +72,38 @@ class TestNavigate(MarionetteTestCase):
self.marionette.navigate(self.marionette.absolute_url("test_iframe.html"))
self.marionette.switch_to_frame(0)
self.marionette.navigate(self.marionette.absolute_url("empty.html"))
self.assertTrue('empty.html' in self.marionette.get_url())
self.marionette.switch_to_frame()
self.assertTrue('test_iframe.html' in self.marionette.get_url())
'''
+ @skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
def test_shouldnt_error_if_nonexistent_url_used(self):
try:
self.marionette.navigate("thisprotocoldoesnotexist://")
self.fail("Should have thrown a MarionetteException")
except TimeoutException:
self.fail("The socket shouldn't have timed out when navigating to a non-existent URL")
except MarionetteException as e:
+ self.assertIn("Error loading page", str(e))
+ except Exception as inst:
+ import traceback
+ print traceback.format_exc()
+ self.fail("Should have thrown a MarionetteException instead of %s" % type(inst))
+ @skip_if_e10s # Interactions with about: pages need e10s support (bug 1096488).
+ @skip_if_b2g # about:blocked isn't a well formed uri on b2g
+ def test_should_navigate_to_requested_about_page(self):
+ self.marionette.navigate("about:neterror")
+ self.assertEqual(self.marionette.get_url(), "about:neterror")
+ self.marionette.navigate(self.marionette.absolute_url("test.html"))
self.marionette.navigate("about:blocked")
+ self.assertEqual(self.marionette.get_url(), "about:blocked")
def test_find_element_state_complete(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
state = self.marionette.execute_script("return window.document.readyState;")
self.assertEqual("complete", state)
self.assertTrue(self.marionette.find_element("id", "mozLink"))
--- a/testing/marionette/client/marionette/tests/unit/test_profile_management.py
+++ b/testing/marionette/client/marionette/tests/unit/test_profile_management.py
@@ -1,14 +1,14 @@
# 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_driver.errors import JavascriptException
+from errors import JavascriptException
from marionette_test import MarionetteTestCase
class TestLog(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.marionette.enforce_gecko_prefs({"marionette.test.bool": True, "marionette.test.string": "testing", "marionette.test.int": 3})
def test_preferences_are_set(self):
--- a/testing/marionette/client/marionette/tests/unit/test_screen_orientation.py
+++ b/testing/marionette/client/marionette/tests/unit/test_screen_orientation.py
@@ -1,15 +1,15 @@
# -*- fill-column: 100; comment-column: 100; -*-
# 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/.
-from marionette_driver.errors import MarionetteException
+from errors import MarionetteException
from marionette_test import MarionetteTestCase
from mozrunner.devices.emulator_screen import EmulatorScreen
default_orientation = "portrait-primary"
unknown_orientation = "Unknown screen orientation: %s"
class TestScreenOrientation(MarionetteTestCase):
def tearDown(self):
--- a/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
+++ b/testing/marionette/client/marionette/tests/unit/test_set_window_size.py
@@ -1,13 +1,13 @@
# 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/.
-from marionette_driver.errors import MarionetteException
+from errors import MarionetteException
from marionette_test import MarionetteTestCase
class TestSetWindowSize(MarionetteTestCase):
def setUp(self):
super(MarionetteTestCase, self).setUp()
self.start_size = self.marionette.window_size
self.max_width = self.marionette.execute_script("return window.screen.availWidth;")
self.max_height = self.marionette.execute_script("return window.screen.availHeight;")
--- a/testing/marionette/client/marionette/tests/unit/test_simpletest_sanity.py
+++ b/testing/marionette/client/marionette/tests/unit/test_simpletest_sanity.py
@@ -1,16 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import (JavascriptException,
- MarionetteException,
- ScriptTimeoutException)
+from errors import JavascriptException, MarionetteException, ScriptTimeoutException
class SimpletestSanityTest(MarionetteTestCase):
callFinish = "return finish();"
def test_is(self):
def runtests():
sentFail1 = "is(true, false, 'isTest1', TEST_UNEXPECTED_FAIL, TEST_PASS);" + self.callFinish
--- a/testing/marionette/client/marionette/tests/unit/test_single_finger.py
+++ b/testing/marionette/client/marionette/tests/unit/test_single_finger.py
@@ -1,15 +1,15 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.marionette import Actions
-from marionette_driver.errors import MarionetteException
+from marionette import Actions
+from errors import MarionetteException
#add this directory to the path
import os
import sys
sys.path.append(os.path.dirname(__file__))
from single_finger_functions import (
chain, chain_flick, context_menu, double_tap,
long_press_action, long_press_on_xy_action,
move_element, move_element_offset, press_release, single_tap, wait,
--- a/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py
+++ b/testing/marionette/client/marionette/tests/unit/test_single_finger_desktop.py
@@ -1,11 +1,11 @@
from marionette_test import MarionetteTestCase
-from marionette_driver.marionette import Actions
-from marionette_driver.errors import MarionetteException
+from marionette import Actions
+from errors import MarionetteException
#add this directory to the path
import os
import sys
sys.path.append(os.path.dirname(__file__))
from single_finger_functions import (
chain, chain_flick, context_menu, double_tap,
long_press_action, long_press_on_xy_action,
move_element, move_element_offset, press_release, single_tap, wait,
--- a/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
+++ b/testing/marionette/client/marionette/tests/unit/test_specialpowers.py
@@ -1,26 +1,26 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import JavascriptException, MarionetteException
+from errors import JavascriptException, MarionetteException
class TestSpecialPowersContent(MarionetteTestCase):
testpref = "testing.marionette.contentcharpref"
testvalue = "blabla"
def test_prefs(self):
result = self.marionette.execute_script("""
SpecialPowers.setCharPref("%(pref)s", "%(value)s");
return SpecialPowers.getCharPref("%(pref)s")
""" % {'pref': self.testpref, 'value': self.testvalue}, special_powers=True);
- self.assertEqual(result, self.testvalue)
+ self.assertEqual(result, self.testvalue)
def test_prefs_after_navigate(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
self.test_prefs()
class TestSpecialPowersChrome(TestSpecialPowersContent):
--- a/testing/marionette/client/marionette/tests/unit/test_submit.py
+++ b/testing/marionette/client/marionette/tests/unit/test_submit.py
@@ -1,18 +1,19 @@
# 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 time
-from marionette_driver.by import By
-from marionette_driver.errors import NoSuchElementException
-from marionette_driver.wait import Wait
+from by import By
+from errors import NoSuchElementException
from marionette_test import MarionetteTestCase
+from wait import Wait
+
class TestSubmit(MarionetteTestCase):
def test_should_be_able_to_submit_forms(self):
test_html = self.marionette.absolute_url("formPage.html")
self.marionette.navigate(test_html)
self.marionette.find_element(By.NAME, "login").submit()
for x in xrange(1, 10):
--- a/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
+++ b/testing/marionette/client/marionette/tests/unit/test_switch_frame.py
@@ -1,15 +1,15 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import (JavascriptException,
- NoSuchFrameException)
+from errors import JavascriptException
+from errors import NoSuchFrameException
class TestSwitchFrame(MarionetteTestCase):
def test_switch_simple(self):
start_url = "test_iframe.html"
verify_title = "Marionette IFrame Test"
test_html = self.marionette.absolute_url(start_url)
self.marionette.navigate(test_html)
--- a/testing/marionette/client/marionette/tests/unit/test_switch_frame_chrome.py
+++ b/testing/marionette/client/marionette/tests/unit/test_switch_frame_chrome.py
@@ -43,8 +43,14 @@ class TestSwitchFrameChrome(MarionetteTe
def test_stack_trace(self):
self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
self.marionette.switch_to_frame(0)
self.assertRaises(JavascriptException, self.marionette.execute_async_script, "foo();")
try:
self.marionette.execute_async_script("foo();")
except JavascriptException as e:
self.assertIn("foo", e.msg)
+
+ def test_we_can_switch_to_a_browser_frame(self):
+ self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
+ browser = self.marionette.find_element(By.ID, 'aBrowser')
+ self.marionette.switch_to_frame(browser)
+ self.assertIn("test2.xul", self.marionette.get_url(), "Switching by element failed")
--- a/testing/marionette/client/marionette/tests/unit/test_text.py
+++ b/testing/marionette/client/marionette/tests/unit/test_text.py
@@ -1,14 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.keys import Keys
+from keys import Keys
class TestText(MarionetteTestCase):
def test_getText(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
l = self.marionette.find_element("id", "mozLink")
self.assertEqual("Click me!", l.text)
--- a/testing/marionette/client/marionette/tests/unit/test_timeouts.py
+++ b/testing/marionette/client/marionette/tests/unit/test_timeouts.py
@@ -1,19 +1,16 @@
# 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_test import MarionetteTestCase
-from marionette_driver.marionette import HTMLElement
-from marionette_driver.errors import (NoSuchElementException,
- JavascriptException,
- MarionetteException,
- ScriptTimeoutException)
+from marionette import HTMLElement
+from errors import NoSuchElementException, JavascriptException, MarionetteException, ScriptTimeoutException
class TestTimeouts(MarionetteTestCase):
def test_pagetimeout_notdefinetimeout_pass(self):
test_html = self.marionette.absolute_url("test.html")
self.marionette.navigate(test_html)
def test_pagetimeout_fail(self):
self.marionette.timeouts("page load", 0)
--- a/testing/marionette/client/marionette/tests/unit/test_typing.py
+++ b/testing/marionette/client/marionette/tests/unit/test_typing.py
@@ -1,15 +1,15 @@
# 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/.
from marionette_test import MarionetteTestCase, skip_if_b2g
-from marionette_driver.keys import Keys
-from marionette_driver.errors import ElementNotVisibleException
+from keys import Keys
+from errors import ElementNotVisibleException
class TestTyping(MarionetteTestCase):
def testShouldFireKeyPressEvents(self):
test_html = self.marionette.absolute_url("javascriptPage.html")
self.marionette.navigate(test_html)
keyReporter = self.marionette.find_element("id", "keyReporter")
--- a/testing/marionette/client/marionette/tests/unit/test_wait.py
+++ b/testing/marionette/client/marionette/tests/unit/test_wait.py
@@ -1,21 +1,20 @@
# 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 sys
import time
-from marionette_driver import errors
-from marionette_driver import wait
-from marionette_driver.wait import Wait
+import errors
+import wait
from marionette_test import MarionetteTestCase
-
+from wait import Wait
class TickingClock(object):
def __init__(self, incr=1):
self.ticks = 0
self.increment = incr
def sleep(self, dur):
self.ticks += self.increment
--- a/testing/marionette/client/marionette/tests/unit/test_window_position.py
+++ b/testing/marionette/client/marionette/tests/unit/test_window_position.py
@@ -8,17 +8,17 @@
#
#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import MarionetteException
+from errors import MarionetteException
class TestWindowPosition(MarionetteTestCase):
def test_that_we_return_the_window_position(self):
position = self.marionette.get_window_position()
self.assertTrue(isinstance(position['x'], int))
self.assertTrue(isinstance(position['y'], int))
--- a/testing/marionette/client/marionette/tests/unit/test_window_switching.py
+++ b/testing/marionette/client/marionette/tests/unit/test_window_switching.py
@@ -1,17 +1,16 @@
# 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/.
+from by import By
+from errors import NoSuchElementException
from marionette_test import MarionetteTestCase
-
-from marionette_driver.by import By
-from marionette_driver.errors import NoSuchElementException
-from marionette_driver.wait import Wait
+from wait import Wait
class TestWindowSwitching(MarionetteTestCase):
def testJSWindowCreationAndSwitching(self):
test_html = self.marionette.absolute_url("test_windows.html")
self.marionette.navigate(test_html)
self.current_window = self.marionette.current_window_handle
--- a/testing/marionette/client/marionette/tests/unit/test_with_using_context.py
+++ b/testing/marionette/client/marionette/tests/unit/test_with_using_context.py
@@ -1,14 +1,14 @@
# 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/.
from marionette_test import MarionetteTestCase
-from marionette_driver.errors import MarionetteException
+from errors import MarionetteException
class TestSetContext(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
# shortcuts to improve readability of these tests
self.chrome = self.marionette.CONTEXT_CHROME