mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
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:
parent
040fc52724
commit
7d36400dbd
@ -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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
@ -50,6 +50,8 @@ describe('Login component - SSO', () => {
|
|||||||
await settingsPage.setProviderEcmSso(browser.params.testConfig.adf_acs.host,
|
await settingsPage.setProviderEcmSso(browser.params.testConfig.adf_acs.host,
|
||||||
browser.params.testConfig.adf.hostSso,
|
browser.params.testConfig.adf.hostSso,
|
||||||
browser.params.testConfig.adf.hostIdentity, true, true, browser.params.config.oauth2.clientId);
|
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);
|
await loginSSOPage.loginSSOIdentityService(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ const htmlReporter = require('protractor-html-reporter-2');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const rimraf = require('rimraf');
|
const rimraf = require('rimraf');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const projectRoot = path.resolve(__dirname);
|
const projectRoot = path.resolve(__dirname,'../../');
|
||||||
|
|
||||||
|
let FOLDER = process.env.FOLDER || '';
|
||||||
|
|
||||||
function buildNumber() {
|
function buildNumber() {
|
||||||
let buildNumber = process.env.TRAVIS_BUILD_NUMBER;
|
let buildNumber = process.env.TRAVIS_BUILD_NUMBER;
|
||||||
@ -14,7 +16,7 @@ function buildNumber() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function uploadScreenshot(alfrescoJsApi, retryCount) {
|
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) {
|
if (files && files.length > 0) {
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ async function uploadScreenshot(alfrescoJsApi, retryCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const fileName of files) {
|
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 file = fs.createReadStream(pathFile);
|
||||||
|
|
||||||
let safeFileName = fileName.replace(new RegExp('"', 'g'), '');
|
let safeFileName = fileName.replace(new RegExp('"', 'g'), '');
|
||||||
@ -63,7 +65,7 @@ async function uploadScreenshot(alfrescoJsApi, retryCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function uploadReport(alfrescoJsApi, filenameReport) {
|
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 reportFile = fs.createReadStream(pathFile);
|
||||||
|
|
||||||
let reportFolder;
|
let reportFolder;
|
||||||
|
@ -660,35 +660,6 @@ describe('LoginComponent', () => {
|
|||||||
expect(element.querySelector('#login-button-sso')).toBeDefined();
|
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();
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -169,7 +169,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
const provider = this.appConfig.get<string>(AppConfigValues.PROVIDERS);
|
const provider = this.appConfig.get<string>(AppConfigValues.PROVIDERS);
|
||||||
|
|
||||||
this.authService.setRedirect({ provider, url });
|
this.authService.setRedirect({ provider, url });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasCustomFieldsValidation()) {
|
if (this.hasCustomFieldsValidation()) {
|
||||||
@ -200,28 +200,18 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
onSubmit(values: any): void {
|
onSubmit(values: any): void {
|
||||||
this.disableError();
|
this.disableError();
|
||||||
|
|
||||||
if (this.authService.isOauth() && !this.authService.isSSODiscoveryConfigured()) {
|
const args = new LoginSubmitEvent({
|
||||||
this.errorMsg = 'LOGIN.MESSAGES.SSO-WRONG-CONFIGURATION';
|
controls: { username: this.form.controls.username }
|
||||||
this.isError = true;
|
});
|
||||||
} else {
|
this.executeSubmit.emit(args);
|
||||||
const args = new LoginSubmitEvent({
|
|
||||||
controls: { username: this.form.controls.username }
|
|
||||||
});
|
|
||||||
this.executeSubmit.emit(args);
|
|
||||||
|
|
||||||
if (!args.defaultPrevented) {
|
if (!args.defaultPrevented) {
|
||||||
this.performLogin(values);
|
this.performLogin(values);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitLogin() {
|
implicitLogin() {
|
||||||
if (this.authService.isOauth() && !this.authService.isSSODiscoveryConfigured()) {
|
this.authService.ssoImplicitLogin();
|
||||||
this.errorMsg = 'LOGIN.MESSAGES.SSO-WRONG-CONFIGURATION';
|
|
||||||
this.isError = true;
|
|
||||||
} else {
|
|
||||||
this.authService.ssoImplicitLogin();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -361,7 +351,7 @@ export class LoginComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBackgroundUrlImageUrl(): SafeStyle {
|
getBackgroundUrlImageUrl(): SafeStyle {
|
||||||
return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
|
return this.sanitizer.bypassSecurityTrustStyle(`url(${this.backgroundImageUrl})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
25
package-lock.json
generated
@ -76,14 +76,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@alfresco/js-api": {
|
"@alfresco/js-api": {
|
||||||
"version": "3.6.0-72a767454e7c319e7427f808ba9ec4dcff88a637",
|
"version": "3.6.0-5085d994f7aa1713c03ecdbc320df32423e4b4f9",
|
||||||
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-72a767454e7c319e7427f808ba9ec4dcff88a637.tgz",
|
"resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-5085d994f7aa1713c03ecdbc320df32423e4b4f9.tgz",
|
||||||
"integrity": "sha512-VkYfy1P2DcpzIREG4CdgLStCSbgmRdLpT5Xs5fCjlR3ojFoboiqnFVkFONKM2FrWXFkMKkruYkFQlfnUjLdOzQ==",
|
"integrity": "sha512-477wYs1Z1H5c3LystqIw7R9H4AgpP2gumEw6uAWUtUeA2NDWu4DbTeIssX+V3WVj+odwIKy+OVYfmAjXi4sF5g==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@alfresco/adf-cli": "^3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
|
"@alfresco/adf-cli": "^3.6.0-d659073389847ab312623736ec171791c10f6534",
|
||||||
"event-emitter": "^0.3.5",
|
"event-emitter": "^0.3.5",
|
||||||
"minimatch": "3.0.4",
|
"minimatch": "3.0.4",
|
||||||
"superagent": "^3.8.2"
|
"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": {
|
"@angular-devkit/architect": {
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
"@alfresco/adf-process-services": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
|
"@alfresco/adf-process-services": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
|
||||||
"@alfresco/adf-process-services-cloud": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
|
"@alfresco/adf-process-services-cloud": "3.6.0-70fd3a1c602128ed45d195c424d45b366b8b50ce",
|
||||||
"@alfresco/adf-testing": "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/animations": "^7.2.15",
|
||||||
"@angular/cdk": "7.3.7",
|
"@angular/cdk": "7.3.7",
|
||||||
"@angular/common": "^7.2.15",
|
"@angular/common": "^7.2.15",
|
||||||
|
@ -216,7 +216,7 @@ exports.config = {
|
|||||||
|
|
||||||
let alfrescoJsApi = new AlfrescoApi({
|
let alfrescoJsApi = new AlfrescoApi({
|
||||||
provider: 'ECM',
|
provider: 'ECM',
|
||||||
hostEcm: TestConfig.adf.url
|
hostEcm: TestConfig.adf_acs.host
|
||||||
});
|
});
|
||||||
|
|
||||||
alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user