mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
amend implicit returns
This commit is contained in:
parent
af67703371
commit
2c5fe7d3f4
@ -125,16 +125,13 @@ export class DataTable extends Component {
|
|||||||
return await this.getSortedColumnHeader().getText();
|
return await this.getSortedColumnHeader().getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSortingOrder() {
|
async getSortingOrder(): Promise<string> {
|
||||||
const str = await this.getSortedColumnHeader().getAttribute('class');
|
const str = await this.getSortedColumnHeader().getAttribute('class');
|
||||||
if (str.includes('asc')) {
|
if (str.includes('asc')) {
|
||||||
return 'asc';
|
return 'asc';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (str.includes('desc')) {
|
return 'desc';
|
||||||
return 'desc';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async sortByColumn(columnName: string) {
|
async sortByColumn(columnName: string) {
|
||||||
@ -328,32 +325,40 @@ export class DataTable extends Component {
|
|||||||
return await this.emptyFolderDragAndDrop.isDisplayed();
|
return await this.emptyFolderDragAndDrop.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptyDragAndDropText() {
|
async getEmptyDragAndDropText(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyWithDragAndDrop();
|
const isEmpty = await this.isEmptyWithDragAndDrop();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyFolderDragAndDrop.getText();
|
return await this.emptyFolderDragAndDrop.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptyStateTitle() {
|
async getEmptyStateTitle(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListTitle.getText();
|
return await this.emptyListTitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptyStateSubtitle() {
|
async getEmptyStateSubtitle(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListSubtitle.getText();
|
return await this.emptyListSubtitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptyStateText() {
|
async getEmptyStateText(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListText.getText();
|
return await this.emptyListText.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptySearchResultsText() {
|
async getEmptySearchResultsText() {
|
||||||
|
@ -92,10 +92,12 @@ export class InfoDrawer extends Component {
|
|||||||
return await this.getTabByTitle(title).isPresent();
|
return await this.getTabByTitle(title).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isTabDisplayed(title: string) {
|
async isTabDisplayed(title: string): Promise<boolean> {
|
||||||
if (await browser.isElementPresent(this.getTabByTitle(title))) {
|
if (await browser.isElementPresent(this.getTabByTitle(title))) {
|
||||||
return await this.getTabByTitle(title).isDisplayed();
|
return await this.getTabByTitle(title).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTabTitle(index: number) {
|
async getTabTitle(index: number) {
|
||||||
|
@ -76,7 +76,7 @@ export class LoginComponent extends Component {
|
|||||||
return await this.passwordVisibility.click();
|
return await this.passwordVisibility.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPasswordVisibility() {
|
async getPasswordVisibility(): Promise<boolean> {
|
||||||
const text = await this.passwordVisibility.getText();
|
const text = await this.passwordVisibility.getText();
|
||||||
if (text.endsWith('visibility_off')) {
|
if (text.endsWith('visibility_off')) {
|
||||||
return false;
|
return false;
|
||||||
@ -86,9 +86,11 @@ export class LoginComponent extends Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPasswordDisplayed() {
|
async isPasswordDisplayed(): Promise<boolean> {
|
||||||
const type = await this.passwordInput.getAttribute('type');
|
const type = await this.passwordInput.getAttribute('type');
|
||||||
if (type === 'text') {
|
if (type === 'text') {
|
||||||
return true;
|
return true;
|
||||||
@ -98,6 +100,8 @@ export class LoginComponent extends Component {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUsernameEnabled() {
|
async isUsernameEnabled() {
|
||||||
|
@ -167,7 +167,7 @@ export class Menu extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasSubMenu(menuItem: string) {
|
async hasSubMenu(menuItem: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const elem = this.getItemByLabel(menuItem);
|
const elem = this.getItemByLabel(menuItem);
|
||||||
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
|
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');
|
return elemClass.includes('mat-menu-item-submenu-trigger');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('---- has submenu error: ', error);
|
console.log('---- has submenu error: ', error);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,13 +201,14 @@ export class Menu extends Component {
|
|||||||
return await this.submenus.count();
|
return await this.submenus.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMenuItemDisabled(title: string) {
|
async isMenuItemDisabled(title: string): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
const item = this.getItemByLabel(title);
|
const item = this.getItemByLabel(title);
|
||||||
const disabled = await item.getAttribute('disabled');
|
const disabled = await item.getAttribute('disabled');
|
||||||
return disabled;
|
return disabled;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('----- isMenuItemDisabled catch: ', error);
|
console.log('----- isMenuItemDisabled catch: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +100,12 @@ export class Viewer extends Component {
|
|||||||
return await browser.isElementPresent(this.viewerExtensionContent);
|
return await browser.isElementPresent(this.viewerExtensionContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getComponentIdOfView() {
|
async getComponentIdOfView(): Promise<string|null> {
|
||||||
if (await this.isCustomContentPresent()) {
|
if (await this.isCustomContentPresent()) {
|
||||||
return await this.viewerExtensionContent.getAttribute('data-automation-id');
|
return await this.viewerExtensionContent.getAttribute('data-automation-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPdfViewerContentDisplayed() {
|
async isPdfViewerContentDisplayed() {
|
||||||
|
@ -119,10 +119,11 @@ export async function checkViewerToolbarMoreActions(item: string, expectedToolba
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removeClosePreviousNextOldInfo(actions: string[]) {
|
function removeClosePreviousNextOldInfo(actions: string[]): string[] {
|
||||||
return actions.filter(elem => {
|
return actions.filter(elem => {
|
||||||
if ( (elem !== 'Close') && (elem !== 'Previous File') && (elem !== 'Next File') && (elem !== 'View details')) {
|
if ( (elem !== 'Close') && (elem !== 'Previous File') && (elem !== 'Next File') && (elem !== 'View details')) {
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
});
|
return null
|
||||||
|
}).filter((action) => action != null);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
import { RepoApi } from '../repo-api';
|
import { RepoApi } from '../repo-api';
|
||||||
import { RepoClient } from './../../repo-client';
|
import { RepoClient } from './../../repo-client';
|
||||||
import { Utils } from '../../../../utilities/utils';
|
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 {
|
export class FavoritesApi extends RepoApi {
|
||||||
favoritesApi = new AdfFavoritesApi(this.alfrescoJsApi);
|
favoritesApi = new AdfFavoritesApi(this.alfrescoJsApi);
|
||||||
@ -48,7 +48,7 @@ export class FavoritesApi extends RepoApi {
|
|||||||
return await this.favoritesApi.createFavorite('-me-', data);
|
return await this.favoritesApi.createFavorite('-me-', data);
|
||||||
}
|
}
|
||||||
|
|
||||||
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string) {
|
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry|null> {
|
||||||
let guid;
|
let guid;
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
|
|
||||||
@ -68,6 +68,7 @@ export class FavoritesApi extends RepoApi {
|
|||||||
return await this.favoritesApi.createFavorite('-me-', data);
|
return await this.favoritesApi.createFavorite('-me-', data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('--- add favorite by id catch ');
|
console.log('--- add favorite by id catch ');
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
import { RepoApi } from '../repo-api';
|
import { RepoApi } from '../repo-api';
|
||||||
import { Utils } from '../../../../utilities/utils';
|
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 {
|
export class SharedLinksApi extends RepoApi {
|
||||||
sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi);
|
sharedlinksApi = new AdfSharedlinksApi(this.alfrescoJsApi);
|
||||||
@ -34,7 +34,7 @@ export class SharedLinksApi extends RepoApi {
|
|||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async shareFileById(id: string, expireDate?: Date) {
|
async shareFileById(id: string, expireDate?: Date): Promise<SharedLinkEntry|null> {
|
||||||
try {
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
const data = {
|
const data = {
|
||||||
@ -44,6 +44,7 @@ export class SharedLinksApi extends RepoApi {
|
|||||||
return await this.sharedlinksApi.createSharedLink(data);
|
return await this.sharedlinksApi.createSharedLink(data);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('---- shareFileById error: ', error);
|
console.log('---- shareFileById error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { RepoApi } from '../repo-api';
|
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 { SITE_VISIBILITY } from '../../../../configs';
|
||||||
import { Utils } from '../../../../utilities/utils';
|
import { Utils } from '../../../../utilities/utils';
|
||||||
import { SitesApi as AdfSiteApi } from '@alfresco/js-api';
|
import { SitesApi as AdfSiteApi } from '@alfresco/js-api';
|
||||||
@ -66,7 +66,7 @@ export class SitesApi extends RepoApi {
|
|||||||
return site.entry.title;
|
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<SiteEntry|null> {
|
||||||
const site = <SiteBody>{
|
const site = <SiteBody>{
|
||||||
title,
|
title,
|
||||||
visibility: visibility || SITE_VISIBILITY.PUBLIC,
|
visibility: visibility || SITE_VISIBILITY.PUBLIC,
|
||||||
@ -79,6 +79,7 @@ export class SitesApi extends RepoApi {
|
|||||||
return await this.sitesApi.createSite(site);
|
return await this.sitesApi.createSite(site);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('=== create 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);
|
return await this.sitesApi.deleteSiteMembership(siteId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async requestToJoin(siteId: string) {
|
async requestToJoin(siteId: string): Promise<SiteMembershipRequestEntry|null> {
|
||||||
const body = {
|
const body = {
|
||||||
id: siteId
|
id: siteId
|
||||||
};
|
};
|
||||||
@ -143,6 +144,7 @@ export class SitesApi extends RepoApi {
|
|||||||
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
|
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('====== requestToJoin catch ', error);
|
console.log('====== requestToJoin catch ', error);
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user