[ADF-3384] Create automated tests for Version Component (#3631)

* fix version component restore and delete event

* version manager actions

* fix test

* fix unit test

* remove fdescribe

* fix tslint

* fix screenshot rewrite problem

* remove fdescribe

* multi instance try

* remove fdescribe

* try uncomment some test

* error page

* fix user preferences pagiantion

* search page test include

* fix type tslint e2e

* restore code

* default lang momentadapter

* fix test

* [ADF-3384] removed console log from test

* [ADF-3384] adding some fixes for tests and code

* [ADF-3384] fixed some test and code
This commit is contained in:
Eugenio Romano
2018-08-03 18:12:03 +01:00
committed by Eugenio Romano
parent 17074478e2
commit a12662e7e2
101 changed files with 2047 additions and 718 deletions

View File

@@ -72,7 +72,9 @@
"options": [
{ "key": "name", "label": "Name", "type": "FIELD", "field": "cm:name", "ascending": true },
{ "key": "content.sizeInBytes", "label": "Size", "type": "FIELD", "field": "content.size", "ascending": true },
{ "key": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true }
{ "key": "description", "label": "Description", "type": "FIELD", "field": "cm:description", "ascending": true },
{ "key": "createdByUser", "label": "Author", "type": "FIELD", "field": "cm:creator", "ascending": true },
{ "key": "createdAt", "label": "Created", "type": "FIELD", "field": "cm:created", "ascending": true }
],
"defaults": [
{ "key": "name", "type": "FIELD", "field": "cm:name", "ascending": true }
@@ -194,7 +196,7 @@
]
},
"pagination": {
"size": 25,
"size": 20,
"supportedPageSizes": [ 5, 10, 15, 20 ]
},
"files": {

View File

@@ -7,3 +7,14 @@
<button mat-raised-button id="adf-metadata-clear" (click)="onClearMetadata()" color="primary">Clear metadata configuration</button>
<br>
<br>
<br>
<h2>Search App config editor</h2>
<ngx-monaco-editor id="adf-search-editor" class="adf-search-editor" [options]="editorOptions" [(ngModel)]="searchConf" (onInit)="onInitSearch($event)" ></ngx-monaco-editor>
<button mat-raised-button id="adf-search-save" (click)="onSaveSearch()" color="primary">Save Search configuration</button>
<button mat-raised-button id="adf-search-clear" (click)="onClearSearch()" color="primary">Clear Search configuration</button>
<br>

View File

@@ -26,6 +26,7 @@ import { AppConfigService, NotificationService } from '@alfresco/adf-core';
export class ConfigEditorComponent {
editor: any;
editorSearch: any;
editorOptions = {
theme: 'vs-dark',
@@ -36,6 +37,7 @@ export class ConfigEditorComponent {
};
metadataConf: string;
searchConf: string;
onInitMetadata(editor) {
this.editor = editor;
@@ -44,8 +46,16 @@ export class ConfigEditorComponent {
}, 1000);
}
onInitSearch(editor) {
this.editorSearch = editor;
setTimeout(() => {
this.editorSearch.getAction('editor.action.formatDocument').run();
}, 1000);
}
constructor(private appConfig: AppConfigService, private notificationService: NotificationService) {
this.metadataConf = JSON.stringify(appConfig.config['content-metadata']);
this.searchConf = JSON.stringify(appConfig.config['search']);
}
onSaveMetadata() {
@@ -59,7 +69,22 @@ export class ConfigEditorComponent {
}
}
onSaveSearch() {
try {
this.appConfig.config['search'] = JSON.parse(this.editor.getValue());
} catch (error) {
this.notificationService.openSnackMessage(
'Wrong sSearch configuration',
4000
);
}
}
onClearMetadata() {
this.metadataConf = '';
}
onClearSearch() {
this.searchConf = '';
}
}

View File

@@ -380,7 +380,6 @@
*ngIf="!infiniteScrolling"
class="adf-documentlist-pagination"
[target]="documentList"
[supportedPageSizes]="supportedPages"
(changePageSize)="onChangePageSize($event)"
(changePageNumber)="onChangePageNumber($event)"
(nextPage)="onNextPage($event)"
@@ -397,7 +396,7 @@
<adf-info-drawer-layout *ngIf="showVersions" class="adf-manage-versions-sidebar" fxFlex="0 0 auto">
<div info-drawer-content>
<adf-info-drawer [title]="'Details'">
<adf-info-drawer [title]="'Details'" *ngIf="documentList.selection[0]" >
<adf-info-drawer-tab [label]="'Properties'">
<adf-content-metadata-card
[node]="documentList.selection[0].entry">

View File

@@ -28,7 +28,7 @@ import {
AlfrescoApiService, AuthenticationService, AppConfigService, AppConfigValues, ContentService, TranslationService,
FileUploadEvent, FolderCreatedEvent, LogService, NotificationService,
UploadService, DataColumn, DataRow, UserPreferencesService,
PaginationComponent, FormValues, DisplayMode, UserPreferenceValues, InfinitePaginationComponent
PaginationComponent, FormValues, DisplayMode, InfinitePaginationComponent
} from '@alfresco/adf-core';
import {
@@ -177,7 +177,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
permissionsStyle: PermissionStyleModel[] = [];
infiniteScrolling: boolean;
supportedPages: number[];
currentSiteid = '';
warnOnMultipleUploads = false;
thumbnails = false;
@@ -201,10 +200,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Optional() private route: ActivatedRoute,
public authenticationService: AuthenticationService,
public alfrescoApiService: AlfrescoApiService) {
this.preference.select(UserPreferenceValues.SupportedPageSizes)
.subscribe((pages) => {
this.supportedPages = pages;
});
this.alfrescoApiService.nodeUpdated.subscribe(() => {
this.documentList.reload();
@@ -255,7 +250,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.contentService.folderCreated.subscribe(value => this.onFolderCreated(value));
this.onCreateFolder = this.contentService.folderCreate.subscribe(value => this.onFolderAction(value));
this.onEditFolder = this.contentService.folderEdit.subscribe(value => this.onFolderAction(value));
this.supportedPages = this.supportedPages ? this.supportedPages : this.preference.getDefaultPageSizes();
// this.permissionsStyle.push(new PermissionStyleModel('document-list__create', PermissionsEnum.CREATE));
// this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', PermissionsEnum.NOT_CREATE, false, true));

View File

@@ -1,11 +1,23 @@
<header mat-dialog-title>{{'VERSION.DIALOG.TITLE' | translate}}</header>
<section>
<mat-slide-toggle color="primary" [(ngModel)]="readOnly">
<mat-slide-toggle id="adf-version-manager-switch-readonly" color="primary" [(ngModel)]="readOnly">
{{'APP.ADF_VERSION_MANAGER.READ_ONLY' | translate}}
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle id="adf-version-manager-switch-download"color="primary" [(ngModel)]="allowDownload">
{{'APP.ADF_VERSION_MANAGER.ALLOW_DOWNLOAD' | translate}}
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle id="adf-version-manager-switch-comments" color="primary" [(ngModel)]="showComments">
{{'APP.ADF_VERSION_MANAGER.COMMENTS' | translate}}
</mat-slide-toggle>
</section>
<section mat-dialog-content *ngIf="!readOnly">
<adf-version-manager [node]="contentEntry" [allowDownload]="allowDownload" [showComments]="showComments" (uploadError)="uploadError($event)"></adf-version-manager>
</section>

View File

@@ -72,6 +72,10 @@ export class NotificationsComponent implements OnInit {
}
setSnackBarConfig(configFormValues: any) {
if (configFormValues.announcementMessage) {
this.snackBarConfig.announcementMessage = configFormValues.announcementMessage;
}
if (configFormValues.direction) {
this.snackBarConfig.direction = configFormValues.direction;
@@ -109,7 +113,6 @@ export class NotificationsComponent implements OnInit {
"duration": "${this.snackBarConfig.duration}",
"horizontalPosition": "${ this.snackBarConfig.horizontalPosition}",
"verticalPosition": "${ this.snackBarConfig.verticalPosition}"}`;
if (this.message) {
if (this.withAction) {
this.notificationService

View File

@@ -59,7 +59,6 @@
*ngIf="taskList"
[target]="taskList"
(changePageSize)="onChangePageSize($event)"
[supportedPageSizes]="supportedPages"
#taskListPagination>
</adf-pagination>
</div>
@@ -157,7 +156,6 @@
*ngIf="processList"
[target]="processList"
(changePageSize)="onChangePageSize($event)"
[supportedPageSizes]="supportedPages"
#processListPagination>
</adf-pagination>
</div>

View File

@@ -127,8 +127,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
paginationPageSize = 0;
processSchemaColumns: any[] = [];
supportedPages: number[];
defaultProcessDefinitionName: string;
defaultProcessName: string;
@@ -225,7 +223,6 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
this.currentProcessInstanceId = null;
});
this.layoutType = AppsListComponent.LAYOUT_GRID;
this.supportedPages = this.preferenceService.getDefaultPageSizes();
}
ngOnDestroy() {

View File

@@ -91,7 +91,6 @@
</adf-document-list>
<adf-pagination [ngClass]="{ 'no-border' : documentList.isEmpty()}"
[supportedPageSizes]="supportedPages"
[target]="documentList">
</adf-pagination>
</div>

View File

@@ -37,7 +37,6 @@ export class TrashcanComponent {
@ViewChild('documentList')
documentList: DocumentListComponent;
supportedPages = [];
currentLocale;
constructor(
@@ -45,12 +44,6 @@ export class TrashcanComponent {
private router: Router,
private notificationService: NotificationService
) {
this.preference
.select(UserPreferenceValues.SupportedPageSizes)
.subscribe(pages => {
this.supportedPages = pages;
});
this.preference
.select(UserPreferenceValues.Locale)
.subscribe(locale => {