summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--js/.jshintrc10
-rw-r--r--js/Gruntfile.js7
-rw-r--r--js/README.md13
-rw-r--r--js/config/karma.js2
-rw-r--r--js/config/protractor.js13
-rw-r--r--js/tests/e2e/main.js34
6 files changed, 76 insertions, 3 deletions
diff --git a/js/.jshintrc b/js/.jshintrc
index 7d424890d..611743709 100644
--- a/js/.jshintrc
+++ b/js/.jshintrc
@@ -5,6 +5,14 @@
"$": true,
"angular": true,
"OC": true,
- "app": true
+ "app": true,
+ "protractor": true,
+ "describe": true,
+ "beforeEach": true,
+ "module": true,
+ "browser": true,
+ "expect": true,
+ "By": true,
+ "it": true
}
} \ No newline at end of file
diff --git a/js/Gruntfile.js b/js/Gruntfile.js
index 04a48a1c4..55d607a83 100644
--- a/js/Gruntfile.js
+++ b/js/Gruntfile.js
@@ -76,7 +76,11 @@ module.exports = function(grunt) {
],
directives: {
browser: true,
- predef: ['$', 'angular', 'app', 'OC']
+ predef: [
+ '$', 'angular', 'app', 'OC',
+ 'protractor', 'describe', 'beforeEach', 'module', 'it',
+ 'browser', 'expect', 'By'
+ ]
}
}
},
@@ -84,6 +88,7 @@ module.exports = function(grunt) {
all: [
'**/*.js',
'!config/karma.js',
+ '!config/protractor.js',
'!build/**/*',
'!coverage/**/*',
'!vendor/**/*',
diff --git a/js/README.md b/js/README.md
index 27c9fbd98..c4d80fd62 100644
--- a/js/README.md
+++ b/js/README.md
@@ -22,3 +22,16 @@ Single run mode:
grunt phpunit
grunt ci
+
+### Running e2e tests
+Install protractor and set up selenium:
+
+ sudo npm install -g protractor
+ sudo webdriver-manager update
+
+then the selenium server can be started with:
+
+ webdriver-manager start
+ protractor conf/protractor.js
+
+
diff --git a/js/config/karma.js b/js/config/karma.js
index b4c3e1071..f1129a2ea 100644
--- a/js/config/karma.js
+++ b/js/config/karma.js
@@ -23,7 +23,7 @@ module.exports = function(config) {
'vendor/angular-route/angular-route.js',
'vendor/angular/angular-sanitize/angular-sanitize.js',
'build/app.js',
- 'tests/**/*Spec.js'
+ 'tests/unit/**/*.js'
],
diff --git a/js/config/protractor.js b/js/config/protractor.js
new file mode 100644
index 000000000..759dcef6e
--- /dev/null
+++ b/js/config/protractor.js
@@ -0,0 +1,13 @@
+/**
+ * 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.config = {
+ seleniumAddress: 'http://localhost:4444/wd/hub',
+ specs: ['../tests/e2e/**/*.js']
+} \ No newline at end of file
diff --git a/js/tests/e2e/main.js b/js/tests/e2e/main.js
new file mode 100644
index 000000000..94e31ee62
--- /dev/null
+++ b/js/tests/e2e/main.js
@@ -0,0 +1,34 @@
+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();
+ });
+
+
+ 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');
+ });
+ });
+
+ });
+}); \ No newline at end of file