From c39dfad25a2272cb7ecf38bb5fef9fda7fa3f2ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= Date: Fri, 29 Aug 2014 19:56:42 +0200 Subject: [PATCH] fix login suite --- tests/acceptance/tests/login/authentication_spec.js | 9 ++++++--- tests/acceptance/tests/pages/login.page.js | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/acceptance/tests/login/authentication_spec.js b/tests/acceptance/tests/login/authentication_spec.js index f331e33fdc..ad02db4092 100644 --- a/tests/acceptance/tests/login/authentication_spec.js +++ b/tests/acceptance/tests/login/authentication_spec.js @@ -3,7 +3,7 @@ var UserPage = require('../pages/user.page.js'); var FirstRunWizardPage = require('../pages/firstRunWizard.page.js'); var Screenshot = require('../helper/screenshot.js'); -describe('Authentication', function() { +ddescribe('Authentication', function() { var params = browser.params; var loginPage; @@ -31,7 +31,7 @@ describe('Authentication', function() { new Screenshot(png, 'LoginPage.png'); }); - expect(loginPage.isLoginPage()).toBeTruthy(); + expect(loginPage.isCurrentPage()).toBeTruthy(); }); it('should meet the locator dependencies', function() { @@ -57,6 +57,7 @@ describe('Authentication', function() { new Screenshot(png, 'LoginAsAdmin.png'); }); expect(browser.getCurrentUrl()).toContain('index.php/apps/files/'); + expect(loginPage.isCurrentPage()).toBeFalsy(); }); it('should return to the login page after logout', function() { @@ -68,11 +69,13 @@ describe('Authentication', function() { }); it('should not login with wrong credentials', function() { - loginPage.login('wrongName', 'wrongPass'); + loginPage.fillUserCredentilas('wrongName', 'wrongPass'); + loginPage.loginButton.click(); browser.takeScreenshot().then(function (png) { new Screenshot(png, 'LoginWrong.png'); }); expect(browser.getCurrentUrl()).not.toContain('index.php/apps/files/'); + expect(loginPage.isCurrentPage()).toBeTruthy(); }); it('should have rights to visit user management after admin login', function() { diff --git a/tests/acceptance/tests/pages/login.page.js b/tests/acceptance/tests/pages/login.page.js index 5244a7f094..b7019fa54a 100644 --- a/tests/acceptance/tests/pages/login.page.js +++ b/tests/acceptance/tests/pages/login.page.js @@ -11,15 +11,16 @@ // On Page when logged in this.menuButton = element(by.id('expand')); this.logoutButton = element(by.id('logout')); - this.newButton = element(by.css('#new a')); + this.newButton = element(by.id('expandDisplayName')); }; LoginPage.prototype.get = function() { browser.get(this.url); }; - LoginPage.prototype.isLoginPage = function() { - return !!this.loginForm; + LoginPage.prototype.isCurrentPage = function() { + + return this.loginForm.isPresent(); }; LoginPage.prototype.fillUserCredentilas = function(user, pass) { @@ -32,7 +33,7 @@ this.loginButton.click(); var button = this.newButton; browser.wait(function() { - return button.isDisplayed(); + return button.isPresent(); }, 5000, 'load files content'); };