Remove discovery (#5212)

* remove discovery

* remoce discovery test

* fix save remote

* use host acs to save screenshot

* fix e2e

* remove invalid test

* fix the package version
This commit is contained in:
Eugenio Romano 2019-11-05 16:15:54 +02:00 committed by Denys Vuika
parent 040fc52724
commit 7d36400dbd
9 changed files with 40 additions and 109 deletions

View File

@ -1,43 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LoginSSOPage, SettingsPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('Login component - SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginSSOPage();
describe('SSO Login Error for login component', () => {
afterEach(async () => {
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
it('[C299205] Should display the login error message when the SSO identity service is wrongly configured', async () => {
await settingsPage.setProviderEcmSso(browser.params.testConfig.adf_acs.host,
'http://aps22/auth/realms/alfresco',
browser.params.testConfig.adf.hostIdentity, false, true, browser.params.config.oauth2.clientId);
await loginSSOPage.clickOnSSOButton();
await loginSSOPage.checkLoginErrorIsDisplayed();
await expect(loginSSOPage.getLoginErrorMessage()).toContain('SSO Authentication server unreachable');
});
});
});

View File

@ -50,6 +50,8 @@ describe('Login component - SSO', () => {
await settingsPage.setProviderEcmSso(browser.params.testConfig.adf_acs.host,
browser.params.testConfig.adf.hostSso,
browser.params.testConfig.adf.hostIdentity, true, true, browser.params.config.oauth2.clientId);
await browser.refresh();
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
});

View File

@ -2,7 +2,9 @@ const htmlReporter = require('protractor-html-reporter-2');
const fs = require('fs');
const rimraf = require('rimraf');
const path = require('path');
const projectRoot = path.resolve(__dirname);
const projectRoot = path.resolve(__dirname,'../../');
let FOLDER = process.env.FOLDER || '';
function buildNumber() {
let buildNumber = process.env.TRAVIS_BUILD_NUMBER;
@ -14,7 +16,7 @@ function buildNumber() {
}
async function uploadScreenshot(alfrescoJsApi, retryCount) {
let files = fs.readdirSync(path.join(__dirname, './e2e-output/screenshots'));
let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots'));
if (files && files.length > 0) {
@ -38,7 +40,7 @@ async function uploadScreenshot(alfrescoJsApi, retryCount) {
}
for (const fileName of files) {
let pathFile = path.join(__dirname, './e2e-output/screenshots', fileName);
let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName);
let file = fs.createReadStream(pathFile);
let safeFileName = fileName.replace(new RegExp('"', 'g'), '');
@ -63,7 +65,7 @@ async function uploadScreenshot(alfrescoJsApi, retryCount) {
}
async function uploadReport(alfrescoJsApi, filenameReport) {
let pathFile = path.join(__dirname, './e2e-output/junit-report/html', filenameReport + '.html');
let pathFile = path.join(__dirname, '../../e2e-output/junit-report/html', filenameReport + '.html');
let reportFile = fs.createReadStream(pathFile);
let reportFolder;

View File

@ -660,35 +660,6 @@ describe('LoginComponent', () => {
expect(element.querySelector('#login-button-sso')).toBeDefined();
});
}));
it('should show the SSO error when the discovery server is unreachable', async(() => {
spyOn(authService, 'isOauth').and.returnValue(true);
spyOn(authService, 'isSSODiscoveryConfigured').and.returnValue(false);
component.ngOnInit();
fixture.detectChanges();
element.querySelector('[data-automation-id="login-button-sso"]').click();
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(getLoginErrorMessage()).toEqual('LOGIN.MESSAGES.SSO-WRONG-CONFIGURATION');
});
}));
it('should not show the SSO error when the discovery server is reachable', async(() => {
spyOn(authService, 'isOauth').and.returnValue(true);
spyOn(authService, 'isSSODiscoveryConfigured').and.returnValue(true);
spyOn(authService, 'ssoImplicitLogin').and.stub();
component.ngOnInit();
fixture.detectChanges();
element.querySelector('[data-automation-id="login-button-sso"]').click();
fixture.whenStable().then(() => {
expect(getLoginErrorMessage()).toBeUndefined();
});
}));
});
});
});

View File

@ -200,10 +200,6 @@ export class LoginComponent implements OnInit, OnDestroy {
onSubmit(values: any): void {
this.disableError();
if (this.authService.isOauth() && !this.authService.isSSODiscoveryConfigured()) {
this.errorMsg = 'LOGIN.MESSAGES.SSO-WRONG-CONFIGURATION';
this.isError = true;
} else {
const args = new LoginSubmitEvent({
controls: { username: this.form.controls.username }
});
@ -213,16 +209,10 @@ export class LoginComponent implements OnInit, OnDestroy {
this.performLogin(values);
}
}
}
implicitLogin() {
if (this.authService.isOauth() && !this.authService.isSSODiscoveryConfigured()) {
this.errorMsg = 'LOGIN.MESSAGES.SSO-WRONG-CONFIGURATION';
this.isError = true;
} else {
this.authService.ssoImplicitLogin();
}
}
/**
* The method check the error in the form and push the error in the formError object

View File

@ -316,12 +316,4 @@ export class AuthenticationService {
}
});
}
/**
* Checks if SSO is configured correctly.
* @returns True if configured correctly, false otherwise
*/
isSSODiscoveryConfigured() {
return this.alfrescoApi.getInstance().storage.getItem('discovery') ? true : false;
}
}

25
package-lock.json generated
View File

@ -76,14 +76,31 @@
}
},
"@alfresco/js-api": {
"version": "3.6.0-72a767454e7c319e7427f808ba9ec4dcff88a637",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-72a767454e7c319e7427f808ba9ec4dcff88a637.tgz",
"integrity": "sha512-VkYfy1P2DcpzIREG4CdgLStCSbgmRdLpT5Xs5fCjlR3ojFoboiqnFVkFONKM2FrWXFkMKkruYkFQlfnUjLdOzQ==",
"version": "3.6.0-5085d994f7aa1713c03ecdbc320df32423e4b4f9",
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-5085d994f7aa1713c03ecdbc320df32423e4b4f9.tgz",
"integrity": "sha512-477wYs1Z1H5c3LystqIw7R9H4AgpP2gumEw6uAWUtUeA2NDWu4DbTeIssX+V3WVj+odwIKy+OVYfmAjXi4sF5g==",
"requires": {
"@alfresco/adf-cli": "^3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
"@alfresco/adf-cli": "^3.6.0-d659073389847ab312623736ec171791c10f6534",
"event-emitter": "^0.3.5",
"minimatch": "3.0.4",
"superagent": "^3.8.2"
},
"dependencies": {
"@alfresco/adf-cli": {
"version": "3.6.0-f731988ca6c6e691f24647dd3a26ce01bfeffc23",
"resolved": "https://registry.npmjs.org/@alfresco/adf-cli/-/adf-cli-3.6.0-f731988ca6c6e691f24647dd3a26ce01bfeffc23.tgz",
"integrity": "sha512-IXTLRXyBh1FL5zhzZucUWJ8FS1NMCigAm+wH/S0cZLewAlXoUkrqUUGtCoQkH4/b1Et5nEbWbSGUvkqB6VUxfg==",
"requires": {
"@angular-devkit/core": "^7.2.15",
"commander": "^2.15.1",
"ejs": "^2.6.1",
"license-checker": "^25.0.1",
"npm-registry-fetch": "^3.9.0",
"rxjs": ">=6.2.2",
"shelljs": "^0.8.3",
"spdx-license-list": "^5.0.0"
}
}
}
},
"@angular-devkit/architect": {

View File

@ -82,7 +82,7 @@
"@alfresco/adf-process-services": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
"@alfresco/adf-process-services-cloud": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
"@alfresco/adf-testing": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
"@alfresco/js-api": "3.6.0-72a767454e7c319e7427f808ba9ec4dcff88a637",
"@alfresco/js-api": "3.6.0-5085d994f7aa1713c03ecdbc320df32423e4b4f9",
"@angular/animations": "^7.2.15",
"@angular/cdk": "7.3.7",
"@angular/common": "^7.2.15",

View File

@ -216,7 +216,7 @@ exports.config = {
let alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
hostEcm: TestConfig.adf_acs.host
});
alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);