[ADF-4329][ASD-5330] plus Improve e2e (#6580)

Improve e2e
Fix SSO user avatar 
Fix Priority for APS1
This commit is contained in:
Eugenio Romano
2021-02-05 15:18:30 +00:00
committed by GitHub
parent e4990f4b0c
commit f4976a1949
72 changed files with 649 additions and 442 deletions

View File

@@ -79,7 +79,7 @@ function main(args) {
.requiredOption('--dockerRepo [type]', 'docker repo')
.requiredOption('--dockerTags [type]', ' tags')
.requiredOption('--buildArgs [type]', ' buildArgs')
.requiredOption('--pathProject [type]', 'path ptojrct')
.requiredOption('--pathProject [type]', 'path project')
.parse(process.argv);
if (process.argv.includes('-h') || process.argv.includes('--help')) {

View File

@@ -259,6 +259,7 @@ export abstract class BaseQueryBuilderService {
}
if (query) {
const result: QueryBody = <QueryBody> {
query: {
query: query,
@@ -336,13 +337,11 @@ export abstract class BaseQueryBuilderService {
* @returns True if defined, false otherwise
*/
get hasFacetIntervals(): boolean {
if (this.config
return this.config
&& this.config.facetIntervals
&& this.config.facetIntervals.intervals
&& this.config.facetIntervals.intervals.length > 0) {
return true;
}
return false;
&& this.config.facetIntervals.intervals.length > 0;
}
get hasFacetHighlight(): boolean {

View File

@@ -42,8 +42,8 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
this.updated.pipe(
filter((query: QueryBody) => !!query)).subscribe(() => {
this.execute();
});
this.execute();
});
}
public isFilterServiceActive(): boolean {
@@ -99,8 +99,15 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
dataSorting.forEach((columnSorting: DataSorting) => {
const fieldValue = this.getSortingFieldFromColumnName(columnSorting.key);
if (fieldValue) {
const optionAscending = columnSorting.direction.toLocaleLowerCase() === 'asc' ? true : false;
const currentSort: SearchSortingDefinition = { key: columnSorting.key, label: 'current', type: 'FIELD', field: fieldValue, ascending: optionAscending };
const optionAscending = columnSorting.direction.toLocaleLowerCase() === 'asc';
const type = fieldValue === 'score' ? 'SCORE' : 'FIELD';
const currentSort: SearchSortingDefinition = {
key: columnSorting.key,
label: 'current',
type: type,
field: fieldValue,
ascending: optionAscending
};
this.sorting.push(currentSort);
}
});

View File

@@ -28,6 +28,7 @@ export abstract class CardViewBaseItemModel {
icon?: string;
validators?: CardViewItemValidator[];
data?: any;
type?: string;
constructor(cardViewItemProperties: CardViewItemProperties) {
this.label = cardViewItemProperties.label || '';

View File

@@ -20,7 +20,7 @@ import { Subject } from 'rxjs';
import { CardViewBaseItemModel } from '../models/card-view-baseitem.model';
export interface UpdateNotification {
target: any;
target: CardViewBaseItemModel;
changed: any;
}
@@ -60,7 +60,7 @@ export class CardViewUpdateService {
/**
* Updates the cardview items property
* @param CardViewBaseItemModel
* @param notification
*/
updateElement(notification: CardViewBaseItemModel) {
this.updateItem$.next(notification);

View File

@@ -327,7 +327,7 @@ export class FormFieldModel extends FormWidgetModel {
}
if (this.isCheckboxField(json)) {
value = json.value === 'true' || json.value === true ? true : false;
value = json.value === 'true' || json.value === true;
}
return value;

View File

@@ -19,7 +19,15 @@
data-automation-id="adf-user-profile">
<div class="adf-userinfo-button-profile" id="user-profile">
<div *ngIf="identityUser$ | async as identityUser; else showBpmAndEcmUserImage" id="identity-user-image">
<div [outerHTML]="identityUser | usernameInitials:'adf-userinfo-pic'"></div>
<div *ngIf="ecmUser$ | async as ecmUser">
<div *ngIf="ecmUser.avatarId; else initialTemplate" class="adf-userinfo-profile-container">
<img id="logged-user-img" [src]="getEcmAvatar(ecmUser.avatarId)" alt="user-info-profile-button"
class="adf-userinfo-profile-image"/>
</div>
</div>
<ng-template #initialTemplate>
<div [outerHTML]="identityUser | usernameInitials:'adf-userinfo-pic'"></div>
</ng-template>
</div>
<ng-template #showBpmAndEcmUserImage>
<div *ngIf="ecmUser$ | async as ecmUser; else showBpmUserImage" id="ecm-user-image">
@@ -50,7 +58,7 @@
<mat-tab-group id="tab-group-env" (click)="stopClosing($event)" selectedIndex="0"
class="adf-userinfo-tab" [class.adf-hide-tab]="!(bpmUser$ | async) || !(ecmUser$ | async)">
<mat-tab id="ecm-panel" label="{{ 'USER_PROFILE.TAB.CS' | translate }}"
*ngIf="mode==='CONTENT' || mode==='ALL'">
*ngIf="mode==='CONTENT' || mode==='ALL'">
<mat-card class="adf-userinfo-card" *ngIf="ecmUser$ | async as ecmUser">
<mat-card-header class="adf-userinfo-card-header"
[style.background-image]="'url(' + ecmBackgroundImage + ')'">
@@ -76,7 +84,8 @@
<div class="adf-userinfo-detail">
<span class="adf-userinfo__secondary-info" id="ecm-job-title-label">
{{ 'USER_PROFILE.LABELS.ECM.JOB_TITLE' | translate }}
<span id="ecm-job-title" class="adf-userinfo__detail-profile"> {{ ecmUser.jobTitle ? ecmUser.jobTitle : 'N/A' }} </span>
<span id="ecm-job-title"
class="adf-userinfo__detail-profile"> {{ ecmUser.jobTitle ? ecmUser.jobTitle : 'N/A' }} </span>
</span>
</div>
</div>
@@ -107,7 +116,8 @@
<div class="adf-userinfo-detail">
<span id="bpm-tenant" class="adf-userinfo__secondary-info">
{{ 'USER_PROFILE.LABELS.BPM.TENANT' | translate }}
<span class="adf-userinfo__detail-profile">{{ bpmUser.tenantName ? bpmUser.tenantName : '' }}</span>
<span
class="adf-userinfo__detail-profile">{{ bpmUser.tenantName ? bpmUser.tenantName : '' }}</span>
</span>
</div>
</div>
@@ -118,15 +128,24 @@
<mat-card class="adf-userinfo-card" *ngIf="identityUser$ | async as identityUser">
<mat-card-header class="adf-userinfo-card-header"
[style.background-image]="'url(' + bpmBackgroundImage + ')'">
<div
[outerHTML]="identityUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'">
<div *ngIf="ecmUser$ | async as ecmUser">
<div *ngIf="ecmUser.avatarId; else initialTemplate"
class="adf-userinfo-profile-container adf-hide-small">
<img class="adf-userinfo-profile-picture" id="ecm-user-detail-image"
alt="ecm-profile-image" [src]="getEcmAvatar(ecmUser.avatarId)"/>
</div>
</div>
<ng-template #initialTemplate>
<div
[outerHTML]="identityUser | usernameInitials:'adf-userinfo-profile-initials adf-hide-small'"></div>
</ng-template>
<div class="adf-userinfo-title" id="identity-username">{{identityUser | fullName}}</div>
</mat-card-header>
<mat-card-content>
<div class="adf-userinfo-supporting-text">
<div class="adf-userinfo-detail">
<span id="identity-full-name" class="adf-userinfo__detail-title">{{identityUser | fullName}}</span>
<span id="identity-full-name"
class="adf-userinfo__detail-title">{{identityUser | fullName}}</span>
<span class="adf-userinfo__detail-profile"
id="identity-email"> {{identityUser.email}} </span>
</div>

View File

@@ -83,6 +83,11 @@ export class UserInfoComponent implements OnInit {
if (this.authService.isOauth()) {
this.loadIdentityUserInfo();
this.mode = 'SSO';
if (this.authService.isEcmLoggedIn()) {
this.loadEcmUserInfo();
}
} else if (this.authService.isEcmLoggedIn() && this.authService.isBpmLoggedIn()) {
this.loadEcmUserInfo();
this.loadBpmUserInfo();

View File

@@ -267,7 +267,6 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
*/
private loadDetails(taskId: string) {
this.taskPeople = [];
this.taskFormName = null;
if (taskId) {
this.taskListService.getTaskDetails(taskId).subscribe(
@@ -339,6 +338,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
}
onCompleteAttachForm() {
this.taskFormName = null;
this.showAttachForm = false;
this.taskFormComponent.loadTask(this.taskId);
this.loadDetails(this.taskId);

View File

@@ -15,16 +15,17 @@
* limitations under the License.
*/
import { Component, EventEmitter, Input, OnChanges, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
import {
BpmUserService,
CardViewDateItemModel,
CardViewItem,
CardViewMapItemModel,
CardViewTextItemModel,
CardViewBaseItemModel,
TranslationService,
AppConfigService
AppConfigService,
CardViewIntItemModel,
CardViewItemLengthValidator
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskDescriptionValidator } from '../validators/task-description.validator';
@@ -52,13 +53,13 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
@Output()
claim: EventEmitter<any> = new EventEmitter<any>();
/** Emitted when the task is unclaimed (ie, requeued). */
/** Emitted when the task is unclaimed (ie, requeue). */
@Output()
unclaim: EventEmitter<any> = new EventEmitter<any>();
private currentUserId: number;
properties: CardViewItem [];
properties: any [] = [];
inEdit: boolean = false;
displayDateClearAction = false;
dateFormat: string;
@@ -73,13 +74,19 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
ngOnInit() {
this.loadCurrentBpmUserId();
this.initData();
}
ngOnChanges() {
this.refreshData();
ngOnChanges(changes: SimpleChanges) {
const taskDetailsChange = changes['taskDetails'];
if (taskDetailsChange?.currentValue?.id !== taskDetailsChange?.previousValue?.id) {
this.initData();
} else {
this.refreshData();
}
}
private initDefaultProperties(parentInfoMap) {
private initDefaultProperties(parentInfoMap): any[] {
return [
new CardViewTextItemModel(
{
@@ -98,12 +105,13 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
key: 'status'
}
),
new CardViewTextItemModel(
new CardViewIntItemModel(
{
label: 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
value: this.taskDetails.priority,
key: 'priority',
editable: true
editable: true,
validators: [new CardViewItemLengthValidator(1, 10)]
}
),
new CardViewDateItemModel(
@@ -200,7 +208,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
/**
* Refresh the card data
*/
refreshData() {
initData() {
if (this.taskDetails) {
const parentInfoMap = this.getParentInfo();
const defaultProperties = this.initDefaultProperties(parentInfoMap);
@@ -209,6 +217,26 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
}
}
/**
* Refresh the card data
*/
refreshData() {
this.properties = this.properties.map((cardItem) => {
if (cardItem.key === 'formName' && cardItem.value !== this.formName) {
return new CardViewTextItemModel({
label: 'ADF_TASK_LIST.PROPERTIES.FORM_NAME',
value: this.formName,
key: 'formName',
default: this.translationService.instant('ADF_TASK_LIST.PROPERTIES.FORM_NAME_DEFAULT'),
clickable: this.isFormClickable(),
icon: 'create'
});
} else {
return cardItem;
}
});
}
private isValidSelection(filteredProperties: string[], cardItem: CardViewBaseItemModel): boolean {
return filteredProperties ? filteredProperties.indexOf(cardItem.key) >= 0 : true;
}
@@ -236,7 +264,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
* Does the task have an assignee
*/
public hasAssignee(): boolean {
return !!this.taskDetails.assignee ? true : false;
return !!this.taskDetails.assignee;
}
/**

View File

@@ -15,14 +15,6 @@
* limitations under the License.
*/
/*
* Copyright 2005-2019 Alfresco Software, Ltd. All rights reserved.
*
* License rights for this program may be obtained from Alfresco Software, Ltd.
* pursuant to a written agreement and any use of this program without such an
* agreement is prohibited.
*/
export type ApiResultPredicate<T> = (result: T) => boolean;
export type ApiCall<T> = () => Promise<T>;

View File

@@ -94,7 +94,7 @@ export class LoginPage {
await this.enterPassword(password);
await this.clickLoginButton();
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await BrowserVisibility.waitUntilElementIsVisible(this.header);
await BrowserVisibility.waitUntilElementIsVisible(this.header, BrowserVisibility.DEFAULT_TIMEOUT * 2);
}
async loginBasicAuth(username: string, password: string): Promise<void> {

View File

@@ -43,7 +43,7 @@ export class BrowserActions {
}
};
return ApiUtil.waitForApi(apiCall, predicate, 5, 2000);
return ApiUtil.waitForApi(apiCall, predicate, 10, 2000);
}
static async click(elementToClick: ElementFinder): Promise<void> {

View File

@@ -24,4 +24,5 @@ export * from './local-storage.util';
export * from './file-browser.util';
export * from './form.util';
export * from './date-util';
export * from './wait-actions';
export * from './logger';

View File

@@ -0,0 +1,70 @@
/*!
* @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 { NodeEntry } from '@alfresco/js-api';
import { ApiService } from '../actions/api.service';
import { ApiUtil } from '../actions/api.util';
import { Logger } from './logger';
export class WaitActions {
DELAY_API_CALL = 5000;
apiService: ApiService;
constructor(apiService: ApiService) {
this.apiService = apiService;
}
async nodeIsPresent(nodeId: string): Promise<NodeEntry | null> {
const predicate = (result) => {
return result.entry.id === nodeId;
};
const apiCall = async () => {
try {
return this.apiService.getInstance().core.nodesApi.getNode(nodeId);
} catch (error) {
Logger.error('Node not present');
return null;
}
};
return ApiUtil.waitForApi(apiCall, predicate, this.DELAY_API_CALL);
}
async nodeIsUnlock(nodeId: string): Promise<NodeEntry | null> {
const predicate = (result) => {
return result.entry.isLocked === false;
};
const apiCall = async () => {
try {
return this.apiService.getInstance().core.nodesApi.getNode(nodeId);
} catch (error) {
Logger.error('Node not present');
return null;
}
};
return ApiUtil.waitForApi(apiCall, predicate, this.DELAY_API_CALL);
}
}