fix login suite

This commit is contained in:
Felix Böhm 2014-08-29 19:56:42 +02:00
parent 41c5327fca
commit c39dfad25a
2 changed files with 11 additions and 7 deletions

View file

@ -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() {

View file

@ -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');
};