diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 13:36:51 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 13:36:51 +0200 |
commit | dcbe710cf2bfad7d722e7232958a1c35e2991334 (patch) | |
tree | 7269eeb282d448c9f41e2231af0928fc2cd90371 /js | |
parent | d6625bc44524500e11c9072c6ba294112cd52d43 (diff) |
put login into prepare function
Diffstat (limited to 'js')
-rw-r--r-- | js/config/protractor.js | 21 | ||||
-rw-r--r-- | js/tests/e2e/include/auth.js | 17 | ||||
-rw-r--r-- | js/tests/e2e/main.js | 6 |
3 files changed, 20 insertions, 24 deletions
diff --git a/js/config/protractor.js b/js/config/protractor.js index 759dcef6e..364ff7bfe 100644 --- a/js/config/protractor.js +++ b/js/config/protractor.js @@ -7,7 +7,24 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2012, 2014 */ + +var baseUrl = 'http://localhost'; + exports.config = { - seleniumAddress: 'http://localhost:4444/wd/hub', - specs: ['../tests/e2e/**/*.js'] + seleniumAddress: 'http://localhost:4444/wd/hub', + specs: ['../tests/e2e/**/*.js'], + onPrepare: function () { + 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) { + return /apps/.test(url); + }); + }); + }, + baseUrl: baseUrl }
\ No newline at end of file diff --git a/js/tests/e2e/include/auth.js b/js/tests/e2e/include/auth.js deleted file mode 100644 index 6dea83a77..000000000 --- a/js/tests/e2e/include/auth.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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 40ab73c38..444e43e5d 100644 --- a/js/tests/e2e/main.js +++ b/js/tests/e2e/main.js @@ -7,18 +7,14 @@ * @author Bernhard Posselt <dev@bernhard-posselt.com> * @copyright Bernhard Posselt 2012, 2014 */ - -var auth = require('./include/auth.js'); - describe('news page', function () { 'use strict'; beforeEach(function () { - auth.login(browser); + browser.get('http://localhost/owncloud/index.php/apps/news/'); }); 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'); }); |