diff options
-rw-r--r-- | .travis.yml | 5 | ||||
-rw-r--r-- | js/Gruntfile.js | 52 | ||||
-rw-r--r-- | js/app/app.js (renamed from js/config/app.js) | 0 | ||||
-rw-r--r-- | js/app/config.js (renamed from js/config/config.js) | 0 | ||||
-rw-r--r-- | js/app/run.js (renamed from js/config/run.js) | 0 | ||||
-rw-r--r-- | js/config/karma.js | 80 | ||||
-rw-r--r-- | js/karma.conf.js | 82 | ||||
-rw-r--r-- | js/protractor.chrome.conf.js | 33 | ||||
-rw-r--r-- | js/protractor.phantomjs.conf.js (renamed from js/config/protractor.js) | 7 |
9 files changed, 153 insertions, 106 deletions
diff --git a/.travis.yml b/.travis.yml index 105bdf3c8..381c91584 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_script: - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - sudo cp -f owncloud/apps/news/tests/travis/travis-ci-apache /etc/apache2/sites-available/default - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default - - sudo service apache2 restart + - sudo service apache2 restart - cd owncloud - ocdev ci $DB - php -f console.php app:enable news @@ -50,10 +50,9 @@ script: - npm install --deps # npm install needs to run before sudo npm install because otherwise it fails because a tmp file exists in the home dir - sudo npm -g install grunt-cli protractor - webdriver-manager update - - npm test - sudo chown -R www-data:www-data ../../../data - sudo chown -R www-data:www-data ../../../config - - grunt e2e --verbose + - grunt ci --verbose addons: postgresql: "9.3" diff --git a/js/Gruntfile.js b/js/Gruntfile.js index 4bc803072..8d86bf34c 100644 --- a/js/Gruntfile.js +++ b/js/Gruntfile.js @@ -22,10 +22,12 @@ var globals = [ 'expect', 'By', 'inject', - 'console' + 'console', + 'exports' ]; -module.exports = function(grunt) { +module.exports = function (grunt) { + 'use strict'; // load needed modules grunt.loadNpmTasks('grunt-contrib-concat'); @@ -52,13 +54,12 @@ module.exports = function(grunt) { }, dist: { src: [ - 'config/app.js', - 'config/config.js', - 'config/run.js', + 'app/app.js', + 'app/config.js', + 'app/run.js', 'filter/**/*.js', 'service/**/*.js', - 'directive/**/*.js', - 'utilitie/**/*.js' + 'directive/**/*.js' ], dest: '<%= meta.production %>app.js' } @@ -66,7 +67,7 @@ module.exports = function(grunt) { ngmin: { app: { src: ['<%= meta.production %>app.js'], - dest: '<%= meta.production %>app.js', + dest: '<%= meta.production %>app.js' } }, wrap: { @@ -84,14 +85,14 @@ module.exports = function(grunt) { jslint: { browser: { src: [ - 'tests/**/*.js', - 'config/app.js', - 'config/config.js', - 'config/run.js', - 'controller/**/*.js', - 'directive/**/*.js', + 'app/**/*.js', 'filter/**/*.js', 'service/**/*.js', + 'directive/**/*.js', + 'tests/**/*.js', + 'Gruntfile.js', + 'karma.conf.js', + 'protractor*conf.js' ], directives: { browser: true, @@ -103,30 +104,34 @@ module.exports = function(grunt) { concat: { files: [ 'tests/**/*.js', - 'config/**/*.js', + 'app/**/*.js', 'controller/**/*.js', 'directive/**/*.js', 'filter/**/*.js', 'service/**/*.js', + '../templates/**/*.php' ], + options: { + livereload: true + }, tasks: ['default'] }, phpunit: { files: [ '../*/**.php', - '!../3rdparty', + '!../3rdparty' ], tasks: ['phpunit'] } }, karma: { unit: { - configFile: 'config/karma.js', + configFile: 'karma.conf.js', browsers: ['PhantomJS'], autoWatch: true }, continuous: { - configFile: 'config/karma.js', + configFile: 'karma.conf.js', singleRun: true, browsers: ['PhantomJS'], preprocessors: { @@ -156,7 +161,12 @@ module.exports = function(grunt) { protractor: { phantomjs: { options: { - configFile: 'config/protractor.js' + configFile: 'protractor.phantomjs.conf.js' + } + }, + chrome: { + options: { + configFile: 'protractor.chrome.conf.js' } } }, @@ -172,7 +182,7 @@ module.exports = function(grunt) { // make tasks available under simpler commands grunt.registerTask('default', ['jslint', 'concat', 'ngmin', 'wrap']); grunt.registerTask('test', ['karma:unit']); - grunt.registerTask('ci', ['default', 'karma:continuous']); - grunt.registerTask('e2e', ['protractor_webdriver', 'connect', 'protractor']); + grunt.registerTask('e2e', ['protractor_webdriver', 'connect', 'protractor:chrome']); + grunt.registerTask('ci', ['default', 'karma:continuous', 'protractor_webdriver', 'connect', 'protractor:phantomjs']); };
\ No newline at end of file diff --git a/js/config/app.js b/js/app/app.js index 947a68a2e..947a68a2e 100644 --- a/js/config/app.js +++ b/js/app/app.js diff --git a/js/config/config.js b/js/app/config.js index 776f4ee92..776f4ee92 100644 --- a/js/config/config.js +++ b/js/app/config.js diff --git a/js/config/run.js b/js/app/run.js index 00e71a7b0..00e71a7b0 100644 --- a/js/config/run.js +++ b/js/app/run.js diff --git a/js/config/karma.js b/js/config/karma.js deleted file mode 100644 index 5a397a886..000000000 --- a/js/config/karma.js +++ /dev/null @@ -1,80 +0,0 @@ -// Karma configuration -// Generated on Thu May 15 2014 04:01:02 GMT+0200 (CEST) - -module.exports = function(config) { - config.set({ - - // base path that will be used to resolve all patterns (eg. files, exclude) - basePath: '../', - - - // frameworks to use - // available frameworks: https://npmjs.org/browse/keyword/karma-adapter - frameworks: ['jasmine'], - - - // list of files / patterns to load in the browser - files: [ - 'vendor/jquery/dist/jquery.js', - 'vendor/momentjs/moment.js', - 'vendor/bootstrap/tooltip.js', - 'vendor/angular/angular.js', - 'vendor/angular-mocks/angular-mocks.js', - 'vendor/angular-route/angular-route.js', - 'vendor/angular-sanitize/angular-sanitize.js', - 'vendor/angular-animate/angular-animate.js', - 'tests/unit/stubs/*.js', - 'controller/**/*.js', - 'filter/**/*.js', - 'service/**/*.js', - 'directive/**/*.js', - 'tests/unit/**/*Spec.js' - ], - - - // list of files to exclude - exclude: [ - - ], - - - // preprocess matching files before serving them to the browser - // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: { - - }, - - - // test results reporter to use - // possible values: 'dots', 'progress' - // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], - - - // web server port - port: 9876, - - - // enable / disable colors in the output (reporters and logs) - colors: true, - - - // level of logging - // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - - // start these browsers - // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher - browsers: ['PhantomJS'], - - - // Continuous Integration mode - // if true, Karma captures browsers, runs the tests and exits - singleRun: false - }); -}; diff --git a/js/karma.conf.js b/js/karma.conf.js new file mode 100644 index 000000000..91118736c --- /dev/null +++ b/js/karma.conf.js @@ -0,0 +1,82 @@ +// Karma configuration +// Generated on Thu May 15 2014 04:01:02 GMT+0200 (CEST) + +module.exports = function (config) { + 'use strict'; + + config.set({ + + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: '', + + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ['jasmine'], + + + // list of files / patterns to load in the browser + files: [ + 'vendor/jquery/dist/jquery.js', + 'vendor/momentjs/moment.js', + 'vendor/bootstrap/tooltip.js', + 'vendor/angular/angular.js', + 'vendor/angular-mocks/angular-mocks.js', + 'vendor/angular-route/angular-route.js', + 'vendor/angular-sanitize/angular-sanitize.js', + 'vendor/angular-animate/angular-animate.js', + 'tests/unit/stubs/*.js', + 'controller/**/*.js', + 'filter/**/*.js', + 'service/**/*.js', + 'directive/**/*.js', + 'tests/unit/**/*Spec.js' + ], + + + // list of files to exclude + exclude: [ + + ], + + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + + }, + + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ['progress'], + + + // web server port + port: 9876, + + + // enable / disable colors in the output (reporters and logs) + colors: true, + + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + browsers: ['PhantomJS'], + + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: false + }); +}; diff --git a/js/protractor.chrome.conf.js b/js/protractor.chrome.conf.js new file mode 100644 index 000000000..4a615f805 --- /dev/null +++ b/js/protractor.chrome.conf.js @@ -0,0 +1,33 @@ +/** + * 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 2014 + */ + +var baseUrl = 'http://localhost'; + +exports.config = { + seleniumAddress: 'http://localhost:4444/wd/hub', + specs: ['tests/e2e/**/*.js'], + onPrepare: function () { + 'use strict'; + + browser.ignoreSynchronization = true; + browser.get(baseUrl + '/owncloud/'); + browser.findElement(By.id('user')).sendKeys('admin'); + browser.findElement(By.id('password')).sendKeys('admin'); + browser.findElement(By.id('submit')).click(); + + browser.driver.wait(function () { + return browser.driver.getCurrentUrl().then(function (url) { + var regex = /apps/; + return regex.test(url); + }); + }); + }, + baseUrl: baseUrl +};
\ No newline at end of file diff --git a/js/config/protractor.js b/js/protractor.phantomjs.conf.js index e1ed3d14d..73fdd153f 100644 --- a/js/config/protractor.js +++ b/js/protractor.phantomjs.conf.js @@ -12,8 +12,10 @@ var baseUrl = 'http://localhost'; exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', - specs: ['../tests/e2e/**/*.js'], + specs: ['tests/e2e/**/*.js'], onPrepare: function () { + 'use strict'; + browser.ignoreSynchronization = true; browser.get(baseUrl + '/owncloud/'); browser.findElement(By.id('user')).sendKeys('admin'); @@ -22,7 +24,8 @@ exports.config = { browser.driver.wait(function () { return browser.driver.getCurrentUrl().then(function (url) { - return /apps/.test(url); + var regex = /apps/; + return regex.test(url); }); }); }, |