Граф коммитов

18 Коммитов

Автор SHA1 Сообщение Дата
Andreas Tolfsen 2861122a4c Bug 1430109 - Combine assert.window and assert.contentBrowser. r=maja_zf
The forthcoming window tracking refactoring introduces the new
abstractions ContentContext and ChromeContext that to a large extent
share the same interface.  They make it possible to interact with
both types of browsing context in a uniform manner.

Marionette currently has a lot of convoluted if-conditions to
paper over the differences between ChromeWindow, <xul:browser>,
and browser.Context.  Examples of this includes the assert.window
and assert.contentBrowser assertions: they essentially perform the
same job, but does not share the same API because the underlying
APIs they call are different.

In an effort to prepare Marionette for the window tracking refactoring,
this patch adds a bit of glue to combine them both into one assertion
called assert.open.  This checks that the browsing context has not
been discarded.

MozReview-Commit-ID: K5e7Sr1mq0
2018-01-15 14:02:39 +00:00
Andreas Tolfsen 17e02f9dbb Bug 1106913 - Add assert.acyclic for testing for cyclic objects. r=whimboo
Introduces a new assert.acyclic assertion helper function that uses
JSON.stringify to test if the input contains cyclic object references.
A JavaScriptError will be thrown if the object is not acyclic.

MozReview-Commit-ID: 3y8pnkPgf2k

--HG--
extra : rebase_source : 069ae9e1e6d3738c8712fe5c1838f6d3a91125e4
2017-11-24 18:21:03 +00:00
Andreas Tolfsen da6629ba61 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 abcc631524 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

--HG--
extra : rebase_source : f429a4cdd420c8d078419754d3cb0c39ac418ef1
2017-06-12 18:18:48 +01:00
Andreas Tolfsen d26d0d6594 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

--HG--
extra : rebase_source : 86c57aaaf60526eaf65345b9d5e38378920419e3
2017-06-12 18:02:39 +01:00
Henrik Skupin c0479d07f7 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

--HG--
extra : rebase_source : 31bf31d2151e4b461574101ce7770d38fb92bd5c
2017-06-13 18:08:22 +02:00
Henrik Skupin 8907d0b29a 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

--HG--
extra : rebase_source : 7e44fc6e05d7fb1429fb3e36e897cf51b3d9142f
2017-05-31 16:44:49 +02:00
Henrik Skupin 16a144567e Bug 1318351 - Remove B2G related assertions. r=ato
MozReview-Commit-ID: Iy0wYJoodvO

--HG--
extra : rebase_source : 3bd93ecc4ef24df3db6846d7db2a314c183128aa
2017-05-03 16:40:37 +02:00
Andreas Tolfsen 9d9b0dba43 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

--HG--
extra : rebase_source : caa1506a0e972c7ad0da2d31993fb0b8ecc1ee17
2017-04-20 18:00:46 +01:00
Henrik Skupin 8f09dfa944 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

--HG--
extra : rebase_source : 5c672e441789e45b4972b0f8fde8471b4998394d
2017-03-28 21:10:06 +02:00
Andreas Tolfsen 90398e4cd5 Bug 1337743 - Add assert.callable for checking callbacks; r=maja_zf
MozReview-Commit-ID: 2bJbi4iEGlZ

--HG--
extra : rebase_source : 2a16d909389df554eb719f574d655ee96694e0ad
2017-02-10 19:28:51 +00:00
Maja Frydrychowicz a0e09e3402 Bug 1337133 - Add number check to assert.js; r=ato+446296
MozReview-Commit-ID: 9BVna5jO49b

--HG--
extra : rebase_source : d3f0342adaaa872496bc6eb16ce40fb990311aab
2017-02-20 10:38:05 -05:00
Andreas Tolfsen 69d406c698 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

--HG--
extra : rebase_source : 0c705054dae8c0647500bb90e9b970cc57e712c4
2017-02-10 18:36:52 +00:00
Andreas Tolfsen 73f85ac684 Bug 1336124 - Add assert.session for checking if session is active; r=maja_zf
MozReview-Commit-ID: CmHFag2q1V2

--HG--
extra : rebase_source : 526e01466ce4a00a091dd88cb060d166c6ac4245
2017-02-02 16:09:14 +00:00
Andreas Tolfsen 52426eb1ab 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

--HG--
extra : rebase_source : 3f4121226d65f127fdf0c990915483659f3a7f93
2016-12-30 11:39:22 +00:00
Andreas Tolfsen 4a5f5aabaf Bug 1326534 - Add test for assert.array; r=automatedtester
MozReview-Commit-ID: IWUnhCgPp1R

--HG--
extra : rebase_source : 4cc54031f9e34cf210229bcd394747e4bafcbd8f
2016-12-30 11:30:05 +00:00
Andreas Tolfsen de884b68a6 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

--HG--
extra : rebase_source : 4d1fe95a75343964836e670d0ceffa6ce680e390
2016-12-30 11:21:27 +00:00
Andreas Tolfsen e5010028a2 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

--HG--
extra : rebase_source : 1d35c10e29d4fd536829e9714ae65bcd14ad21f8
2016-10-31 22:00:21 +00:00