Execute test when change exclude file (#5989)

* Execute test when change exclude file

* Update protractor.excludes.json

* Update nx.json

* fix first call use all params document list
This commit is contained in:
Eugenio Romano 2020-08-17 10:45:55 +01:00 committed by GitHub
parent bba8ab1839
commit 7cfb95da9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 60 deletions

View File

@ -123,6 +123,7 @@ describe('Version component permissions', () => {
}); });
afterAll(async () => { afterAll(async () => {
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true }); await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
}); });

View File

@ -1,5 +1,4 @@
{ {
"C277201": "Investigate after NG10",
"C362240": "Include once ADF starts using ACS 7 , https://issues.alfresco.com/jira/browse/ADF-5182", "C362240": "Include once ADF starts using ACS 7 , https://issues.alfresco.com/jira/browse/ADF-5182",
"C362241": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182", "C362241": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182",
"C362242": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182", "C362242": "Include once ADF starts using ACS 7, https://issues.alfresco.com/jira/browse/ADF-5182",

View File

@ -74,7 +74,8 @@ describe('DocumentList', () => {
beforeEach(() => { beforeEach(() => {
eventMock = { eventMock = {
preventDefault: function () {} preventDefault: function () {
}
}; };
fixture = TestBed.createComponent(DocumentListComponent); fixture = TestBed.createComponent(DocumentListComponent);
@ -278,7 +279,7 @@ describe('DocumentList', () => {
documentList.executeContentAction(node, action); documentList.executeContentAction(node, action);
expect(action.handler).toHaveBeenCalledWith(node, documentList, undefined); expect(action.handler).toHaveBeenCalledWith(node, documentList, undefined);
}); });
it('should call action handler with node and permission', () => { it('should call action handler with node and permission', () => {
const node = new FileNode(); const node = new FileNode();
@ -457,7 +458,7 @@ describe('DocumentList', () => {
expect(actions.length).toBe(1); expect(actions.length).toBe(1);
expect(actions[0].title).toEqual('FileAction'); expect(actions[0].title).toEqual('FileAction');
expect(actions[0].disabled).toBe(true); expect(actions[0].disabled).toBe(true);
}); });
it('should not display hidden content actions', () => { it('should not display hidden content actions', () => {
documentList.actions = [ documentList.actions = [
@ -546,7 +547,7 @@ describe('DocumentList', () => {
expect(actions.length).toBe(1); expect(actions.length).toBe(1);
expect(actions[0].title).toEqual('FileAction'); expect(actions[0].title).toEqual('FileAction');
expect(actions[0].disabled).toBeFalsy(); expect(actions[0].disabled).toBeFalsy();
}); });
it('should disable the action if there is no permission for the folder and disableWithNoPermission true', () => { it('should disable the action if there is no permission for the folder and disableWithNoPermission true', () => {
const documentMenu = new ContentActionModel({ const documentMenu = new ContentActionModel({
@ -566,7 +567,7 @@ describe('DocumentList', () => {
expect(actions.length).toBe(1); expect(actions.length).toBe(1);
expect(actions[0].title).toEqual('FolderAction'); expect(actions[0].title).toEqual('FolderAction');
expect(actions[0].disabled).toBe(true); expect(actions[0].disabled).toBe(true);
}); });
it('should not disable the action if there is the right permission for the file', () => { it('should not disable the action if there is the right permission for the file', () => {
const documentMenu = new ContentActionModel({ const documentMenu = new ContentActionModel({
@ -830,7 +831,7 @@ describe('DocumentList', () => {
documentList.onNodeClick(null); documentList.onNodeClick(null);
expect(documentList.loadFolder).not.toHaveBeenCalled(); expect(documentList.loadFolder).not.toHaveBeenCalled();
}); });
it('should display folder content only on folder node click', () => { it('should display folder content only on folder node click', () => {
expect(documentList.navigate).toBe(true); expect(documentList.navigate).toBe(true);
@ -1180,13 +1181,15 @@ describe('DocumentList', () => {
documentList.onNodeDblClick(node); documentList.onNodeDblClick(node);
}); });
it('should load folder by ID on init', () => { it('should load folder by ID on init', async () => {
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve()); spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve());
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
fixture.detectChanges(); fixture.detectChanges();
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
await fixture.whenStable();
expect(documentList.loadFolder).toHaveBeenCalled(); expect(documentList.loadFolder).toHaveBeenCalled();
}); });
@ -1442,13 +1445,13 @@ describe('DocumentList', () => {
documentList.includeFields = ['test-include']; documentList.includeFields = ['test-include'];
documentList.currentFolderId = 'fake-id'; documentList.currentFolderId = 'fake-id';
fixture.detectChanges(); documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
expect(documentListService.getFolder).toHaveBeenCalledWith(null, { expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
where: undefined, where: undefined,
maxItems: 25, maxItems: 25,
skipCount: 0, skipCount: 0,
orderBy: ['isFolder DESC', 'name asc' ], orderBy: ['isFolder DESC', 'name asc'],
rootFolderId: 'fake-id' rootFolderId: 'fake-id'
}, ['test-include']); }, ['test-include']);
}); });
@ -1458,13 +1461,13 @@ describe('DocumentList', () => {
documentList.where = '(isFolder=true)'; documentList.where = '(isFolder=true)';
documentList.currentFolderId = 'fake-id'; documentList.currentFolderId = 'fake-id';
fixture.detectChanges(); documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
expect(documentListService.getFolder).toHaveBeenCalledWith(null, { expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
where: '(isFolder=true)', where: '(isFolder=true)',
maxItems: 25, maxItems: 25,
skipCount: 0, skipCount: 0,
orderBy: ['isFolder DESC', 'name asc' ], orderBy: ['isFolder DESC', 'name asc'],
rootFolderId: 'fake-id' rootFolderId: 'fake-id'
}, ['test-include']); }, ['test-include']);
}); });
@ -1472,15 +1475,15 @@ describe('DocumentList', () => {
it('should add orderBy in the server request', () => { it('should add orderBy in the server request', () => {
documentList.includeFields = ['test-include']; documentList.includeFields = ['test-include'];
documentList.sorting = ['size', 'DESC']; documentList.sorting = ['size', 'DESC'];
documentList.currentFolderId = 'fake-id';
documentList.where = null; documentList.where = null;
documentList.currentFolderId = 'fake-id';
fixture.detectChanges(); documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, 'fake-id', true) });
expect(documentListService.getFolder).toHaveBeenCalledWith(null, { expect(documentListService.getFolder).toHaveBeenCalledWith(null, {
maxItems: 25, maxItems: 25,
skipCount: 0, skipCount: 0,
where: undefined, where: null,
orderBy: ['isFolder DESC', 'size DESC'], orderBy: ['isFolder DESC', 'size DESC'],
rootFolderId: 'fake-id' rootFolderId: 'fake-id'
}, ['test-include']); }, ['test-include']);
@ -1494,15 +1497,23 @@ describe('DocumentList', () => {
skipCount: 10 skipCount: 10
}); });
expect(documentListService.getFolder).toHaveBeenCalledWith(null, Object({
maxItems: 10,
skipCount: 10,
orderBy: ['name ASC'],
rootFolderId: 'no-node',
where: undefined
}), undefined);
documentList.onNodeClick(folder); documentList.onNodeClick(folder);
expect(documentListService.getFolder).toHaveBeenCalledWith(null, { expect(documentListService.getFolder).toHaveBeenCalledWith(null, Object({
maxItems: 25, maxItems: 25,
skipCount: 0, skipCount: 0,
orderBy: ['isFolder DESC', 'name asc' ], orderBy: ['name ASC'],
rootFolderId: 'folder-id', rootFolderId: 'folder-id',
where: undefined where: undefined
}, undefined); }), undefined);
}); });
}); });

View File

@ -233,7 +233,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
this._rowFilter = rowFilter; this._rowFilter = rowFilter;
if (this.data) { if (this.data) {
this.data.setFilter(this._rowFilter); this.data.setFilter(this._rowFilter);
if (this._currentFolderId) { if (this.currentFolderId) {
this.reload(); this.reload();
} }
} }
@ -255,31 +255,9 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
@Input() @Input()
stickyHeader: boolean = false; stickyHeader: boolean = false;
_currentFolderId: string = null;
/** The ID of the folder node to display or a reserved string alias for special sources */ /** The ID of the folder node to display or a reserved string alias for special sources */
@Input() @Input()
set currentFolderId(currentFolderId: string) { currentFolderId: string = null;
if (this._currentFolderId !== currentFolderId) {
this._currentFolderId = currentFolderId;
if (this.sorting) {
const [key, direction] = this.sorting;
this.orderBy = this.buildOrderByArray(key, direction);
}
if (this.data) {
this.data.loadPage(null, false);
this.resetNewFolderPagination();
}
if (this._currentFolderId) {
this.loadFolder();
}
}
}
get currentFolderId(): string {
return this._currentFolderId;
}
/** The Document list will show all the nodes contained in the NodePaging entity */ /** The Document list will show all the nodes contained in the NodePaging entity */
@Input() @Input()
@ -461,15 +439,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
const columns = this.data.getColumns(); const columns = this.data.getColumns();
if (!columns || columns.length === 0) { if (!columns || columns.length === 0) {
this.setupDefaultColumns(this._currentFolderId); this.setupDefaultColumns(this.currentFolderId);
} }
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
this.resetSelection(); this.resetSelection();
if (changes.sorting && changes.sorting.currentValue) { if (this.sorting) {
const [key, direction] = changes.sorting.currentValue; const [key, direction] = this.sorting;
this.orderBy = this.buildOrderByArray(key, direction); this.orderBy = this.buildOrderByArray(key, direction);
} }
@ -489,6 +467,19 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
} }
} }
if (changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
if (this.data) {
this.data.loadPage(null, false);
this.resetNewFolderPagination();
}
if (changes['currentFolderId'].currentValue) {
this.loadFolder();
}
}
if (this.data) { if (this.data) {
if (changes.node && changes.node.currentValue) { if (changes.node && changes.node.currentValue) {
const merge = this._pagination ? this._pagination.merge : false; const merge = this._pagination ? this._pagination.merge : false;
@ -597,15 +588,15 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
navigateTo(node: Node | string): boolean { navigateTo(node: Node | string): boolean {
if (typeof node === 'string') { if (typeof node === 'string') {
this.resetNewFolderPagination(); this.resetNewFolderPagination();
this._currentFolderId = node; this.currentFolderId = node;
this.folderChange.emit(new NodeEntryEvent(<Node> {id: node})); this.folderChange.emit(new NodeEntryEvent(<Node> {id: node}));
this.reload(); this.reload();
return true; return true;
} else { } else {
if (this.canNavigateFolder(node)) { if (this.canNavigateFolder(node)) {
this.resetNewFolderPagination(); this.resetNewFolderPagination();
this._currentFolderId = this.getNodeFolderDestinationId(node); this.currentFolderId = this.getNodeFolderDestinationId(node);
this.folderChange.emit(new NodeEntryEvent(<Node> {id: this._currentFolderId})); this.folderChange.emit(new NodeEntryEvent(<Node> {id: this.currentFolderId}));
this.reload(); this.reload();
return true; return true;
} }
@ -623,7 +614,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
} }
updateCustomSourceData(nodeId: string): void { updateCustomSourceData(nodeId: string): void {
this._currentFolderId = nodeId; this.currentFolderId = nodeId;
} }
/** /**
@ -662,20 +653,19 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
} }
loadFolder() { loadFolder() {
if (!this._pagination.merge) { if (!this._pagination.merge) {
this.setLoadingState(true); this.setLoadingState(true);
} }
if (!this.hasCustomLayout) { if (!this.hasCustomLayout) {
this.setupDefaultColumns(this._currentFolderId); this.setupDefaultColumns(this.currentFolderId);
} }
if (this.documentListService.isCustomSourceService(this._currentFolderId)) { if (this.documentListService.isCustomSourceService(this.currentFolderId)) {
this.updateCustomSourceData(this._currentFolderId); this.updateCustomSourceData(this.currentFolderId);
} }
this.documentListService.loadFolderByNodeId(this._currentFolderId, this._pagination, this.includeFields, this.where, this.orderBy) this.documentListService.loadFolderByNodeId(this.currentFolderId, this._pagination, this.includeFields, this.where, this.orderBy)
.subscribe((documentNode: DocumentLoaderNode) => { .subscribe((documentNode: DocumentLoaderNode) => {
if (documentNode.currentNode) { if (documentNode.currentNode) {
this.folderNode = documentNode.currentNode.entry; this.folderNode = documentNode.currentNode.entry;

View File

@ -1,5 +1,5 @@
{ {
"npmScope": "my-company", "npmScope": "adf",
"implicitDependencies": { "implicitDependencies": {
"angular.json": "*", "angular.json": "*",
"package.json": "*", "package.json": "*",
@ -7,9 +7,7 @@
"tslint.json": "*", "tslint.json": "*",
"nx.json": "*", "nx.json": "*",
".travis.yml": "*", ".travis.yml": "*",
"e2e/protractor.excludes.json": [ "e2e/protractor.excludes.json": "*"
"demoshell-e2e"
]
}, },
"projects": { "projects": {
"demoshell": { "demoshell": {