summaryrefslogtreecommitdiffstats
path: root/js/tests
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 12:26:42 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-15 12:26:42 +0200
commitd6625bc44524500e11c9072c6ba294112cd52d43 (patch)
treecd1e93b6b21434d6aba7725821d811d312d687f7 /js/tests
parent866f17fe43f841691a8858d671962d623369d3b3 (diff)
fix protractor tests
Diffstat (limited to 'js/tests')
-rw-r--r--js/tests/e2e/include/auth.js17
-rw-r--r--js/tests/e2e/main.js43
-rw-r--r--js/tests/unit/controller/AllItemsControllerSpec.js26
-rw-r--r--js/tests/unit/service/LoadingSpec.js24
-rw-r--r--js/tests/unit/stubs/app.js10
-rw-r--r--js/tests/unit/stubs/oc.js16
6 files changed, 111 insertions, 25 deletions
diff --git a/js/tests/e2e/include/auth.js b/js/tests/e2e/include/auth.js
new file mode 100644
index 000000000..6dea83a77
--- /dev/null
+++ b/js/tests/e2e/include/auth.js
@@ -0,0 +1,17 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+exports.login = function (browser) {
+ browser.ignoreSynchronization = true;
+ browser.get('http://localhost/owncloud/');
+ browser.findElement(By.id('user')).sendKeys('admin');
+ browser.findElement(By.id('password')).sendKeys('admin');
+ browser.findElement(By.id('submit')).click();
+}; \ No newline at end of file
diff --git a/js/tests/e2e/main.js b/js/tests/e2e/main.js
index 94e31ee62..40ab73c38 100644
--- a/js/tests/e2e/main.js
+++ b/js/tests/e2e/main.js
@@ -1,34 +1,27 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+
+var auth = require('./include/auth.js');
+
describe('news page', function () {
'use strict';
- var ptor = protractor.getInstance();
-
- beforeEach(function () {
- browser.ignoreSynchronization = true;
- return browser.ignoreSynchronization;
- });
-
beforeEach(function () {
- ptor.get('http://localhost/owncloud/');
- ptor.findElement(By.id('user')).sendKeys('admin');
- ptor.findElement(By.id('password')).sendKeys('admin');
- ptor.findElement(By.id('submit')).click();
+ auth.login(browser);
});
-
- describe('should log in', function () {
-
- beforeEach(function () {
- browser.ignoreSynchronization = false;
- return browser.ignoreSynchronization;
- });
-
- it('should go to the news page', function () {
- ptor.get('http://localhost/owncloud/index.php/apps/news/');
- ptor.getTitle().then(function (title) {
- expect(title).toBe('News - ownCloud');
- });
+ it('should go to the news page', function () {
+ browser.get('http://localhost/owncloud/index.php/apps/news/');
+ browser.getTitle().then(function (title) {
+ expect(title).toBe('News - ownCloud');
});
-
});
+
}); \ No newline at end of file
diff --git a/js/tests/unit/controller/AllItemsControllerSpec.js b/js/tests/unit/controller/AllItemsControllerSpec.js
new file mode 100644
index 000000000..63cf55536
--- /dev/null
+++ b/js/tests/unit/controller/AllItemsControllerSpec.js
@@ -0,0 +1,26 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+describe('AllItemsController', function () {
+ 'use strict';
+
+ var controller;
+
+ beforeEach(module('News'));
+
+ beforeEach(inject(function ($controller) {
+ controller = $controller;
+ }));
+
+
+ it('should ', function () {
+ expect(controller).toBeDefined();
+ });
+
+}); \ No newline at end of file
diff --git a/js/tests/unit/service/LoadingSpec.js b/js/tests/unit/service/LoadingSpec.js
new file mode 100644
index 000000000..cae049c99
--- /dev/null
+++ b/js/tests/unit/service/LoadingSpec.js
@@ -0,0 +1,24 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+describe('Loading', function () {
+ 'use strict';
+
+ beforeEach(module('News'));
+
+ it('should be not load by default', inject(function (Loading) {
+ expect(Loading.isLoading()).toBe(false);
+ }));
+
+ it('should set loading', inject(function (Loading) {
+ Loading.setLoading(true);
+ expect(Loading.isLoading()).toBe(true);
+ }));
+
+}); \ No newline at end of file
diff --git a/js/tests/unit/stubs/app.js b/js/tests/unit/stubs/app.js
new file mode 100644
index 000000000..54135ec10
--- /dev/null
+++ b/js/tests/unit/stubs/app.js
@@ -0,0 +1,10 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngMock']); \ No newline at end of file
diff --git a/js/tests/unit/stubs/oc.js b/js/tests/unit/stubs/oc.js
new file mode 100644
index 000000000..07ac96491
--- /dev/null
+++ b/js/tests/unit/stubs/oc.js
@@ -0,0 +1,16 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2012, 2014
+ */
+var OC = {
+ generateUrl: function () {
+ 'use strict';
+
+ return '';
+ }
+}; \ No newline at end of file