Commit Graph
79 Commits
Author SHA1 Message Date
Andreas Tolfsen be7f5da303 Bug 1405004 - Remove unused imports from testing/marionette/element.js. r=whimboo
MozReview-Commit-ID: 7EoehdeV8tf
2017-10-02 17:20:57 +01:00
Henrik Skupin f522dd4100 Bug 1404277 - Retrieve namespaceURI as property and not attribute. r=ato
With newer Selenium atoms which do not conflate attributes and
properties, the retrieval via getElementAttribute will fail. By
retrieving it directly as property will fix it.

MozReview-Commit-ID: CFy3JZDeUWq
2017-09-29 12:54:03 +02:00
Andreas Tolfsen 2db99be489 Bug 1399076 - Error when weakref of web element is destroyed. r=automatedtester
Take into account that a weak referenced element might have been destroyed
in the element staleness check.

An error is thrown when the reference object has been destroyed when
getting a weakrefs' pointer.  We catch this, but element.isStale does
not take into account that the el argument in this case can be null,
or in this revision of the patch, undefined.

MozReview-Commit-ID: 7sr4YGhAotS
2017-09-12 13:18:52 +01:00
Wes Kocher 3f192cf984 Merge m-c to inbound, a=merge
MozReview-Commit-ID: 77Uz3uceUmk
2017-08-31 16:56:23 -07:00
Andreas Tolfsen 14aee217d3 Bug 1395469 - Check discarded ChromeWindow in staleness test. r=me
HTML elements' ownerGlobal is a WindowProxy that indirects operations
to the current browsing context.  However, for XUL elements this global
is ChromeWindow which gets reset to null when the window is discarded.

For the same reason, since win indirects to the current browsing context's
associated window, we need to test that the element's node document is
not the active document.

Finally test that its shadow-including root is a document.

MozReview-Commit-ID: EYh18P8DbcN
2017-08-31 17:36:27 +01:00
Andreas Tolfsen 7aeed18293 Bug 1394849 - Export pprint separately. r=automatedtester
pprint is currently exposed twice: once on the error namespace and once
separately.  We only want to expose it once, and since there are only a
handful "error.pprint" usages left, we can go ahead and make this change.

When we move transition to use "require" in the future, like devtools
does, it will be possible to use both "error.pprint" and "pprint" styles
without export duplication.

MozReview-Commit-ID: CAnPDWn9Vr7
2017-08-29 17:33:38 +01:00
Andreas Tolfsen c084a3b467 Bug 1394881 - Use Node.isConnected for web element staleness check. r=automatedtester
It turns out that Node.isConnected (described in
https://dom.spec.whatwg.org/#dom-node-isconnected) handles an element’s
shadow root, which element.isDisconnected tries to replicate.

element.isDisconnected and element.isStale are both long and error-prone
and can be removed entirely in favour of this web platform API.

The relevant change to the WebDriver specification landed in
https://github.com/w3c/webdriver/commit/32a477b023d155d0ee348cd87bcbc3e2b65eda1b.

MozReview-Commit-ID: 5Q0gWLvw8KL
2017-08-30 14:22:39 +01:00
Andreas Tolfsen 7120605cd4 Bug 1393812 - Fix call to element.isDisconnected. r=automatedtester
A fallout from https://bugzil.la/1392346 was that element.isStale called
element.isDisconnected incorrectly by using the old container object.
This was reported in https://bugzil.la/1392854.

Since we in the long term want to get rid of the concept
of window/shadow root containers (in preparation for
https://bugzil.la/marionette-window-tracking), we might as well fix
the fallout by making element.isDisconnected take separate window-
and shadowRoot arguments, like element.isStale.

Fixes: https://bugzil.la/1392854
MozReview-Commit-ID: ELIu8HsZUfK
2017-08-25 16:30:08 +01:00
Andreas Tolfsen c044670d59 Bug 1392346 - Decouple element staleness check from element.Store. r=automatedtester
In preparation for a larger window tracking change to Marionette, we
want to decouple the element staleness check from the element.Store.

MozReview-Commit-ID: JNZqCc2eZqy
2017-08-21 19:09:15 +01:00
Andreas Tolfsen 070bd7e93b Bug 1392339 - Fix misuse of nsIDOMElement in API docs. r=automatedtester
MozReview-Commit-ID: 3q35q6TTbTH
2017-08-21 18:56:19 +01:00
Andreas Tolfsen bc94bffcdf Bug 1392339 - Fix misuse of nsIDOMWindow in API docs. r=automatedtester
nsIDOMWindow is the XPCOM interface and not what we mean in all these
cases.  We either want to refer to the ChromeWindow or to the WindowProxy,
depending on the context of the code.

MozReview-Commit-ID: 405po1XLXRi
2017-08-21 18:52:18 +01:00
David Burns a4c539f207 Bug 1387644 - Return NoSuchElementError when element is not found r=ato
MozReview-Commit-ID: LDHiyce09GR
2017-08-05 00:50:46 +01:00
Andreas Tolfsen 4de66d5b60 Bug 1387461 - Add note to remove element.isVisible. r=automatedtester
DONTBUILD

MozReview-Commit-ID: AO8ikaX6RHB
2017-08-04 15:51:19 +01:00
Andreas Tolfsen ec31b545aa Bug 1385547 - Lint testing/marionette. r=automatedtester
Automatic fixes from './mach lint --fix testing/marionette'.

MozReview-Commit-ID: 4UOLrLLxMbH
2017-07-31 16:01:12 +01:00
Andreas Tolfsen f52986781a Bug 1384517 - Fix testing/marionette API docs; r=automatedtester
Various fixes to make the generated API documentation from
testing/marionette somewhat easier to read.

MozReview-Commit-ID: F9duuQoOYBt
2017-07-26 13:11:53 +01:00
Andreas Tolfsen 521870d93c Bug 1376128 - Lint testing/marionette; r=automatedtester
MozReview-Commit-ID: DY4yCSBEZrN
2017-06-29 16:40:24 -07:00
Andreas Tolfsen 079e04e58f Bug 1376128 - Ensure consistent return types from findElement; r=automatedtester
MozReview-Commit-ID: LnzsAHCMAxW
2017-06-28 11:16:34 -07:00
Andreas Tolfsen 2a6f025f94 Bug 1376128 - Fix undefined id variable; r=automatedtester
We try to delete the element entry by "id", which is not defined.

MozReview-Commit-ID: DXAOJAV1z9Q
2017-06-28 11:15:00 -07:00
Andreas Tolfsen 1bb08497bf Bug 1376128 - Expose unrecognised eslint globals; r=automatedtester
In particular, XPCNativeWrapper should probably be made available
by default.

MozReview-Commit-ID: E1oYFyApbLi
2017-06-28 11:04:14 -07:00
Andreas Tolfsen d81d7b9dad Bug 1376128 - Use selective imports from error module; r=automatedtester
Instead of importing everything from the testing/marionette/error.js
module into the global scope, we need to be selective about what symbols
we want.

MozReview-Commit-ID: HZDAS0bs0GD
2017-06-28 11:01:49 -07:00
Andreas Tolfsen c169392ebb Bug 1363053 - Move element.fromJson/toJson to evaluate module r=maja_zf
This patch renames element.fromJson and element.toJson to
evaluate.fromJSON and evaluate.toJSON, respectively.

The JSON (de)serialisation code belongs more naturally in the evaluate
module, which did not exist when these functions were written.

MozReview-Commit-ID: FJGbjGD1kZ6
2017-05-08 17:05:20 +01:00
Andreas Tolfsen 719adb851d Bug 1359079 - Take <select multiple> into account for obscured click test; r=whimboo
Because individual <option> elements are painted and represented in the
DOM when they belong to a <select multiple> list, the center point of
the list might be one of the options.

To take this into account, we perform an inclusive descendant check
(DOMElement.contains) to see if the <option> element is a descendant of
the container <select> element.

In the case the targetted element is the element itself, the test will
still pass since it is an _inclusive_ descendant check.  In other words,
containerEl.contains(tree[0]), if tree[0] is equal to containerEl,
will pass.

The relevant specification changes were made in
https://github.com/w3c/webdriver/pull/894/commits/40abcefd6acb86ac64befe2cad4b729b5e566932.

MozReview-Commit-ID: ORX8zLxQJ
2017-04-17 17:24:19 +01:00
Andreas Tolfsen 7da810455a Bug 1359050 - Test element in view with pointer events enabled; r=maja_zf
This change makes it possible to click elements that has its
pointer-events style property set to "none".

If an element has its style property pointer-events set to "none",
the element in view test will fail due to document.elementsFromPoint
excluding it due to non-interactability.  This is only a problem when
checking if the element is inside the viewport, and not when actually
performing interaction with the element.

The relevant specification change is
https://github.com/w3c/webdriver/commit/ba6ee925b5bc85938d542d65ef5034a761fe73d7.

MozReview-Commit-ID: JwZB6fm7P9A
2017-04-17 19:34:44 +01:00
Andreas Tolfsen 0d9e1ed755 Bug 1359054 - Take shadow DOM into account when getting paint tree; r=maja_zf
We want to take shadow DOM into account when getting an element's
pointer-interactable paint tree.

Marionette is currently unable to determine if an element inside a shadow
DOM host is disconnected from the document because we are constructing
the frame container with only the main document.

MozReview-Commit-ID: IPDi8fQZYRP
2017-04-17 17:51:13 +01:00
Andreas Tolfsen 99a8279511 Bug 1333014 - Lint testing/marionette/element.js; r=maja_zf
No functional changes.

MozReview-Commit-ID: CK33FjpQMmO
2017-02-07 19:18:40 +00:00
Andreas Tolfsen 62a28a8a68 Bug 1333014 - Change element.isDisconnected to take container; r=maja_zf
It makes sense for element.isDisconnected to accept a container object
with frame and shadowRoot, instead of taking the shadowRoot as an optional
third argument, since this is what most consumers start out with.

MozReview-Commit-ID: 6kfEIEf8u96
2017-02-07 19:00:28 +00:00
Andreas Tolfsen 354cf4e22a Bug 1333014 - Remove unused element.isInteractable API; r=maja_zf
MozReview-Commit-ID: 5iBcHUeNmSN
2017-02-07 17:05:06 +00:00
Andreas Tolfsen 9cd498a1ba Bug 1333014 - Pretty-print HTML elements; r=maja_zf
When passing a DOM element that is an HTML element to error.pprint,
it will get pretty-printed with its ID and class properties.

This helps to identify elements when one is obscuring the other when
clicking. For example, the error message

	Element <input id="foo"> is obscured by <input id="bar">

is nicer than the old error message

	Element [object HTMLElement] {} is obscured by [object HTMLElement] {}

MozReview-Commit-ID: 8U2Lo8V4lmv
2017-02-07 16:59:59 +00:00
Andreas Tolfsen b4bb798ad6 Bug 1333014 - Support intercepted clicks and align with spec; r=automatedtester,whimboo
The WebDriver specification changed recently to introduce a new
'element click intercepted' error that is returned if the high-level
Element Click command attempts an element that is obscured by another
(the other element's z-index, or order in the paint tree, is higher).

This patch introduces the notion of 'container elements', which is an
element's context.  For example, an <option> element's container element
or context is the nearest ancestral <select> or <datalist> element.

It also makes a distinction between an element being pointer-interactable
and merely being in-view.  This is important since an element may be in
view but not pointer-interactable (i.e. clicking its centre coordinates
might be intercepted), and we do not want to wait for an element to
become pointer-interactable after scrolling it into view if it is indeed
obscured.

MozReview-Commit-ID: 8dqGZP6UyOo
2017-02-03 19:52:34 +00:00
Andreas Tolfsen 14c11762bc Bug 1319237 - Generalise wait condition utility; r=automatedtester,maja_zf
This makes the `implicitWaitFor` utility from
testing/marionette/element.js generally available in Marionette.

It improves on the design of the old wait utility by providing
promise-like resolve and reject options to the evaluated function.  These
can be used to indicate success or failure of waiting.  If resolved, the
provided value is returned immediately.  When rejected, the function is
evaluated over again until the timeout is reached or an error is thrown.

It is useful to indicate success and failure state because it saves the
calling code from guessing based on the return value.  Guessing from
the return value can be problematic since there are certain types and
values in JavaScript that are ambigeous or misleading, such as the fact
that empty arrays are evaluated as a truthy value.

MozReview-Commit-ID: G8F99tdbiNb
2016-11-21 23:41:20 +01:00
Wes Kocher 6a43d7e2d5 Backed out 14 changesets (bug 1319237) for android xpcshell failures a=backout
Backed out changeset c85849b790c5 (bug 1319237)
Backed out changeset 9746878e5fc7 (bug 1319237)
Backed out changeset 1f7f75c57c59 (bug 1319237)
Backed out changeset 4dc796bbcfaa (bug 1319237)
Backed out changeset f8449c471b8f (bug 1319237)
Backed out changeset f2bdf078f39a (bug 1319237)
Backed out changeset 8df8cda56942 (bug 1319237)
Backed out changeset f651a9e54a57 (bug 1319237)
Backed out changeset 76c8aafbd933 (bug 1319237)
Backed out changeset a2096fa29cd7 (bug 1319237)
Backed out changeset af71a9376bef (bug 1319237)
Backed out changeset 778721edd8b9 (bug 1319237)
Backed out changeset feaf6ba3bd9a (bug 1319237)
Backed out changeset f5f206ed675b (bug 1319237)

MozReview-Commit-ID: EpmToL8Xqfz
2017-02-06 11:28:28 -08:00
Andreas Tolfsen 237c3bb8e2 Bug 1319237 - Generalise wait condition utility; r=automatedtester,maja_zf
This makes the `implicitWaitFor` utility from
testing/marionette/element.js generally available in Marionette.

It improves on the design of the old wait utility by providing
promise-like resolve and reject options to the evaluated function.  These
can be used to indicate success or failure of waiting.  If resolved, the
provided value is returned immediately.  When rejected, the function is
evaluated over again until the timeout is reached or an error is thrown.

It is useful to indicate success and failure state because it saves the
calling code from guessing based on the return value.  Guessing from
the return value can be problematic since there are certain types and
values in JavaScript that are ambigeous or misleading, such as the fact
that empty arrays are evaluated as a truthy value.

MozReview-Commit-ID: G8F99tdbiNb
2016-11-21 23:41:20 +01:00
Florian Quèze c8cf49999e Bug 1334156 - script-generated patch to replace .ownerDocument.defaultView with .ownerGlobal, r=jaws. 2017-01-27 10:51:03 +01:00
Henrik Skupin dee74b0ddc Bug 1143071 - Searching anonymous elements has to use the documentElement as default start node. r=ato
MozReview-Commit-ID: 90zTSulITcR
2016-12-02 17:36:52 +01:00
Thomas Charles b57e64d886 Bug 1316975 - Correct function definition style in Marionette components; r=ato
No functional changes.

MozReview-Commit-ID: 25cWAnpRB9H
2016-12-04 12:42:52 +01:00
Andreas Tolfsen eeca8d1793 Bug 1317386 - Test pointer interactability of first element in paint order; r=automatedtester
When returning the tree of interactable elemenets under the cursor, we
want to test the first one against the passed element, not that there
are _any_ interactable elements under the cursor.

MozReview-Commit-ID: AUvKAWKHgZk
2016-11-15 11:21:32 +00:00
Andreas Tolfsen 7fe4a8b661 Bug 1317386 - Rewrite in-view centre point calcaulation; r=automatedtester
The old calcaulation to determine an element's in-view centre point was
wrong as pointed out in https://github.com/w3c/webdriver/issues/425,
and this is an implementation of the proposed algorithm which passes
real-world tests.

This also addresses https://github.com/w3c/webdriver/pull/441 which
checks if the `DOMRect` sequence returned from `getClientRects` is empty,
as it may be if the element's `display` style property is `none`.

MozReview-Commit-ID: 4uitUrviW2a
2016-11-14 21:10:08 +00:00
Andreas Tolfsen 7cf028e219 Bug 1317386 - Scroll element into view at the bottom; r=automatedtester
When scrolling an element into view using `Element.scrollIntoView`,
use the `{block: "end", inline: "nearest"}` scroll position arguments,
which are equivalent to `Element.scrollIntoView(false)`.  This is what
other WebDriver implementations have used for a while, and we meant to
change to this sooner.

This ensures that the element appears at the bottom of the viewport
rather than the top, where overlaying menus with fixed style position
may more frequently appear.

In the future we might consider replacing this with `{block: "center"}`
which is specified in the CSSOM specification, but not yet implemented
in any browsers.

This implements https://github.com/w3c/webdriver/pull/440, which should
fix https://github.com/mozilla/geckodriver/issues/327.

MozReview-Commit-ID: BRMupP4fM89
2016-11-14 21:06:50 +00:00
Maja Frydrychowicz 9e46eefc78 Bug 1303234 - Implement extracting action chain from a request; r=ato,jgraham
MozReview-Commit-ID: JxNoGZog1om
2016-10-26 13:04:48 -04:00
Andreas Tolfsen 749c2e4739 Bug 1298454 - Use element.makeWebElement instead of manually creating web element; r=automatedtester
MozReview-Commit-ID: 83W3e6mWqYJ
2016-08-26 19:02:33 +01:00
Andreas Tolfsen 214eb242ff Bug 1284232 - Marshal all HTML and JS collections; r=automatedtester
This patch adds marshaling of HTMLFormControlsCollection,
HTMLAllCollection, and HTMLOptionsCollection element collections to
Marionette.

It will allow us you to return from HTMLSelectElement.options,
document.forms[0].elements, and document.all. This is in
addition to the already supported document.querySelector
(NodeList), document.getElementsBy* (HTMLCollection), and
Array.from(ELEMENT...) collections.

MozReview-Commit-ID: 71a65lZRn4S
2016-07-04 17:34:06 +01:00
David Burns d77d20a09e Bug 1285240: Trim leading and trailing space when finding elements by link text r=ato
This gives up parity with the WebDriver project and brings us in line with the current
specification http://w3c.github.io/webdriver/webdriver-spec.html#dfn-link-text

MozReview-Commit-ID: 9OD6B2pKTfx
2016-07-07 23:06:17 +01:00
Andreas Tolfsen 81c15f27ff Bug 1283999 - Publish XPath find element functions; r=automatedtester
Publish the findByXPath and findAllByXPath functions to match the style
of the recently introduces findByLinkText and findByPartialLinkText
functions.

Do note that this patch rearranges the input arguments these functions
take.  Possibly we do not have to send the root element as input at all.

MozReview-Commit-ID: 4H7kpZBUsTw
2016-07-02 21:51:21 +01:00
Andreas Tolfsen 180e508b6c Bug 1283999 - Fix lookup of hyperlinks in XHTML documents; r=automatedtester
Lower-case "a" matches hyperlinks in XHTML documents as well as HTML
documents. Upper-case "A" only matches HTML documents.

The patch also refactors link text- and partial link text lookup into
distinct functions, so that there is no more worry about variable scoping
in match blocks.

MozReview-Commit-ID: FB7MAmosBoR
2016-07-02 21:38:48 +01:00
Andreas Tolfsen d3f2d11845 Bug 1274274 - Rename element store clear function to delete; r=automatedtester
This matches the Map data structure in JavaScript.

MozReview-Commit-ID: 5l2xOb4W2BC
2016-05-20 16:54:42 +01:00
Andreas Tolfsen 94ad918799 Bug 1274274 - Update exported symbols and correct docs; r=automatedtester
MozReview-Commit-ID: 95ikD0oyrmy
2016-05-20 16:52:01 +01:00
Andreas Tolfsen 11025c0655 Bug 1274274 - Disassociate wrapValue from element store; r=automatedtester
Moves ElementManager#wrapValue to the testing/marionette/element.js
module level and renames it to toJson.

MozReview-Commit-ID: GJBl2L1GRxZ
2016-05-20 16:32:31 +01:00
Andreas Tolfsen 24ff5e6ac2 Bug 1274274 - Disassociate convertWrappedArguments from element store; r=automatedtester
Moved ElementManager#convertWrappedArguments to the
testing/marionette/element.js module scope and renamed it to fromJson.

MozReview-Commit-ID: JMTZcG0JSUE
2016-05-20 16:16:56 +01:00
Andreas Tolfsen fc35a37071 Bug 1274274 - Remove unused method applyNamedArgs; r=automatedtester
MozReview-Commit-ID: 1FeFZK4VVu2
2016-05-20 15:13:24 +01:00
Andreas Tolfsen 297c10bb99 Bug 1274274 - Disassociate isDisconnected from element store; r=automatedtester
MozReview-Commit-ID: 4uxbLKlgfsL
2016-05-20 15:11:37 +01:00