Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 976127 - Automate unit tests #13

Merged
merged 1 commit into from
Apr 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions browser/components/loop/test/desktop-local/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ and the Chai Assertion Library's [BDD interface][2].
[1]: http://visionmedia.github.io/mocha/
[2]: http://chaijs.com/api/bdd/

Aim your browser at the index.html in this directory on your localhost using a file: or HTTP URL to run the tests.
Aim your browser at the index.html in this directory on your localhost using
a file: or HTTP URL to run the tests. Alternately, from the top-level of your
Gecko source directory, execute:

```
./mach marionette-test browser/components/loop/test/manifest.ini
```

Next steps:
* hook up to Marionette test suite so that they can be run by Tbpl
* run via mach command-line
* run using JS http server so the property security context for DOM elements is used

* run using JS http server so the property security context for DOM elements
is used

5 changes: 3 additions & 2 deletions browser/components/loop/test/desktop-local/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
getStrings: function() {
return [];
},
}
};
window.Components = {fake: true, utils: {import: function(){}}};
window.Services = {fake: true, prefs: {getCharPref: function() {
Expand All @@ -47,6 +47,7 @@
<script src="../shared/vendor/chai-1.9.0.js"></script>
<script src="../shared/vendor/sinon-1.9.0.js"></script>
<script>
/*global chai,mocha */
chai.Assertion.includeStack = true;
mocha.setup('bdd');
</script>
Expand All @@ -64,7 +65,7 @@
<script src="panel_test.js"></script>
<script>
mocha.run(function () {
$("#mocha").append("<p>Complete.</p>");
$("#mocha").append("<p id='complete'>Complete.</p>");
});
</script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion browser/components/loop/test/desktop-local/panel_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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/. */

/* global loop, sinon */
/*global loop, sinon */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the point of this change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's because my IDE (IntelliJ) only recognizes the syntax where global is jammed up against the comment delimiter. When it doesn't recognize it, it flags false jshint errors. :-(


var expect = chai.expect;

Expand Down
16 changes: 16 additions & 0 deletions browser/components/loop/test/desktop-local/test_desktop_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# need to get this dir in the path so that we make the import work
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'shared'))

from frontend_tester import BaseTestFrontendUnits


class TestDesktopUnits(BaseTestFrontendUnits):

def setUp(self):
super(TestDesktopUnits, self).setUp()
self.set_server_prefix("browser/components/loop/test/desktop-local/")

def test_units(self):
self.check_page("index.html")
7 changes: 7 additions & 0 deletions browser/components/loop/test/manifest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[DEFAULT]
b2g = false
browser = true
qemu = false

[shared/test_shared_all.py]
[desktop-local/test_desktop_all.py]