mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
integrate Prettier with tslint (#1419)
* integrate prettier with tslint * remove obsolte scripts * update tsconfig * fix lint issues * fix lint errors * more rules and fixes * kebab case and lint fixes * update helpers * update util
This commit is contained in:
@@ -179,7 +179,7 @@ export class DataTable extends Component {
|
||||
getRowByName(name: string, location: string = ''): ElementFinder {
|
||||
if (location) {
|
||||
return this.body.all(by.cssContainingText(DataTable.selectors.row, name))
|
||||
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location))))
|
||||
.filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.cell, location))))
|
||||
.first();
|
||||
}
|
||||
return this.body.element(by.cssContainingText(DataTable.selectors.row, name));
|
||||
@@ -444,7 +444,7 @@ export class DataTable extends Component {
|
||||
getSearchResultsRowByName(name: string, location: string = ''): ElementFinder {
|
||||
if (location) {
|
||||
return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name))
|
||||
.filter(async (elem) => await browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
|
||||
.filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location))))
|
||||
.first();
|
||||
}
|
||||
return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name));
|
||||
|
@@ -27,6 +27,7 @@ import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import * as moment from 'moment';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class DateTimePicker extends Component {
|
||||
private static selectors = {
|
||||
@@ -63,7 +64,9 @@ export class DateTimePicker extends Component {
|
||||
}
|
||||
|
||||
async isCalendarOpen(): Promise<boolean> {
|
||||
return (await browser.element(this.rootElemLocator).isPresent()) && (await browser.element(this.rootElemLocator).isDisplayed());
|
||||
const element = browser.element(this.rootElemLocator);
|
||||
|
||||
return isPresentAndDisplayed(element);
|
||||
}
|
||||
|
||||
async getDate(): Promise<string> {
|
||||
|
@@ -26,7 +26,7 @@
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
import { Utils, isPresentAndDisplayed } from '../../utilities/utils';
|
||||
import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb';
|
||||
import { DataTable } from '../data-table/data-table';
|
||||
|
||||
@@ -108,11 +108,11 @@ export class ContentNodeSelectorDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isSearchInputPresent(): Promise<boolean> {
|
||||
return await this.searchInput.isPresent();
|
||||
return this.searchInput.isPresent();
|
||||
}
|
||||
|
||||
async isSelectLocationDropdownDisplayed(): Promise<boolean> {
|
||||
return (await this.locationDropDown.isPresent()) && (await this.locationDropDown.isDisplayed());
|
||||
return isPresentAndDisplayed(this.locationDropDown);
|
||||
}
|
||||
|
||||
async isCopyButtonEnabled(): Promise<boolean> {
|
||||
@@ -130,6 +130,6 @@ export class ContentNodeSelectorDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async getToolbarTitle(): Promise<string> {
|
||||
return await this.toolbarTitle.getText();
|
||||
return this.toolbarTitle.getText();
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
private static selectors = {
|
||||
@@ -55,7 +56,7 @@ export class CreateOrEditFolderDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isValidationMessageDisplayed(): Promise<boolean> {
|
||||
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed());
|
||||
return isPresentAndDisplayed(this.validationMessage);
|
||||
}
|
||||
|
||||
async isUpdateButtonEnabled(): Promise<boolean> {
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, protractor } from 'protractor';
|
||||
import { GenericDialog } from '../dialog/generic-dialog';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class CreateFromTemplateDialog extends GenericDialog {
|
||||
private static selectors = {
|
||||
@@ -49,7 +50,7 @@ export class CreateFromTemplateDialog extends GenericDialog {
|
||||
}
|
||||
|
||||
async isValidationMessageDisplayed(): Promise<boolean> {
|
||||
return (await this.validationMessage.isPresent()) && (await this.validationMessage.isDisplayed());
|
||||
return isPresentAndDisplayed(this.validationMessage);
|
||||
}
|
||||
|
||||
async isCreateButtonEnabled(): Promise<boolean> {
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils';
|
||||
|
||||
export abstract class GenericDialog {
|
||||
private static locators = {
|
||||
@@ -65,7 +66,7 @@ export abstract class GenericDialog {
|
||||
}
|
||||
|
||||
async isDialogOpen(): Promise<boolean> {
|
||||
return (await this.rootElem.isPresent()) && (await this.rootElem.isDisplayed());
|
||||
return isPresentAndDisplayed(this.rootElem);
|
||||
}
|
||||
|
||||
async getTitle(): Promise<string> {
|
||||
@@ -77,7 +78,7 @@ export abstract class GenericDialog {
|
||||
}
|
||||
|
||||
async isButtonEnabled(selector: Locator): Promise<boolean> {
|
||||
return (await this.getActionButton(selector).isPresent()) && (await this.getActionButton(selector).isEnabled());
|
||||
return isPresentAndEnabled(this.getActionButton(selector));
|
||||
}
|
||||
|
||||
async clickButton(selector: Locator): Promise<void> {
|
||||
|
@@ -26,6 +26,7 @@
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class ContentMetadata extends Component {
|
||||
private static selectors = {
|
||||
@@ -66,14 +67,14 @@ export class ContentMetadata extends Component {
|
||||
}
|
||||
|
||||
async getVisiblePropertiesLabels() {
|
||||
return await this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
|
||||
.filter(async (elem) => await elem.isDisplayed())
|
||||
.map(async (elem) => await elem.getText());
|
||||
return this.component.all(by.css(ContentMetadata.selectors.propertyLabel))
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => elem.getText());
|
||||
}
|
||||
|
||||
async getVisiblePropertiesValues() {
|
||||
return await this.component.all(by.css(ContentMetadata.selectors.propertyValue))
|
||||
.filter(async (elem) => await elem.isDisplayed())
|
||||
return this.component.all(by.css(ContentMetadata.selectors.propertyValue))
|
||||
.filter(async (elem) => elem.isDisplayed())
|
||||
.map(async (elem) => {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox'))) {
|
||||
if (await elem.isElementPresent(by.css('.mat-checkbox-checked'))) {
|
||||
@@ -81,27 +82,27 @@ export class ContentMetadata extends Component {
|
||||
}
|
||||
return false
|
||||
}
|
||||
return await elem.getText();
|
||||
return elem.getText();
|
||||
});
|
||||
}
|
||||
|
||||
async isEditPropertiesButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.editPropertiesButton)) && (await this.editPropertiesButton.isEnabled());
|
||||
async isEditPropertiesButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.editPropertiesButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.lessInfoButton)) && (await this.lessInfoButton.isEnabled());
|
||||
async isLessInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.lessInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonEnabled() {
|
||||
return (await browser.isElementPresent(this.moreInfoButton)) && (await this.moreInfoButton.isEnabled());
|
||||
async isMoreInfoButtonEnabled(): Promise<boolean> {
|
||||
return isPresentAndEnabled(this.moreInfoButton);
|
||||
}
|
||||
|
||||
async isLessInfoButtonDisplayed() {
|
||||
return browser.isElementPresent(this.lessInfoButton);
|
||||
}
|
||||
|
||||
async isMoreInfoButtonDisplayed() {
|
||||
async isMoreInfoButtonDisplayed(): Promise<boolean> {
|
||||
return browser.isElementPresent(this.moreInfoButton);
|
||||
}
|
||||
|
||||
@@ -113,8 +114,8 @@ export class ContentMetadata extends Component {
|
||||
await this.moreInfoButton.click();
|
||||
}
|
||||
|
||||
async isImagePropertiesPanelDisplayed() {
|
||||
return (await browser.isElementPresent(this.imagePropertiesPanel)) && (await this.imagePropertiesPanel.isDisplayed());
|
||||
async isImagePropertiesPanelDisplayed(): Promise<boolean> {
|
||||
return isPresentAndDisplayed(this.imagePropertiesPanel);
|
||||
}
|
||||
|
||||
async clickImagePropertiesPanel() {
|
||||
|
@@ -27,7 +27,7 @@ import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as E
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils'
|
||||
import { Utils, isPresentAndEnabled } from '../../utilities/utils'
|
||||
|
||||
export class Menu extends Component {
|
||||
private static selectors = {
|
||||
@@ -357,27 +357,27 @@ export class Menu extends Component {
|
||||
}
|
||||
|
||||
async isCreateFolderEnabled(): Promise<boolean> {
|
||||
return (await this.createFolderAction.isPresent()) && (await this.createFolderAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFolderAction);
|
||||
}
|
||||
|
||||
async isCreateLibraryEnabled(): Promise<boolean> {
|
||||
return (await this.createLibraryAction.isPresent()) && (await this.createLibraryAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createLibraryAction);
|
||||
}
|
||||
|
||||
async isUploadFileEnabled(): Promise<boolean> {
|
||||
return (await this.uploadFileAction.isPresent()) && (await this.uploadFileAction.isEnabled());
|
||||
return isPresentAndEnabled(this.uploadFileAction);
|
||||
}
|
||||
|
||||
async isUploadFolderEnabled(): Promise<boolean> {
|
||||
return (await this.uploadFolderAction.isPresent()) && (await this.uploadFolderAction.isEnabled());
|
||||
return isPresentAndEnabled(this.uploadFolderAction);
|
||||
}
|
||||
|
||||
async isCreateFileFromTemplateEnabled(): Promise<boolean> {
|
||||
return (await this.createFileFromTemplateAction.isPresent()) && (await this.createFileFromTemplateAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFileFromTemplateAction);
|
||||
}
|
||||
|
||||
async isCreateFolderFromTemplateEnabled(): Promise<boolean> {
|
||||
return (await this.createFolderFromTemplateAction.isPresent()) && (await this.createFolderFromTemplateAction.isEnabled());
|
||||
return isPresentAndEnabled(this.createFolderFromTemplateAction);
|
||||
}
|
||||
|
||||
async clickCreateFolder(): Promise<void> {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
import { ElementFinder, by, protractor } from 'protractor';
|
||||
import { GenericFilterPanel } from './generic-filter-panel';
|
||||
import { Utils } from '../../../utilities/utils';
|
||||
import { Utils, isPresentAndDisplayed } from '../../../utilities/utils';
|
||||
|
||||
export class CreatedDateFilter extends GenericFilterPanel {
|
||||
constructor() {
|
||||
@@ -42,27 +42,27 @@ export class CreatedDateFilter extends GenericFilterPanel {
|
||||
applyButton: ElementFinder = this.panel.element(by.css('.adf-facet-buttons [data-automation-id="date-range-apply-btn"]'));
|
||||
|
||||
async isFromFieldDisplayed(): Promise<boolean> {
|
||||
return (await this.fromField.isPresent()) && (await this.fromField.isDisplayed());
|
||||
return isPresentAndDisplayed(this.fromField);
|
||||
}
|
||||
|
||||
async isFromErrorDisplayed(): Promise<boolean> {
|
||||
return (await this.fromFieldError.isPresent()) && (await this.fromFieldError.isDisplayed());
|
||||
return isPresentAndDisplayed(this.fromFieldError);
|
||||
}
|
||||
|
||||
async isToFieldDisplayed(): Promise<boolean> {
|
||||
return (await this.toField.isPresent()) && (await this.toField.isDisplayed());
|
||||
return isPresentAndDisplayed(this.toField);
|
||||
}
|
||||
|
||||
async isToErrorDisplayed(): Promise<boolean> {
|
||||
return (await this.toFieldError.isPresent()) && (await this.toFieldError.isDisplayed());
|
||||
return isPresentAndDisplayed(this.toFieldError);
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async isApplyButtonEnabled(): Promise<boolean> {
|
||||
return await this.applyButton.isEnabled();
|
||||
return this.applyButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
|
@@ -66,11 +66,11 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isFilterFacetsDisplayed(): Promise<boolean> {
|
||||
return await this.facetsFilter.isDisplayed();
|
||||
return this.facetsFilter.isDisplayed();
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
@@ -80,7 +80,7 @@ export class FacetFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isFilterCategoryInputDisplayed(): Promise<boolean> {
|
||||
return await this.filterCategoryInput.isDisplayed();
|
||||
return this.filterCategoryInput.isDisplayed();
|
||||
}
|
||||
|
||||
async checkCategory(name: string): Promise<void> {
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser } from 'protractor';
|
||||
import { isPresentAndDisplayed } from '../../../utilities/utils';
|
||||
|
||||
export class GenericFilterPanel {
|
||||
private filterName: string;
|
||||
@@ -49,11 +50,11 @@ export class GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isPanelDisplayed(): Promise<boolean> {
|
||||
return (await browser.isElementPresent(this.panel)) && (await this.panel.isDisplayed());
|
||||
return isPresentAndDisplayed(this.panel);
|
||||
}
|
||||
|
||||
async isPanelExpanded(): Promise<boolean> {
|
||||
return (await this.panelExpanded.isPresent()) && (await this.panelExpanded.isDisplayed());
|
||||
return isPresentAndDisplayed(this.panelExpanded);
|
||||
}
|
||||
|
||||
async expandPanel(): Promise<void> {
|
||||
|
@@ -60,7 +60,7 @@ export class SizeFilter extends GenericFilterPanel {
|
||||
}
|
||||
|
||||
async isClearButtonEnabled(): Promise<boolean> {
|
||||
return await this.clearButton.isEnabled();
|
||||
return this.clearButton.isEnabled();
|
||||
}
|
||||
|
||||
async clickClearButton(): Promise<void> {
|
||||
|
@@ -28,6 +28,7 @@ import { Component } from '../component';
|
||||
import { SizeFilter } from './filters/size-filter';
|
||||
import { CreatedDateFilter } from './filters/created-date-filter';
|
||||
import { FacetFilter } from './filters/facet-filter';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class SearchFilters extends Component {
|
||||
private static selectors = {
|
||||
@@ -50,7 +51,7 @@ export class SearchFilters extends Component {
|
||||
}
|
||||
|
||||
async isSearchFiltersPanelDisplayed(): Promise<boolean> {
|
||||
return (await this.mainPanel.isPresent()) && (await this.mainPanel.isDisplayed());
|
||||
return isPresentAndDisplayed(this.mainPanel);
|
||||
}
|
||||
|
||||
async clickResetAllButton(): Promise<void> {
|
||||
|
@@ -63,7 +63,10 @@ export class SearchInput extends Component {
|
||||
}
|
||||
|
||||
async isSearchContainerDisplayed() {
|
||||
return (await this.searchContainer.isDisplayed()) && (await this.searchButton.isDisplayed());
|
||||
const isContainerDisplayed = await this.searchContainer.isDisplayed();
|
||||
const isSearchButtonDisplayed = await this.searchButton.isDisplayed();
|
||||
|
||||
return isContainerDisplayed && isSearchButtonDisplayed;
|
||||
}
|
||||
|
||||
async clickSearchButton() {
|
||||
|
@@ -26,6 +26,7 @@
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { isPresentAndDisplayed } from '../../utilities/utils';
|
||||
|
||||
export class SearchSortingPicker extends Component {
|
||||
private static selectors = {
|
||||
@@ -48,7 +49,7 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async isSortOrderButtonDisplayed(): Promise<boolean> {
|
||||
return (await this.sortOrderButton.isPresent()) && (await this.sortOrderButton.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortOrderButton);
|
||||
}
|
||||
|
||||
async getSortOrder(): Promise<'ASC' | 'DESC' | ''> {
|
||||
@@ -64,15 +65,15 @@ export class SearchSortingPicker extends Component {
|
||||
}
|
||||
|
||||
async isSortByOptionDisplayed(): Promise<boolean> {
|
||||
return (await this.sortByDropdownCollapsed.isPresent()) && (await this.sortByDropdownCollapsed.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortByDropdownCollapsed);
|
||||
}
|
||||
|
||||
async isSortByDropdownExpanded(): Promise<boolean> {
|
||||
return (await this.sortByDropdownExpanded.isPresent()) && (await this.sortByDropdownExpanded.isDisplayed());
|
||||
return isPresentAndDisplayed(this.sortByDropdownExpanded);
|
||||
}
|
||||
|
||||
async getSelectedSortByOption(): Promise<string> {
|
||||
return await this.sortByDropdownCollapsed.getText();
|
||||
return this.sortByDropdownCollapsed.getText();
|
||||
}
|
||||
|
||||
async clickSortByDropdown(): Promise<void> {
|
||||
|
@@ -79,7 +79,7 @@ export class Toolbar extends Component {
|
||||
|
||||
async getButtons(): Promise<string[]> {
|
||||
return this.buttons.map(async elem => {
|
||||
return await elem.getAttribute('title');
|
||||
return elem.getAttribute('title');
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -52,11 +52,11 @@ export class SearchResultsPage extends BrowsingPage {
|
||||
}
|
||||
|
||||
async getResultsHeader(): Promise<string> {
|
||||
return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
|
||||
return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
|
||||
}
|
||||
|
||||
async getResultsFoundText(): Promise<string> {
|
||||
return await this.infoText.getText();
|
||||
return this.infoText.getText();
|
||||
}
|
||||
|
||||
async getResultsChipsValues(): Promise<string[]> {
|
||||
|
@@ -109,7 +109,7 @@ describe('Search results - libraries', () => {
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await Promise.all(<any>[
|
||||
await Promise.all([
|
||||
apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminPrivate ]),
|
||||
apis.user.sites.deleteSites([ site1.id, site2.id, site3.id, site4.id, userSitePublic, userSiteModerated, userSitePrivate, siteRussian.id ])
|
||||
]);
|
||||
|
@@ -47,57 +47,57 @@ export class AdminActions {
|
||||
search: SearchApi = new SearchApi();
|
||||
|
||||
async getDataDictionaryId(): Promise<string> {
|
||||
return await this.adminApi.nodes.getNodeIdFromParent('Data Dictionary', '-root-');
|
||||
return this.adminApi.nodes.getNodeIdFromParent('Data Dictionary', '-root-');
|
||||
}
|
||||
|
||||
async getNodeTemplatesFolderId(): Promise<string> {
|
||||
return await this.adminApi.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId());
|
||||
return this.adminApi.nodes.getNodeIdFromParent('Node Templates', await this.getDataDictionaryId());
|
||||
}
|
||||
|
||||
async getSpaceTemplatesFolderId(): Promise<string> {
|
||||
return await this.adminApi.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId());
|
||||
return this.adminApi.nodes.getNodeIdFromParent('Space Templates', await this.getDataDictionaryId());
|
||||
}
|
||||
|
||||
async createUser(user: PersonModel): Promise<PersonEntry> {
|
||||
return await this.adminApi.people.createUser(user);
|
||||
return this.adminApi.people.createUser(user);
|
||||
}
|
||||
|
||||
async createNodeTemplate(name: string, title: string = '', description: string = '', author: string = ''): Promise<NodeEntry> {
|
||||
const templatesRootFolderId: string = await this.getNodeTemplatesFolderId();
|
||||
|
||||
return await this.adminApi.nodes.createFile(name, templatesRootFolderId, title, description, author);
|
||||
return this.adminApi.nodes.createFile(name, templatesRootFolderId, title, description, author);
|
||||
}
|
||||
|
||||
async createNodeTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> {
|
||||
return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`);
|
||||
return this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Node Templates`);
|
||||
}
|
||||
|
||||
async createSpaceTemplate(name: string, title: string = '', description: string = ''): Promise<NodeEntry> {
|
||||
const templatesRootFolderId: string = await this.getSpaceTemplatesFolderId();
|
||||
|
||||
return await this.adminApi.nodes.createFolder(name, templatesRootFolderId, title, description);
|
||||
return this.adminApi.nodes.createFolder(name, templatesRootFolderId, title, description);
|
||||
}
|
||||
|
||||
async createSpaceTemplatesHierarchy(hierarchy: NodeContentTree): Promise<any> {
|
||||
return await this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`);
|
||||
return this.adminApi.nodes.createContent(hierarchy, `Data Dictionary/Space Templates`);
|
||||
}
|
||||
|
||||
async removeUserAccessOnNodeTemplate(nodeName: string): Promise<NodeEntry> {
|
||||
const templatesRootFolderId = await this.getNodeTemplatesFolderId();
|
||||
const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId);
|
||||
|
||||
return await this.adminApi.nodes.setInheritPermissions(nodeId, false);
|
||||
return this.adminApi.nodes.setInheritPermissions(nodeId, false);
|
||||
}
|
||||
|
||||
async removeUserAccessOnSpaceTemplate(nodeName: string): Promise<NodeEntry> {
|
||||
const templatesRootFolderId = await this.getSpaceTemplatesFolderId();
|
||||
const nodeId: string = await this.adminApi.nodes.getNodeIdFromParent(nodeName, templatesRootFolderId);
|
||||
|
||||
return await this.adminApi.nodes.setInheritPermissions(nodeId, false);
|
||||
return this.adminApi.nodes.setInheritPermissions(nodeId, false);
|
||||
}
|
||||
|
||||
async cleanupNodeTemplatesFolder(): Promise<void> {
|
||||
return await this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId());
|
||||
return this.adminApi.nodes.deleteNodeChildren(await this.getNodeTemplatesFolderId());
|
||||
}
|
||||
|
||||
async cleanupSpaceTemplatesFolder(): Promise<void> {
|
||||
@@ -108,11 +108,11 @@ export class AdminActions {
|
||||
const nodesToDelete = (await this.adminApi.nodes.getNodeChildren(spaceTemplatesNodeId)).list.entries
|
||||
.filter(node => (node.entry.nodeType !== 'app:folderlink') && (node.entry.name !== 'Software Engineering Project'))
|
||||
.map(node => node.entry.id);
|
||||
return await this.adminApi.nodes.deleteNodesById(nodesToDelete);
|
||||
return this.adminApi.nodes.deleteNodesById(nodesToDelete);
|
||||
}
|
||||
|
||||
async createLinkToFileId(originalFileId: string, destinationParentId: string): Promise<NodeEntry> {
|
||||
return await this.adminApi.nodes.createFileLink(originalFileId, destinationParentId);
|
||||
return this.adminApi.nodes.createFileLink(originalFileId, destinationParentId);
|
||||
}
|
||||
|
||||
async createLinkToFileName(originalFileName: string, originalFileParentId: string, destinationParentId?: string): Promise<NodeEntry> {
|
||||
@@ -122,11 +122,11 @@ export class AdminActions {
|
||||
|
||||
const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFileName, originalFileParentId);
|
||||
|
||||
return await this.createLinkToFileId(nodeId, destinationParentId);
|
||||
return this.createLinkToFileId(nodeId, destinationParentId);
|
||||
}
|
||||
|
||||
async createLinkToFolderId(originalFolderId: string, destinationParentId: string): Promise<NodeEntry> {
|
||||
return await this.adminApi.nodes.createFolderLink(originalFolderId, destinationParentId);
|
||||
return this.adminApi.nodes.createFolderLink(originalFolderId, destinationParentId);
|
||||
}
|
||||
|
||||
async createLinkToFolderName(originalFolderName: string, originalFolderParentId: string, destinationParentId?: string): Promise<NodeEntry> {
|
||||
@@ -136,7 +136,7 @@ export class AdminActions {
|
||||
|
||||
const nodeId = await this.adminApi.nodes.getNodeIdFromParent(originalFolderName, originalFolderParentId);
|
||||
|
||||
return await this.createLinkToFolderId(nodeId, destinationParentId);
|
||||
return this.createLinkToFolderId(nodeId, destinationParentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -287,7 +287,7 @@ export class NodesApi extends RepoApi {
|
||||
async createChildren(data: NodeBodyCreate[]): Promise<NodeEntry|any> {
|
||||
try {
|
||||
await this.apiAuth();
|
||||
return await this.nodesApi.createNode('-my-', <any>data);
|
||||
return await this.nodesApi.createNode('-my-', data as any);
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.createChildren.name}`, error);
|
||||
}
|
||||
@@ -443,9 +443,9 @@ export class NodesApi extends RepoApi {
|
||||
|
||||
// lock node
|
||||
async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES'): Promise<NodeEntry|null> {
|
||||
const data = <NodeBodyLock>{
|
||||
const data = {
|
||||
type: lockType
|
||||
};
|
||||
} as NodeBodyLock;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
import { PersonModel, Person } from './people-api-models';
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { PeopleApi as AdfPeopleApi} from '@alfresco/js-api';
|
||||
import { PeopleApi as AdfPeopleApi } from '@alfresco/js-api';
|
||||
|
||||
export class PeopleApi extends RepoApi {
|
||||
peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
|
||||
|
@@ -53,7 +53,7 @@ export class SharedLinksApi extends RepoApi {
|
||||
try {
|
||||
return await ids.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return await this.shareFileById(current);
|
||||
return this.shareFileById(current);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.shareFilesByIds.name}`, error);
|
||||
|
@@ -97,12 +97,12 @@ export class SitesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise<SiteEntry|null> {
|
||||
const site = <SiteBody>{
|
||||
const site = {
|
||||
title,
|
||||
visibility: visibility || SITE_VISIBILITY.PUBLIC,
|
||||
description: description,
|
||||
id: siteId || title
|
||||
};
|
||||
} as SiteBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
@@ -125,7 +125,7 @@ export class SitesApi extends RepoApi {
|
||||
try {
|
||||
return titles.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return await this.createSite(current, visibility);
|
||||
return this.createSite(current, visibility);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.createSites.name}`, error);
|
||||
@@ -149,7 +149,7 @@ export class SitesApi extends RepoApi {
|
||||
try {
|
||||
return siteIds.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
return await this.deleteSite(current, permanent);
|
||||
return this.deleteSite(current, permanent);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.deleteSites.name}`, error);
|
||||
@@ -162,7 +162,7 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
return await siteIds.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
return await this.deleteSite(current, permanent);
|
||||
return this.deleteSite(current, permanent);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.deleteAllUserSites.name}`, error);
|
||||
@@ -170,9 +170,9 @@ export class SitesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async updateSiteMember(siteId: string, userId: string, role: string) {
|
||||
const siteRole = <SiteMemberRoleBody>{
|
||||
const siteRole = {
|
||||
role: role
|
||||
};
|
||||
} as SiteMemberRoleBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
@@ -184,10 +184,10 @@ export class SitesApi extends RepoApi {
|
||||
}
|
||||
|
||||
async addSiteMember(siteId: string, userId: string, role: string) {
|
||||
const memberBody = <SiteMemberBody>{
|
||||
const memberBody = {
|
||||
id: userId,
|
||||
role: role
|
||||
};
|
||||
} as SiteMemberBody;
|
||||
|
||||
try {
|
||||
await this.apiAuth();
|
||||
|
@@ -26,7 +26,7 @@
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { TrashcanApi as AdfTrashcanApi} from '@alfresco/js-api';
|
||||
import { TrashcanApi as AdfTrashcanApi } from '@alfresco/js-api';
|
||||
|
||||
export class TrashcanApi extends RepoApi {
|
||||
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
|
||||
@@ -73,7 +73,7 @@ export class TrashcanApi extends RepoApi {
|
||||
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
return await this.permanentlyDelete(current);
|
||||
return this.permanentlyDelete(current);
|
||||
}, Promise.resolve());
|
||||
} catch (error) {
|
||||
this.handleError(`${this.constructor.name} ${this.emptyTrash.name}`, error);
|
||||
|
@@ -31,6 +31,26 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const StreamZip = require('node-stream-zip');
|
||||
|
||||
export const isPresentAndEnabled = async (element: ElementFinder): Promise<boolean> => {
|
||||
const isPresent = await element.isPresent();
|
||||
|
||||
if (isPresent) {
|
||||
return element.isEnabled();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const isPresentAndDisplayed = async (element: ElementFinder): Promise<boolean> => {
|
||||
const isPresent = await element.isPresent();
|
||||
|
||||
if (isPresent) {
|
||||
return element.isDisplayed();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export class Utils {
|
||||
static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \
|
||||
reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation';
|
||||
@@ -56,7 +76,7 @@ export class Utils {
|
||||
}
|
||||
|
||||
static async getSessionStorage(): Promise<any> {
|
||||
return await browser.executeScript('return window.sessionStorage.getItem("app.extension.config");');
|
||||
return browser.executeScript('return window.sessionStorage.getItem("app.extension.config");');
|
||||
}
|
||||
|
||||
static async setSessionStorageFromConfig(configFileName: string): Promise<void> {
|
||||
|
Reference in New Issue
Block a user