Commit Graph
16 Commits
Author SHA1 Message Date
Andreas Tolfsen b10438b2d3 Bug 1387559 - Drop session_id fallback for WebDriver:NewSession. r=automatedtester
The WebDriver service in the remote protocol accepts sessionId and
session_id and we only need on.  All known consumers are using sessionId,
and we can drop the session_id fallback.

MozReview-Commit-ID: 6fa5Lgkzwfu
2017-08-05 17:35:54 +01:00
Andreas Tolfsen 8179268646 Bug 1371733 - Add tests for custom assertion errors; r=whimboo
The last commit discovered a bug that one assertion's error message was
not being propagated.  This adds extensive tests for this, for all the
remaining assertions to ensure this does not regress in the future.

MozReview-Commit-ID: EK91mUPeweG
2017-06-12 18:18:48 +01:00
Andreas Tolfsen e04ebea203 Bug 1371733 - Propagate error message of assert.object; r=whimboo
The err argument to assert.object is currently being dropped, which
means we loose the specialised and the custom error message.

This patch propagates the error message like we do for all other
assertions in this module.

MozReview-Commit-ID: GwuBSbqKfk1
2017-06-12 18:02:39 +01:00
Henrik Skupin 4dc68ecf81 Bug 1368965 - assert.contentBrowser has to check for closed chrome window. r=ato
Due to the current caching of this.tab in browser.js the assertion
for the contentBrowser would fail. As such additionally assert that
the currently selected chrome window has not been closed yet.

Also assert.window should better check the 'closed' property instead
of handling a possible TypeError.

MozReview-Commit-ID: B79czg3dsux
2017-06-13 18:08:22 +02:00
Henrik Skupin e2b4d84969 Bug 1368492 - Add assert.browsingContext for parent process. r=ato
When accessing a property of the current content browser from
the parent process, the current top-level browsing context has
to be valid.

MozReview-Commit-ID: BZHJTk1j5Nj
2017-05-31 16:44:49 +02:00
Henrik Skupin 1d4ac0eb59 Bug 1318351 - Remove B2G related assertions. r=ato
MozReview-Commit-ID: Iy0wYJoodvO
2017-05-03 16:40:37 +02:00
Andreas Tolfsen 7e0a9391a6 Bug 1359004 - Add preliminary support for unexpected alerts r=whimboo
Add preliminary support for returning unexpected alert open errors when
calling commands that require it according to the WebDriver standard.

Also fixes a faulty test that seems to believe it is fine to click an
element whilst an alert is present.

Further work needs to be done on user prompts, asserts, and the handler
for user prompts in https://bugzilla.mozilla.org/show_bug.cgi?id=1264259.

MozReview-Commit-ID: BiWURoQECji
2017-04-20 18:00:46 +01:00
Henrik Skupin d99dfff76e Bug 1299626 - Fix "TypeError: can't access dead object" in assert.window(). r=ato
The assertion method is used to check for a valid window. But it can fail
itself when already accessing the ChromeWindow. To fix that we have to
catch a possible TypeError and let the method throw a NoSuchWindowError
instead.

MozReview-Commit-ID: 3Uaio4a3HtA
2017-03-28 21:10:06 +02:00
Andreas Tolfsen eb0d003cc0 Bug 1337743 - Add assert.callable for checking callbacks; r=maja_zf
MozReview-Commit-ID: 2bJbi4iEGlZ
2017-02-10 19:28:51 +00:00
Maja Frydrychowicz 77d26033aa Bug 1337133 - Add number check to assert.js; r=ato+446296
MozReview-Commit-ID: 9BVna5jO49b
2017-02-20 10:38:05 -05:00
Andreas Tolfsen aa93eaee12 Bug 1336214 - Preserve stacktraces in Marionette errors; r=maja_zf
Since bug 1326534 we have discarded the original stacktrace from errors
originating inside Marionette.  This was due to faulty logic when
attempting to generate a new stacktrace when it was missing from a
propagated error.

This change simplifies WebDriver errors by making use of Error
inheritance.  The WebDriver error specific functions error.toJson and
error.fromJson has additionally been moved to WebDriverError.

MozReview-Commit-ID: C3Ns0H01LyG
2017-02-10 18:36:52 +00:00
Andreas Tolfsen 4a96e5632e Bug 1336124 - Add assert.session for checking if session is active; r=maja_zf
MozReview-Commit-ID: CmHFag2q1V2
2017-02-02 16:09:14 +00:00
Andreas Tolfsen f7d6d4a748 Bug 1326534 - Add assert.in for own properties; r=automatedtester
The implementation of the new library function `assert.in` is analogous
to Python's `unittest.TestCase.assertIn`.

MozReview-Commit-ID: 1pjS9ttPXgo
2016-12-30 11:39:22 +00:00
Andreas Tolfsen f6dbe88765 Bug 1326534 - Add test for assert.array; r=automatedtester
MozReview-Commit-ID: IWUnhCgPp1R
2016-12-30 11:30:05 +00:00
Andreas Tolfsen 565ff529dd Bug 1326534 - Exclude array and null from being counted as objects; r=automatedtester
Calling `typeof` on arrays or null in JavaScript returns `"object"`,
and a safer check is to rely on `Object.prototype.toString`.

MozReview-Commit-ID: 5VxXf2ByoEx
2016-12-30 11:21:27 +00:00
Andreas Tolfsen 47d9068910 Bug 1313865 - Centralise common Marionette assertions; r=automatedtester,maja_zf
Many tests that result in throwing errors, amongst those many type-
and platform checks, are repeated throughout the Marionette code base.
This patch centralises the most common of these, typically reducing
consumer calls from three to one line.

Example usage:

	assert.defined(cmd.parameters.value);
	assert.postiveInteger(cmd.parameters.value,
	    error.pprint`Expected 'value' (${value}) to be a signed integer`);
	// InvalidArgumentError: Expected 'value' ([object Object] {"foo": "bar"}) to be a positive integer

MozReview-Commit-ID: BHOaDazeGer
2016-10-31 22:00:21 +00:00