summary refs log tree commit diff
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-22 14:29:12 +0100
committerKegan Dougal <kegan@matrix.org>2014-09-22 14:29:12 +0100
commite3152188ef27c1952185764ce0d1c072cb149d99 (patch)
tree068a742d908f5746f96a4a9a522eea0c1dae5d06
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-e3152188ef27c1952185764ce0d1c072cb149d99.tar.xz
Added boilerplate for running end-to-end tests.\nThis is done using Protractor, which looks for a .gitignored file environment-protractor.js which contains the selenium endpoint url.
Diffstat (limited to '')
-rw-r--r--.gitignore1
-rw-r--r--webclient/test/README17
-rw-r--r--webclient/test/e2e/user.spec.js6
-rw-r--r--webclient/test/protractor.conf.js6
-rw-r--r--webclient/test/unit/user-controller.spec.js6
5 files changed, 30 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index dfe8dfedbf..b91b52b615 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,5 +25,6 @@ graph/*.png
 graph/*.dot
 
 webclient/config.js
+webclient/test/environment-protractor.js
 
 uploads
diff --git a/webclient/test/README b/webclient/test/README
index b1e0d7adea..1813883196 100644
--- a/webclient/test/README
+++ b/webclient/test/README
@@ -1,9 +1,22 @@
 Requires:
- - npm
+ - nodejs/npm
  - npm install karma
  - npm install jasmine
+ - npm install protractor (e2e testing)
 
-Setting up continuous integration / run the tests:
+Setting up continuous integration / run the unit tests (make sure you're in
+this directory so it can find the config file):
   karma start
 
+Setting up e2e tests (only if you don't have a selenium server to run the tests
+on. If you do, edit the config to point to that url):
+  webdriver-manager update
+  webdriver-manager start
+
+Running e2e tests:
+  protractor protractor.conf.js
+
+
+
+
 
diff --git a/webclient/test/e2e/user.spec.js b/webclient/test/e2e/user.spec.js
new file mode 100644
index 0000000000..bbac53899b
--- /dev/null
+++ b/webclient/test/e2e/user.spec.js
@@ -0,0 +1,6 @@
+describe("user page", function() {
+    it("should have a title", function() {
+        browser.get("http://matrix.org/alpha/#/login");
+        expect(browser.getTitle()).toEqual("[matrix]");
+    });
+});
diff --git a/webclient/test/protractor.conf.js b/webclient/test/protractor.conf.js
new file mode 100644
index 0000000000..66f4df5407
--- /dev/null
+++ b/webclient/test/protractor.conf.js
@@ -0,0 +1,6 @@
+var env = require("./environment-protractor.js");
+
+exports.config = {
+  seleniumAddress: env.seleniumAddress,
+  specs: ['e2e/*.spec.js']
+}
diff --git a/webclient/test/unit/user-controller.spec.js b/webclient/test/unit/user-controller.spec.js
index 217559114b..798cc4de48 100644
--- a/webclient/test/unit/user-controller.spec.js
+++ b/webclient/test/unit/user-controller.spec.js
@@ -21,13 +21,12 @@ describe("UserCtrl", function() {
 
                 getDisplayName: function(uid) {
                     var d = $q.defer();
-                    // FIXME: everything goes into fire here
                     d.resolve({
                         data: {
                             displayname: displayName
                         }
                     });
-                    return d;
+                    return d.promise;
                 },
 
                 getProfilePictureUrl: function(uid) {
@@ -37,7 +36,7 @@ describe("UserCtrl", function() {
                             avatar_url: avatarUrl
                         }
                     });
-                    return d;
+                    return d.promise;
                 }
             };
             scope = $rootScope.$new();
@@ -49,7 +48,6 @@ describe("UserCtrl", function() {
                 '$routeParams': routeParams, 
                 'matrixService': matrixService
             });
-            console.log("end inject");
         });
     });