diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 7917cf83b..3e165c0f5 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -125,16 +125,17 @@ export class DataTable extends Component { return await this.getSortedColumnHeader().getText(); } - async getSortingOrder() { + async getSortingOrder(): Promise { const str = await this.getSortedColumnHeader().getAttribute('class'); if (str.includes('asc')) { return 'asc'; } - else { - if (str.includes('desc')) { - return 'desc'; - } + + if (str.includes('desc')) { + return 'desc'; } + + return 'none'; } async sortByColumn(columnName: string) { @@ -328,32 +329,40 @@ export class DataTable extends Component { return await this.emptyFolderDragAndDrop.isDisplayed(); } - async getEmptyDragAndDropText() { + async getEmptyDragAndDropText(): Promise { const isEmpty = await this.isEmptyWithDragAndDrop(); if (isEmpty) { return await this.emptyFolderDragAndDrop.getText(); } + + return ''; } - async getEmptyStateTitle() { + async getEmptyStateTitle(): Promise { const isEmpty = await this.isEmptyList(); if (isEmpty) { return await this.emptyListTitle.getText(); } + + return ''; } - async getEmptyStateSubtitle() { + async getEmptyStateSubtitle(): Promise { const isEmpty = await this.isEmptyList(); if (isEmpty) { return await this.emptyListSubtitle.getText(); } + + return ''; } - async getEmptyStateText() { + async getEmptyStateText(): Promise { const isEmpty = await this.isEmptyList(); if (isEmpty) { return await this.emptyListText.getText(); } + + return ''; } async getEmptySearchResultsText() { diff --git a/e2e/components/info-drawer/info-drawer.ts b/e2e/components/info-drawer/info-drawer.ts index 46d8371a4..6e2dd74b6 100755 --- a/e2e/components/info-drawer/info-drawer.ts +++ b/e2e/components/info-drawer/info-drawer.ts @@ -92,10 +92,12 @@ export class InfoDrawer extends Component { return await this.getTabByTitle(title).isPresent(); } - async isTabDisplayed(title: string) { + async isTabDisplayed(title: string): Promise { if (await browser.isElementPresent(this.getTabByTitle(title))) { return await this.getTabByTitle(title).isDisplayed(); } + + return false; } async getTabTitle(index: number) { diff --git a/e2e/components/login/login.ts b/e2e/components/login/login.ts index b4e654f44..1bbeb1cbc 100755 --- a/e2e/components/login/login.ts +++ b/e2e/components/login/login.ts @@ -76,7 +76,7 @@ export class LoginComponent extends Component { return await this.passwordVisibility.click(); } - async getPasswordVisibility() { + async getPasswordVisibility(): Promise { const text = await this.passwordVisibility.getText(); if (text.endsWith('visibility_off')) { return false; @@ -86,9 +86,11 @@ export class LoginComponent extends Component { return true; } } + + return false; } - async isPasswordDisplayed() { + async isPasswordDisplayed(): Promise { const type = await this.passwordInput.getAttribute('type'); if (type === 'text') { return true; @@ -98,6 +100,8 @@ export class LoginComponent extends Component { return false; } } + + return false; } async isUsernameEnabled() { diff --git a/e2e/components/menu/menu.ts b/e2e/components/menu/menu.ts index 6dabbd736..9ba44043e 100755 --- a/e2e/components/menu/menu.ts +++ b/e2e/components/menu/menu.ts @@ -167,7 +167,7 @@ export class Menu extends Component { } } - async hasSubMenu(menuItem: string) { + async hasSubMenu(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); @@ -175,6 +175,7 @@ export class Menu extends Component { return elemClass.includes('mat-menu-item-submenu-trigger'); } catch (error) { console.log('---- has submenu error: ', error); + return false; } } @@ -200,13 +201,14 @@ export class Menu extends Component { return await this.submenus.count(); } - async isMenuItemDisabled(title: string) { + async isMenuItemDisabled(title: string): Promise { try { const item = this.getItemByLabel(title); const disabled = await item.getAttribute('disabled'); return disabled; } catch (error) { console.log('----- isMenuItemDisabled catch: ', error); + return null; } } diff --git a/e2e/components/viewer/viewer.ts b/e2e/components/viewer/viewer.ts index 944aa928e..109f03abb 100755 --- a/e2e/components/viewer/viewer.ts +++ b/e2e/components/viewer/viewer.ts @@ -100,10 +100,12 @@ export class Viewer extends Component { return await browser.isElementPresent(this.viewerExtensionContent); } - async getComponentIdOfView() { + async getComponentIdOfView(): Promise { if (await this.isCustomContentPresent()) { return await this.viewerExtensionContent.getAttribute('data-automation-id'); } + + return null; } async isPdfViewerContentDisplayed() { diff --git a/e2e/suites/actions-available/test-util.ts b/e2e/suites/actions-available/test-util.ts index aa3a71adf..c2afaeb47 100644 --- a/e2e/suites/actions-available/test-util.ts +++ b/e2e/suites/actions-available/test-util.ts @@ -119,10 +119,11 @@ export async function checkViewerToolbarMoreActions(item: string, expectedToolba } -function removeClosePreviousNextOldInfo(actions: string[]) { +function removeClosePreviousNextOldInfo(actions: string[]): string[] { return actions.filter(elem => { if ( (elem !== 'Close') && (elem !== 'Previous File') && (elem !== 'Next File') && (elem !== 'View details')) { return elem; } - }); + return null + }).filter((action) => action != null); } diff --git a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts index d884d925c..acd9f9226 100755 --- a/e2e/utilities/repo-client/apis/favorites/favorites-api.ts +++ b/e2e/utilities/repo-client/apis/favorites/favorites-api.ts @@ -26,7 +26,7 @@ import { RepoApi } from '../repo-api'; import { RepoClient } from './../../repo-client'; import { Utils } from '../../../../utilities/utils'; -import { FavoritesApi as AdfFavoritesApi, SitesApi as AdfSiteApi } from '@alfresco/js-api'; +import { FavoritesApi as AdfFavoritesApi, SitesApi as AdfSiteApi, FavoriteEntry } from '@alfresco/js-api'; export class FavoritesApi extends RepoApi { favoritesApi = new AdfFavoritesApi(this.alfrescoJsApi); @@ -48,7 +48,7 @@ export class FavoritesApi extends RepoApi { return await this.favoritesApi.createFavorite('-me-', data); } - async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string) { + async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise { let guid; await this.apiAuth(); @@ -68,6 +68,7 @@ export class FavoritesApi extends RepoApi { return await this.favoritesApi.createFavorite('-me-', data); } catch (error) { console.log('--- add favorite by id catch '); + return null; } } diff --git a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts index 22570ed7f..9604e07fc 100755 --- a/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts +++ b/e2e/utilities/repo-client/apis/shared-links/shared-links-api.ts @@ -25,7 +25,7 @@ import { RepoApi } from '../repo-api'; import { Utils } from '../../../../utilities/utils'; -import { SharedlinksApi as AdfSharedlinksApi } from '@alfresco/js-api'; +import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry } from '@alfresco/js-api'; export class SharedLinksApi extends RepoApi { sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi); @@ -34,7 +34,7 @@ export class SharedLinksApi extends RepoApi { super(username, password); } - async shareFileById(id: string, expireDate?: Date) { + async shareFileById(id: string, expireDate?: Date): Promise { try { await this.apiAuth(); const data = { @@ -44,6 +44,7 @@ export class SharedLinksApi extends RepoApi { return await this.sharedlinksApi.createSharedLink(data); } catch (error) { console.log('---- shareFileById error: ', error); + return null; } } diff --git a/e2e/utilities/repo-client/apis/sites/sites-api.ts b/e2e/utilities/repo-client/apis/sites/sites-api.ts index 037f5c541..0c811cc82 100755 --- a/e2e/utilities/repo-client/apis/sites/sites-api.ts +++ b/e2e/utilities/repo-client/apis/sites/sites-api.ts @@ -24,7 +24,7 @@ */ import { RepoApi } from '../repo-api'; -import { SiteBody, SiteMemberRoleBody, SiteMemberBody } from '@alfresco/js-api'; +import { SiteBody, SiteMemberRoleBody, SiteMemberBody, SiteEntry, SiteMembershipRequestEntry } from '@alfresco/js-api'; import { SITE_VISIBILITY } from '../../../../configs'; import { Utils } from '../../../../utilities/utils'; import { SitesApi as AdfSiteApi } from '@alfresco/js-api'; @@ -66,7 +66,7 @@ export class SitesApi extends RepoApi { return site.entry.title; } - async createSite(title: string, visibility?: string, description?: string, siteId?: string) { + async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise { const site = { title, visibility: visibility || SITE_VISIBILITY.PUBLIC, @@ -79,6 +79,7 @@ export class SitesApi extends RepoApi { return await this.sitesApi.createSite(site); } catch (error) { console.log('=== create site catch: ', error); + return null; } } @@ -134,7 +135,7 @@ export class SitesApi extends RepoApi { return await this.sitesApi.deleteSiteMembership(siteId, userId); } - async requestToJoin(siteId: string) { + async requestToJoin(siteId: string): Promise { const body = { id: siteId }; @@ -143,6 +144,7 @@ export class SitesApi extends RepoApi { return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body); } catch (error) { console.log('====== requestToJoin catch ', error); + return null; }; } diff --git a/package-lock.json b/package-lock.json index 1fe9f935c..e3d40cdca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,9 +29,9 @@ } }, "@alfresco/js-api": { - "version": "3.6.0-e6e63bb456c4b5c98ee92b18e63e6e69f08b6557", - "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-e6e63bb456c4b5c98ee92b18e63e6e69f08b6557.tgz", - "integrity": "sha512-13KrK7fvipEhtnr3Z9vrcpST2djkHyja2V0KnH6TXWkMLH7hhRnoFYYUlF0ivlH+RhE3oNr/aCUOloXH9b3PtQ==", + "version": "3.6.0-30c45018502e789b5f32210201829125b285bcce", + "resolved": "https://registry.npmjs.org/@alfresco/js-api/-/js-api-3.6.0-30c45018502e789b5f32210201829125b285bcce.tgz", + "integrity": "sha512-i65bwt3IIJrfOJaej17YOh3TWR5gX1NUyh1ZCkZvgaVz3LDPDO+ivaBiVxBv37eJzb89nRxwQS4TmJ98zVAGBA==", "requires": { "event-emitter": "0.3.4", "minimatch": "3.0.4", diff --git a/package.json b/package.json index 4b4b2ed30..42d58e7d6 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "@alfresco/adf-content-services": "3.6.0-1d7ef6209592e8703cdbaf48d4340d141fa461a5", "@alfresco/adf-core": "3.6.0-1d7ef6209592e8703cdbaf48d4340d141fa461a5", "@alfresco/adf-extensions": "3.6.0-1d7ef6209592e8703cdbaf48d4340d141fa461a5", - "@alfresco/js-api": "3.6.0-e6e63bb456c4b5c98ee92b18e63e6e69f08b6557", + "@alfresco/js-api": "3.6.0-30c45018502e789b5f32210201829125b285bcce", "@angular/animations": "7.2.15", "@angular/cdk": "^7.3.7", "@angular/common": "7.2.15", diff --git a/src/app/components/layout/app-layout/app-layout.component.spec.ts b/src/app/components/layout/app-layout/app-layout.component.spec.ts index e44dd487e..bef3918cd 100644 --- a/src/app/components/layout/app-layout/app-layout.component.spec.ts +++ b/src/app/components/layout/app-layout/app-layout.component.spec.ts @@ -111,6 +111,7 @@ describe('AppLayoutComponent', () => { if (key === 'expandedSidenav') { return 'true'; } + return 'false'; }); fixture.detectChanges(); @@ -128,6 +129,7 @@ describe('AppLayoutComponent', () => { if (key === 'expandedSidenav') { return 'false'; } + return 'true'; }); fixture.detectChanges(); diff --git a/src/app/components/search/search-results/search-results.component.ts b/src/app/components/search/search-results/search-results.component.ts index d0674e5f9..889a6af8e 100644 --- a/src/app/components/search/search-results/search-results.component.ts +++ b/src/app/components/search/search-results/search-results.component.ts @@ -24,7 +24,11 @@ */ import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; -import { NodePaging, Pagination, MinimalNodeEntity } from '@alfresco/js-api'; +import { + Pagination, + MinimalNodeEntity, + ResultSetPaging +} from '@alfresco/js-api'; import { ActivatedRoute, Params, Router } from '@angular/router'; import { SearchQueryBuilderService, @@ -57,7 +61,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit { searchedWord: string; queryParamName = 'q'; - data: NodePaging; + data: ResultSetPaging; totalResults = 0; hasSelectedFilters = false; sorting = ['name', 'asc']; @@ -201,7 +205,7 @@ export class SearchResultsComponent extends PageComponent implements OnInit { return this.formatFields(fields, userInput); } - onSearchResultLoaded(nodePaging: NodePaging) { + onSearchResultLoaded(nodePaging: ResultSetPaging) { this.data = nodePaging; this.totalResults = this.getNumberOfResults(); this.hasSelectedFilters = this.isFiltered(); diff --git a/src/app/services/content-management.service.spec.ts b/src/app/services/content-management.service.spec.ts index 4572aba2b..cc30f14ed 100644 --- a/src/app/services/content-management.service.spec.ts +++ b/src/app/services/content-management.service.spec.ts @@ -982,6 +982,8 @@ describe('ContentManagementService', () => { if (id === '3') { return of(null); } + + return of(null); }); actions$.pipe( @@ -1047,6 +1049,8 @@ describe('ContentManagementService', () => { if (id === '3') { return throwError({}); } + + return of(null); }); const selection = [ @@ -1082,6 +1086,8 @@ describe('ContentManagementService', () => { if (id === '4') { return of({}); } + + return of(null); }); const selection = [ @@ -1139,6 +1145,8 @@ describe('ContentManagementService', () => { if (id === '2') { return of({}); } + + return of(null); }); const selection = [ @@ -1164,6 +1172,8 @@ describe('ContentManagementService', () => { if (id === '2') { return throwError({}); } + + return of({}); }); const selection = [ @@ -1295,6 +1305,8 @@ describe('ContentManagementService', () => { if (id === '3') { return throwError(error); } + + return of({}); }); const path = { @@ -1395,6 +1407,8 @@ describe('ContentManagementService', () => { if (id === '2') { return of({}); } + + return of({}); }); actions$.pipe( diff --git a/tsconfig.json b/tsconfig.json index a0b9424f8..4c0b0800e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "noUnusedLocals": true, + "noImplicitReturns": true, "target": "es5", "typeRoots": ["node_modules/@types"], "lib": ["es2018", "dom"],