68.14.8 - testing

This commit is contained in:
Fedor 2025-04-19 19:16:30 +03:00
parent 047e832886
commit 68568abe3a
374 changed files with 6669 additions and 2721 deletions

View File

@ -47,7 +47,6 @@ class TestBrowserWindowShortcuts(PuppeteerMixin, MarionetteTestCase):
# TODO: Check that the right input box is focused
# Located below searchbar as class="textbox-input"
# Anon locator has not been released yet (bug 1080764)
def has_input_selected(mn):
selection_name = mn.execute_script("""
return window.document.activeElement.localName;

View File

@ -1,5 +1,4 @@
[include:keyboard_shortcuts/manifest.ini]
[include:private_browsing/manifest.ini]
[include:safebrowsing/manifest.ini]
[include:security/manifest.ini]
[include:sessionstore/manifest.ini]

View File

@ -1,4 +0,0 @@
[DEFAULT]
tags = local
[test_about_private_browsing.py]

View File

@ -1,73 +0,0 @@
# 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 __future__ import absolute_import
from firefox_puppeteer import PuppeteerMixin
from firefox_puppeteer.ui.browser.window import BrowserWindow
from marionette_driver import By, Wait
from marionette_harness import MarionetteTestCase
class TestAboutPrivateBrowsingWithSearch(PuppeteerMixin, MarionetteTestCase):
def setUp(self):
super(TestAboutPrivateBrowsingWithSearch, self).setUp()
# Use a fake local support URL
support_url = 'about:blank?'
self.marionette.set_pref('app.support.baseURL', support_url)
self.pb_url = support_url + 'private-browsing-myths'
def tearDown(self):
try:
self.puppeteer.windows.close_all([self.browser])
self.browser.switch_to()
self.marionette.clear_pref('app.support.baseURL')
finally:
super(TestAboutPrivateBrowsingWithSearch, self).tearDown()
def testCheckAboutPrivateBrowsingWithSearch(self):
self.assertFalse(self.browser.is_private)
with self.marionette.using_context('content'):
self.marionette.navigate('about:privatebrowsing')
# Disabled awaiting support for Fluent strings in firefox-ui tests (bug 1534310)
# status_node = self.marionette.find_element(By.CSS_SELECTOR, 'p.showNormal')
# self.assertEqual(status_node.text,
# self.browser.localize_entity('aboutPrivateBrowsing.notPrivate'),
# 'Status text indicates we are not in private browsing mode')
def window_opener(win):
with win.marionette.using_context('content'):
button = self.marionette.find_element(By.ID, 'startPrivateBrowsing')
button.click()
pb_window = self.browser.open_window(callback=window_opener,
expected_window_class=BrowserWindow)
try:
self.assertTrue(pb_window.is_private)
# Test the search hand-off
with self.marionette.using_context('content'):
search = self.marionette.find_element(By.ID, 'search-handoff-button')
search.click()
self.assertTrue(pb_window.navbar.locationbar.focused, 'url bar is focused')
pb_window.navbar.locationbar.urlbar.send_keys('foo')
self.assertEqual(pb_window.navbar.locationbar.value, '@google foo',
'url bar prepends the @search shortcut')
# Test the private browsing myths link
with self.marionette.using_context('content'):
link = self.marionette.find_element(By.ID, 'private-browsing-myths')
link.click()
Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda _: self.marionette.get_url() == self.pb_url)
finally:
pb_window.close()

View File

@ -85,27 +85,13 @@ class TestLocationBar(PuppeteerMixin, MarionetteTestCase):
self.locationbar = self.browser.navbar.locationbar
def test_elements(self):
self.assertEqual(self.locationbar.urlbar.get_property('localName'), 'textbox')
self.assertIn('urlbar-input', self.locationbar.urlbar_input.get_property('className'))
self.assertEqual(self.locationbar.urlbar_input.get_property('id'), 'urlbar-input')
self.assertEqual(self.locationbar.connection_icon.get_property('localName'), 'image')
self.assertEqual(self.locationbar.identity_box.get_property('localName'), 'box')
self.assertEqual(self.locationbar.identity_country_label.get_property('localName'),
'label')
self.assertEqual(self.locationbar.identity_organization_label.get_property('localName'),
'label')
self.assertEqual(self.locationbar.identity_icon.get_property('localName'), 'image')
self.assertEqual(self.locationbar.history_drop_marker.get_property('localName'),
'dropmarker')
self.assertEqual(self.locationbar.reload_button.get_property('localName'),
'toolbarbutton')
self.assertEqual(self.locationbar.stop_button.get_property('localName'),
'toolbarbutton')
self.assertEqual(self.locationbar.contextmenu.get_property('localName'), 'menupopup')
self.assertEqual(self.locationbar.get_contextmenu_entry('paste').get_attribute('cmd'),
'cmd_paste')
def test_reload(self):
event_types = ["shortcut", "shortcut2", "button"]
for event in event_types:
@ -131,83 +117,3 @@ class TestLocationBar(PuppeteerMixin, MarionetteTestCase):
with self.marionette.using_context('content'):
Wait(self.marionette).until(lambda mn: mn.get_url() == data_uri)
class TestIdentityPopup(PuppeteerMixin, MarionetteTestCase):
def setUp(self):
super(TestIdentityPopup, self).setUp()
self.locationbar = self.browser.navbar.locationbar
self.identity_popup = self.locationbar.identity_popup
self.url = 'https://extended-validation.badssl.com'
with self.marionette.using_context('content'):
self.marionette.navigate(self.url)
def tearDown(self):
try:
self.identity_popup.close(force=True)
finally:
super(TestIdentityPopup, self).tearDown()
def test_elements(self):
self.locationbar.open_identity_popup()
# Test main view elements
main = self.identity_popup.view.main
self.assertEqual(main.element.get_property('localName'), 'panelview')
self.assertEqual(main.expander.get_property('localName'), 'button')
self.assertEqual(main.host.get_property('localName'), 'label')
self.assertEqual(main.insecure_connection_label.get_property('localName'),
'description')
self.assertEqual(main.internal_connection_label.get_property('localName'),
'description')
self.assertEqual(main.secure_connection_label.get_property('localName'),
'description')
self.assertEqual(main.permissions.get_property('localName'), 'vbox')
# Test security view elements
security = self.identity_popup.view.security
self.assertEqual(security.element.get_property('localName'), 'panelview')
self.assertEqual(security.host.get_property('localName'), 'label')
self.assertEqual(security.insecure_connection_label.get_property('localName'),
'description')
self.assertEqual(security.secure_connection_label.get_property('localName'),
'description')
self.assertEqual(security.owner.get_property('localName'), 'description')
self.assertEqual(security.owner_location.get_property('localName'), 'description')
self.assertEqual(security.verifier.get_property('localName'), 'description')
self.assertEqual(security.disable_mixed_content_blocking_button.get_property('localName'),
'button')
self.assertEqual(security.enable_mixed_content_blocking_button.get_property('localName'),
'button')
self.assertEqual(security.more_info_button.get_property('localName'), 'button')
def test_open_close(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.url)
self.assertFalse(self.identity_popup.is_open)
self.locationbar.open_identity_popup()
self.identity_popup.close()
self.assertFalse(self.identity_popup.is_open)
def test_force_close(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.url)
self.assertFalse(self.identity_popup.is_open)
self.locationbar.open_identity_popup()
self.identity_popup.close(force=True)
self.assertFalse(self.identity_popup.is_open)

View File

@ -68,7 +68,7 @@ class TestWindows(PuppeteerMixin, MarionetteTestCase):
def open_by_js(_):
with self.marionette.using_context('chrome'):
self.marionette.execute_script("""
window.open('chrome://browser/content/safeMode.xul', '_blank',
window.open('chrome://browser/content/safeMode.xhtml', '_blank',
'chrome,centerscreen,resizable=no');
""")

View File

@ -41,20 +41,15 @@ capture.Format = {
*
* @param {Node} node
* The node to take a screenshot of.
* @param {Array.<Node>=} highlights
* Optional array of nodes, around which a border will be marked to
* highlight them in the screenshot.
*
* @return {HTMLCanvasElement}
* The canvas element where the element has been painted on.
*/
capture.element = function(node, highlights = []) {
capture.element = function(node) {
let win = node.ownerGlobal;
let rect = node.getBoundingClientRect();
return capture.canvas(win, rect.left, rect.top, rect.width, rect.height, {
highlights,
});
return capture.canvas(win, rect.left, rect.top, rect.width, rect.height);
};
/**
@ -64,21 +59,17 @@ capture.element = function(node, highlights = []) {
* @param {DOMWindow} win
* The DOM window providing the document element to capture,
* and the offsets for the viewport.
* @param {Array.<Node>=} highlights
* Optional array of nodes, around which a border will be marked to
* highlight them in the screenshot.
*
* @return {HTMLCanvasElement}
* The canvas element where the viewport has been painted on.
*/
capture.viewport = function(win, highlights = []) {
capture.viewport = function(win) {
return capture.canvas(
win,
win.pageXOffset,
win.pageYOffset,
win.innerWidth,
win.innerHeight,
{ highlights }
win.innerHeight
);
};
@ -96,9 +87,6 @@ capture.viewport = function(win, highlights = []) {
* The width dimension of the rectangle to paint.
* @param {number} height
* The height dimension of the rectangle to paint.
* @param {Array.<Node>=} highlights
* Optional array of nodes, around which a border will be marked to
* highlight them in the screenshot.
* @param {HTMLCanvasElement=} canvas
* Optional canvas to reuse for the screenshot.
* @param {number=} flags
@ -115,7 +103,7 @@ capture.canvas = function(
top,
width,
height,
{ highlights = [], canvas = null, flags = null } = {}
{ canvas = null, flags = null } = {}
) {
const scale = win.devicePixelRatio;
@ -149,49 +137,20 @@ capture.canvas = function(
let ctx = canvas.getContext(CONTEXT_2D);
if (flags === null) {
flags = ctx.DRAWWINDOW_DRAW_CARET;
// TODO(ato): https://bugzil.la/1377335
//
// Disabled in bug 1243415 for webplatform-test
// failures due to out of view elements. Needs
// https://github.com/w3c/web-platform-tests/issues/4383 fixed.
/*
ctx.DRAWWINDOW_DRAW_VIEW;
*/
// Bug 1009762 - Crash in [@ mozilla::gl::ReadPixelsIntoDataSurface]
/*
ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
*/
// Enabling those flags for drawWindow by default causes
// drawing failures. Wait until drawSnapshot is used and supports
// these flags (bug 1571341)
// ctx.DRAWWINDOW_DRAW_VIEW;
// ctx.DRAWWINDOW_USE_WIDGET_LAYERS;
}
ctx.scale(scale, scale);
ctx.drawWindow(win, left, top, width, height, BG_COLOUR, flags);
if (highlights.length) {
ctx = capture.highlight_(ctx, highlights, top, left);
}
return canvas;
};
capture.highlight_ = function(context, highlights, top = 0, left = 0) {
if (typeof highlights == "undefined") {
throw new InvalidArgumentError("Missing highlights");
}
context.lineWidth = "2";
context.strokeStyle = "red";
context.save();
for (let el of highlights) {
let rect = el.getBoundingClientRect();
let oy = -top;
let ox = -left;
context.strokeRect(rect.left + ox, rect.top + oy, rect.width, rect.height);
}
return context;
};
/**
* Encode the contents of an HTMLCanvasElement to a Base64 encoded string.
*

View File

@ -14,14 +14,14 @@
<vbox id="things">
<checkbox id="testBox" label="box" />
<textbox id="textInput" size="6" value="test" label="input" />
<textbox id="textInput2" size="6" value="test" label="input" />
<textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput" size="6" value="test" label="input" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput2" size="6" value="test" label="input" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput3" class="asdf" size="6" value="test" label="input" />
</vbox>
<iframe id="iframe" name="iframename" src="chrome://marionette/content/test2.xul"/>
<iframe id="iframe" name="iframename" src="chrome://marionette/content/test_nested_iframe.xul"/>
<iframe id="iframe" name="iframename" src="chrome://marionette/content/test2.xhtml"/>
<iframe id="iframe" name="iframename" src="chrome://marionette/content/test_nested_iframe.xhtml"/>
<hbox id="testXulBox"/>
<browser id='aBrowser' src="chrome://marionette/content/test2.xul"/>
<browser id='aBrowser' src="chrome://marionette/content/test2.xhtml"/>
</dialog>
</window>

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!-- 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/. -->
<!DOCTYPE window [
]>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<dialog id="dia">
<vbox id="things">
<checkbox id="testBox" label="box" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput" size="6" value="test" label="input" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput2" size="6" value="test" label="input" />
<input xmlns="http://www.w3.org/1999/xhtml" id="textInput3" class="asdf" size="6" value="test" label="input" />
</vbox>
</dialog>
</window>

View File

@ -1,19 +0,0 @@
<?xml version="1.0"?>
<!-- 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/. -->
<!DOCTYPE window [
]>
<dialog id="dia"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox id="things">
<checkbox id="testBox" label="box" />
<textbox id="textInput" size="6" value="test" label="input" />
<textbox id="textInput2" size="6" value="test" label="input" />
<textbox id="textInput3" class="asdf" size="6" value="test" label="input" />
</vbox>
</dialog>

View File

@ -1,37 +0,0 @@
<?xml version="1.0"?>
<!-- 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/. -->
<!DOCTYPE dialog [
]>
<dialog id="testDialogAnonymousNode"
buttons="accept, cancel"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<bindings id="testBindings" xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="framebox">
<content orient="vertical" mousethrough="never">
<xul:browser anonid="content" id="browser" flex="1"
context="contentAreaContextMenu"
src="test.xul"
type="content"/>
</content>
</binding>
<binding id="iframebox">
<content>
<xul:box>
<xul:iframe anonid="iframe" src="chrome://marionette/content/test.xul"></xul:iframe>
</xul:box>
</content>
</binding>
</bindings>
<hbox id="testAnonymousContentBox"/>
<hbox id="container" style="-moz-binding: url('#testBindings');"/>
<hbox id="container2" style="-moz-binding: url('#iframebox');"/>
</dialog>

View File

@ -11,9 +11,9 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&testDialog.title;">
<dialog id="testDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&testDialog.title;"
buttons="accept,cancel">
<vbox flex="1" style="min-width: 300px; min-height: 500px;">
@ -29,8 +29,9 @@
<checkbox id="check-box" label="Test Mode 2" />
<hbox align="center">
<label id="text-box-label" control="text-box">Name:</label>
<textbox id="text-box" flex="1" />
<input xmlns="http://www.w3.org/1999/xhtml" id="text-box" style="-moz-box-flex: 1;" />
</hbox>
</vbox>
</dialog>
</window>

View File

@ -6,4 +6,4 @@
<!DOCTYPE window [
]>
<iframe id="iframe" name="iframename" src="test2.xul"/>
<iframe id="iframe" name="iframename" src="test2.xhtml"/>

View File

@ -85,42 +85,3 @@ Doing the following will work::
But this will raise a `NoSuchElementException`::
client.find_element(By.ID, 'container').find_element(By.ID, 'footer')
Finding Anonymous Nodes
-----------------------
When working in chrome scope, for example manipulating the Firefox user
interface, you may run into something called an anonymous node.
Firefox uses a markup language called XUL_ for its interface. XUL is similar
to HTML in that it has a DOM and tags that render controls on the display. One
ability of XUL is to create re-useable widgets that are made up out of several
smaller XUL elements. These widgets can be bound to the DOM using something
called the `XML binding language (XBL)`_.
The end result is that the DOM sees the widget as a single entity. It doesn't
know anything about how that widget is made up. All of the smaller XUL elements
that make up the widget are called `anonymous content`_. It is not possible to
query such elements using traditional DOM methods like `getElementById`.
Marionette provides two special strategies used for finding anonymous content.
Unlike normal elements, anonymous nodes can only be seen by their parent. So
it's necessary to first find the parent element and then search for the
anonymous children from there.
* `anon` - Finds all anonymous children of the element, there is no search term
so `None` must be passed in::
anon_children = client.find_element('id', 'parent').find_elements('anon', None)
* `anon attribute` - Find an anonymous child based on an attribute. An
unofficial convention is for anonymous nodes to have an
`anonid` attribute::
anon_child = client.find_element('id', 'parent').find_element('anon attribute', {'anonid': 'container'})
.. _XUL: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL
.. _XML binding language (XBL): https://developer.mozilla.org/en-US/docs/XBL
.. _anonymous content: https://developer.mozilla.org/en-US/docs/XBL/XBL_1.0_Reference/Anonymous_Content

View File

@ -25,5 +25,3 @@ class By(object):
TAG_NAME = "tag name"
CLASS_NAME = "class name"
CSS_SELECTOR = "css selector"
ANON_ATTRIBUTE = "anon attribute"
ANON = "anon"

View File

@ -1677,9 +1677,9 @@ class Marionette(object):
:param method: The method to use to locate the element; one of:
"id", "name", "class name", "tag name", "css selector",
"link text", "partial link text", "xpath", "anon" and "anon
attribute". Note that the "name", "link text" and "partial
link test" methods are not supported in the chrome DOM.
"link text", "partial link text" and "xpath".
Note that the "name", "link text" and "partial link test"
methods are not supported in the chrome DOM.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would
be an element id.
@ -1707,9 +1707,9 @@ class Marionette(object):
:param method: The method to use to locate the elements; one
of: "id", "name", "class name", "tag name", "css selector",
"link text", "partial link text", "xpath", "anon" and "anon
attribute". Note that the "name", "link text" and "partial link
test" methods are not supported in the chrome DOM.
"link text", "partial link text" and "xpath".
Note that the "name", "link text" and "partial link test"
methods are not supported in the chrome DOM.
:param target: The target of the search. For example, if method =
"tag", target might equal "div". If method = "id", target would be
an element id.
@ -1794,8 +1794,7 @@ class Marionette(object):
"""
return self._send_message("WebDriver:GetCookies")
def save_screenshot(self, fh, element=None, highlights=None,
full=True, scroll=True):
def save_screenshot(self, fh, element=None, full=True, scroll=True):
"""Takes a screenhot of a web element or the current frame and
saves it in the filehandle.
@ -1804,11 +1803,10 @@ class Marionette(object):
The rest of the parameters are defined like in screenshot()
"""
data = self.screenshot(element, highlights, "binary", full, scroll)
data = self.screenshot(element, "binary", full, scroll)
fh.write(data)
def screenshot(self, element=None, highlights=None, format="base64",
full=True, scroll=True):
def screenshot(self, element=None, format="base64", full=True, scroll=True):
"""Takes a screenshot of a web element or the current frame.
The screen capture is returned as a lossless PNG image encoded
@ -1820,10 +1818,6 @@ class Marionette(object):
:param element: The element to take a screenshot of. If None, will
take a screenshot of the current frame.
:param highlights: A list of
:class:`~marionette_driver.marionette.HTMLElement` objects to draw
a red box around in the returned screenshot.
:param format: if "base64" (the default), returns the screenshot
as a base64-string. If "binary", the data is decoded and
returned as raw binary. If "hash", the data is hashed using
@ -1840,12 +1834,8 @@ class Marionette(object):
if element:
element = element.id
lights = None
if highlights:
lights = [highlight.id for highlight in highlights]
body = {"id": element,
"highlights": lights,
"full": full,
"hash": False,
"scroll": scroll}

View File

@ -430,11 +430,12 @@ class MarionetteParentProcess {
win.addEventListener(
"load",
() => {
if (win.document.getElementById("safeModeDialog")) {
let dialog = win.document.getElementById("safeModeDialog");
if (dialog) {
// accept the dialog to start in safe-mode
log.trace("Safe mode detected, supressing dialog");
win.setTimeout(() => {
win.document.documentElement.getButton("accept").click();
dialog.getButton("accept").click();
});
}
},

View File

@ -26,10 +26,6 @@ element.findByPartialLinkText
-----------------------------
.. js:autofunction:: element.findByPartialLinkText
element.findAnonymousNodes
----------------------------
.. js:autofunction:: element.findAnonymousNodes
element.findClosest
-------------------
.. js:autofunction:: element.findClosest

View File

@ -98,8 +98,6 @@ const SUPPORTED_STRATEGIES = new Set([
element.Strategy.ID,
element.Strategy.TagName,
element.Strategy.XPath,
element.Strategy.Anon,
element.Strategy.AnonAttribute,
]);
// Timeout used to abort fullscreen, maximize, and minimize
@ -1800,37 +1798,6 @@ GeckoDriver.prototype.switchToFrame = async function(cmd) {
return;
}
// Check if the frame is XBL anonymous
let parent = curWindow.document.getBindingParent(wantedFrame);
// Shadow nodes also show up in getAnonymousNodes, we should
// ignore them.
if (
parent &&
!(parent.shadowRoot && parent.shadowRoot.contains(wantedFrame))
) {
const doc = curWindow.document;
let anonNodes = [...(doc.getAnonymousNodes(parent) || [])];
if (anonNodes.length > 0) {
let el = wantedFrame;
while (el) {
if (anonNodes.indexOf(el) > -1) {
curWindow = wantedFrame.contentWindow;
this.curFrame = curWindow;
if (focus) {
this.curFrame.focus();
}
checkTimer.initWithCallback(
checkLoad.bind(this),
100,
Ci.nsITimer.TYPE_ONE_SHOT
);
return;
}
el = el.parentNode;
}
}
}
// else, assume iframe
let frames = curWindow.document.getElementsByTagName("iframe");
let numFrames = frames.length;
@ -2656,7 +2623,7 @@ GeckoDriver.prototype.clearElement = async function(cmd) {
case Context.Chrome:
// the selenium atom doesn't work here
let el = this.curBrowser.seenEls.get(webEl);
if (el.nodeName == "textbox") {
if (el.nodeName == "input" && el.type == "text") {
el.value = "";
} else if (el.nodeName == "checkbox") {
el.checked = false;
@ -2997,16 +2964,13 @@ GeckoDriver.prototype.deleteSession = function() {
* @param {string=} id
* Optional web element reference to take a screenshot of.
* If undefined, a screenshot will be taken of the document element.
* @param {Array.<string>=} highlights
* List of web elements to highlight.
* @param {boolean} full
* True to take a screenshot of the entire document element. Is not
* @param {boolean=} full
* True to take a screenshot of the entire document element. Is only
* considered if <var>id</var> is not defined. Defaults to true.
* @param {boolean=} hash
* True if the user requests a hash of the image data.
* True if the user requests a hash of the image data. Defaults to false.
* @param {boolean=} scroll
* Scroll to element if |id| is provided. If undefined, it will
* scroll to the element.
* Scroll to element if |id| is provided. Defaults to true.
*
* @return {string}
* If <var>hash</var> is false, PNG image encoded as Base64 encoded
@ -3016,23 +2980,21 @@ GeckoDriver.prototype.deleteSession = function() {
GeckoDriver.prototype.takeScreenshot = function(cmd) {
let win = assert.open(this.getCurrentWindow());
let { id, highlights, full, hash } = cmd.parameters;
highlights = highlights || [];
let { id, full, hash, scroll } = cmd.parameters;
let format = hash ? capture.Format.Hash : capture.Format.Base64;
full = typeof full == "undefined" ? true : full;
scroll = typeof scroll == "undefined" ? true : scroll;
// Only consider full screenshot if no element has been specified
full = id ? false : full;
switch (this.context) {
case Context.Chrome:
let highlightEls = highlights
.map(ref => WebElement.fromUUID(ref, Context.Chrome))
.map(webEl => this.curBrowser.seenEls.get(webEl));
// viewport
let canvas;
if (!id && !full) {
canvas = capture.viewport(win, highlightEls);
// element or full document element
} else {
if (id || full) {
let node;
if (id) {
let webEl = WebElement.fromUUID(id, Context.Chrome);
@ -3041,7 +3003,11 @@ GeckoDriver.prototype.takeScreenshot = function(cmd) {
node = win.document.documentElement;
}
canvas = capture.element(node, highlightEls);
canvas = capture.element(node);
// viewport
} else {
canvas = capture.viewport(win);
}
switch (format) {
@ -3054,7 +3020,11 @@ GeckoDriver.prototype.takeScreenshot = function(cmd) {
break;
case Context.Content:
return this.listener.takeScreenshot(format, cmd.parameters);
return this.listener.takeScreenshot(format, {
id,
full,
scroll,
});
}
throw new TypeError(`Unknown context: ${this.context}`);

View File

@ -82,8 +82,6 @@ element.Strategy = {
PartialLinkText: "partial link text",
TagName: "tag name",
XPath: "xpath",
Anon: "anon",
AnonAttribute: "anon attribute",
};
/**
@ -329,17 +327,7 @@ element.find = function(container, strategy, selector, opts = {}) {
// the following code ought to be moved into findElement
// and findElements when bug 1254486 is addressed
if (!opts.all && (!foundEls || foundEls.length == 0)) {
let msg;
switch (strategy) {
case element.Strategy.AnonAttribute:
msg =
"Unable to locate anonymous element: " + JSON.stringify(selector);
break;
default:
msg = "Unable to locate element: " + selector;
}
let msg = `Unable to locate element: ${selector}`;
reject(new NoSuchElementError(msg));
}
@ -361,20 +349,8 @@ function find_(
let rootNode = container.shadowRoot || container.frame.document;
if (!startNode) {
switch (strategy) {
// For anonymous nodes the start node needs to be of type
// DOMElement, which will refer to :root in case of a DOMDocument.
case element.Strategy.Anon:
case element.Strategy.AnonAttribute:
if (rootNode.nodeType == rootNode.DOCUMENT_NODE) {
startNode = rootNode.documentElement;
}
break;
default:
startNode = rootNode;
}
}
let res;
try {
@ -484,24 +460,6 @@ element.findByPartialLinkText = function(startNode, linkText) {
);
};
/**
* Find anonymous nodes of <var>node</var>.
*
* @param {XULDocument} document
* Root node of the document.
* @param {XULElement} node
* Where in the DOM hierarchy to begin searching.
*
* @return {Iterable.<XULElement>}
* Iterator over anonymous elements.
*/
element.findAnonymousNodes = function*(document, node) {
let anons = document.getAnonymousNodes(node) || [];
for (let node of anons) {
yield node;
}
};
/**
* Filters all hyperlinks that are descendant of <var>startNode</var>
* by <var>predicate</var>.
@ -592,17 +550,6 @@ function findElement(strategy, selector, document, startNode = undefined) {
} catch (e) {
throw new InvalidSelectorError(`${e.message}: "${selector}"`);
}
case element.Strategy.Anon:
return element.findAnonymousNodes(document, startNode).next().value;
case element.Strategy.AnonAttribute:
let attr = Object.keys(selector)[0];
return document.getAnonymousElementByAttribute(
startNode,
attr,
selector[attr]
);
}
throw new InvalidSelectorError(`No such strategy: ${strategy}`);
@ -664,21 +611,6 @@ function findElements(strategy, selector, document, startNode = undefined) {
case element.Strategy.Selector:
return startNode.querySelectorAll(selector);
case element.Strategy.Anon:
return [...element.findAnonymousNodes(document, startNode)];
case element.Strategy.AnonAttribute:
let attr = Object.keys(selector)[0];
let el = document.getAnonymousElementByAttribute(
startNode,
attr,
selector[attr]
);
if (el) {
return [el];
}
return [];
default:
throw new InvalidSelectorError(`No such strategy: ${strategy}`);
}

View File

@ -17,7 +17,6 @@ from .marionette_test import (
skip_if_chrome,
skip_if_desktop,
skip_if_e10s,
skip_if_mobile,
SkipTest,
skip_unless_protocol,
)

View File

@ -19,7 +19,6 @@ from .decorators import (
skip_if_chrome,
skip_if_desktop,
skip_if_e10s,
skip_if_mobile,
skip_unless_browser_pref,
skip_unless_protocol,
with_parameters,

View File

@ -139,21 +139,6 @@ def skip_if_e10s(reason):
return decorator
def skip_if_mobile(reason):
"""Decorator which skips a test if run on mobile."""
def decorator(test_item):
if not isinstance(test_item, types.FunctionType):
raise Exception('Decorator only supported for functions')
@functools.wraps(test_item)
def skip_wrapper(self, *args, **kwargs):
if self.marionette.session_capabilities.get('browserName') == 'fennec':
raise SkipTest(reason)
return test_item(self, *args, **kwargs)
return skip_wrapper
return decorator
def skip_unless_browser_pref(reason, pref, predicate=bool):
"""Decorator which skips a test based on the value of a browser preference.

View File

@ -1,87 +0,0 @@
# 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 __future__ import absolute_import
from marionette_driver.by import By
from marionette_driver.errors import NoSuchElementException
from marionette_driver.marionette import HTMLElement
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestAnonymousNodes(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestAnonymousNodes, self).setUp()
self.marionette.set_context("chrome")
url = "chrome://marionette/content/test_anonymous_content.xul"
new_window = self.open_chrome_window(url)
self.marionette.switch_to_window(new_window)
def tearDown(self):
self.close_all_windows()
super(TestAnonymousNodes, self).tearDown()
def test_switch_to_anonymous_frame(self):
self.marionette.find_element(By.ID, "testAnonymousContentBox")
anon_browser_el = self.marionette.find_element(By.ID, "browser")
self.assertTrue("test_anonymous_content.xul" in self.marionette.get_url())
self.marionette.switch_to_frame(anon_browser_el)
self.assertTrue("test.xul" in self.marionette.get_url())
self.marionette.find_element(By.ID, "testXulBox")
self.assertRaises(NoSuchElementException,
self.marionette.find_element, By.ID, "testAnonymousContentBox")
def test_switch_to_anonymous_iframe(self):
self.marionette.find_element(By.ID, "testAnonymousContentBox")
el = self.marionette.find_element(By.ID, "container2")
anon_iframe_el = el.find_element(By.ANON_ATTRIBUTE, {"anonid": "iframe"})
self.marionette.switch_to_frame(anon_iframe_el)
self.assertTrue("test.xul" in self.marionette.get_url())
self.marionette.find_element(By.ID, "testXulBox")
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID,
"testAnonymousContentBox")
def test_find_anonymous_element_by_attribute(self):
accept_button = (By.ANON_ATTRIBUTE, {"dlgtype": "accept"},)
not_existent = (By.ANON_ATTRIBUTE, {"anonid": "notexistent"},)
# By using the window document element
start_node = self.marionette.find_element(By.CSS_SELECTOR, ":root")
button = start_node.find_element(*accept_button)
self.assertEquals(HTMLElement, type(button))
with self.assertRaises(NoSuchElementException):
start_node.find_element(*not_existent)
# By using the default start node
self.assertEquals(button, self.marionette.find_element(*accept_button))
with self.assertRaises(NoSuchElementException):
self.marionette.find_element(*not_existent)
def test_find_anonymous_elements_by_attribute(self):
dialog_buttons = (By.ANON_ATTRIBUTE, {"anonid": "buttons"},)
not_existent = (By.ANON_ATTRIBUTE, {"anonid": "notexistent"},)
# By using the window document element
start_node = self.marionette.find_element(By.CSS_SELECTOR, ":root")
buttons = start_node.find_elements(*dialog_buttons)
self.assertEquals(1, len(buttons))
self.assertEquals(HTMLElement, type(buttons[0]))
self.assertListEqual([], start_node.find_elements(*not_existent))
# By using the default start node
self.assertListEqual(buttons, self.marionette.find_elements(*dialog_buttons))
self.assertListEqual([], self.marionette.find_elements(*not_existent))
def test_find_anonymous_children(self):
self.assertEquals(HTMLElement, type(self.marionette.find_element(By.ANON, None)))
self.assertEquals(3, len(self.marionette.find_elements(By.ANON, None)))
frame = self.marionette.find_element(By.ID, "framebox")
with self.assertRaises(NoSuchElementException):
frame.find_element(By.ANON, None)
self.assertListEqual([], frame.find_elements(By.ANON, None))

View File

@ -16,7 +16,7 @@ class TestSelectedChrome(WindowManagerMixin, MarionetteTestCase):
self.marionette.set_context("chrome")
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
def tearDown(self):

View File

@ -12,7 +12,6 @@ from marionette_driver.marionette import Alert
from marionette_harness import (
MarionetteTestCase,
run_if_e10s,
skip_if_mobile,
WindowManagerMixin,
)
@ -453,7 +452,6 @@ class TestClickCloseContext(WindowManagerMixin, MarionetteTestCase):
self.marionette.navigate(self.test_page)
self.marionette.find_element(By.ID, "close-window").click()
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_click_close_window(self):
new_tab = self.open_window()
self.marionette.switch_to_window(new_tab)

View File

@ -22,7 +22,7 @@ class TestClickChrome(WindowManagerMixin, MarionetteTestCase):
super(TestClickChrome, self).tearDown()
def test_click(self):
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
def checked():

View File

@ -16,7 +16,7 @@ class TestElementState(WindowManagerMixin, MarionetteTestCase):
self.marionette.set_context("chrome")
self.win = self.open_chrome_window("chrome://marionette/content/test.xul")
self.win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(self.win)
def tearDown(self):

View File

@ -16,7 +16,7 @@ class TestElementSizeChrome(WindowManagerMixin, MarionetteTestCase):
self.marionette.set_context("chrome")
new_window = self.open_chrome_window("chrome://marionette/content/test2.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test2.xhtml")
self.marionette.switch_to_window(new_window)
def tearDown(self):

View File

@ -6,7 +6,7 @@ from __future__ import absolute_import
from marionette_driver.errors import JavascriptException
from marionette_harness import MarionetteTestCase, skip_if_mobile
from marionette_harness import MarionetteTestCase
class TestExecuteSandboxes(MarionetteTestCase):
@ -41,7 +41,6 @@ class TestExecuteSandboxes(MarionetteTestCase):
"return foo", sandbox="2", new_sandbox=False)
self.assertEqual(foo, 2)
@skip_if_mobile("Intermittent on Android - bug 1526914")
def test_execute_new_sandbox(self):
# test that clearing a sandbox does not affect other sandboxes
self.marionette.execute_script("foo = 1", sandbox="1")

View File

@ -7,7 +7,7 @@ from marionette_driver import By, errors
from marionette_driver.marionette import Alert, HTMLElement
from marionette_driver.wait import Wait
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
from marionette_harness import MarionetteTestCase, WindowManagerMixin
def inline(doc):
@ -351,7 +351,6 @@ class TestExecuteContent(MarionetteTestCase):
def test_comment_in_last_line(self):
self.marionette.execute_script(" // comment ")
@skip_if_mobile("Modal dialogs not supported in Fennec")
def test_return_value_on_alert(self):
res = self.marionette._send_message("WebDriver:ExecuteScript", {"script": "alert()"})
self.assertIn("value", res)
@ -372,15 +371,15 @@ class TestExecuteChrome(WindowManagerMixin, TestExecuteContent):
self.marionette.execute_script(
"Components.classes['@mozilla.org/preferences-service;1']")
@skip_if_mobile("New windows not supported in Fennec")
def test_unmarshal_element_collection(self):
try:
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
expected = self.marionette.find_elements(By.TAG_NAME, "textbox")
expected = self.marionette.find_elements(By.TAG_NAME, "input")
actual = self.marionette.execute_script(
"return document.querySelectorAll('textbox')")
"return document.querySelectorAll('input')")
self.assertTrue(len(expected) > 0)
self.assertEqual(expected, actual)
finally:

View File

@ -18,7 +18,7 @@ class TestElementsChrome(WindowManagerMixin, MarionetteTestCase):
self.marionette.set_context("chrome")
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
def tearDown(self):
@ -41,14 +41,14 @@ class TestElementsChrome(WindowManagerMixin, MarionetteTestCase):
def test_child_element(self):
el = self.marionette.find_element(By.ID, "textInput")
parent = self.marionette.find_element(By.ID, "things")
found_el = parent.find_element(By.TAG_NAME, "textbox")
found_el = parent.find_element(By.TAG_NAME, "input")
self.assertEqual(HTMLElement, type(found_el))
self.assertEqual(el, found_el)
def test_child_elements(self):
el = self.marionette.find_element(By.ID, "textInput3")
parent = self.marionette.find_element(By.ID, "things")
found_els = parent.find_elements(By.TAG_NAME, "textbox")
found_els = parent.find_elements(By.TAG_NAME, "input")
self.assertTrue(el.id in [found_el.id for found_el in found_els])
def test_tag_name(self):
@ -85,7 +85,7 @@ class TestElementsChrome(WindowManagerMixin, MarionetteTestCase):
self.marionette.timeout.implicit = 4
self.marionette.execute_script("""
window.setTimeout(function () {
var b = window.document.createElement('button');
var b = window.document.createXULElement('button');
b.id = 'myid';
document.getElementById('things').appendChild(b);
}, 1000); """)

View File

@ -6,7 +6,7 @@ from __future__ import absolute_import
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestGetCurrentUrlChrome(WindowManagerMixin, MarionetteTestCase):
@ -29,9 +29,8 @@ class TestGetCurrentUrlChrome(WindowManagerMixin, MarionetteTestCase):
chrome_url = self.marionette.execute_script("return window.location.href;")
self.assertEqual(self.marionette.get_url(), chrome_url)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_no_browser_window(self):
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
chrome_url = self.marionette.execute_script("return window.location.href;")

View File

@ -9,7 +9,7 @@ import time
from marionette_driver import errors
from marionette_driver.marionette import Marionette
from marionette_harness import MarionetteTestCase, run_if_manage_instance, skip_if_mobile
from marionette_harness import MarionetteTestCase, run_if_manage_instance
class TestMarionette(MarionetteTestCase):
@ -25,7 +25,6 @@ class TestMarionette(MarionetteTestCase):
self.assertIn(expected_test_name, self.marionette.test_name)
@run_if_manage_instance("Only runnable if Marionette manages the instance")
@skip_if_mobile("Bug 1322993 - Missing temporary folder")
def test_raise_for_port_non_existing_process(self):
"""Test that raise_for_port doesn't run into a timeout if instance is not running."""
self.marionette.quit()
@ -61,7 +60,6 @@ class TestMarionette(MarionetteTestCase):
self.assertEqual(current_socket_timeout,
self.marionette.client._sock.gettimeout())
@skip_if_mobile("No application update service available on Android")
def test_application_update_disabled(self):
# Updates of the application should always be disabled by default
with self.marionette.using_context("chrome"):

View File

@ -9,7 +9,7 @@ import urllib
from marionette_driver import By, errors, Wait
from marionette_driver.keys import Keys
from marionette_harness import MarionetteTestCase, skip_if_mobile
from marionette_harness import MarionetteTestCase
def inline(doc):
@ -78,7 +78,6 @@ class TestPointerActions(BaseMouseAction):
event_count = self.marionette.execute_script("return window.eventCount", sandbox=None)
self.assertEqual(event_count, 2)
@skip_if_mobile("There is no context menu available on mobile")
def test_context_click_action(self):
test_html = self.marionette.absolute_url("clicks.html")
self.marionette.navigate(test_html)
@ -151,7 +150,6 @@ class TestNonSpecCompliantPointerOrigin(BaseMouseAction):
self.assertAlmostEqual(click_position["x"], elem_center_point["x"], delta=1)
self.assertAlmostEqual(click_position["y"], elem_center_point["y"], delta=1)
@skip_if_mobile("Bug 1534291 - Missing MoveTargetOutOfBoundsException")
def test_click_element_larger_than_viewport_with_center_point_outside(self):
self.marionette.navigate(inline("""
<div id="div" style="width: 300vw; height: 300vh; background: green;"

View File

@ -15,7 +15,6 @@ from marionette_harness import (
MarionetteTestCase,
run_if_e10s,
run_if_manage_instance,
skip_if_mobile,
WindowManagerMixin,
)
@ -258,14 +257,12 @@ class TestNavigate(BaseNavigationTestCase):
self.marionette.go_back()
self.assertEqual(self.marionette.get_url(), self.test_page_push_state)
@skip_if_mobile("Test file is only located on host machine")
def test_navigate_file_url(self):
self.marionette.navigate(self.test_page_file_url)
self.marionette.find_element(By.ID, "file-url")
self.marionette.navigate(self.test_page_remote)
@run_if_e10s("Requires e10s mode enabled")
@skip_if_mobile("Test file is only located on host machine")
def test_navigate_file_url_remoteness_change(self):
self.marionette.navigate("about:robots")
self.assertFalse(self.is_remote_tab)
@ -283,7 +280,6 @@ class TestNavigate(BaseNavigationTestCase):
self.marionette.navigate("about:blank")
@run_if_manage_instance("Only runnable if Marionette manages the instance")
@skip_if_mobile("Bug 1322993 - Missing temporary folder")
def test_focus_after_navigation(self):
self.marionette.restart()
@ -299,13 +295,12 @@ class TestNavigate(BaseNavigationTestCase):
self.marionette.switch_to_window(self.new_tab)
self.marionette.navigate(self.test_page_remote)
@skip_if_mobile("Interacting with chrome elements not available for Fennec")
def test_type_to_non_remote_tab(self):
self.marionette.navigate(self.test_page_not_remote)
self.assertFalse(self.is_remote_tab)
with self.marionette.using_context("chrome"):
urlbar = self.marionette.find_element(By.ID, "urlbar")
urlbar = self.marionette.find_element(By.ID, "urlbar-input")
urlbar.send_keys(self.mod_key + "a")
urlbar.send_keys(self.mod_key + "x")
urlbar.send_keys("about:support" + Keys.ENTER)
@ -315,13 +310,12 @@ class TestNavigate(BaseNavigationTestCase):
message="'about:support' hasn't been loaded")
self.assertFalse(self.is_remote_tab)
@skip_if_mobile("Interacting with chrome elements not available for Fennec")
@run_if_e10s("Requires e10s mode enabled")
def test_type_to_remote_tab(self):
self.assertTrue(self.is_remote_tab)
with self.marionette.using_context("chrome"):
urlbar = self.marionette.find_element(By.ID, "urlbar")
urlbar = self.marionette.find_element(By.ID, "urlbar-input")
urlbar.send_keys(self.mod_key + "a")
urlbar.send_keys(self.mod_key + "x")
urlbar.send_keys(self.test_page_remote + Keys.ENTER)
@ -431,7 +425,6 @@ class TestBackForwardNavigation(BaseNavigationTestCase):
]
self.run_bfcache_test(test_pages)
@skip_if_mobile("Test file is only located on host machine")
def test_file_url(self):
test_pages = [
{"url": self.test_page_remote},
@ -521,7 +514,6 @@ class TestBackForwardNavigation(BaseNavigationTestCase):
]
self.run_bfcache_test(test_pages)
@skip_if_mobile("Bug 1333209 - Process killed because of connection loss")
def test_non_remote_about_pages(self):
test_pages = [
{"url": "about:preferences", "is_remote": False},
@ -620,7 +612,6 @@ class TestRefresh(BaseNavigationTestCase):
self.marionette.refresh()
self.marionette.find_element(By.NAME, "third")
@skip_if_mobile("Test file is only located on host machine")
def test_file_url(self):
self.marionette.navigate(self.test_page_file_url)
self.assertEqual(self.test_page_file_url, self.marionette.get_url())

View File

@ -13,7 +13,7 @@ class TestPageSourceChrome(WindowManagerMixin, MarionetteTestCase):
super(TestPageSourceChrome, self).setUp()
self.marionette.set_context("chrome")
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
def tearDown(self):
@ -22,4 +22,4 @@ class TestPageSourceChrome(WindowManagerMixin, MarionetteTestCase):
def testShouldReturnXULDetails(self):
source = self.marionette.page_source
self.assertTrue('<textbox id="textInput"' in source)
self.assertTrue('<input xmlns="http://www.w3.org/1999/xhtml" id="textInput"' in source)

View File

@ -10,8 +10,6 @@ from marionette_driver.errors import JavascriptException
from marionette_harness import (
MarionetteTestCase,
run_if_manage_instance,
skip_if_desktop,
skip_if_mobile
)
@ -43,7 +41,6 @@ class TestPreferences(MarionetteTestCase):
self.assertEqual(self.marionette.get_pref(key), value,
"Preference {} hasn't been set to {}".format(key, repr(value)))
@skip_if_mobile("Only runnable with Firefox")
def test_desktop_instance_preferences(self):
required_prefs = geckoinstance.DesktopInstance.desktop_prefs
@ -54,17 +51,6 @@ class TestPreferences(MarionetteTestCase):
self.assertEqual(self.marionette.get_pref(key), value,
"Preference {} hasn't been set to {}".format(key, value))
@skip_if_desktop("Only runnable with Fennec")
def test_fennec_instance_preferences(self):
required_prefs = geckoinstance.FennecInstance.required_prefs
for key, value in required_prefs.iteritems():
if key in ["browser.tabs.remote.autostart"]:
return
self.assertEqual(self.marionette.get_pref(key), value,
"Preference {} hasn't been set to {}".format(key, value))
def test_clear_pref(self):
self.assertIsNone(self.marionette.get_pref(self.prefs["bool"]))

View File

@ -10,7 +10,6 @@ from marionette_harness import (
MarionetteTestCase,
parameterized,
skip_if_desktop,
skip_if_mobile,
)
@ -22,12 +21,8 @@ class TestScreenOrientation(MarionetteTestCase):
def setUp(self):
MarionetteTestCase.setUp(self)
self.is_mobile = self.marionette.session_capabilities.get("rotatable", False)
def tearDown(self):
if self.is_mobile:
self.marionette.set_orientation(default_orientation)
self.wait_for_orientation(default_orientation)
MarionetteTestCase.tearDown(self)
def wait_for_orientation(self, orientation, timeout=None):
@ -75,7 +70,6 @@ class TestScreenOrientation(MarionetteTestCase):
unknown_orientation.format("null")):
self.marionette.set_orientation(None)
@skip_if_mobile("Specific test for Firefox")
def test_unsupported_operation_on_desktop(self):
with self.assertRaises(errors.UnsupportedOperationException):
self.marionette.set_orientation("landscape-primary")

View File

@ -8,15 +8,16 @@ import base64
import hashlib
import imghdr
import struct
import sys
import tempfile
import unittest
import urllib
from marionette_driver import By
from marionette_driver.errors import NoSuchElementException, NoSuchWindowException
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import (
MarionetteTestCase,
skip,
skip_if_mobile,
WindowManagerMixin,
)
@ -135,7 +136,7 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
"""))
def open_dialog(self):
return self.open_chrome_window("chrome://marionette/content/test_dialog.xul")
return self.open_chrome_window("chrome://marionette/content/test_dialog.xhtml")
def test_capture_different_context(self):
"""Check that screenshots in content and chrome are different."""
@ -144,7 +145,6 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
screenshot_chrome = self.marionette.screenshot()
self.assertNotEqual(screenshot_content, screenshot_chrome)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_capture_element(self):
dialog = self.open_dialog()
self.marionette.switch_to_window(dialog)
@ -162,8 +162,6 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
self.marionette.close_chrome_window()
self.marionette.switch_to_window(self.start_window)
# @skip_if_mobile("Fennec doesn't support other chrome windows")
@skip("Bug 1329424 - AssertionError: u'iVBORw0KGgoA... (images unexpectedly equal)")
def test_capture_flags(self):
dialog = self.open_dialog()
self.marionette.switch_to_window(dialog)
@ -192,7 +190,6 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
self.assertEqual(self.scale(self.get_element_dimensions(self.document_element)),
self.get_image_dimensions(screenshot_full))
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_capture_window_already_closed(self):
dialog = self.open_dialog()
self.marionette.switch_to_window(dialog)
@ -201,7 +198,6 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
self.assertRaises(NoSuchWindowException, self.marionette.screenshot)
self.marionette.switch_to_window(self.start_window)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_formats(self):
dialog = self.open_dialog()
self.marionette.switch_to_window(dialog)
@ -215,46 +211,6 @@ class TestScreenCaptureChrome(WindowManagerMixin, ScreenCaptureTestCase):
with self.assertRaises(ValueError):
self.marionette.screenshot(format="cheese")
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_highlight_elements(self):
dialog = self.open_dialog()
self.marionette.switch_to_window(dialog)
# Highlighting the element itself shouldn't make the image larger
element = self.marionette.find_element(By.ID, "test-list")
screenshot_element = self.marionette.screenshot(element=element)
screenshot_highlight = self.marionette.screenshot(element=element,
highlights=[element])
self.assertEqual(self.scale(self.get_element_dimensions(element)),
self.get_image_dimensions(screenshot_element))
self.assertNotEqual(screenshot_element, screenshot_highlight)
# Highlighting a sub element
button = self.marionette.find_element(By.ID, "choose-button")
screenshot_highlight_button = self.marionette.screenshot(element=element,
highlights=[button])
self.assertNotEqual(screenshot_element, screenshot_highlight_button)
self.assertNotEqual(screenshot_highlight, screenshot_highlight_button)
self.marionette.close_chrome_window()
self.marionette.switch_to_window(self.start_window)
def test_highlight_element_not_seen(self):
"""Check that for not found elements an exception is raised."""
with self.marionette.using_context('content'):
self.marionette.navigate(box)
content_element = self.marionette.find_element(By.ID, "green")
self.assertRaisesRegexp(NoSuchElementException, "Web element reference not seen before",
self.marionette.screenshot, highlights=[content_element])
chrome_document_element = self.document_element
with self.marionette.using_context('content'):
self.assertRaisesRegexp(NoSuchElementException,
"Web element reference not seen before",
self.marionette.screenshot,
highlights=[chrome_document_element])
class TestScreenCaptureContent(WindowManagerMixin, ScreenCaptureTestCase):
@ -280,7 +236,6 @@ class TestScreenCaptureContent(WindowManagerMixin, ScreenCaptureTestCase):
self.assertRaises(NoSuchWindowException, self.marionette.screenshot)
self.marionette.switch_to_window(self.start_tab)
@skip_if_mobile("Bug 1487124 - Android need its own maximum allowed dimensions")
def test_capture_vertical_bounds(self):
self.marionette.navigate(inline("<body style='margin-top: 32768px'>foo"))
screenshot = self.marionette.screenshot()
@ -304,7 +259,7 @@ class TestScreenCaptureContent(WindowManagerMixin, ScreenCaptureTestCase):
self.get_image_dimensions(screenshot))
self.assertGreater(self.page_y_offset, 0)
@skip("Bug 1330560 - AssertionError: u'iVBORw0KGgoA... (images unexpectedly equal)")
@unittest.skipIf(sys.platform.startswith("win"), "Bug 1330560")
def test_capture_flags(self):
self.marionette.navigate(input)
@ -361,25 +316,6 @@ class TestScreenCaptureContent(WindowManagerMixin, ScreenCaptureTestCase):
with self.assertRaises(ValueError):
self.marionette.screenshot(format="cheese")
def test_highlight_elements(self):
self.marionette.navigate(box)
element = self.marionette.find_element(By.TAG_NAME, "div")
# Highlighting the element itself shouldn't make the image larger
screenshot_element = self.marionette.screenshot(element=element)
screenshot_highlight = self.marionette.screenshot(element=element,
highlights=[element])
self.assertEqual(self.scale(self.get_element_dimensions(element)),
self.get_image_dimensions(screenshot_highlight))
self.assertNotEqual(screenshot_element, screenshot_highlight)
# Highlighting a sub element
paragraph = self.marionette.find_element(By.ID, "green")
screenshot_highlight_paragraph = self.marionette.screenshot(element=element,
highlights=[paragraph])
self.assertNotEqual(screenshot_element, screenshot_highlight_paragraph)
self.assertNotEqual(screenshot_highlight, screenshot_highlight_paragraph)
def test_save_screenshot(self):
expected = self.marionette.screenshot(format="binary")
with tempfile.TemporaryFile('w+b') as fh:

View File

@ -15,7 +15,7 @@ class TestSwitchFrameChrome(WindowManagerMixin, MarionetteTestCase):
super(TestSwitchFrameChrome, self).setUp()
self.marionette.set_context("chrome")
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
self.assertNotEqual(self.start_window, self.marionette.current_chrome_window_handle)
@ -24,26 +24,26 @@ class TestSwitchFrameChrome(WindowManagerMixin, MarionetteTestCase):
super(TestSwitchFrameChrome, self).tearDown()
def test_switch_simple(self):
self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
self.assertIn("test.xhtml", self.marionette.get_url(), "Initial navigation has failed")
self.marionette.switch_to_frame(0)
self.assertIn("test2.xul", self.marionette.get_url(),"Switching by index failed")
self.assertIn("test2.xhtml", self.marionette.get_url(),"Switching by index failed")
self.marionette.switch_to_frame()
self.assertEqual(None, self.marionette.get_active_frame(), "Switiching by null failed")
self.assertIn("test.xul", self.marionette.get_url(), "Switching by null failed")
self.assertIn("test.xhtml", self.marionette.get_url(), "Switching by null failed")
self.marionette.switch_to_frame("iframe")
self.assertIn("test2.xul", self.marionette.get_url(), "Switching by name failed")
self.assertIn("test2.xhtml", self.marionette.get_url(), "Switching by name failed")
self.marionette.switch_to_frame()
self.assertIn("test.xul", self.marionette.get_url(), "Switching by null failed")
self.assertIn("test.xhtml", self.marionette.get_url(), "Switching by null failed")
self.marionette.switch_to_frame("iframename")
self.assertIn("test2.xul", self.marionette.get_url(), "Switching by name failed")
self.assertIn("test2.xhtml", self.marionette.get_url(), "Switching by name failed")
iframe_element = self.marionette.get_active_frame()
self.marionette.switch_to_frame()
self.assertIn("test.xul", self.marionette.get_url(), "Switching by null failed")
self.assertIn("test.xhtml", self.marionette.get_url(), "Switching by null failed")
self.marionette.switch_to_frame(iframe_element)
self.assertIn("test2.xul", self.marionette.get_url(), "Switching by element failed")
self.assertIn("test2.xhtml", self.marionette.get_url(), "Switching by element failed")
def test_stack_trace(self):
self.assertIn("test.xul", self.marionette.get_url(), "Initial navigation has failed")
self.assertIn("test.xhtml", self.marionette.get_url(), "Initial navigation has failed")
self.marionette.switch_to_frame(0)
self.assertRaises(JavascriptException, self.marionette.execute_async_script, "foo();")
try:

View File

@ -9,7 +9,6 @@ from marionette_driver.keys import Keys
from marionette_harness import (
MarionetteTestCase,
skip_if_mobile,
WindowManagerMixin,
)
@ -89,7 +88,6 @@ class TestSwitchToWindowContent(WindowManagerMixin, MarionetteTestCase):
self.assertEqual(self.marionette.current_window_handle, self.start_tab)
self.assertEqual(self.get_selected_tab_index(), self.selected_tab_index)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_switch_tabs_in_different_windows_with_focus_change(self):
new_tab1 = self.open_tab(focus=True)
self.assertEqual(self.marionette.current_window_handle, self.start_tab)

View File

@ -12,7 +12,7 @@ from marionette_driver.errors import (
)
from marionette_driver.marionette import HTMLElement
from marionette_harness import MarionetteTestCase, run_if_manage_instance, skip_if_mobile
from marionette_harness import MarionetteTestCase, run_if_manage_instance
class TestTimeouts(MarionetteTestCase):
@ -65,7 +65,6 @@ class TestTimeouts(MarionetteTestCase):
self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "newDiv")
@run_if_manage_instance("Only runnable if Marionette manages the instance")
@skip_if_mobile("Bug 1322993 - Missing temporary folder")
def test_reset_timeout(self):
timeouts = [getattr(self.marionette.timeout, f) for f in (
'implicit', 'page_load', 'script',)]

View File

@ -20,7 +20,7 @@ class TestTitleChrome(WindowManagerMixin, MarionetteTestCase):
super(TestTitleChrome, self).tearDown()
def test_get_chrome_title(self):
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
title = self.marionette.execute_script(

View File

@ -10,7 +10,7 @@ from marionette_driver.by import By
from marionette_driver.errors import ElementNotInteractableException
from marionette_driver.keys import Keys
from marionette_harness import MarionetteTestCase, skip, skip_if_mobile
from marionette_harness import MarionetteTestCase, skip
def inline(doc):
@ -34,7 +34,6 @@ class TestTypingChrome(TypingTestCase):
super(TestTypingChrome, self).setUp()
self.marionette.set_context("chrome")
@skip_if_mobile("Interacting with chrome elements not available for Fennec")
def test_cut_and_paste_shortcuts(self):
with self.marionette.using_context("content"):
test_html = self.marionette.absolute_url("keyboard.html")
@ -50,12 +49,12 @@ class TestTypingChrome(TypingTestCase):
key_reporter.send_keys(self.mod_key, "x")
self.assertEqual("", key_reporter.get_property("value"))
url_bar = self.marionette.find_element(By.ID, "urlbar")
url_bar = self.marionette.find_element(By.ID, "urlbar-input")
# Clear contents first
url_bar.send_keys(self.mod_key, "a")
url_bar.send_keys(Keys.BACK_SPACE)
self.assertEqual("", url_bar.get_attribute("value"))
self.assertEqual("", url_bar.get_property("value"))
url_bar.send_keys(self.mod_key, "v")
self.assertEqual("zyxwvutsr", url_bar.get_property("value"))
@ -215,7 +214,6 @@ class TestTypingContent(TypingTestCase):
# filled, we're a letter short here
self.assertEqual(result.text, "I like chees")
@skip_if_mobile("Bug 1333069 - Assertion: 'down: 40' not found in u''")
def test_should_report_key_code_of_arrow_keys_up_down_events(self):
test_html = self.marionette.absolute_url("keyboard.html")
self.marionette.navigate(test_html)

View File

@ -31,7 +31,7 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
self.assertNotIn(new_window, self.marionette.window_handles)
def test_close_chrome_window_for_non_browser_window(self):
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
self.assertIn(win, self.marionette.chrome_window_handles)

View File

@ -7,7 +7,7 @@ from __future__ import absolute_import
import urllib
from marionette_driver.by import By
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
from marionette_harness import MarionetteTestCase, WindowManagerMixin
def inline(doc):
@ -22,7 +22,6 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
super(TestCloseWindow, self).tearDown()
@skip_if_mobile("Interacting with chrome windows not available for Fennec")
def test_close_chrome_window_for_browser_window(self):
with self.marionette.using_context("chrome"):
new_window = self.open_window()
@ -34,9 +33,8 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
self.assertListEqual(self.start_windows, chrome_window_handles)
self.assertNotIn(new_window, self.marionette.window_handles)
@skip_if_mobile("Interacting with chrome windows not available for Fennec")
def test_close_chrome_window_for_non_browser_window(self):
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
self.assertIn(new_window, self.marionette.chrome_window_handles)
@ -46,7 +44,6 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
self.assertListEqual(self.start_windows, chrome_window_handles)
self.assertNotIn(new_window, self.marionette.window_handles)
@skip_if_mobile("Interacting with chrome windows not available for Fennec")
def test_close_chrome_window_for_last_open_window(self):
self.close_all_windows()
@ -79,7 +76,6 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
self.marionette.find_element(By.TAG_NAME, "input").send_keys("foo")
self.marionette.close()
@skip_if_mobile("Interacting with chrome windows not available for Fennec")
def test_close_window_for_browser_window_with_single_tab(self):
new_tab = self.open_window()
self.marionette.switch_to_window(new_tab)
@ -98,7 +94,6 @@ class TestCloseWindow(WindowManagerMixin, MarionetteTestCase):
self.assertListEqual([self.start_window], self.marionette.chrome_window_handles)
self.assertIsNotNone(self.marionette.session)
@skip_if_mobile("discardBrowser is only available in Firefox")
def test_close_browserless_tab(self):
self.close_all_tabs()

View File

@ -16,7 +16,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestWindowHandles, self).setUp()
self.xul_dialog = "chrome://marionette/content/test_dialog.xul"
self.chrome_dialog = "chrome://marionette/content/test_dialog.xhtml"
self.marionette.set_context("chrome")
@ -46,7 +46,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
self.assertIn(new_browser, self.marionette.chrome_window_handles)
self.assertEqual(self.marionette.current_chrome_window_handle, self.start_window)
new_dialog = self.open_chrome_window(self.xul_dialog)
new_dialog = self.open_chrome_window(self.chrome_dialog)
self.assert_window_handles()
self.assertEqual(len(self.marionette.chrome_window_handles), len(self.start_windows) + 2)
self.assertIn(new_dialog, self.marionette.chrome_window_handles)
@ -62,7 +62,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
window_handles_in_chrome_scope)
def test_chrome_window_handles_after_opening_new_chrome_window(self):
new_window = self.open_chrome_window(self.xul_dialog)
new_window = self.open_chrome_window(self.chrome_dialog)
self.assert_window_handles()
self.assertEqual(len(self.marionette.chrome_window_handles), len(self.start_windows) + 1)
self.assertIn(new_window, self.marionette.chrome_window_handles)
@ -72,7 +72,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
self.marionette.switch_to_window(new_window)
self.assert_window_handles()
self.assertEqual(self.marionette.current_chrome_window_handle, new_window)
self.assertEqual(self.marionette.get_url(), self.xul_dialog)
self.assertEqual(self.marionette.get_url(), self.chrome_dialog)
# Close the chrome window, and carry on in our original window.
self.marionette.close_chrome_window()
@ -158,7 +158,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
self.assertEqual(self.marionette.current_window_handle, self.start_tab)
def test_window_handles_after_opening_new_chrome_window(self):
new_window = self.open_chrome_window(self.xul_dialog)
new_window = self.open_chrome_window(self.chrome_dialog)
self.assert_window_handles()
self.assertEqual(len(self.marionette.window_handles), len(self.start_tabs))
self.assertNotIn(new_window, self.marionette.window_handles)
@ -166,7 +166,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
self.marionette.switch_to_window(new_window)
self.assert_window_handles()
self.assertEqual(self.marionette.get_url(), self.xul_dialog)
self.assertEqual(self.marionette.get_url(), self.chrome_dialog)
# Check that the opened dialog is not accessible via window handles
with self.assertRaises(errors.NoSuchWindowException):

View File

@ -9,7 +9,7 @@ import urllib
from marionette_driver import errors
from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
from marionette_harness import MarionetteTestCase, WindowManagerMixin
def inline(doc):
@ -21,7 +21,7 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
def setUp(self):
super(TestWindowHandles, self).setUp()
self.xul_dialog = "chrome://marionette/content/test_dialog.xul"
self.chrome_dialog = "chrome://marionette/content/test_dialog.xhtml"
def tearDown(self):
self.close_all_tabs()
@ -78,9 +78,8 @@ class TestWindowHandles(WindowManagerMixin, MarionetteTestCase):
self.assert_window_handles()
self.assertEqual(self.marionette.current_window_handle, self.start_tab)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def tst_window_handles_after_opening_new_non_browser_window(self):
new_window = self.open_chrome_window(self.xul_dialog)
new_window = self.open_chrome_window(self.chrome_dialog)
self.assert_window_handles()
self.assertEqual(len(self.marionette.window_handles), len(self.start_tabs))
self.assertEqual(self.marionette.current_window_handle, self.start_tab)

View File

@ -7,7 +7,7 @@ from __future__ import absolute_import
from marionette_driver import By
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
@ -19,7 +19,6 @@ class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
self.close_all_tabs()
super(TestNoSuchWindowContent, self).tearDown()
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_closed_chrome_window(self):
with self.marionette.using_context("chrome"):
new_window = self.open_window()
@ -39,9 +38,8 @@ class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
with self.assertRaises(NoSuchWindowException):
self.marionette.switch_to_window(new_window)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_closed_chrome_window_while_in_frame(self):
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
with self.marionette.using_context("chrome"):
self.marionette.switch_to_frame("iframe")

View File

@ -7,7 +7,7 @@ from __future__ import absolute_import
from marionette_driver import By
from marionette_driver.errors import NoSuchWindowException
from marionette_harness import MarionetteTestCase, WindowManagerMixin, skip_if_mobile
from marionette_harness import MarionetteTestCase, WindowManagerMixin
class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
@ -19,7 +19,6 @@ class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
self.close_all_windows()
super(TestNoSuchWindowContent, self).tearDown()
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_closed_chrome_window(self):
with self.marionette.using_context("chrome"):
new_window = self.open_window()
@ -39,9 +38,8 @@ class TestNoSuchWindowContent(WindowManagerMixin, MarionetteTestCase):
with self.assertRaises(NoSuchWindowException):
self.marionette.switch_to_window(new_window)
@skip_if_mobile("Fennec doesn't support other chrome windows")
def test_closed_chrome_window_while_in_frame(self):
new_window = self.open_chrome_window("chrome://marionette/content/test.xul")
new_window = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(new_window)
with self.marionette.using_context("chrome"):

View File

@ -20,7 +20,7 @@ class TestWindowTypeChrome(WindowManagerMixin, MarionetteTestCase):
super(TestWindowTypeChrome, self).tearDown()
def test_get_window_type(self):
win = self.open_chrome_window("chrome://marionette/content/test.xul")
win = self.open_chrome_window("chrome://marionette/content/test.xhtml")
self.marionette.switch_to_window(win)
window_type = self.marionette.execute_script(

View File

@ -1,7 +1,7 @@
[test_marionette.py]
[test_transport.py]
[test_cli_arguments.py]
skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921
skip-if = manage_instance == false
[test_geckoinstance.py]
[test_data_driven.py]
[test_session.py]
@ -12,20 +12,15 @@ skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921
expected = fail
[test_click.py]
[test_click_chrome.py]
skip-if = appname == 'fennec'
[test_checkbox.py]
[test_checkbox_chrome.py]
skip-if = appname == 'fennec'
[test_elementsize.py]
[test_elementsize_chrome.py]
skip-if = appname == 'fennec'
[test_position.py]
[test_rendered_element.py]
[test_chrome_element_css.py]
skip-if = appname == 'fennec'
[test_element_state.py]
[test_element_state_chrome.py]
skip-if = appname == 'fennec'
[test_text.py]
[test_typing.py]
@ -34,36 +29,26 @@ skip-if = appname == 'fennec'
[test_execute_script.py]
[test_element_retrieval.py]
[test_findelement_chrome.py]
skip-if = appname == 'fennec'
[test_get_current_url_chrome.py]
[test_navigation.py]
[test_timeouts.py]
[test_anonymous_content.py]
skip-if = appname == 'fennec'
[test_switch_frame.py]
[test_switch_frame_chrome.py]
skip-if = appname == 'fennec'
[test_switch_window_chrome.py]
skip-if = appname == 'fennec'
[test_switch_window_content.py]
[test_pagesource.py]
[test_pagesource_chrome.py]
skip-if = appname == 'fennec'
[test_visibility.py]
[test_window_handles_chrome.py]
skip-if = appname == 'fennec'
[test_window_handles_content.py]
[test_window_close_chrome.py]
skip-if = appname == 'fennec'
[test_window_close_content.py]
[test_window_rect.py]
skip-if = appname == 'fennec'
[test_window_maximize.py]
skip-if = appname == 'fennec'
[test_window_status_content.py]
[test_window_status_chrome.py]
@ -71,9 +56,7 @@ skip-if = appname == 'fennec'
[test_cookies.py]
[test_title.py]
[test_title_chrome.py]
skip-if = appname == 'fennec'
[test_window_type_chrome.py]
skip-if = appname == 'fennec'
[test_implicit_waits.py]
[test_wait.py]
[test_expected.py]
@ -84,40 +67,35 @@ skip-if = appname == 'fennec'
[test_execute_isolate.py]
[test_click_scrolling.py]
[test_profile_management.py]
skip-if = manage_instance == false || appname == 'fennec' || (debug && ((os == 'mac') || (os == 'linux'))) # Bug 1298921, Bug 1450355
skip-if = manage_instance == false || (debug && ((os == 'mac') || (os == 'linux'))) # Bug 1450355
[test_quit_restart.py]
skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921
skip-if = manage_instance == false
[test_context.py]
[test_modal_dialogs.py]
skip-if = appname == 'fennec' # Bug 1325738
[test_unhandled_prompt_behavior.py]
skip-if = appname == 'fennec' # Bug 1325738
[test_key_actions.py]
[test_mouse_action.py]
[test_teardown_context_preserved.py]
[test_file_upload.py]
skip-if = appname == 'fennec' || os == "win" # http://bugs.python.org/issue14574
skip-if = os == "win" # http://bugs.python.org/issue14574
[test_execute_sandboxes.py]
[test_prefs.py]
[test_prefs_enforce.py]
skip-if = manage_instance == false || appname == 'fennec' # Bug 1298921
skip-if = manage_instance == false
[test_shadow_dom.py]
[test_chrome.py]
skip-if = appname == 'fennec'
[test_addons.py]
skip-if = appname == 'fennec' # Bug 1330598
[test_select.py]
[test_crash.py]
skip-if = asan || manage_instance == false || appname == 'fennec' # Bug 1298921
skip-if = asan || manage_instance == false
[test_localization.py]
[test_reftest.py]
skip-if = appname == 'fennec' # Bug 1519552

View File

@ -63,7 +63,6 @@ const DISABLED_ATTRIBUTE_SUPPORTED_XUL = new Set([
"SCALE",
"TAB",
"TABS",
"TEXTBOX",
"TOOLBARBUTTON",
"TREE",
]);

View File

@ -33,19 +33,18 @@ marionette.jar:
content/prefs.js (prefs.js)
content/proxy.js (proxy.js)
content/reftest.js (reftest.js)
content/reftest.xul (reftest.xul)
content/reftest.xhtml (reftest.xhtml)
content/server.js (server.js)
content/stream-utils.js (stream-utils.js)
content/sync.js (sync.js)
content/transport.js (transport.js)
#ifdef ENABLE_TESTS
content/test2.xul (chrome/test2.xul)
content/test_anonymous_content.xul (chrome/test_anonymous_content.xul)
content/test.xhtml (chrome/test.xhtml)
content/test2.xhtml (chrome/test2.xhtml)
content/test_dialog.dtd (chrome/test_dialog.dtd)
content/test_dialog.properties (chrome/test_dialog.properties)
content/test_dialog.xul (chrome/test_dialog.xul)
content/test_nested_iframe.xul (chrome/test_nested_iframe.xul)
content/test.xul (chrome/test.xul)
content/test_dialog.xhtml (chrome/test_dialog.xhtml)
content/test_nested_iframe.xhtml (chrome/test_nested_iframe.xhtml)
#ifdef MOZ_CODE_COVERAGE
content/PerTestCoverageUtils.jsm (../../tools/code-coverage/PerTestCoverageUtils.jsm)
#endif

View File

@ -1632,18 +1632,13 @@ function switchToFrame(msg) {
* Accepted values for |opts|:
*
* @param {UUID=} id
* Optional web element reference of an element to take a screenshot
* of.
* Optional web element reference of an element to take a screenshot of.
* @param {boolean=} full
* True to take a screenshot of the entire document element. Is not
* considered if {@code id} is not defined. Defaults to true.
* @param {Array.<UUID>=} highlights
* Draw a border around the elements found by their web element
* references.
* True to take a screenshot of the entire document element. Is only
* considered if <var>id</var> is not defined. Defaults to true.
* @param {boolean=} scroll
* When |id| is given, scroll it into view before taking the
* When <var>id</var> is given, scroll it into view before taking the
* screenshot. Defaults to true.
*
* @param {capture.Format} format
* Format to return the screenshot in.
* @param {Object.<string, ?>} opts
@ -1652,25 +1647,13 @@ function switchToFrame(msg) {
* @return {string}
* Base64 encoded string or a SHA-256 hash of the screenshot.
*/
function takeScreenshot(format, opts = {}) {
let id = opts.id;
let full = !!opts.full;
let highlights = opts.highlights || [];
let scroll = !!opts.scroll;
function takeScreenshot(format, { id, full = true, scroll = true } = {}) {
let win = curContainer.frame;
let canvas;
let highlightEls = highlights
.map(ref => WebElement.fromUUID(ref, "content"))
.map(webEl => seenEls.get(webEl, win));
// viewport
if (!id && !full) {
canvas = capture.viewport(win, highlightEls);
// element or full document element
} else {
if (id || full) {
let el;
if (id) {
let webEl = WebElement.fromUUID(id, "content");
@ -1682,7 +1665,11 @@ function takeScreenshot(format, opts = {}) {
el = win.document.documentElement;
}
canvas = capture.element(el, highlightEls);
canvas = capture.element(el);
// viewport
} else {
canvas = capture.viewport(win);
}
switch (format) {

View File

@ -8,7 +8,7 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
this.EXPORTED_SYMBOLS = ["modal"];
const COMMON_DIALOG = "chrome://global/content/commonDialog.xul";
const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml";
const isFirefox = () =>
Services.appinfo.ID == "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";

View File

@ -14,9 +14,3 @@ Tab
.. autoclass:: Tab
:members:
MenuPanel
----------
.. autoclass:: MenuPanel
:members:

View File

@ -65,8 +65,7 @@ class AddOnInstallBlockedNotification(BaseNotification):
:returns: The allow button.
"""
return self.element.find_element(
By.ANON_ATTRIBUTE, {'anonid': 'button'}).find_element(
By.ANON_ATTRIBUTE, {'anonid': 'button'})
By.CLASS, "popup-notification-primary-button")
class AddOnInstallConfirmationNotification(BaseNotification):

View File

@ -8,12 +8,10 @@ from marionette_driver import (
By, Wait
)
from marionette_driver.errors import NoSuchElementException
import firefox_puppeteer.errors as errors
from firefox_puppeteer.api.security import Security
from firefox_puppeteer.ui.base import UIBaseLib, DOMElement
from firefox_puppeteer.ui.base import UIBaseLib
class TabBar(UIBaseLib):
@ -21,22 +19,13 @@ class TabBar(UIBaseLib):
# Properties for visual elements of the tabs toolbar #
@property
def menupanel(self):
"""A :class:`MenuPanel` instance which represents the menu panel
at the far right side of the tabs toolbar.
:returns: :class:`MenuPanel` instance.
"""
return MenuPanel(self.marionette, self.window)
@property
def newtab_button(self):
"""The DOM element which represents the new tab button.
:returns: Reference to the new tab button.
"""
return self.toolbar.find_element(By.ANON_ATTRIBUTE, {'anonid': 'tabs-newtab-button'})
return self.toolbar.find_element(By.ID, 'tabs-newtab-button')
@property
def tabs(self):
@ -233,7 +222,7 @@ class Tab(UIBaseLib):
:returns: Reference to the tab close button.
"""
return self.tab_element.find_element(By.ANON_ATTRIBUTE, {'anonid': 'close-button'})
return self.tab_element.find_element(By.CSS_SELECTOR, '.tab-close-button')
@property
def tab_element(self):
@ -362,47 +351,3 @@ class Tab(UIBaseLib):
Use the :func:`~Tab.select` method instead.
"""
self.marionette.switch_to_window(self.handle)
class MenuPanel(UIBaseLib):
@property
def popup(self):
"""
:returns: The :class:`MenuPanelElement`.
"""
popup = self.marionette.find_element(By.ID, 'PanelUI-popup')
return self.MenuPanelElement(popup)
class MenuPanelElement(DOMElement):
"""Wraps the menu panel."""
_buttons = None
@property
def buttons(self):
"""
:returns: A list of all the clickable buttons in the menu panel.
"""
if not self._buttons:
self._buttons = (self.find_element(By.ID, 'PanelUI-multiView')
.find_element(By.ANON_ATTRIBUTE,
{'anonid': 'viewContainer'})
.find_elements(By.TAG_NAME,
'toolbarbutton'))
return self._buttons
def click(self, target=None):
"""
Overrides HTMLElement.click to provide a target to click.
:param target: The label associated with the button to click on,
e.g., `New Private Window`.
"""
if not target:
return DOMElement.click(self)
for button in self.buttons:
if button.get_attribute('label') == target:
return button.click()
raise NoSuchElementException('Could not find "{}"" in the '
'menu panel UI'.format(target))

View File

@ -79,7 +79,6 @@ class LocationBar(UIBaseLib):
def __init__(self, *args, **kwargs):
super(LocationBar, self).__init__(*args, **kwargs)
self._autocomplete_results = None
self._identity_popup = None
def clear(self):
@ -90,29 +89,6 @@ class LocationBar(UIBaseLib):
lambda _: self.value == '',
message='Contents of location bar could not be cleared.')
def close_context_menu(self):
"""Closes the Location Bar context menu by a key event."""
# TODO: This method should be implemented via the menu API.
self.contextmenu.send_keys(keys.Keys.ESCAPE)
@property
def connection_icon(self):
""" Provides access to the urlbar connection icon.
:returns: Reference to the connection icon element.
"""
return self.marionette.find_element(By.ID, 'connection-icon')
@property
def contextmenu(self):
"""Provides access to the urlbar context menu.
:returns: Reference to the urlbar context menu.
"""
# TODO: This method should be implemented via the menu API.
parent = self.urlbar.find_element(By.ANON_ATTRIBUTE, {'anonid': 'moz-input-box'})
return parent.find_element(By.ANON_ATTRIBUTE, {'anonid': 'input-box-contextmenu'})
@property
def focused(self):
"""Checks the focus state of the location bar.
@ -147,27 +123,6 @@ class LocationBar(UIBaseLib):
lambda _: self.focused,
message='Location bar has not be focused.')
def get_contextmenu_entry(self, action):
"""Retrieves the urlbar context menu entry corresponding
to the given action.
:param action: The action corresponding to the retrieved value.
:returns: Reference to the urlbar contextmenu entry.
"""
# TODO: This method should be implemented via the menu API.
entries = self.contextmenu.find_elements(By.CSS_SELECTOR, 'menuitem')
filter_on = 'cmd_%s' % action
found = [e for e in entries if e.get_attribute('cmd') == filter_on]
return found[0] if len(found) else None
@property
def history_drop_marker(self):
"""Provides access to the history drop marker.
:returns: Reference to the history drop marker.
"""
return self.urlbar.find_element(By.ANON_ATTRIBUTE, {'anonid': 'historydropmarker'})
@property
def identity_box(self):
"""The DOM element which represents the identity box.
@ -279,7 +234,7 @@ class LocationBar(UIBaseLib):
:returns: Reference to the urlbar input.
"""
return self.urlbar.find_element(By.ANON_ATTRIBUTE, {'anonid': 'input'})
return self.marionette.find_element(By.ID, 'urlbar-input')
@property
def value(self):
@ -287,113 +242,7 @@ class LocationBar(UIBaseLib):
:returns: The urlbar value.
"""
return self.urlbar.get_property('value')
class AutocompleteResults(UIBaseLib):
"""Wraps DOM elements and methods for interacting with autocomplete results."""
def close(self, force=False):
"""Closes the urlbar autocomplete popup.
:param force: If true, the popup is closed by its own hide function,
otherwise a key event is sent to close the popup.
"""
if not self.is_open:
return
if force:
self.marionette.execute_script("""
arguments[0].hidePopup();
""", script_args=[self.element])
else:
self.element.send_keys(keys.Keys.ESCAPE)
Wait(self.marionette).until(
lambda _: not self.is_open,
message='Autocomplete popup has not been closed.')
def get_matching_text(self, result, match_type):
"""Returns an array of strings of the matching text within an autocomplete
result in the urlbar.
:param result: The result to inspect for matches.
:param match_type: The type of match to search for (one of `title` or `url`).
"""
if match_type not in ('title', 'url'):
raise ValueError('match_type provided must be one of'
'"title" or "url", not %s' % match_type)
# Search for nodes of the given type with emphasized text
emphasized_nodes = result.find_elements(
By.ANON_ATTRIBUTE,
{'class': 'ac-emphasize-text ac-emphasize-text-%s' % match_type}
)
return [node.get_property('textContent') for node in emphasized_nodes]
@property
def visible_results(self):
"""Supplies the list of visible autocomplete result nodes.
:returns: The list of visible results.
"""
match_count = self.element.get_property('matchCount')
return self.marionette.execute_script("""
let rv = [];
let node = arguments[0];
let count = arguments[1];
for (let i = 0; i < count; ++i) {
rv.push(node.getItemAtIndex(i));
}
return rv;
""", script_args=[self.results, match_count])
@property
def is_open(self):
"""Returns whether this popup is currently open.
:returns: True when the popup is open, otherwise false.
"""
return self.element.get_property('state') == 'open'
@property
def is_complete(self):
"""Returns when this popup is open and autocomplete results are complete.
:returns: True, when autocomplete results have been populated.
"""
return self.marionette.execute_script("""
Components.utils.import("resource://gre/modules/Services.jsm");
let win = Services.focus.activeWindow;
if (win) {
return win.gURLBar.controller.searchStatus >=
Components.interfaces.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH;
}
return null;
""")
@property
def results(self):
"""
:returns: The autocomplete result container node.
"""
return self.element.find_element(By.ANON_ATTRIBUTE,
{'anonid': 'richlistbox'})
@property
def selected_index(self):
"""Provides the index of the selected item in the autocomplete list.
:returns: The index.
"""
return self.results.get_property('selectedIndex')
return self.urlbar_input.get_property('value')
class IdentityPopup(UIBaseLib):

View File

@ -35,7 +35,6 @@ class BrowserWindow(BaseWindow):
properties = [
'chrome://branding/locale/brand.properties',
'chrome://browser/locale/browser.properties',
'chrome://browser/locale/preferences/preferences.properties',
'chrome://global/locale/browser.properties',
]

View File

@ -50,7 +50,7 @@ class Wizard(UIBaseLib):
@property
def _buttons(self):
return self.element.find_element(By.ANON_ATTRIBUTE, {'anonid': 'Buttons'})
return self.element.get_property('_wizardButtons')
@property
def cancel_button(self):

View File

@ -137,7 +137,7 @@ reftest.Runner = class {
assert.positiveInteger(height);
let reftestWin = this.parentWindow.open(
"chrome://marionette/content/reftest.xul",
"chrome://marionette/content/reftest.xhtml",
"reftest",
`chrome,height=${height},width=${width}`
);
@ -157,7 +157,6 @@ reftest.Runner = class {
browser = reftestWin.document.createElementNS(XUL_NS, "xul:browser");
browser.permanentKey = {};
browser.setAttribute("id", "browser");
browser.setAttribute("anonid", "initialBrowser");
browser.setAttribute("type", "content");
browser.setAttribute("primary", "true");
if (this.remote) {

View File

@ -780,7 +780,7 @@ var BrowserTestUtils = {
return new Promise(resolve => {
async function observer(subject, topic, data) {
if (topic == "domwindowopened" && (!win || subject === win)) {
let observedWindow = subject.QueryInterface(Ci.nsIDOMWindow);
let observedWindow = subject;
if (checkFn && !(await checkFn(observedWindow))) {
return;
}
@ -806,7 +806,7 @@ var BrowserTestUtils = {
function observer(subject, topic, data) {
if (topic == "domwindowclosed" && (!win || subject === win)) {
Services.ww.unregisterNotification(observer);
resolve(subject.QueryInterface(Ci.nsIDOMWindow));
resolve(subject);
}
}
Services.ww.registerNotification(observer);
@ -2123,7 +2123,7 @@ var BrowserTestUtils = {
*/
async promiseAlertDialogOpen(
buttonAction,
uri = "chrome://global/content/commonDialog.xul",
uri = "chrome://global/content/commonDialog.xhtml",
func
) {
let win = await this.domWindowOpened(null, async win => {
@ -2140,8 +2140,8 @@ var BrowserTestUtils = {
return win;
}
let doc = win.document.documentElement;
doc.getButton(buttonAction).click();
let dialog = win.document.querySelector("dialog");
dialog.getButton(buttonAction).click();
return win;
},
@ -2161,7 +2161,7 @@ var BrowserTestUtils = {
*/
async promiseAlertDialog(
buttonAction,
uri = "chrome://global/content/commonDialog.xul",
uri = "chrome://global/content/commonDialog.xhtml",
func
) {
let win = await this.promiseAlertDialogOpen(buttonAction, uri, func);

View File

@ -1,4 +1,4 @@
[DEFAULT]
[test_baselinecoverage.xul]
[test_baselinecoverage.xhtml]
run-if = ccov && verify

View File

@ -72,7 +72,7 @@
try {
logger = new MozillaFileLogger(gConfig.logFile)
} catch (ex) {
dump("TEST-UNEXPECTED-FAIL | (browser-harness.xul) | " +
dump("TEST-UNEXPECTED-FAIL | (browser-harness.xhtml) | " +
"Error trying to log to " + gConfig.logFile + ": " + ex + "\n");
}
}

View File

@ -5,7 +5,6 @@
// Test timeout (seconds)
var gTimeoutSeconds = 45;
var gConfig;
var gSaveInstrumentationData = null;
var { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
@ -96,7 +95,7 @@ function testInit() {
Services.ww.openWindow(
window,
"chrome://mochikit/content/browser-harness.xul",
"chrome://mochikit/content/browser-harness.xhtml",
"browserTest",
"chrome,centerscreen,dialog=no,resizable,titlebar,toolbar=no,width=800,height=600",
sstring
@ -148,279 +147,6 @@ function testInit() {
"chrome://mochikit/content/tests/SimpleTest/AsyncUtilsContent.js",
true
);
var testSuite = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment)
.get("TEST_SUITE");
if (testSuite == "browser-chrome-instrumentation") {
takeInstrumentation();
}
}
function takeInstrumentation() {
let instrumentData = {
elements: {},
};
function pad(str, length) {
if (str.length >= length) {
return str;
}
return str + " ".repeat(length - str.length);
}
function byCount(a, b) {
return b[1] - a[1];
}
function getSummaryText() {
let summary = [];
let allData = {};
for (let selector of Object.keys(instrumentData.elements)) {
allData[selector] = instrumentData.elements[selector];
}
let selectors = Object.keys(allData);
let elements = selectors.map(s => allData[s]);
let namespaceMap = new Map();
let bindingMap = new Map();
for (let element of elements) {
if (!bindingMap.has(element.binding)) {
bindingMap.set(element.binding, 1);
} else {
bindingMap.set(element.binding, bindingMap.get(element.binding) + 1);
}
if (!namespaceMap.has(element.namespaceURI)) {
namespaceMap.set(element.namespaceURI, new Map());
}
let localNameMap = namespaceMap.get(element.namespaceURI);
if (!localNameMap.has(element.localName)) {
localNameMap.set(element.localName, 1);
} else {
localNameMap.set(
element.localName,
localNameMap.get(element.localName) + 1
);
}
}
for (let [namespace, localNameMap] of namespaceMap) {
summary.push(`Elements in namespace ${namespace}`);
let entries = Array.from(localNameMap);
entries.sort(byCount);
for (let entry of entries) {
summary.push(` ${pad(entry[1] + "", 5)} ${entry[0]}`);
}
}
summary.push("XBL bindings");
let bindings = Array.from(bindingMap);
bindings.sort(byCount);
let bindingsJSON = {};
for (let binding of bindings) {
summary.push(` ${pad(binding[1] + "", 5)} ${binding[0]}`);
if (binding[0]) {
bindingsJSON[binding[0].split("#")[1].split('"')[0]] = binding[1];
}
}
summary.push("XBL bindings as JSON");
summary.push(JSON.stringify(bindingsJSON, null, 2));
return summary.join("\n");
}
// Saves instrumantation data
function saveData() {
let path = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment)
.get("MOZ_UPLOAD_DIR");
let encoder = new TextEncoder();
let instrumentPath = OS.Path.join(path, "xulinstrument.txt");
OS.File.writeAtomic(
instrumentPath,
encoder.encode(JSON.stringify(instrumentData, null, 2))
);
let summaryPath = OS.Path.join(path, "xulsummary.txt");
OS.File.writeAtomic(summaryPath, encoder.encode(getSummaryText()));
}
// An iterator over an element and its ancestors
function* elementPath(element) {
yield element;
while ((element = element.parentNode) && element instanceof Element) {
yield element;
}
}
// Returns the information we care about for an element
function getElementInfo(element) {
let style = element.ownerGlobal.getComputedStyle(element);
let binding = style && style.getPropertyValue("-moz-binding");
return {
namespaceURI: element.namespaceURI,
localName: element.localName,
binding: binding && binding != "none" ? binding : null,
};
}
// The selector for just this element
function immediateSelector(element) {
if (
element.localName == "notificationbox" &&
element.parentNode &&
element.parentNode.id == "tabbrowser-tabpanels"
) {
// Don't do a full selector for a tabpanel's notificationbox
return element.localName;
}
if (
element.localName == "tab" &&
element.classList.contains("tabbrowser-tab")
) {
// Don't do a full selector for a tab
return element.localName;
}
if (element.id) {
return `#${element.id}`;
}
let selector = element.localName;
if (element.classList.length) {
selector += `.${Array.from(element.classList).join(".")}`;
}
for (let attr of ["src", "label"]) {
if (element.hasAttribute(attr)) {
selector += `[${attr}=${JSON.stringify(element.getAttribute(attr))}]`;
}
}
return selector;
}
// The selector chain for the element
function elementSelector(element) {
return Array.from(elementPath(element))
.reverse()
.map(immediateSelector)
.join(" > ");
}
// An iterator over all elements in the window
function* windowElements(win) {
yield* elementDescendants(win.document.documentElement);
}
// An iterator over an element and all of its descendants
function* elementDescendants(element) {
let walker = Cc["@mozilla.org/inspector/deep-tree-walker;1"].createInstance(
Ci.inIDeepTreeWalker
);
walker.showAnonymousContent = true;
walker.showSubDocuments = false;
walker.showDocumentsAsNodes = false;
walker.init(element, NodeFilter.SHOW_ELEMENT);
yield element;
while (walker.nextNode()) {
if (walker.currentNode instanceof Element) {
yield walker.currentNode;
}
}
}
// Checks if we've seen an element and if not adds it to the instrumentation data
function instrumentElement(element) {
if (element.__instrumentSeen) {
return;
}
let selector = elementSelector(element);
element.__instrumentSeen = true;
if (selector in instrumentData.elements) {
return;
}
instrumentData.elements[selector] = getElementInfo(element);
}
// Instruments every element in a window
function scanWindow(win) {
Array.from(windowElements(win)).forEach(instrumentElement);
}
// Instruments every element in an element's descendants
function scanElement(element) {
Array.from(elementDescendants(element)).forEach(instrumentElement);
}
function handleMutation(mutation) {
if (mutation.type != "childList") {
return;
}
for (let node of mutation.addedNodes) {
if (node instanceof Element) {
scanElement(node);
}
}
}
// Watches a window for new elements to instrument
function observeWindow(win) {
let observer = new MutationObserver(mutations => {
mutations.forEach(handleMutation);
});
observer.observe(win.document, {
childList: true,
subtree: true,
});
win.addEventListener(
"unload",
() => {
observer.takeRecords().forEach(handleMutation);
},
{ once: true }
);
}
scanWindow(window);
observeWindow(window);
gSaveInstrumentationData = saveData;
Services.ww.registerNotification((win, topic, data) => {
if (topic != "domwindowopened") {
return;
}
win.addEventListener(
"load",
() => {
if (win.location.href != AppConstants.BROWSER_CHROME_URL) {
return;
}
scanWindow(win);
observeWindow(win);
},
{ once: true }
);
});
}
function isGenerator(value) {
@ -637,11 +363,8 @@ Tester.prototype = {
},
async promiseMainWindowReady() {
if (window.gBrowserInit && !gBrowserInit.idleTasksFinished) {
await this.TestUtils.topicObserved(
"browser-idle-startup-tasks-finished",
subject => subject === window
);
if (window.gBrowserInit) {
await window.gBrowserInit.idleTasksFinishedPromise;
}
},
@ -680,7 +403,7 @@ Tester.prototype = {
// Remove stale tabs
if (this.currentTest && window.gBrowser && gBrowser.tabs.length > 1) {
while (gBrowser.tabs.length > 1) {
let lastTab = gBrowser.tabContainer.lastElementChild;
let lastTab = gBrowser.tabs[gBrowser.tabs.length - 1];
if (!lastTab.closing) {
// Report the stale tab as an error only when they're not closing.
// Tests can finish without waiting for the closing tabs.
@ -793,10 +516,6 @@ Tester.prototype = {
this.callback(this.tests);
this.callback = null;
this.tests = null;
if (gSaveInstrumentationData) {
gSaveInstrumentationData();
}
},
haltTests: function Tester_haltTests() {

View File

@ -2,15 +2,15 @@
skip-if = os == 'android'
support-files = test-dir/test-file
[test_sample.xul]
[test_sanityEventUtils.xul]
[test_sample.xhtml]
[test_sanityEventUtils.xhtml]
[test_sanityPluginUtils.html]
[test_sanityException.xul]
[test_sanityException2.xul]
[test_sanityManifest.xul]
[test_sanityException.xhtml]
[test_sanityException2.xhtml]
[test_sanityManifest.xhtml]
fail-if = true
[test_sanityManifest_pf.xul]
[test_sanityManifest_pf.xhtml]
fail-if = true
[test_chromeGetTestFile.xul]
[test_tasks_skip.xul]
[test_tasks_skipall.xul]
[test_chromeGetTestFile.xhtml]
[test_tasks_skip.xhtml]
[test_tasks_skipall.xhtml]

View File

@ -17,21 +17,21 @@
SimpleTest.waitForExplicitFinish();
SimpleTest.doesThrow(function () {
getTestFilePath("/test_chromeGetTestFile.xul")
getTestFilePath("/test_chromeGetTestFile.xhtml")
}, "getTestFilePath rejects absolute paths");
Promise.all([
OS.File.exists(getTestFilePath("test_chromeGetTestFile.xul"))
OS.File.exists(getTestFilePath("test_chromeGetTestFile.xhtml"))
.then(function (exists) {
ok(exists, "getTestFilePath consider the path as being relative");
}),
OS.File.exists(getTestFilePath("./test_chromeGetTestFile.xul"))
OS.File.exists(getTestFilePath("./test_chromeGetTestFile.xhtml"))
.then(function (exists) {
ok(exists, "getTestFilePath also accepts explicit relative path");
}),
OS.File.exists(getTestFilePath("./test_chromeGetTestFileTypo.xul"))
OS.File.exists(getTestFilePath("./test_chromeGetTestFileTypo.xhtml"))
.then(function (exists) {
ok(!exists, "getTestFilePath do not throw if the file doesn't exists");
}),

View File

@ -106,24 +106,6 @@
var startTime = new Date();
var result;
/* test synthesizeDragStart */
result = synthesizeDragStart($("drag1"), drag1, window);
is(result, null, "drag1 is text/uri-list");
result = synthesizeDragStart($("drag1"), drag1WrongFlavor, window);
isnot(result, null, "drag1 is not text/plain");
result = synthesizeDragStart($("drag1"), drag2items, window);
isnot(result, null, "drag1 is not 2 items");
result = synthesizeDragStart($("drag2"), drag2, window);
is(result, null, "drag2 is ordered text/plain then text/uri-list");
result = synthesizeDragStart($("drag2"), drag1, window);
isnot(result, null, "drag2 is not one flavor");
result = synthesizeDragStart($("drag2"), drag2WrongOrder, window);
isnot(result, null, "drag2 is not ordered text/uri-list then text/plain");
result = synthesizeDragStart($("dragfile"), dragfile, window);
is(result, null, "dragfile is nsIFile");
result = synthesizeDragStart($("drag1"), null, window);
is(result, regularDtForDrag1, "synthesizeDragStart accepts null expectedDragData");
/* test synthesizeDrop */
result = synthesizeDrop($("dragDrop"), $("dragDrop"), dragDrop, null, window);
ok(gEnter, "Fired dragenter");

View File

@ -189,7 +189,7 @@ class ShutdownLeaks(object):
def _isHiddenWindowURL(self, url):
return (url == "resource://gre-resources/hiddenWindow.html" or # Win / Linux
url == "chrome://browser/content/hiddenWindow.xul") # Mac
url == "chrome://browser/content/hiddenWindowMac.xhtml") # Mac
class LSANLeaks(object):

View File

@ -539,12 +539,6 @@ class MochitestArguments(ArgumentContainer):
"help": "Filter out tests that don't have the given tag. Can be used multiple "
"times in which case the test must contain at least one of the given tags.",
}],
[["--enable-cpow-warnings"],
{"action": "store_true",
"dest": "enableCPOWWarnings",
"help": "Enable logging of unsafe CPOW usage, which is disabled by default for tests",
"suppress": True,
}],
[["--marionette"],
{"default": None,
"help": "host:port to use when connecting to Marionette",

View File

@ -20,11 +20,11 @@ FINAL_TARGET_FILES += [
]
FINAL_TARGET_FILES.content += [
'browser-harness.xul',
'browser-harness.xhtml',
'browser-test.js',
'chrome-harness.js',
'chunkifyTests.js',
'harness.xul',
'harness.xhtml',
'manifestLibrary.js',
'mochitest-e10s-utils.js',
'nested_setup.js',
@ -94,12 +94,12 @@ TEST_HARNESS_FILES.testing.mochitest += [
'/build/valgrind/x86_64-pc-linux-gnu.sup',
'/netwerk/test/httpserver/httpd.js',
'bisection.py',
'browser-harness.xul',
'browser-harness.xhtml',
'browser-test.js',
'chrome-harness.js',
'chunkifyTests.js',
'favicon.ico',
'harness.xul',
'harness.xhtml',
'leaks.py',
'mach_test_package_commands.py',
'manifest.webapp',

View File

@ -17,7 +17,7 @@
}
function redirectToHarness() {
redirect("chrome://mochikit/content/harness.xul");
redirect("chrome://mochikit/content/harness.xhtml");
}
function onLoad() {

View File

@ -81,9 +81,15 @@ function starttest(){
// QueryInterface and getPrivilegedProps tests
is(SpecialPowers.can_QI(SpecialPowers), false);
ok(SpecialPowers.can_QI(window));
ok(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"));
is(SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(window, "nsIDOMWindow"), "document.nodeName"), "#document");
let doc = SpecialPowers.wrap(document);
is(SpecialPowers.getPrivilegedProps(doc, "baseURIObject.fileName"), null,
"Should not have a fileName property yet");
let uri = SpecialPowers.getPrivilegedProps(doc, "baseURIObject");
ok(SpecialPowers.can_QI(uri));
ok(SpecialPowers.do_QueryInterface(uri, "nsIURL"));
is(SpecialPowers.getPrivilegedProps(doc, "baseURIObject.fileName"),
"test_SpecialPowersExtension.html",
"Should have a fileName property now");
//try to run garbage collection
SpecialPowers.gc();

File diff suppressed because it is too large Load Diff

View File

@ -138,4 +138,18 @@ ExtensionTestUtils.loadExtension = function(ext)
SimpleTest.info(`Extension loaded`);
return extension;
}
};
ExtensionTestUtils.failOnSchemaWarnings = (warningsAsErrors = true) => {
let prefName = "extensions.webextensions.warnings-as-errors";
SpecialPowers.setBoolPref(prefName, warningsAsErrors);
if (!warningsAsErrors) {
let registerCleanup;
if (typeof registerCleanupFunction != "undefined") {
registerCleanup = registerCleanupFunction;
} else {
registerCleanup = SimpleTest.registerCleanupFunction.bind(SimpleTest);
}
registerCleanup(() => SpecialPowers.setBoolPref(prefName, true));
}
};

View File

@ -31,8 +31,8 @@ try {
// case it is not defined) from a parent/opener window.
//
// Finding the SpecialPowers object is needed when we have ChromePowers in
// harness.xul and we need SpecialPowers in the iframe, and also for tests
// like test_focus.xul where we open a window which opens another window which
// harness.xhtml and we need SpecialPowers in the iframe, and also for tests
// like test_focus.xhtml where we open a window which opens another window which
// includes SimpleTest.js.
(function() {
function ancestor(w) {

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'"></meta>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; object-src 'none'"></meta>
<title>This is a dummy page</title>
<meta charset="utf-8">
<body>This is a dummy page</body>

View File

@ -141,6 +141,9 @@ def test_environment(xrePath, env=None, crashreporter=True, debugger=False,
env.setdefault('R_LOG_DESTINATION', 'stderr')
env.setdefault('R_LOG_VERBOSE', '1')
# Ask NSS to use lower-security password encryption. See Bug 1594559
env.setdefault('NSS_MAX_MP_PBE_ITERATION_COUNT', '10')
# ASan specific environment stuff
asan = bool(mozinfo.info.get("asan"))
if asan:

View File

@ -169,7 +169,6 @@ config = {
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
"mochitest-browser-chrome-coverage": ["--flavor=browser", "--chunk-by-runtime", "--timeout=1200"],
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],

View File

@ -136,7 +136,6 @@ config = {
"mochitest-browser-chrome": ["--flavor=browser"],
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],

View File

@ -159,7 +159,6 @@ config = {
"mochitest-browser-chrome": ["--flavor=browser"],
"mochitest-browser-chrome-chunked": ["--flavor=browser", "--chunk-by-runtime"],
"mochitest-browser-chrome-screenshots": ["--flavor=browser", "--subsuite=screenshots"],
"mochitest-browser-chrome-instrumentation": ["--flavor=browser"],
"mochitest-webgl1-core": ["--subsuite=webgl1-core"],
"mochitest-webgl1-ext": ["--subsuite=webgl1-ext"],
"mochitest-webgl2-core": ["--subsuite=webgl2-core"],

View File

@ -188,8 +188,8 @@ class CodeCoverageMixin(SingleTestMixin):
'test': 'testing/mochitest/baselinecoverage/browser_chrome/browser_baselinecoverage.js', # NOQA: E501
'suite': 'mochitest-browser-chrome'
},
'.xul': {
'test': 'testing/mochitest/baselinecoverage/chrome/test_baselinecoverage.xul',
'.xhtml': {
'test': 'testing/mochitest/baselinecoverage/chrome/test_baselinecoverage.xhtml',
'suite': 'mochitest-chrome'
}
}

View File

@ -57,4 +57,3 @@ user_pref("media.allowed-to-play.enabled", true);
// Ensure media can always play without delay
user_pref("media.block-autoplay-until-in-foreground", false);
user_pref("toolkit.telemetry.coverage.endpoint.base", "http://localhost");
user_pref("layout.css.moz-binding.content.enabled", true); // Le sad

View File

@ -3,3 +3,7 @@
// disk cache smart size is enabled in shipped apps
user_pref("browser.cache.disk.smart_size.enabled", true);
// Raptor's manifest.json contains the "geckoProfiler" permission, which is
// not supported on Android. Ignore the warning about the unknown permission.
user_pref("extensions.webextensions.warnings-as-errors", false);

View File

@ -61,9 +61,9 @@ XPCOMUtils.defineLazyServiceGetter(
);
async function talosStart() {
// Tests are driven from pageloader.xul. We need to be careful to open
// pageloader.xul before dismissing the default browser window or we
// may inadvertently cause the browser to exit before the pageloader.xul
// Tests are driven from pageloader.xhtml. We need to be careful to open
// pageloader.xhtml before dismissing the default browser window or we
// may inadvertently cause the browser to exit before the pageloader.xhtml
// window is opened. Start by finding or waiting for the default window.
let defaultWin = Services.wm.getMostRecentWindow("navigator:browser");
if (!defaultWin) {
@ -84,8 +84,8 @@ async function talosStart() {
}
// Wwe've got the default window, it is time for pageloader to take over.
// Open pageloader.xul in a new window and then close the default window.
let chromeURL = "chrome://pageloader/content/pageloader.xul";
// Open pageloader.xhtml in a new window and then close the default window.
let chromeURL = "chrome://pageloader/content/pageloader.xhtml";
let args = {};
args.wrappedJSObject = args;

View File

@ -6193,9 +6193,6 @@
"startTime": 1393256133774,
"recentCrashes": 0
},
"scratchpads": [
],
"global": {
}

Some files were not shown because too many files have changed in this diff Show More