ADF-3735 automated (#4433)

This commit is contained in:
gmandakini 2019-03-14 11:22:45 +00:00 committed by Eugenio Romano
parent f1014706cf
commit ced2e05d10
3 changed files with 37 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import { SettingsPage } from '../../pages/adf/settingsPage';
import AlfrescoApi = require('alfresco-js-api-node');
import { Util } from '../../util/util';
import { ErrorPage } from '../../pages/adf/errorPage';
describe('Login component', () => {
@ -40,6 +41,7 @@ describe('Login component', () => {
let userInfoPage = new UserInfoPage();
let contentServicesPage = new ContentServicesPage();
let loginPage = new LoginPage();
let errorPage = new ErrorPage();
let adminUserModel = new AcsUserModel({
'id': TestConfig.adf.adminUser,
'password': TestConfig.adf.adminPassword
@ -84,6 +86,14 @@ describe('Login component', () => {
expect(userInfoPage.getContentEmail()).toEqual(userB.email);
});
it('[C299206] Should redirect the user without the right access role on a forbidden page', () => {
loginPage.loginToContentServicesUsingUserModel(userA);
navigationBarPage.navigateToProcessServicesCloudPage();
expect(errorPage.getErrorCode()).toBe('403');
expect(errorPage.getErrorTitle()).toBe('You don\'t have permission to access this server.');
expect(errorPage.getErrorDescription()).toBe('You\'re not allowed access to this resource on the server.');
});
it('[C260036] Should require username', () => {
loginPage.goToLoginPage();
loginPage.checkUsernameInactive();

View File

@ -28,6 +28,8 @@ describe('Login component - SSO', () => {
const navigationBarPage = new NavigationBarPage();
let silentLogin;
describe('Login component - SSO', () => {
afterEach(() => {
navigationBarPage.clickLogoutButton();
browser.executeScript('window.sessionStorage.clear();');
@ -38,11 +40,26 @@ describe('Login component - SSO', () => {
silentLogin = false;
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity, silentLogin);
loginApsPage.clickOnSSOButton();
browser.ignoreSynchronization = true;
loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
});
it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', () => {
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, TestConfig.adf.hostSso, TestConfig.adf.hostIdentity);
browser.ignoreSynchronization = true;
loginApsPage.loginAPS(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
});
});
describe('SSO Login Error for login componentO', () => {
it('[C299205] Should display the login error message when the SSO identity service is wrongly configured', () => {
silentLogin = false;
settingsPage.setProviderBpmSso(TestConfig.adf.hostBPM, 'http://aps22/auth/realms/alfresco', TestConfig.adf.hostIdentity, silentLogin);
loginApsPage.clickOnSSOButton();
loginApsPage.checkLoginErrorIsDisplayed();
expect(loginApsPage.getLoginErrorMessage()).toContain('SSO Authentication server unreachable');
});
});
});

View File

@ -24,6 +24,7 @@ export class LoginSSOPage {
passwordField = element(by.id('password'));
loginButton = element(by.css('input[class="submit"]'));
header = element(by.id('adf-header'));
loginError = element(by.css(`div[data-automation-id="login-error"]`));
loginAPS(username, password) {
BrowserVisibility.waitUntilElementIsVisible(this.usernameField);
@ -56,4 +57,13 @@ export class LoginSSOPage {
return this.loginButton.click();
}
checkLoginErrorIsDisplayed() {
BrowserVisibility.waitUntilElementIsVisible(this.loginError);
}
getLoginErrorMessage() {
BrowserVisibility.waitUntilElementIsVisible(this.loginError);
return this.loginError.getText();
}
}