mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
- remove some awaits
- add try catch - small refactoring
This commit is contained in:
@@ -45,11 +45,11 @@ export class Breadcrumb extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getNthItemName(nth: number) {
|
async getNthItemName(nth: number) {
|
||||||
return await this.getNthItem(nth).getText();
|
return this.getNthItem(nth).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getItemsCount() {
|
async getItemsCount() {
|
||||||
return await this.items.count();
|
return this.items.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAllItems() {
|
async getAllItems() {
|
||||||
@@ -60,7 +60,7 @@ export class Breadcrumb extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getFirstItemName() {
|
async getFirstItemName() {
|
||||||
return await this.items.get(0).getText();
|
return this.items.get(0).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentItem() {
|
getCurrentItem() {
|
||||||
@@ -68,7 +68,7 @@ export class Breadcrumb extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentItemName() {
|
async getCurrentItemName() {
|
||||||
return await this.currentItem.getText();
|
return this.currentItem.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickItem(name: string) {
|
async clickItem(name: string) {
|
||||||
@@ -81,6 +81,6 @@ export class Breadcrumb extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getNthItemTooltip(nth: number) {
|
async getNthItemTooltip(nth: number) {
|
||||||
return await this.getNthItem(nth).getAttribute('title');
|
return this.getNthItem(nth).getAttribute('title');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -85,11 +85,11 @@ export class DataTable extends Component {
|
|||||||
|
|
||||||
// Wait methods (waits for elements)
|
// Wait methods (waits for elements)
|
||||||
async waitForHeader() {
|
async waitForHeader() {
|
||||||
return await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
|
await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---');
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForBody() {
|
async waitForBody() {
|
||||||
return await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
|
await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---');
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForEmptyState() {
|
async waitForEmptyState() {
|
||||||
@@ -104,7 +104,7 @@ export class DataTable extends Component {
|
|||||||
|
|
||||||
async getColumnHeadersText() {
|
async getColumnHeadersText() {
|
||||||
const el = this.getColumnHeaders();
|
const el = this.getColumnHeaders();
|
||||||
return await el.getText();
|
return el.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getNthColumnHeader(nth: number) {
|
getNthColumnHeader(nth: number) {
|
||||||
@@ -122,7 +122,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSortedColumnHeaderText() {
|
async getSortedColumnHeaderText() {
|
||||||
return await this.getSortedColumnHeader().getText();
|
return this.getSortedColumnHeader().getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSortingOrder(): Promise<string> {
|
async getSortingOrder(): Promise<string> {
|
||||||
@@ -151,7 +151,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async countRows() {
|
async countRows() {
|
||||||
return await this.getRows().count();
|
return this.getRows().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedRows() {
|
getSelectedRows() {
|
||||||
@@ -159,7 +159,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async countSelectedRows() {
|
async countSelectedRows() {
|
||||||
return await this.getSelectedRows().count();
|
return this.getSelectedRows().count();
|
||||||
}
|
}
|
||||||
|
|
||||||
getNthRow(nth: number) {
|
getNthRow(nth: number) {
|
||||||
@@ -180,7 +180,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getRowCellsCount(itemName: string) {
|
async getRowCellsCount(itemName: string) {
|
||||||
return await this.getRowCells(itemName).count();
|
return this.getRowCells(itemName).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
getRowFirstCell(name: string, location: string = '') {
|
getRowFirstCell(name: string, location: string = '') {
|
||||||
@@ -196,28 +196,28 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getItemNameTooltip(name: string, location: string = '') {
|
async getItemNameTooltip(name: string, location: string = '') {
|
||||||
return await this.getRowNameCellSpan(name, location).getAttribute('title');
|
return this.getRowNameCellSpan(name, location).getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasCheckMarkIcon(itemName: string, location: string = '') {
|
async hasCheckMarkIcon(itemName: string, location: string = '') {
|
||||||
const row = this.getRowByName(itemName, location);
|
const row = this.getRowByName(itemName, location);
|
||||||
return await row.element(by.css(DataTable.selectors.selectedIcon)).isPresent();
|
return row.element(by.css(DataTable.selectors.selectedIcon)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasLockIcon(itemName: string, location: string = '') {
|
async hasLockIcon(itemName: string, location: string = '') {
|
||||||
const row = this.getRowByName(itemName, location);
|
const row = this.getRowByName(itemName, location);
|
||||||
return await row.element(by.css(DataTable.selectors.lockIcon)).isPresent();
|
return row.element(by.css(DataTable.selectors.lockIcon)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async hasLockOwnerInfo(itemName: string, location: string = '') {
|
async hasLockOwnerInfo(itemName: string, location: string = '') {
|
||||||
const row = this.getRowByName(itemName, location);
|
const row = this.getRowByName(itemName, location);
|
||||||
return await row.element(by.css(DataTable.selectors.lockOwner)).isPresent();
|
return row.element(by.css(DataTable.selectors.lockOwner)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLockOwner(itemName: string, location: string = '') {
|
async getLockOwner(itemName: string, location: string = '') {
|
||||||
if (await this.hasLockOwnerInfo(itemName, location)) {
|
if (await this.hasLockOwnerInfo(itemName, location)) {
|
||||||
const row = this.getRowByName(itemName, location);
|
const row = this.getRowByName(itemName, location);
|
||||||
return await row.$(DataTable.selectors.lockOwner).$('.locked_by--name').getText();
|
return row.$(DataTable.selectors.lockOwner).$('.locked_by--name').getText();
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async hasLinkOnName(itemName: string) {
|
async hasLinkOnName(itemName: string) {
|
||||||
return await this.getNameLink(itemName).isPresent();
|
return this.getNameLink(itemName).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Navigation/selection methods
|
// Navigation/selection methods
|
||||||
@@ -303,7 +303,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getItemLocation(name: string) {
|
async getItemLocation(name: string) {
|
||||||
return await this.getItemLocationEl(name).getText();
|
return this.getItemLocationEl(name).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getItemLocationTooltip(name: string) {
|
async getItemLocationTooltip(name: string) {
|
||||||
@@ -313,7 +313,7 @@ export class DataTable extends Component {
|
|||||||
await browser.actions().mouseMove(location).perform();
|
await browser.actions().mouseMove(location).perform();
|
||||||
|
|
||||||
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||||
return await location.getAttribute('title');
|
return location.getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickItemLocation(name: string) {
|
async clickItemLocation(name: string) {
|
||||||
@@ -322,17 +322,17 @@ export class DataTable extends Component {
|
|||||||
|
|
||||||
// empty state methods
|
// empty state methods
|
||||||
async isEmptyList() {
|
async isEmptyList() {
|
||||||
return await this.emptyList.isPresent();
|
return this.emptyList.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEmptyWithDragAndDrop() {
|
async isEmptyWithDragAndDrop() {
|
||||||
return await this.emptyFolderDragAndDrop.isDisplayed();
|
return this.emptyFolderDragAndDrop.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptyDragAndDropText(): Promise<string> {
|
async getEmptyDragAndDropText(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyWithDragAndDrop();
|
const isEmpty = await this.isEmptyWithDragAndDrop();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyFolderDragAndDrop.getText();
|
return this.emptyFolderDragAndDrop.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@@ -341,7 +341,7 @@ export class DataTable extends Component {
|
|||||||
async getEmptyStateTitle(): Promise<string> {
|
async getEmptyStateTitle(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListTitle.getText();
|
return this.emptyListTitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@@ -350,7 +350,7 @@ export class DataTable extends Component {
|
|||||||
async getEmptyStateSubtitle(): Promise<string> {
|
async getEmptyStateSubtitle(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListSubtitle.getText();
|
return this.emptyListSubtitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
@@ -359,14 +359,14 @@ export class DataTable extends Component {
|
|||||||
async getEmptyStateText(): Promise<string> {
|
async getEmptyStateText(): Promise<string> {
|
||||||
const isEmpty = await this.isEmptyList();
|
const isEmpty = await this.isEmptyList();
|
||||||
if (isEmpty) {
|
if (isEmpty) {
|
||||||
return await this.emptyListText.getText();
|
return this.emptyListText.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmptySearchResultsText() {
|
async getEmptySearchResultsText() {
|
||||||
return await this.emptySearchText.getText();
|
return this.emptySearchText.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCellsContainingName(name: string) {
|
async getCellsContainingName(name: string) {
|
||||||
@@ -380,11 +380,11 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getLibraryRole(name: string) {
|
async getLibraryRole(name: string) {
|
||||||
return await this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText();
|
return this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isItemPresent(name: string, location? : string) {
|
async isItemPresent(name: string, location? : string) {
|
||||||
return await this.getRowByName(name, location).isPresent();
|
return this.getRowByName(name, location).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEntireDataTableText() {
|
async getEntireDataTableText() {
|
||||||
@@ -423,7 +423,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSearchResultLinesCount(name: string, location: string = '') {
|
async getSearchResultLinesCount(name: string, location: string = '') {
|
||||||
return await this.getSearchResultRowLines(name, location).count();
|
return this.getSearchResultRowLines(name, location).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
getSearchResultNthLine(name: string, location: string = '', index: number) {
|
getSearchResultNthLine(name: string, location: string = '', index: number) {
|
||||||
@@ -431,19 +431,19 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getSearchResultNameAndTitle(name: string, location: string = '') {
|
async getSearchResultNameAndTitle(name: string, location: string = '') {
|
||||||
return await this.getSearchResultNthLine(name, location, 0).getText();
|
return this.getSearchResultNthLine(name, location, 0).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSearchResultDescription(name: string, location: string = '') {
|
async getSearchResultDescription(name: string, location: string = '') {
|
||||||
return await this.getSearchResultNthLine(name, location, 1).getText();
|
return this.getSearchResultNthLine(name, location, 1).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSearchResultModified(name: string, location: string = '') {
|
async getSearchResultModified(name: string, location: string = '') {
|
||||||
return await this.getSearchResultNthLine(name, location, 2).getText();
|
return this.getSearchResultNthLine(name, location, 2).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSearchResultLocation(name: string, location: string = '') {
|
async getSearchResultLocation(name: string, location: string = '') {
|
||||||
return await this.getSearchResultNthLine(name, location, 3).getText();
|
return this.getSearchResultNthLine(name, location, 3).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getSearchResultNameLink(itemName: string, location: string = '') {
|
getSearchResultNameLink(itemName: string, location: string = '') {
|
||||||
@@ -451,7 +451,7 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async hasLinkOnSearchResultName(itemName: string, location: string = '') {
|
async hasLinkOnSearchResultName(itemName: string, location: string = '') {
|
||||||
return await this.getSearchResultNameLink(itemName, location).isPresent();
|
return this.getSearchResultNameLink(itemName, location).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickSearchResultNameLink(itemName: string, location: string = '') {
|
async clickSearchResultNameLink(itemName: string, location: string = '') {
|
||||||
|
@@ -61,15 +61,15 @@ export class DateTimePicker extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isCalendarOpen() {
|
async isCalendarOpen() {
|
||||||
return await browser.isElementPresent(by.css(DateTimePicker.selectors.root));
|
return browser.isElementPresent(by.css(DateTimePicker.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDate() {
|
async getDate() {
|
||||||
return await this.headerDate.getText();
|
return this.headerDate.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getYear() {
|
async getYear() {
|
||||||
return await this.headerYear.getText();
|
return this.headerYear.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async setDefaultDay() {
|
async setDefaultDay() {
|
||||||
|
@@ -57,15 +57,15 @@ export class ConfirmDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
|
return browser.isElementPresent(by.css(ConfirmDialog.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getText() {
|
async getText() {
|
||||||
return await this.content.getText();
|
return this.content.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonByName(name: string) {
|
getButtonByName(name: string) {
|
||||||
@@ -79,49 +79,49 @@ export class ConfirmDialog extends Component {
|
|||||||
|
|
||||||
async isButtonEnabled(name: string) {
|
async isButtonEnabled(name: string) {
|
||||||
const button = this.getButtonByName(name);
|
const button = this.getButtonByName(name);
|
||||||
return await button.isEnabled();
|
return button.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isOkEnabled() {
|
async isOkEnabled() {
|
||||||
return await this.isButtonEnabled('OK');
|
return this.isButtonEnabled('OK');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelEnabled() {
|
async isCancelEnabled() {
|
||||||
return await this.isButtonEnabled('Cancel');
|
return this.isButtonEnabled('Cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isKeepEnabled() {
|
async isKeepEnabled() {
|
||||||
return await this.isButtonEnabled('Keep');
|
return this.isButtonEnabled('Keep');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDeleteEnabled() {
|
async isDeleteEnabled() {
|
||||||
return await this.isButtonEnabled('Delete');
|
return this.isButtonEnabled('Delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isRemoveEnabled() {
|
async isRemoveEnabled() {
|
||||||
return await this.isButtonEnabled('Remove');
|
return this.isButtonEnabled('Remove');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async clickOk() {
|
async clickOk() {
|
||||||
return await this.clickButton('OK');
|
await this.clickButton('OK');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCancel() {
|
async clickCancel() {
|
||||||
return await this.cancelButton.click();
|
await this.cancelButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickKeep() {
|
async clickKeep() {
|
||||||
return await this.clickButton('Keep');
|
await this.clickButton('Keep');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickDelete() {
|
async clickDelete() {
|
||||||
return await this.clickButton('Delete');
|
await this.clickButton('Delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickRemove() {
|
async clickRemove() {
|
||||||
return await this.clickButton('Remove');
|
await this.clickButton('Remove');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -78,11 +78,11 @@ export class CopyMoveDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.$(CopyMoveDialog.selectors.root).isDisplayed();
|
return browser.$(CopyMoveDialog.selectors.root).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCancel() {
|
async clickCancel() {
|
||||||
|
@@ -61,15 +61,15 @@ export class CreateOrEditFolderDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(by.css(CreateOrEditFolderDialog.selectors.root));
|
return browser.isElementPresent(by.css(CreateOrEditFolderDialog.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isValidationMessageDisplayed() {
|
async isValidationMessageDisplayed() {
|
||||||
return await this.validationMessage.isDisplayed();
|
return this.validationMessage.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUpdateButtonEnabled() {
|
async isUpdateButtonEnabled() {
|
||||||
@@ -85,24 +85,24 @@ export class CreateOrEditFolderDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isNameDisplayed() {
|
async isNameDisplayed() {
|
||||||
return await this.nameInput.isDisplayed();
|
return this.nameInput.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDescriptionDisplayed() {
|
async isDescriptionDisplayed() {
|
||||||
return await this.descriptionTextArea.isDisplayed();
|
return this.descriptionTextArea.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getValidationMessage() {
|
async getValidationMessage() {
|
||||||
await this.isValidationMessageDisplayed();
|
await this.isValidationMessageDisplayed();
|
||||||
return await this.validationMessage.getText();
|
return this.validationMessage.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getName() {
|
async getName() {
|
||||||
return await this.nameInput.getAttribute('value');
|
return this.nameInput.getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDescription() {
|
async getDescription() {
|
||||||
return await this.descriptionTextArea.getAttribute('value');
|
return this.descriptionTextArea.getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterName(name: string) {
|
async enterName(name: string) {
|
||||||
|
@@ -67,44 +67,44 @@ export class CreateLibraryDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(by.css(CreateLibraryDialog.selectors.root));
|
return browser.isElementPresent(by.css(CreateLibraryDialog.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isErrorMessageDisplayed() {
|
async isErrorMessageDisplayed() {
|
||||||
return await this.errorMessage.isDisplayed();
|
return this.errorMessage.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getErrorMessage() {
|
async getErrorMessage() {
|
||||||
await this.isErrorMessageDisplayed();
|
await this.isErrorMessageDisplayed();
|
||||||
return await this.errorMessage.getText();
|
return this.errorMessage.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isNameDisplayed() {
|
async isNameDisplayed() {
|
||||||
return await this.nameInput.isDisplayed();
|
return this.nameInput.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isLibraryIdDisplayed() {
|
async isLibraryIdDisplayed() {
|
||||||
return await this.libraryIdInput.isDisplayed();
|
return this.libraryIdInput.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDescriptionDisplayed() {
|
async isDescriptionDisplayed() {
|
||||||
return await this.descriptionTextArea.isDisplayed();
|
return this.descriptionTextArea.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPublicDisplayed() {
|
async isPublicDisplayed() {
|
||||||
return await this.visibilityPublic.isDisplayed();
|
return this.visibilityPublic.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isModeratedDisplayed() {
|
async isModeratedDisplayed() {
|
||||||
return await this.visibilityModerated.isDisplayed();
|
return this.visibilityModerated.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPrivateDisplayed() {
|
async isPrivateDisplayed() {
|
||||||
return await this.visibilityPrivate.isDisplayed();
|
return this.visibilityPrivate.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterName(name: string) {
|
async enterName(name: string) {
|
||||||
@@ -128,11 +128,11 @@ export class CreateLibraryDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isCreateEnabled() {
|
async isCreateEnabled() {
|
||||||
return await this.createButton.isEnabled();
|
return this.createButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelEnabled() {
|
async isCancelEnabled() {
|
||||||
return await this.cancelButton.isEnabled();
|
return this.cancelButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCreate() {
|
async clickCreate() {
|
||||||
@@ -146,17 +146,17 @@ export class CreateLibraryDialog extends Component {
|
|||||||
|
|
||||||
async isPublicChecked() {
|
async isPublicChecked() {
|
||||||
const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class');
|
const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class');
|
||||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isModeratedChecked() {
|
async isModeratedChecked() {
|
||||||
const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class');
|
const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class');
|
||||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPrivateChecked() {
|
async isPrivateChecked() {
|
||||||
const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class');
|
const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class');
|
||||||
return await elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
return elemClass.includes(CreateLibraryDialog.selectors.radioChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
async selectPublic() {
|
async selectPublic() {
|
||||||
|
@@ -45,19 +45,19 @@ export class ManageVersionsDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForDialogToClose() {
|
async waitForDialogToClose() {
|
||||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.$(ManageVersionsDialog.selectors.root).isDisplayed();
|
return browser.$(ManageVersionsDialog.selectors.root).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getText() {
|
async getText() {
|
||||||
return await this.content.getText();
|
return this.content.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickClose() {
|
async clickClose() {
|
||||||
|
@@ -58,33 +58,33 @@ export class PasswordDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(by.css(PasswordDialog.selectors.root));
|
return browser.isElementPresent(by.css(PasswordDialog.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCloseEnabled() {
|
async isCloseEnabled() {
|
||||||
return await this.closeButton.isEnabled();
|
return this.closeButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSubmitEnabled() {
|
async isSubmitEnabled() {
|
||||||
return await this.submitButton.isEnabled();
|
return this.submitButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickClose() {
|
async clickClose() {
|
||||||
return await this.closeButton.click();
|
await this.closeButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickSubmit() {
|
async clickSubmit() {
|
||||||
return await this.submitButton.click();
|
await this.submitButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPasswordInputDisplayed() {
|
async isPasswordInputDisplayed() {
|
||||||
const present = await browser.isElementPresent(this.passwordInput);
|
const present = await browser.isElementPresent(this.passwordInput);
|
||||||
if (present) {
|
if (present) {
|
||||||
return await this.passwordInput.isDisplayed();
|
return this.passwordInput.isDisplayed();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -92,12 +92,12 @@ export class PasswordDialog extends Component {
|
|||||||
|
|
||||||
async isErrorDisplayed() {
|
async isErrorDisplayed() {
|
||||||
const elem = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.errorMessage)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for error message to appear')
|
const elem = await browser.wait(until.elementLocated(by.css(PasswordDialog.selectors.errorMessage)), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for error message to appear')
|
||||||
return await browser.isElementPresent(elem);
|
return browser.isElementPresent(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getErrorMessage() {
|
async getErrorMessage() {
|
||||||
if (await this.isErrorDisplayed()) {
|
if (await this.isErrorDisplayed()) {
|
||||||
return await this.errorMessage.getText();
|
return this.errorMessage.getText();
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@@ -71,15 +71,15 @@ export class ShareDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(by.css(ShareDialog.selectors.root));
|
return browser.isElementPresent(by.css(ShareDialog.selectors.root));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getInfoText() {
|
async getInfoText() {
|
||||||
return await this.infoText.getText();
|
return this.infoText.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
getLabels() {
|
getLabels() {
|
||||||
@@ -87,15 +87,15 @@ export class ShareDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getLinkUrl() {
|
async getLinkUrl() {
|
||||||
return await this.url.getAttribute('value');
|
return this.url.getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUrlReadOnly() {
|
async isUrlReadOnly() {
|
||||||
return await this.url.getAttribute('readonly');
|
return this.url.getAttribute('readonly');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCloseEnabled() {
|
async isCloseEnabled() {
|
||||||
return await this.closeButton.isEnabled();
|
return this.closeButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickClose() {
|
async clickClose() {
|
||||||
@@ -131,21 +131,21 @@ export class ShareDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async copyUrl() {
|
async copyUrl() {
|
||||||
return await this.urlAction.click();
|
await this.urlAction.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async openDatetimePicker() {
|
async openDatetimePicker() {
|
||||||
return await this.datetimePickerButton.click();
|
await this.datetimePickerButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async closeDatetimePicker() {
|
async closeDatetimePicker() {
|
||||||
if (await this.dateTimePicker.isCalendarOpen()) {
|
if (await this.dateTimePicker.isCalendarOpen()) {
|
||||||
return await this.datetimePickerButton.click();
|
await this.datetimePickerButton.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getExpireDate() {
|
async getExpireDate() {
|
||||||
return await this.getExpireInput().getAttribute('value');
|
return this.getExpireInput().getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickExpirationToggle() {
|
async clickExpirationToggle() {
|
||||||
|
@@ -56,32 +56,32 @@ export class UploadNewVersionDialog extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForDialogToClose() {
|
async waitForDialogToClose() {
|
||||||
return await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.stalenessOf(this.title), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.$(UploadNewVersionDialog.selectors.root).isDisplayed();
|
return browser.$(UploadNewVersionDialog.selectors.root).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await this.title.getText();
|
return this.title.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getText() {
|
async getText() {
|
||||||
return await this.content.getText();
|
return this.content.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isDescriptionDisplayed() {
|
async isDescriptionDisplayed() {
|
||||||
return await this.description.isDisplayed();
|
return this.description.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMinorOptionDisplayed() {
|
async isMinorOptionDisplayed() {
|
||||||
return await this.minorOption.isDisplayed();
|
return this.minorOption.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMajorOptionDisplayed() {
|
async isMajorOptionDisplayed() {
|
||||||
return await this.majorOption.isDisplayed();
|
return this.majorOption.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelButtonEnabled() {
|
async isCancelButtonEnabled() {
|
||||||
@@ -105,11 +105,11 @@ export class UploadNewVersionDialog extends Component {
|
|||||||
|
|
||||||
|
|
||||||
async clickMajor() {
|
async clickMajor() {
|
||||||
return await this.majorOption.click();
|
await this.majorOption.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMinor() {
|
async clickMinor() {
|
||||||
return await this.minorOption.click();
|
await this.minorOption.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -62,19 +62,19 @@ export class Header extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isSignOutDisplayed() {
|
async isSignOutDisplayed() {
|
||||||
return await this.userInfo.menu.isMenuItemPresent('Sign out');
|
return this.userInfo.menu.isMenuItemPresent('Sign out');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickSidenavToggle() {
|
async clickSidenavToggle() {
|
||||||
await this.sidenavToggle.click();
|
await this.sidenavToggle.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isExpandedSidenav() {
|
async isSidenavExpanded() {
|
||||||
return await browser.isElementPresent(Header.selectors.expandedSidenav);
|
return browser.isElementPresent(Header.selectors.expandedSidenav);
|
||||||
}
|
}
|
||||||
|
|
||||||
async expandSideNav() {
|
async expandSideNav() {
|
||||||
const expanded = await this.isExpandedSidenav();
|
const expanded = await this.isSidenavExpanded();
|
||||||
if ( !expanded ) {
|
if ( !expanded ) {
|
||||||
await this.clickSidenavToggle();
|
await this.clickSidenavToggle();
|
||||||
await browser.wait(until.elementLocated(Header.selectors.expandedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for expanded sidenav' );
|
await browser.wait(until.elementLocated(Header.selectors.expandedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for expanded sidenav' );
|
||||||
@@ -82,7 +82,7 @@ export class Header extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async collapseSideNav() {
|
async collapseSideNav() {
|
||||||
const expanded = await this.isExpandedSidenav();
|
const expanded = await this.isSidenavExpanded();
|
||||||
if ( expanded ) {
|
if ( expanded ) {
|
||||||
await this.clickSidenavToggle();
|
await this.clickSidenavToggle();
|
||||||
await browser.wait(until.elementLocated(Header.selectors.collapsedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for collapsed sidenav')
|
await browser.wait(until.elementLocated(Header.selectors.collapsedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for collapsed sidenav')
|
||||||
|
@@ -67,73 +67,73 @@ export class CommentsTab extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getCommentsTabHeaderText() {
|
async getCommentsTabHeaderText() {
|
||||||
return await this.commentsHeader.getText();
|
return this.commentsHeader.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCommentTextAreaDisplayed() {
|
async isCommentTextAreaDisplayed() {
|
||||||
return await browser.isElementPresent(this.commentTextarea);
|
return browser.isElementPresent(this.commentTextarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isAddCommentButtonEnabled() {
|
async isAddCommentButtonEnabled() {
|
||||||
const present = await browser.isElementPresent(this.addCommentButton);
|
const present = await browser.isElementPresent(this.addCommentButton);
|
||||||
if (present) {
|
if (present) {
|
||||||
return await this.addCommentButton.isEnabled();
|
return this.addCommentButton.isEnabled();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentListItem() {
|
async getCommentListItem() {
|
||||||
return await browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2);
|
return browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentById(commentId?: string) {
|
async getCommentById(commentId?: string) {
|
||||||
if (commentId) {
|
if (commentId) {
|
||||||
return await browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
|
return browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2);
|
||||||
}
|
}
|
||||||
return await this.getCommentListItem();
|
return this.getCommentListItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCommentDisplayed(commentId?: string) {
|
async isCommentDisplayed(commentId?: string) {
|
||||||
return await browser.isElementPresent(await this.getCommentById(commentId));
|
return browser.isElementPresent(await this.getCommentById(commentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCommentUserAvatarDisplayed(commentId?: string) {
|
async isCommentUserAvatarDisplayed(commentId?: string) {
|
||||||
const commentElement = await this.getCommentById(commentId);
|
const commentElement = await this.getCommentById(commentId);
|
||||||
return await browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
|
return browser.isElementPresent(commentElement.findElement(this.commentUserAvatar));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentText(commentId?: string) {
|
async getCommentText(commentId?: string) {
|
||||||
const commentElement = await this.getCommentById(commentId);
|
const commentElement = await this.getCommentById(commentId);
|
||||||
const message = await commentElement.findElement(this.commentText);
|
const message = await commentElement.findElement(this.commentText);
|
||||||
return await message.getText();
|
return message.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentUserName(commentId?: string) {
|
async getCommentUserName(commentId?: string) {
|
||||||
const commentElement = await this.getCommentById(commentId);
|
const commentElement = await this.getCommentById(commentId);
|
||||||
const user = await commentElement.findElement(this.commentUser);
|
const user = await commentElement.findElement(this.commentUser);
|
||||||
return await user.getText();
|
return user.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentTime(commentId?: string) {
|
async getCommentTime(commentId?: string) {
|
||||||
const commentElement = await this.getCommentById(commentId);
|
const commentElement = await this.getCommentById(commentId);
|
||||||
const time = await commentElement.findElement(this.commentTime);
|
const time = await commentElement.findElement(this.commentTime);
|
||||||
return await time.getText();
|
return time.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNthCommentId(index: number) {
|
async getNthCommentId(index: number) {
|
||||||
return await this.commentsList.get(index - 1).getAttribute('id');
|
return this.commentsList.get(index - 1).getAttribute('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
async typeComment(text: string) {
|
async typeComment(text: string) {
|
||||||
return await this.commentTextarea.sendKeys(text);
|
await this.commentTextarea.sendKeys(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickAddButton() {
|
async clickAddButton() {
|
||||||
return await this.addCommentButton.click();
|
await this.addCommentButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCommentTextFromTextArea() {
|
async getCommentTextFromTextArea() {
|
||||||
return await this.commentTextarea.getAttribute('value');
|
return this.commentTextarea.getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -58,11 +58,11 @@ export class ContentMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isPropertiesListExpanded() {
|
async isPropertiesListExpanded() {
|
||||||
return await browser.isElementPresent(this.expandedPanel);
|
return browser.isElementPresent(this.expandedPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForImagePropertiesPanelToExpand() {
|
async waitForImagePropertiesPanelToExpand() {
|
||||||
return await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getVisiblePropertiesLabels() {
|
async getVisiblePropertiesLabels() {
|
||||||
@@ -98,19 +98,19 @@ export class ContentMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isLessInfoButtonDisplayed() {
|
async isLessInfoButtonDisplayed() {
|
||||||
return await browser.isElementPresent(this.lessInfoButton);
|
return browser.isElementPresent(this.lessInfoButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMoreInfoButtonDisplayed() {
|
async isMoreInfoButtonDisplayed() {
|
||||||
return await browser.isElementPresent(this.moreInfoButton);
|
return browser.isElementPresent(this.moreInfoButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickLessInformationButton() {
|
async clickLessInformationButton() {
|
||||||
return await this.lessInfoButton.click();
|
await this.lessInfoButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreInformationButton() {
|
async clickMoreInformationButton() {
|
||||||
return await this.moreInfoButton.click();
|
await this.moreInfoButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isImagePropertiesPanelDisplayed() {
|
async isImagePropertiesPanelDisplayed() {
|
||||||
@@ -118,7 +118,7 @@ export class ContentMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickImagePropertiesPanel() {
|
async clickImagePropertiesPanel() {
|
||||||
return await this.imagePropertiesPanel.click();
|
await this.imagePropertiesPanel.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ export class LibraryMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isFieldDisplayed(fieldName: string) {
|
async isFieldDisplayed(fieldName: string) {
|
||||||
return await browser.isElementPresent(this.getFieldByName(fieldName));
|
return browser.isElementPresent(this.getFieldByName(fieldName));
|
||||||
}
|
}
|
||||||
|
|
||||||
async isInputEnabled(fieldName: string) {
|
async isInputEnabled(fieldName: string) {
|
||||||
@@ -80,13 +80,13 @@ export class LibraryMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getValueOfField(fieldName: string) {
|
async getValueOfField(fieldName: string) {
|
||||||
return await this.getFieldByName(fieldName).getText();
|
return this.getFieldByName(fieldName).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterTextInInput(fieldName: string, text: string) {
|
async enterTextInInput(fieldName: string, text: string) {
|
||||||
const input = this.getFieldByName(fieldName);
|
const input = this.getFieldByName(fieldName);
|
||||||
await input.clear();
|
await input.clear();
|
||||||
return await input.sendKeys(text);
|
await input.sendKeys(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,11 +99,11 @@ export class LibraryMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isButtonEnabled(button: string) {
|
async isButtonEnabled(button: string) {
|
||||||
return await this.getButton(button).isEnabled();
|
return this.getButton(button).isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickButton(button: string) {
|
async clickButton(button: string) {
|
||||||
return await this.getButton(button).click();
|
await this.getButton(button).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForVisibilityDropDownToOpen() {
|
async waitForVisibilityDropDownToOpen() {
|
||||||
@@ -115,68 +115,68 @@ export class LibraryMetadata extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isMessageDisplayed() {
|
async isMessageDisplayed() {
|
||||||
return await browser.isElementPresent(this.hint);
|
return browser.isElementPresent(this.hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMessage() {
|
async getMessage() {
|
||||||
return await this.hint.getText();
|
return this.hint.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isErrorDisplayed() {
|
async isErrorDisplayed() {
|
||||||
return await browser.isElementPresent(this.error);
|
return browser.isElementPresent(this.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getError() {
|
async getError() {
|
||||||
return await this.error.getText();
|
return this.error.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isNameDisplayed() {
|
async isNameDisplayed() {
|
||||||
return await this.isFieldDisplayed('Name');
|
return this.isFieldDisplayed('Name');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isNameEnabled() {
|
async isNameEnabled() {
|
||||||
return await this.isInputEnabled('Name');
|
return this.isInputEnabled('Name');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getName() {
|
async getName() {
|
||||||
return await this.getValueOfField('Name');
|
return this.getValueOfField('Name');
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterName(name: string) {
|
async enterName(name: string) {
|
||||||
return await this.enterTextInInput('Name', name);
|
await this.enterTextInInput('Name', name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isDescriptionDisplayed() {
|
async isDescriptionDisplayed() {
|
||||||
return await this.isFieldDisplayed('Description');
|
return this.isFieldDisplayed('Description');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDescriptionEnabled() {
|
async isDescriptionEnabled() {
|
||||||
return await this.isInputEnabled('Description');
|
return this.isInputEnabled('Description');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getDescription() {
|
async getDescription() {
|
||||||
return await this.getValueOfField('Description');
|
return this.getValueOfField('Description');
|
||||||
}
|
}
|
||||||
|
|
||||||
async enterDescription(desc: string) {
|
async enterDescription(desc: string) {
|
||||||
return await this.enterTextInInput('Description', desc);
|
await this.enterTextInInput('Description', desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isVisibilityEnabled() {
|
async isVisibilityEnabled() {
|
||||||
const wrapper = this.getLabelWrapper('Visibility');
|
const wrapper = this.getLabelWrapper('Visibility');
|
||||||
const field = wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.dropDown));
|
const field = wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.dropDown));
|
||||||
return await field.isEnabled();
|
return field.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isVisibilityDisplayed() {
|
async isVisibilityDisplayed() {
|
||||||
return await this.isFieldDisplayed('Visibility');
|
return this.isFieldDisplayed('Visibility');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getVisibility() {
|
async getVisibility() {
|
||||||
return await this.getValueOfField('Visibility');
|
return this.getValueOfField('Visibility');
|
||||||
}
|
}
|
||||||
|
|
||||||
async setVisibility(visibility: string) {
|
async setVisibility(visibility: string) {
|
||||||
@@ -200,54 +200,54 @@ export class LibraryMetadata extends Component {
|
|||||||
|
|
||||||
|
|
||||||
async isLibraryIdDisplayed() {
|
async isLibraryIdDisplayed() {
|
||||||
return await this.isFieldDisplayed('Library ID');
|
return this.isFieldDisplayed('Library ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isLibraryIdEnabled() {
|
async isLibraryIdEnabled() {
|
||||||
return await this.isInputEnabled('Library ID');
|
return this.isInputEnabled('Library ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getLibraryId() {
|
async getLibraryId() {
|
||||||
return await this.getValueOfField('Library ID');
|
return this.getValueOfField('Library ID');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isEditLibraryPropertiesEnabled() {
|
async isEditLibraryPropertiesEnabled() {
|
||||||
return await this.isButtonEnabled('Edit');
|
return this.isButtonEnabled('Edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEditLibraryPropertiesDisplayed() {
|
async isEditLibraryPropertiesDisplayed() {
|
||||||
return await this.isButtonDisplayed('Edit');
|
return this.isButtonDisplayed('Edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickEditLibraryProperties() {
|
async clickEditLibraryProperties() {
|
||||||
return await this.clickButton('Edit');
|
await this.clickButton('Edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isUpdateEnabled() {
|
async isUpdateEnabled() {
|
||||||
return await this.isButtonEnabled('Update');
|
return this.isButtonEnabled('Update');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUpdateDisplayed() {
|
async isUpdateDisplayed() {
|
||||||
return await this.isButtonDisplayed('Update');
|
return this.isButtonDisplayed('Update');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickUpdate() {
|
async clickUpdate() {
|
||||||
return await this.clickButton('Update');
|
await this.clickButton('Update');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async isCancelEnabled() {
|
async isCancelEnabled() {
|
||||||
return await this.isButtonEnabled('Cancel');
|
return this.isButtonEnabled('Cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelDisplayed() {
|
async isCancelDisplayed() {
|
||||||
return await this.isButtonDisplayed('Cancel');
|
return this.isButtonDisplayed('Cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCancel() {
|
async clickCancel() {
|
||||||
return await this.clickButton('Cancel');
|
await this.clickButton('Cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -69,11 +69,11 @@ export class InfoDrawer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForInfoDrawerToOpen() {
|
async waitForInfoDrawerToOpen() {
|
||||||
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isOpen() {
|
async isOpen() {
|
||||||
return await browser.isElementPresent(this.header);
|
return browser.isElementPresent(this.header);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEmpty() {
|
async isEmpty() {
|
||||||
@@ -85,27 +85,27 @@ export class InfoDrawer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getTabsCount() {
|
async getTabsCount() {
|
||||||
return await this.component.all(by.css(InfoDrawer.selectors.tabLabel)).count();
|
return this.component.all(by.css(InfoDrawer.selectors.tabLabel)).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isTabPresent(title: string) {
|
async isTabPresent(title: string) {
|
||||||
return await this.getTabByTitle(title).isPresent();
|
return this.getTabByTitle(title).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isTabDisplayed(title: string): Promise<boolean> {
|
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 this.getTabByTitle(title).isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTabTitle(index: number) {
|
async getTabTitle(index: number) {
|
||||||
return await this.tabLabelsList.get(index - 1).getAttribute('innerText');
|
return this.tabLabelsList.get(index - 1).getAttribute('innerText');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getActiveTabTitle() {
|
async getActiveTabTitle() {
|
||||||
return await this.tabActiveLabel.getText();
|
return this.tabActiveLabel.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickTab(title: string) {
|
async clickTab(title: string) {
|
||||||
@@ -113,19 +113,19 @@ export class InfoDrawer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getComponentIdOfTab() {
|
async getComponentIdOfTab() {
|
||||||
return await this.tabActiveContent.getAttribute('data-automation-id');
|
return this.tabActiveContent.getAttribute('data-automation-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHeaderTitle() {
|
async getHeaderTitle() {
|
||||||
return await this.headerTitle.getText();
|
return this.headerTitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isAboutTabDisplayed() {
|
async isAboutTabDisplayed() {
|
||||||
return await this.isTabDisplayed('About');
|
return this.isTabDisplayed('About');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPropertiesTabDisplayed() {
|
async isPropertiesTabDisplayed() {
|
||||||
return await this.isTabDisplayed('Properties');
|
return this.isTabDisplayed('Properties');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPropertiesTabActive() {
|
async isPropertiesTabActive() {
|
||||||
@@ -133,7 +133,7 @@ export class InfoDrawer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isCommentsTabDisplayed() {
|
async isCommentsTabDisplayed() {
|
||||||
return await this.isTabDisplayed('Comments');
|
return this.isTabDisplayed('Comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickCommentsTab() {
|
async clickCommentsTab() {
|
||||||
@@ -145,8 +145,7 @@ export class InfoDrawer extends Component {
|
|||||||
browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT)
|
browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT)
|
||||||
]);
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('--- catch error on clickCommentsTab ---');
|
console.error('--- info-drawer clickCommentsTab catch error: ', error);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,7 +73,7 @@ export class LoginComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickPasswordVisibility() {
|
async clickPasswordVisibility() {
|
||||||
return await this.passwordVisibility.click();
|
await this.passwordVisibility.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPasswordVisibility(): Promise<boolean> {
|
async getPasswordVisibility(): Promise<boolean> {
|
||||||
@@ -105,15 +105,15 @@ export class LoginComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isUsernameEnabled() {
|
async isUsernameEnabled() {
|
||||||
return await this.usernameInput.isEnabled();
|
return this.usernameInput.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPasswordEnabled() {
|
async isPasswordEnabled() {
|
||||||
return await this.passwordInput.isEnabled();
|
return this.passwordInput.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSubmitEnabled() {
|
async isSubmitEnabled() {
|
||||||
return await this.submitButton.isEnabled();
|
return this.submitButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPasswordHidden() {
|
async isPasswordHidden() {
|
||||||
|
@@ -112,19 +112,19 @@ export class Menu extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getItemTooltip(menuItem: string) {
|
async getItemTooltip(menuItem: string) {
|
||||||
return await this.getItemByLabel(menuItem).getAttribute('title');
|
return this.getItemByLabel(menuItem).getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getItemIconText(menuItem: string) {
|
async getItemIconText(menuItem: string) {
|
||||||
return await this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
|
return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getItemIdAttribute(menuItem: string) {
|
async getItemIdAttribute(menuItem: string) {
|
||||||
return await this.getItemByLabel(menuItem).getAttribute('id');
|
return this.getItemByLabel(menuItem).getAttribute('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
async getItemsCount() {
|
async getItemsCount() {
|
||||||
return await this.items.count();
|
return this.items.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMenuItems(): Promise<string[]> {
|
async getMenuItems(): Promise<string[]> {
|
||||||
@@ -190,15 +190,15 @@ export class Menu extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isMenuItemPresent(title: string) {
|
async isMenuItemPresent(title: string) {
|
||||||
return await browser.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
|
return browser.element(by.cssContainingText(Menu.selectors.item, title)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSubMenuItemPresent(title: string) {
|
async isSubMenuItemPresent(title: string) {
|
||||||
return await browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent();
|
return browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getSubmenuItemsCount() {
|
async getSubmenuItemsCount() {
|
||||||
return await this.submenus.count();
|
return this.submenus.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMenuItemDisabled(title: string): Promise<string | null> {
|
async isMenuItemDisabled(title: string): Promise<string | null> {
|
||||||
@@ -217,7 +217,7 @@ export class Menu extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickEditFolder() {
|
async clickEditFolder() {
|
||||||
return await this.editFolderAction.click();
|
await this.editFolderAction.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickShare() {
|
async clickShare() {
|
||||||
@@ -232,127 +232,126 @@ export class Menu extends Component {
|
|||||||
|
|
||||||
|
|
||||||
async isViewPresent() {
|
async isViewPresent() {
|
||||||
return await this.viewAction.isPresent();
|
return this.viewAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDownloadPresent() {
|
async isDownloadPresent() {
|
||||||
return await this.downloadAction.isPresent();
|
return this.downloadAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEditFolderPresent() {
|
async isEditFolderPresent() {
|
||||||
return await this.editFolderAction.isPresent();
|
return this.editFolderAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEditOfflinePresent() {
|
async isEditOfflinePresent() {
|
||||||
return await this.editOfflineAction.isPresent();
|
return this.editOfflineAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelEditingPresent() {
|
async isCancelEditingPresent() {
|
||||||
return await this.cancelEditingAction.isPresent();
|
return this.cancelEditingAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCopyPresent() {
|
async isCopyPresent() {
|
||||||
return await this.copyAction.isPresent();
|
return this.copyAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMovePresent() {
|
async isMovePresent() {
|
||||||
return await this.moveAction.isPresent();
|
return this.moveAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDeletePresent() {
|
async isDeletePresent() {
|
||||||
return await this.deleteAction.isPresent();
|
return this.deleteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isManagePermissionsPresent() {
|
async isManagePermissionsPresent() {
|
||||||
return await this.managePermissionsAction.isPresent();
|
return this.managePermissionsAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isManageVersionsPresent() {
|
async isManageVersionsPresent() {
|
||||||
return await this.manageVersionsAction.isPresent();
|
return this.manageVersionsAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUploadNewVersionPresent() {
|
async isUploadNewVersionPresent() {
|
||||||
return await this.uploadNewVersionAction.isPresent();
|
return this.uploadNewVersionAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isFavoritePresent() {
|
async isFavoritePresent() {
|
||||||
return await this.favoriteAction.isPresent();
|
return this.favoriteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isRemoveFavoritePresent() {
|
async isRemoveFavoritePresent() {
|
||||||
return await this.removeFavoriteAction.isPresent();
|
return this.removeFavoriteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isToggleFavoritePresent() {
|
async isToggleFavoritePresent() {
|
||||||
return await this.toggleFavoriteAction.isPresent();
|
return this.toggleFavoriteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isToggleRemoveFavoritePresent() {
|
async isToggleRemoveFavoritePresent() {
|
||||||
return await this.toggleRemoveFavoriteAction.isPresent();
|
return this.toggleRemoveFavoriteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isJoinLibraryPresent() {
|
async isJoinLibraryPresent() {
|
||||||
return await this.joinAction.isPresent();
|
return this.joinAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCancelJoinPresent() {
|
async isCancelJoinPresent() {
|
||||||
return await this.cancelJoinAction.isPresent();
|
return this.cancelJoinAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isLeaveLibraryPresent() {
|
async isLeaveLibraryPresent() {
|
||||||
return await this.leaveAction.isPresent();
|
return this.leaveAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPermanentDeletePresent() {
|
async isPermanentDeletePresent() {
|
||||||
return await this.permanentDeleteAction.isPresent();
|
return this.permanentDeleteAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isRestorePresent() {
|
async isRestorePresent() {
|
||||||
return await this.restoreAction.isPresent();
|
return this.restoreAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSharePresent() {
|
async isSharePresent() {
|
||||||
return await this.shareAction.isPresent();
|
return this.shareAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSharedLinkSettingsPresent() {
|
async isSharedLinkSettingsPresent() {
|
||||||
return await this.shareEditAction.isPresent();
|
return this.shareEditAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isViewDetailsPresent() {
|
async isViewDetailsPresent() {
|
||||||
return await this.viewDetailsAction.isPresent();
|
return this.viewDetailsAction.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCreateFolderPresent() {
|
async isCreateFolderPresent() {
|
||||||
return await this.createFolderAction.isPresent();
|
return this.createFolderAction.isPresent();
|
||||||
}
|
}
|
||||||
async isCreateFolderEnabled() {
|
async isCreateFolderEnabled() {
|
||||||
return await this.createFolderAction.isEnabled();
|
return this.createFolderAction.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCreateLibraryPresent() {
|
async isCreateLibraryPresent() {
|
||||||
return await this.createLibraryAction.isPresent();
|
return this.createLibraryAction.isPresent();
|
||||||
}
|
}
|
||||||
async isCreateLibraryEnabled() {
|
async isCreateLibraryEnabled() {
|
||||||
return await this.createLibraryAction.isEnabled();
|
return this.createLibraryAction.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUploadFilePresent() {
|
async isUploadFilePresent() {
|
||||||
return await this.uploadFileAction.isPresent();
|
return this.uploadFileAction.isPresent();
|
||||||
}
|
}
|
||||||
async isUploadFileEnabled() {
|
async isUploadFileEnabled() {
|
||||||
return await this.uploadFileAction.isEnabled();
|
return this.uploadFileAction.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isUploadFolderPresent() {
|
async isUploadFolderPresent() {
|
||||||
return await this.uploadFolderAction.isPresent();
|
return this.uploadFolderAction.isPresent();
|
||||||
}
|
}
|
||||||
async isUploadFolderEnabled() {
|
async isUploadFolderEnabled() {
|
||||||
return await this.uploadFolderAction.isEnabled();
|
return this.uploadFolderAction.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async clickCreateFolder() {
|
async clickCreateFolder() {
|
||||||
const action = this.createFolderAction;
|
const action = this.createFolderAction;
|
||||||
await action.click();
|
await action.click();
|
||||||
|
@@ -44,7 +44,7 @@ export class MetadataCard extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isExpandPresent() {
|
async isExpandPresent() {
|
||||||
return await this.expandButton.isPresent();
|
return this.expandButton.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickExpandButton() {
|
async clickExpandButton() {
|
||||||
@@ -52,15 +52,15 @@ export class MetadataCard extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForFirstExpansionPanel() {
|
async waitForFirstExpansionPanel() {
|
||||||
return await browser.wait(EC.presenceOf(this.expansionPanels.get(0)), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.presenceOf(this.expansionPanels.get(0)), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isExpansionPanelPresent(index) {
|
async isExpansionPanelPresent(index) {
|
||||||
return await this.expansionPanels.get(index).isPresent();
|
return this.expansionPanels.get(index).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getComponentIdOfPanel(index) {
|
async getComponentIdOfPanel(index) {
|
||||||
return await this.expansionPanels.get(index).getAttribute('data-automation-id');
|
return this.expansionPanels.get(index).getAttribute('data-automation-id');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -110,54 +110,54 @@ export class Pagination extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isNextEnabled() {
|
async isNextEnabled() {
|
||||||
return await this.nextButton.isEnabled();
|
return this.nextButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPreviousEnabled() {
|
async isPreviousEnabled() {
|
||||||
return await this.previousButton.isEnabled();
|
return this.previousButton.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPagesButtonPresent() {
|
async isPagesButtonPresent() {
|
||||||
return await browser.isElementPresent(this.pagesButton);
|
return browser.isElementPresent(this.pagesButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isRangePresent() {
|
async isRangePresent() {
|
||||||
return await this.range.isPresent();
|
return this.range.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isMaxItemsPresent() {
|
async isMaxItemsPresent() {
|
||||||
return await this.maxItems.isPresent();
|
return this.maxItems.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCurrentPagePresent() {
|
async isCurrentPagePresent() {
|
||||||
return await this.currentPage.isPresent();
|
return this.currentPage.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isTotalPagesPresent() {
|
async isTotalPagesPresent() {
|
||||||
return await this.totalPages.isPresent();
|
return this.totalPages.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPreviousButtonPresent() {
|
async isPreviousButtonPresent() {
|
||||||
return await this.previousButton.isPresent();
|
return this.previousButton.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isNextButtonPresent() {
|
async isNextButtonPresent() {
|
||||||
return await this.nextButton.isPresent();
|
return this.nextButton.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentPage() {
|
async getCurrentPage() {
|
||||||
return await this.currentPage.getText();
|
return this.currentPage.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRange() {
|
async getRange() {
|
||||||
return await this.range.getText();
|
return this.range.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMaxItems() {
|
async getMaxItems() {
|
||||||
return await this.maxItems.getText();
|
return this.maxItems.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTotalPages() {
|
async getTotalPages() {
|
||||||
return await this.totalPages.getText();
|
return this.totalPages.getText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ export class SearchInput extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForSearchControl() {
|
async waitForSearchControl() {
|
||||||
return await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
|
await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---');
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSearchContainerDisplayed() {
|
async isSearchContainerDisplayed() {
|
||||||
@@ -70,22 +70,22 @@ export class SearchInput extends Component {
|
|||||||
|
|
||||||
async isOptionsAreaDisplayed() {
|
async isOptionsAreaDisplayed() {
|
||||||
await browser.wait(until.elementLocated(by.css(SearchInput.selectors.searchControl)), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(until.elementLocated(by.css(SearchInput.selectors.searchControl)), BROWSER_WAIT_TIMEOUT);
|
||||||
return await browser.isElementPresent(this.searchOptionsArea);
|
return browser.isElementPresent(this.searchOptionsArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickFilesOption() {
|
async clickFilesOption() {
|
||||||
await browser.wait(EC.elementToBeClickable(this.searchFilesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Files to be clickable');
|
await browser.wait(EC.elementToBeClickable(this.searchFilesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Files to be clickable');
|
||||||
return await this.searchFilesOption.click();
|
await this.searchFilesOption.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickFoldersOption() {
|
async clickFoldersOption() {
|
||||||
await browser.wait(EC.elementToBeClickable(this.searchFoldersOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Folders to be clickable');
|
await browser.wait(EC.elementToBeClickable(this.searchFoldersOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Folders to be clickable');
|
||||||
return await this.searchFoldersOption.click();
|
await this.searchFoldersOption.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickLibrariesOption() {
|
async clickLibrariesOption() {
|
||||||
await browser.wait(EC.elementToBeClickable(this.searchLibrariesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Libraries to be clickable');
|
await browser.wait(EC.elementToBeClickable(this.searchLibrariesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Libraries to be clickable');
|
||||||
return await this.searchLibrariesOption.click();
|
await this.searchLibrariesOption.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isFilesOptionEnabled() {
|
async isFilesOptionEnabled() {
|
||||||
@@ -131,12 +131,12 @@ export class SearchInput extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isClearSearchButtonPresent() {
|
async isClearSearchButtonPresent() {
|
||||||
return await browser.isElementPresent(this.clearSearchButton);
|
return browser.isElementPresent(this.clearSearchButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickClearSearchButton() {
|
async clickClearSearchButton() {
|
||||||
if (await this.isClearSearchButtonPresent()) {
|
if (await this.isClearSearchButtonPresent()) {
|
||||||
return await this.clearSearchButton.click();
|
await this.clearSearchButton.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -146,7 +146,7 @@ export class Sidenav extends Component {
|
|||||||
|
|
||||||
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
await browser.wait(condition, BROWSER_WAIT_TIMEOUT);
|
||||||
|
|
||||||
return await link.getAttribute('title');
|
return link.getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickLink(name: string) {
|
async clickLink(name: string) {
|
||||||
@@ -154,18 +154,17 @@ export class Sidenav extends Component {
|
|||||||
const link = this.getLinkLabel(name);
|
const link = this.getLinkLabel(name);
|
||||||
await Utils.waitUntilElementClickable(link);
|
await Utils.waitUntilElementClickable(link);
|
||||||
return await link.click();
|
return await link.click();
|
||||||
|
} catch (error) {
|
||||||
} catch (e){
|
console.log('---- sidebar navigation clickLink catch error: ', error);
|
||||||
console.log('---- sidebar navigation catch clickLink: ', e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async isFileLibrariesMenuExpanded() {
|
async isFileLibrariesMenuExpanded() {
|
||||||
return await element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent();
|
return element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
async expandFileLibraries() {
|
async expandFileLibraries() {
|
||||||
return await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -74,7 +74,7 @@ export class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async numberOfAvailableActions() {
|
async numberOfAvailableActions() {
|
||||||
return await this.buttons.count();
|
return this.buttons.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getButtons(): Promise<string[]> {
|
async getButtons(): Promise<string[]> {
|
||||||
@@ -85,7 +85,7 @@ export class Toolbar extends Component {
|
|||||||
|
|
||||||
async isButtonPresent(title: string) {
|
async isButtonPresent(title: string) {
|
||||||
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`));
|
||||||
return await elem.isPresent();
|
return elem.isPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
getButtonByLabel(label: string) {
|
getButtonByLabel(label: string) {
|
||||||
@@ -112,7 +112,7 @@ export class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getButtonTooltip(button: ElementFinder) {
|
async getButtonTooltip(button: ElementFinder) {
|
||||||
return await button.getAttribute('title');
|
return button.getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickButton(title: string) {
|
async clickButton(title: string) {
|
||||||
@@ -122,47 +122,47 @@ export class Toolbar extends Component {
|
|||||||
|
|
||||||
|
|
||||||
async isSharedLinkSettingsPresent() {
|
async isSharedLinkSettingsPresent() {
|
||||||
return await browser.isElementPresent(this.shareEditButton);
|
return browser.isElementPresent(this.shareEditButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isSharePresent() {
|
async isSharePresent() {
|
||||||
return await browser.isElementPresent(this.shareButton);
|
return browser.isElementPresent(this.shareButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isViewPresent() {
|
async isViewPresent() {
|
||||||
return await browser.isElementPresent(this.viewButton);
|
return browser.isElementPresent(this.viewButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isToggleSearchFiltersPresent() {
|
async isToggleSearchFiltersPresent() {
|
||||||
return await browser.isElementPresent(this.searchFiltersToggleButton);
|
return browser.isElementPresent(this.searchFiltersToggleButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isDownloadPresent() {
|
async isDownloadPresent() {
|
||||||
return await browser.isElementPresent(this.downloadButton);
|
return browser.isElementPresent(this.downloadButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPermanentlyDeletePresent() {
|
async isPermanentlyDeletePresent() {
|
||||||
return await browser.isElementPresent(this.permanentlyDeleteButton);
|
return browser.isElementPresent(this.permanentlyDeleteButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isRestorePresent() {
|
async isRestorePresent() {
|
||||||
return await browser.isElementPresent(this.restoreButton);
|
return browser.isElementPresent(this.restoreButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isEditFolderPresent() {
|
async isEditFolderPresent() {
|
||||||
return await browser.isElementPresent(this.editFolderButton);
|
return browser.isElementPresent(this.editFolderButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isViewDetailsPresent() {
|
async isViewDetailsPresent() {
|
||||||
return await browser.isElementPresent(this.viewDetailsButton);
|
return browser.isElementPresent(this.viewDetailsButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPrintPresent() {
|
async isPrintPresent() {
|
||||||
return await browser.isElementPresent(this.printButton);
|
return browser.isElementPresent(this.printButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isFullScreenPresent() {
|
async isFullScreenPresent() {
|
||||||
return await browser.isElementPresent(this.fullScreenButton);
|
return browser.isElementPresent(this.fullScreenButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -177,84 +177,84 @@ export class Toolbar extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clickView() {
|
async clickView() {
|
||||||
return await this.viewButton.click();
|
await this.viewButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickEditFolder() {
|
async clickEditFolder() {
|
||||||
return await this.editFolderButton.click();
|
await this.editFolderButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickViewDetails() {
|
async clickViewDetails() {
|
||||||
return await this.viewDetailsButton.click();
|
await this.viewDetailsButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickDownload() {
|
async clickDownload() {
|
||||||
return await this.downloadButton.click();
|
await this.downloadButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickJoin() {
|
async clickJoin() {
|
||||||
return await this.joinButton.click();
|
await this.joinButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickLeave() {
|
async clickLeave() {
|
||||||
return await this.leaveButton.click();
|
await this.leaveButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickPermanentlyDelete() {
|
async clickPermanentlyDelete() {
|
||||||
return await this.permanentlyDeleteButton.click();
|
await this.permanentlyDeleteButton.click();
|
||||||
}
|
}
|
||||||
async clickRestore() {
|
async clickRestore() {
|
||||||
return await this.restoreButton.click();
|
await this.restoreButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async clickMoreActionsFavorite() {
|
async clickMoreActionsFavorite() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Favorite');
|
await this.menu.clickMenuItem('Favorite');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsRemoveFavorite() {
|
async clickMoreActionsRemoveFavorite() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Remove Favorite');
|
await this.menu.clickMenuItem('Remove Favorite');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsDelete() {
|
async clickMoreActionsDelete() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Delete');
|
await this.menu.clickMenuItem('Delete');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsManageVersions() {
|
async clickMoreActionsManageVersions() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Manage Versions');
|
await this.menu.clickMenuItem('Manage Versions');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsMove() {
|
async clickMoreActionsMove() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Move');
|
await this.menu.clickMenuItem('Move');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsCopy() {
|
async clickMoreActionsCopy() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Copy');
|
await this.menu.clickMenuItem('Copy');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsEditOffline() {
|
async clickMoreActionsEditOffline() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Edit Offline');
|
await this.menu.clickMenuItem('Edit Offline');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsCancelEditing() {
|
async clickMoreActionsCancelEditing() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Cancel Editing');
|
await this.menu.clickMenuItem('Cancel Editing');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickMoreActionsUploadNewVersion() {
|
async clickMoreActionsUploadNewVersion() {
|
||||||
await this.openMoreMenu();
|
await this.openMoreMenu();
|
||||||
return await this.menu.clickMenuItem('Upload New Version');
|
await this.menu.clickMenuItem('Upload New Version');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickFullScreen() {
|
async clickFullScreen() {
|
||||||
return await this.fullScreenButton.click();
|
await this.fullScreenButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -65,23 +65,23 @@ export class Viewer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isViewerOpened() {
|
async isViewerOpened() {
|
||||||
return await browser.isElementPresent(this.viewerLayout);
|
return browser.isElementPresent(this.viewerLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isViewerContentDisplayed() {
|
async isViewerContentDisplayed() {
|
||||||
return await browser.isElementPresent(this.viewerContainer);
|
return browser.isElementPresent(this.viewerContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isViewerToolbarDisplayed() {
|
async isViewerToolbarDisplayed() {
|
||||||
return await browser.isElementPresent(this.toolbar.component);
|
return browser.isElementPresent(this.toolbar.component);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCloseButtonDisplayed() {
|
async isCloseButtonDisplayed() {
|
||||||
return await browser.isElementPresent(this.closeButton);
|
return browser.isElementPresent(this.closeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async isFileTitleDisplayed() {
|
async isFileTitleDisplayed() {
|
||||||
return await browser.isElementPresent(this.fileTitle);
|
return browser.isElementPresent(this.fileTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickClose() {
|
async clickClose() {
|
||||||
@@ -89,23 +89,23 @@ export class Viewer extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getCloseButtonTooltip() {
|
async getCloseButtonTooltip() {
|
||||||
return await this.toolbar.getButtonTooltip(this.closeButton);
|
return this.toolbar.getButtonTooltip(this.closeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getFileTitle() {
|
async getFileTitle() {
|
||||||
return await this.fileTitle.getText();
|
return this.fileTitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
async isCustomContentPresent() {
|
async isCustomContentPresent() {
|
||||||
return await browser.isElementPresent(this.viewerExtensionContent);
|
return browser.isElementPresent(this.viewerExtensionContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getComponentIdOfView(): Promise<string|null> {
|
async getComponentIdOfView(): Promise<string> {
|
||||||
if (await this.isCustomContentPresent()) {
|
if (await this.isCustomContentPresent()) {
|
||||||
return await this.viewerExtensionContent.getAttribute('data-automation-id');
|
return this.viewerExtensionContent.getAttribute('data-automation-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
async isPdfViewerContentDisplayed() {
|
async isPdfViewerContentDisplayed() {
|
||||||
|
@@ -57,21 +57,21 @@ export abstract class Page {
|
|||||||
constructor(public url: string = '') {}
|
constructor(public url: string = '') {}
|
||||||
|
|
||||||
async getTitle() {
|
async getTitle() {
|
||||||
return await browser.getTitle();
|
return browser.getTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
async load(relativeUrl: string = '') {
|
async load(relativeUrl: string = '') {
|
||||||
const hash = USE_HASH_STRATEGY ? '/#' : '';
|
const hash = USE_HASH_STRATEGY ? '/#' : '';
|
||||||
const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`;
|
const path = `${browser.baseUrl}${hash}${this.url}${relativeUrl}`;
|
||||||
return await browser.get(path);
|
return browser.get(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForApp() {
|
async waitForApp() {
|
||||||
return await browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT);
|
await browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForSnackBarToAppear() {
|
async waitForSnackBarToAppear() {
|
||||||
return await browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear');
|
return browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear');
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForSnackBarToClose() {
|
async waitForSnackBarToClose() {
|
||||||
@@ -83,7 +83,7 @@ export abstract class Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isDialogOpen() {
|
async isDialogOpen() {
|
||||||
return await browser.isElementPresent(this.dialogContainer);
|
return browser.isElementPresent(this.dialogContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
async closeOpenDialogs() {
|
async closeOpenDialogs() {
|
||||||
@@ -99,24 +99,24 @@ export abstract class Page {
|
|||||||
|
|
||||||
async getSnackBarMessage() {
|
async getSnackBarMessage() {
|
||||||
const elem = await this.waitForSnackBarToAppear();
|
const elem = await this.waitForSnackBarToAppear();
|
||||||
return await elem.getAttribute('innerText');
|
return elem.getAttribute('innerText');
|
||||||
}
|
}
|
||||||
|
|
||||||
async clickSnackBarAction() {
|
async clickSnackBarAction() {
|
||||||
try {
|
try {
|
||||||
const action = browser.wait(until.elementLocated(by.css('.mat-simple-snackbar-action button')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snack action to appear');
|
const action = await browser.wait(until.elementLocated(by.css('.mat-simple-snackbar-action button')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snack action to appear');
|
||||||
return await action.click();
|
await action.click();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e, '.......failed on click snack bar action.........');
|
console.log(e, '.......failed on click snack bar action.........');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async isGenericErrorDisplayed() {
|
async isGenericErrorDisplayed() {
|
||||||
return await this.genericError.isDisplayed();
|
return this.genericError.isDisplayed();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGenericErrorTitle() {
|
async getGenericErrorTitle() {
|
||||||
return await this.genericErrorTitle.getText();
|
return this.genericErrorTitle.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -50,10 +50,10 @@ export class SearchResultsPage extends BrowsingPage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async waitForResults() {
|
async waitForResults() {
|
||||||
return await this.dataTable.waitForBody();
|
await this.dataTable.waitForBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getResultsHeader() {
|
async getResultsHeader() {
|
||||||
return await browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
|
return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -176,26 +176,26 @@ describe('Sidebar', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('default state is expanded - [C269095]', async () => {
|
it('default state is expanded - [C269095]', async () => {
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidebar toggle - [C269096]', async () => {
|
it('sidebar toggle - [C269096]', async () => {
|
||||||
await header.collapseSideNav();
|
await header.collapseSideNav();
|
||||||
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
|
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
|
||||||
|
|
||||||
await header.expandSideNav();
|
await header.expandSideNav();
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidebar state is preserved on page refresh - [C269100]', async () => {
|
it('sidebar state is preserved on page refresh - [C269100]', async () => {
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
await page.refresh();
|
await page.refresh();
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
|
|
||||||
await header.collapseSideNav();
|
await header.collapseSideNav();
|
||||||
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
|
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
|
||||||
await page.refresh();
|
await page.refresh();
|
||||||
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
|
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidebar state is preserved after logout / login - [C269102]', async () => {
|
it('sidebar state is preserved after logout / login - [C269102]', async () => {
|
||||||
@@ -203,7 +203,7 @@ describe('Sidebar', () => {
|
|||||||
await page.signOut();
|
await page.signOut();
|
||||||
await loginPage.loginWithAdmin();
|
await loginPage.loginWithAdmin();
|
||||||
|
|
||||||
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
|
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidebar is collapsed automatically when Search Results opens - [C277223]', async () => {
|
it('sidebar is collapsed automatically when Search Results opens - [C277223]', async () => {
|
||||||
@@ -212,7 +212,7 @@ describe('Sidebar', () => {
|
|||||||
await searchInput.searchFor('qwertyuiop');
|
await searchInput.searchFor('qwertyuiop');
|
||||||
await searchResultsPage.waitForResults();
|
await searchResultsPage.waitForResults();
|
||||||
|
|
||||||
expect(await header.isExpandedSidenav()).toBe(false, 'Sidebar not collapsed');
|
expect(await header.isSidenavExpanded()).toBe(false, 'Sidebar not collapsed');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidenav returns to the default state when navigating away from the Search Results page - [C277224]', async () => {
|
it('sidenav returns to the default state when navigating away from the Search Results page - [C277224]', async () => {
|
||||||
@@ -222,7 +222,7 @@ describe('Sidebar', () => {
|
|||||||
await searchResultsPage.waitForResults();
|
await searchResultsPage.waitForResults();
|
||||||
await page.clickFavorites();
|
await page.clickFavorites();
|
||||||
|
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sidenav can be expanded when search results page is displayed - [C277230]', async () => {
|
it('sidenav can be expanded when search results page is displayed - [C277230]', async () => {
|
||||||
@@ -232,6 +232,6 @@ describe('Sidebar', () => {
|
|||||||
await searchResultsPage.waitForResults();
|
await searchResultsPage.waitForResults();
|
||||||
await header.expandSideNav();
|
await header.expandSideNav();
|
||||||
|
|
||||||
expect(await header.isExpandedSidenav()).toBe(true, 'Sidebar not expanded');
|
expect(await header.isSidenavExpanded()).toBe(true, 'Sidebar not expanded');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -32,7 +32,11 @@ export class AuthenticationApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logout() {
|
async logout() {
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return await this.alfrescoJsApi.logout();
|
await this.alfrescoJsApi.logout();
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- authentication api logout catch error: ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,23 +27,39 @@ import { RepoApi } from '../repo-api';
|
|||||||
import { CommentsApi as AdfCommentsApi } from '@alfresco/js-api';
|
import { CommentsApi as AdfCommentsApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class CommentsApi extends RepoApi {
|
export class CommentsApi extends RepoApi {
|
||||||
commentsApi = new AdfCommentsApi(this.alfrescoJsApi);
|
commentsApi = new AdfCommentsApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNodeComments(nodeId: string) {
|
async getNodeComments(nodeId: string) {
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return await this.commentsApi.listComments(nodeId);
|
return await this.commentsApi.listComments(nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- comments api getNodeComments catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async addComment(nodeId: string, comment: string) {
|
async addComment(nodeId: string, comment: string) {
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return await this.commentsApi.createComment(nodeId, { "content": comment });
|
return await this.commentsApi.createComment(nodeId, { "content": comment });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- comments api addComment catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
async addComments(nodeId: string, comment: any) {
|
}
|
||||||
|
|
||||||
|
async addComments(nodeId: string, comment: any) {
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return await this.commentsApi.createComment(nodeId, comment);
|
return await this.commentsApi.createComment(nodeId, comment);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- comments api addComments catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,119 +29,146 @@ import { Utils } from '../../../../utilities/utils';
|
|||||||
import { FavoritesApi as AdfFavoritesApi, SitesApi as AdfSiteApi, FavoriteEntry } 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);
|
||||||
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
|
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
|
||||||
|
|
||||||
async addFavorite(api: RepoClient, nodeType: string, name: string) {
|
|
||||||
const nodeId = (await api.nodes.getNodeByPath(name)).entry.id;
|
|
||||||
const data = {
|
|
||||||
target: {
|
|
||||||
[nodeType]: {
|
|
||||||
guid: nodeId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return await this.favoritesApi.createFavorite('-me-', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry|null> {
|
|
||||||
let guid;
|
|
||||||
await this.apiAuth();
|
|
||||||
|
|
||||||
if ( nodeType === 'site' ) {
|
|
||||||
guid = (await this.sitesApi.getSite(id)).entry.guid;
|
|
||||||
} else {
|
|
||||||
guid = id;
|
|
||||||
}
|
|
||||||
const data = {
|
|
||||||
target: {
|
|
||||||
[nodeType]: {
|
|
||||||
guid: guid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
return await this.favoritesApi.createFavorite('-me-', data);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('--- add favorite by id catch ');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) {
|
|
||||||
return await ids.reduce(async (previous, current) => {
|
|
||||||
await previous;
|
|
||||||
await this.addFavoriteById(nodeType, current);
|
|
||||||
}, Promise.resolve());
|
|
||||||
}
|
|
||||||
|
|
||||||
async getFavorites() {
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.favoritesApi.listFavorites(this.getUsername());
|
|
||||||
}
|
|
||||||
|
|
||||||
async getFavoriteById(nodeId: string) {
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.favoritesApi.getFavorite('-me-', nodeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async isFavorite(nodeId: string) {
|
|
||||||
return JSON.stringify((await this.getFavorites()).list.entries).includes(nodeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async isFavoriteWithRetry(nodeId: string, data) {
|
|
||||||
let isFavorite;
|
|
||||||
try {
|
|
||||||
const favorite = async () => {
|
|
||||||
isFavorite = await this.isFavorite(nodeId);
|
|
||||||
if ( isFavorite !== data.expect ) {
|
|
||||||
return Promise.reject(isFavorite);
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(isFavorite);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return await Utils.retryCall(favorite);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('-----> catch isFavoriteWithRetry: ', error);
|
|
||||||
}
|
|
||||||
return isFavorite;
|
|
||||||
}
|
|
||||||
|
|
||||||
async removeFavoriteById(nodeId: string) {
|
|
||||||
await this.apiAuth();
|
|
||||||
try {
|
|
||||||
return await this.favoritesApi.deleteFavorite('-me-', nodeId);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('--- remove favorite by id catch ', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async removeFavoritesByIds(ids: string[]) {
|
|
||||||
return await ids.reduce(async (previous, current) => {
|
|
||||||
await previous;
|
|
||||||
await this.removeFavoriteById(current);
|
|
||||||
}, Promise.resolve());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async addFavorite(api: RepoClient, nodeType: string, name: string) {
|
||||||
try {
|
try {
|
||||||
const favoriteFiles = async () => {
|
const nodeId = (await api.nodes.getNodeByPath(name)).entry.id;
|
||||||
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
const data = {
|
||||||
if ( totalItems !== data.expect) {
|
target: {
|
||||||
return Promise.reject(totalItems);
|
[nodeType]: {
|
||||||
} else {
|
guid: nodeId
|
||||||
return Promise.resolve(totalItems);
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
return await this.favoritesApi.createFavorite('-me-', data);
|
||||||
return await Utils.retryCall(favoriteFiles);
|
} catch (error) {
|
||||||
} catch (error) {
|
console.log('--- favorites api addFavorite catch error: ', error);
|
||||||
console.log('-----> catch favorites: ', error);
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry|null> {
|
||||||
|
let guid;
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
if ( nodeType === 'site' ) {
|
||||||
|
guid = (await this.sitesApi.getSite(id)).entry.guid;
|
||||||
|
} else {
|
||||||
|
guid = id;
|
||||||
|
}
|
||||||
|
const data = {
|
||||||
|
target: {
|
||||||
|
[nodeType]: {
|
||||||
|
guid: guid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return await this.favoritesApi.createFavorite('-me-', data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api addFavoriteById catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) {
|
||||||
|
try {
|
||||||
|
return await ids.reduce(async (previous, current) => {
|
||||||
|
await previous;
|
||||||
|
await this.addFavoriteById(nodeType, current);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api addFavoritesByIds catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getFavorites() {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.favoritesApi.listFavorites(this.getUsername());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api getFavorites catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getFavoriteById(nodeId: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.favoritesApi.getFavorite('-me-', nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api getFavoriteById catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFavorite(nodeId: string) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify((await this.getFavorites()).list.entries).includes(nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api isFavorite catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFavoriteWithRetry(nodeId: string, data) {
|
||||||
|
let isFavorite;
|
||||||
|
try {
|
||||||
|
const favorite = async () => {
|
||||||
|
isFavorite = await this.isFavorite(nodeId);
|
||||||
|
if ( isFavorite !== data.expect ) {
|
||||||
|
return Promise.reject(isFavorite);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(isFavorite);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await Utils.retryCall(favorite);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api isFavoriteWithRetry catch error: ', error);
|
||||||
|
}
|
||||||
|
return isFavorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeFavoriteById(nodeId: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.favoritesApi.deleteFavorite('-me-', nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api removeFavoriteById catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async removeFavoritesByIds(ids: string[]) {
|
||||||
|
try {
|
||||||
|
return await ids.reduce(async (previous, current) => {
|
||||||
|
await previous;
|
||||||
|
await this.removeFavoriteById(current);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- favorites api removeFavoritesByIds catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForApi(data: { expect: number }) {
|
||||||
|
try {
|
||||||
|
const favoriteFiles = async () => {
|
||||||
|
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
||||||
|
if ( totalItems !== data.expect) {
|
||||||
|
return Promise.reject(totalItems);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(totalItems);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await Utils.retryCall(favoriteFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('favorites api waitForApi catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,269 +30,411 @@ import { NodesApi as AdfNodeApi, NodeBodyLock} from '@alfresco/js-api';
|
|||||||
import { Utils } from '../../../../utilities/utils';
|
import { Utils } from '../../../../utilities/utils';
|
||||||
|
|
||||||
export class NodesApi extends RepoApi {
|
export class NodesApi extends RepoApi {
|
||||||
nodesApi = new AdfNodeApi(this.alfrescoJsApi);
|
nodesApi = new AdfNodeApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNodeByPath(relativePath: string = '/') {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.getNode('-my-', { relativePath });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeByPath catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodeByPath(relativePath: string = '/') {
|
async getNodeById(id: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.nodesApi.getNode('-my-', { relativePath });
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.getNode(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeById catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodeById(id: string) {
|
async getNodeIdFromParent(name: string, parentId: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.nodesApi.getNode(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getNodeIdFromParent(name: string, parentId: string) {
|
|
||||||
const children = (await this.getNodeChildren(parentId)).list.entries;
|
const children = (await this.getNodeChildren(parentId)).list.entries;
|
||||||
return children.find(elem => elem.entry.name === name).entry.id;
|
return children.find(elem => elem.entry.name === name).entry.id;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeIdFromParent catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodeDescription(name: string, parentId: string) {
|
async getNodeDescription(name: string, parentId: string) {
|
||||||
|
try {
|
||||||
const children = (await this.getNodeChildren(parentId)).list.entries;
|
const children = (await this.getNodeChildren(parentId)).list.entries;
|
||||||
return children.find(elem => elem.entry.name === name).entry.properties['cm:description'];
|
return children.find(elem => elem.entry.name === name).entry.properties['cm:description'];
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeDescription catch error: ', error);
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodeProperty(nodeId: string, property: string) {
|
async getNodeProperty(nodeId: string, property: string) {
|
||||||
|
try {
|
||||||
const node = await this.getNodeById(nodeId);
|
const node = await this.getNodeById(nodeId);
|
||||||
if (node.entry.properties) {
|
if (node.entry.properties) {
|
||||||
return node.entry.properties[property];
|
return node.entry.properties[property];
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeProperty catch error: ', error);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getFileVersionType(nodeId: string) {
|
async getFileVersionType(nodeId: string) {
|
||||||
|
try {
|
||||||
const prop = await this.getNodeProperty(nodeId, 'cm:versionType');
|
const prop = await this.getNodeProperty(nodeId, 'cm:versionType');
|
||||||
if ( prop ) {
|
if ( prop ) {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getFileVersionType catch error: ', error);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
async getFileVersionLabel(nodeId: string) {
|
}
|
||||||
|
|
||||||
|
async getFileVersionLabel(nodeId: string) {
|
||||||
|
try {
|
||||||
const prop = await this.getNodeProperty(nodeId, 'cm:versionLabel');
|
const prop = await this.getNodeProperty(nodeId, 'cm:versionLabel');
|
||||||
if ( prop ) {
|
if ( prop ) {
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getFileVersionLabel catch error: ', error);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSharedId(nodeId: string) {
|
||||||
async getSharedId(nodeId: string) {
|
try {
|
||||||
return await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
return await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getSharedId catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSharedExpiryDate(nodeId: string) {
|
async getSharedExpiryDate(nodeId: string) {
|
||||||
|
try {
|
||||||
return await this.getNodeProperty(nodeId, 'qshare:expiryDate');
|
return await this.getNodeProperty(nodeId, 'qshare:expiryDate');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getSharedExpiryDate catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async isFileShared(nodeId: string) {
|
async isFileShared(nodeId: string) {
|
||||||
|
try {
|
||||||
return (await this.getSharedId(nodeId)) !== '';
|
return (await this.getSharedId(nodeId)) !== '';
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api isFileShared catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNodeById(id: string, permanent: boolean = true) {
|
async deleteNodeById(id: string, permanent: boolean = true) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
try {
|
await this.apiAuth();
|
||||||
return await this.nodesApi.deleteNode(id, { permanent });
|
return await this.nodesApi.deleteNode(id, { permanent });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('------ deleteNodeById failed ');
|
console.log('--- nodes api deleteNodeById catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNodeByPath(path: string, permanent: boolean = true) {
|
async deleteNodeByPath(path: string, permanent: boolean = true) {
|
||||||
const id = (await this.getNodeByPath(path)).entry.id;
|
try {
|
||||||
return await this.deleteNodeById(id, permanent);
|
const id = (await this.getNodeByPath(path)).entry.id;
|
||||||
|
return await this.deleteNodeById(id, permanent);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api deleteNodeByPath catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true) {
|
async deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true) {
|
||||||
return await names.reduce(async (previous, current) => {
|
try {
|
||||||
await previous;
|
return await names.reduce(async (previous, current) => {
|
||||||
return await this.deleteNodeByPath(`${relativePath}/${current}`, permanent);
|
await previous;
|
||||||
}, Promise.resolve());
|
const req = await this.deleteNodeByPath(`${relativePath}/${current}`, permanent);
|
||||||
|
return req;
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api deleteNodes catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNodesById(ids: string[], permanent: boolean = true) {
|
async deleteNodesById(ids: string[], permanent: boolean = true) {
|
||||||
return await ids.reduce(async (previous, current) => {
|
try {
|
||||||
await previous;
|
return await ids.reduce(async (previous, current) => {
|
||||||
return await this.deleteNodeById(current, permanent);
|
await previous;
|
||||||
}, Promise.resolve());
|
const req = await this.deleteNodeById(current, permanent);
|
||||||
|
return req;
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api deleteNodesById catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodeChildren(nodeId: string) {
|
async getNodeChildren(nodeId: string) {
|
||||||
const opts = {
|
try {
|
||||||
include: [ 'properties' ]
|
const opts = {
|
||||||
};
|
include: [ 'properties' ]
|
||||||
await this.apiAuth();
|
};
|
||||||
return await this.nodesApi.listNodeChildren(nodeId, opts);
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.listNodeChildren(nodeId, opts);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeChildren catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteNodeChildren(parentId: string) {
|
async deleteNodeChildren(parentId: string) {
|
||||||
|
try {
|
||||||
const listEntries = (await this.getNodeChildren(parentId)).list.entries;
|
const listEntries = (await this.getNodeChildren(parentId)).list.entries;
|
||||||
const nodeIds = listEntries.map(entries => entries.entry.id);
|
const nodeIds = listEntries.map(entries => entries.entry.id);
|
||||||
return await this.deleteNodesById(nodeIds);
|
return await this.deleteNodesById(nodeIds);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api deleteNodeChildren catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createImageNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '') {
|
async createImageNode(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
|
||||||
const imageProps = {
|
const imageProps = {
|
||||||
'exif:pixelXDimension': 1000,
|
'exif:pixelXDimension': 1000,
|
||||||
'exif:pixelYDimension': 1200
|
'exif:pixelYDimension': 1200
|
||||||
};
|
};
|
||||||
|
try {
|
||||||
return await this.createNode('cm:content', name, parentId, title, description, imageProps);
|
return await this.createNode('cm:content', name, parentId, title, description, imageProps);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createImageNode catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, author: string = '', majorVersion: boolean = true) {
|
async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, author: string = '', majorVersion: boolean = true) {
|
||||||
const nodeBody = {
|
const nodeBody = {
|
||||||
name,
|
name,
|
||||||
nodeType,
|
nodeType,
|
||||||
properties: {
|
properties: {
|
||||||
'cm:title': title,
|
'cm:title': title,
|
||||||
'cm:description': description,
|
'cm:description': description,
|
||||||
'cm:author': author
|
'cm:author': author
|
||||||
}
|
|
||||||
};
|
|
||||||
if (imageProps) {
|
|
||||||
nodeBody.properties = Object.assign(nodeBody.properties, imageProps);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
await this.apiAuth();
|
if (imageProps) {
|
||||||
|
nodeBody.properties = Object.assign(nodeBody.properties, imageProps);
|
||||||
try {
|
|
||||||
return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion });
|
|
||||||
} catch (error) {
|
|
||||||
console.log('===========> API create node catch ===========');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', majorVersion: boolean = true) {
|
try {
|
||||||
try {
|
await this.apiAuth();
|
||||||
return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion);
|
return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('==== catch createFile: ', error);
|
console.log('--- nodes api createNode catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
|
async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '', majorVersion: boolean = true) {
|
||||||
return await this.createImageNode('cm:content', name, parentId, title, description);
|
try {
|
||||||
|
return await this.createNode('cm:content', name, parentId, title, description, null, author, majorVersion);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createFile catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '') {
|
async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
|
||||||
try {
|
try {
|
||||||
return await this.createNode('cm:folder', name, parentId, title, description, null, author);
|
return await this.createImageNode(name, parentId, title, description);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('======> API create folder catch ==========');
|
console.log('--- nodes api createImage catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createChildren(data: NodeBodyCreate[]) {
|
async createFolder(name: string, parentId: string = '-my-', title: string = '', description: string = '', author: string = '') {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.nodesApi.createNode('-my-', <any>data);
|
return await this.createNode('cm:folder', name, parentId, title, description, null, author);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createFolder catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createContent(content: NodeContentTree, relativePath: string = '/') {
|
async createChildren(data: NodeBodyCreate[]) {
|
||||||
return await this.createChildren(flattenNodeContentTree(content, relativePath));
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.createNode('-my-', <any>data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createChildren catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createFolders(names: string[], relativePath: string = '/') {
|
async createContent(content: NodeContentTree, relativePath: string = '/') {
|
||||||
return await this.createContent({ folders: names }, relativePath);
|
try {
|
||||||
|
return await this.createChildren(flattenNodeContentTree(content, relativePath));
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createContent catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createFiles(names: string[], relativePath: string = '/') {
|
async createFolders(names: string[], relativePath: string = '/') {
|
||||||
return await this.createContent({ files: names }, relativePath);
|
try {
|
||||||
|
return await this.createContent({ folders: names }, relativePath);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createFolders catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// node content
|
async createFiles(names: string[], relativePath: string = '/') {
|
||||||
async getNodeContent(nodeId: string) {
|
try {
|
||||||
await this.apiAuth();
|
return await this.createContent({ files: names }, relativePath);
|
||||||
return await this.nodesApi.getNodeContent(nodeId);
|
} catch (error) {
|
||||||
|
console.log('--- nodes api createFiles catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async editNodeContent(nodeId: string, content: string) {
|
// node content
|
||||||
await this.apiAuth();
|
async getNodeContent(nodeId: string) {
|
||||||
return await this.nodesApi.updateNodeContent(nodeId, content);
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.getNodeContent(nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodeContent catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async renameNode(nodeId: string, newName: string) {
|
async editNodeContent(nodeId: string, content: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return this.nodesApi.updateNode(nodeId, { name: newName });
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.updateNodeContent(nodeId, content);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api editNodeContent catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// node permissions
|
async renameNode(nodeId: string, newName: string) {
|
||||||
async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string) {
|
try {
|
||||||
const data = {
|
await this.apiAuth();
|
||||||
permissions: {
|
return this.nodesApi.updateNode(nodeId, { name: newName });
|
||||||
isInheritanceEnabled: inheritPermissions,
|
} catch (error) {
|
||||||
locallySet: [
|
console.log('--- nodes api renameNode catch error: ', error);
|
||||||
{
|
return null;
|
||||||
authorityId: username,
|
|
||||||
name: role
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.nodesApi.updateNode(nodeId, data);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getNodePermissions(nodeId: string) {
|
// node permissions
|
||||||
await this.apiAuth();
|
async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string) {
|
||||||
return await this.nodesApi.getNode(nodeId, { include: ['permissions'] });
|
const data = {
|
||||||
}
|
permissions: {
|
||||||
|
isInheritanceEnabled: inheritPermissions,
|
||||||
// lock node
|
locallySet: [
|
||||||
async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES') {
|
{
|
||||||
const data = <NodeBodyLock>{
|
authorityId: username,
|
||||||
type: lockType
|
name: role
|
||||||
};
|
|
||||||
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.nodesApi.lockNode(nodeId, data );
|
|
||||||
}
|
|
||||||
|
|
||||||
async unlockFile(nodeId: string) {
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.nodesApi.unlockNode(nodeId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async getLockType(nodeId: string) {
|
|
||||||
return await this.getNodeProperty(nodeId, 'cm:lockType');
|
|
||||||
}
|
|
||||||
|
|
||||||
async getLockOwner(nodeId: string) {
|
|
||||||
return await this.getNodeProperty(nodeId, 'cm:lockOwner');
|
|
||||||
}
|
|
||||||
|
|
||||||
async isFileLockedWrite(nodeId: string) {
|
|
||||||
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
|
||||||
}
|
|
||||||
|
|
||||||
async isFileLockedWriteWithRetry(nodeId: string, expect: boolean) {
|
|
||||||
const data = {
|
|
||||||
expect: expect,
|
|
||||||
retry: 5
|
|
||||||
};
|
|
||||||
let isLocked;
|
|
||||||
try {
|
|
||||||
const locked = async () => {
|
|
||||||
isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
|
||||||
if ( isLocked !== data.expect ) {
|
|
||||||
return Promise.reject(isLocked);
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(isLocked);
|
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
return await Utils.retryCall(locked, data.retry);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('-----> catch isLockedWriteWithRetry: ', error);
|
|
||||||
}
|
}
|
||||||
return isLocked;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
async isFileLockedByName(fileName: string, parentId: string) {
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.updateNode(nodeId, data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api setGranularPermission catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getNodePermissions(nodeId: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.getNode(nodeId, { include: ['permissions'] });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getNodePermissions catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// lock node
|
||||||
|
async lockFile(nodeId: string, lockType: string = 'ALLOW_OWNER_CHANGES') {
|
||||||
|
const data = <NodeBodyLock>{
|
||||||
|
type: lockType
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.lockNode(nodeId, data );
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api lockFile catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async unlockFile(nodeId: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.nodesApi.unlockNode(nodeId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api unlockFile catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLockType(nodeId: string) {
|
||||||
|
try {
|
||||||
|
return await this.getNodeProperty(nodeId, 'cm:lockType');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getLockType catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLockOwner(nodeId: string) {
|
||||||
|
try {
|
||||||
|
return await this.getNodeProperty(nodeId, 'cm:lockOwner');
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api getLockOwner catch error: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFileLockedWrite(nodeId: string) {
|
||||||
|
try {
|
||||||
|
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api isFileLockedWrite catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFileLockedWriteWithRetry(nodeId: string, expect: boolean) {
|
||||||
|
const data = {
|
||||||
|
expect: expect,
|
||||||
|
retry: 5
|
||||||
|
};
|
||||||
|
let isLocked;
|
||||||
|
try {
|
||||||
|
const locked = async () => {
|
||||||
|
isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK';
|
||||||
|
if ( isLocked !== data.expect ) {
|
||||||
|
return Promise.reject(isLocked);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(isLocked);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return await Utils.retryCall(locked, data.retry);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api isFileLockedWriteWithRetry catch error: ', error);
|
||||||
|
}
|
||||||
|
return isLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFileLockedByName(fileName: string, parentId: string) {
|
||||||
|
try {
|
||||||
const id = await this.getNodeIdFromParent(fileName, parentId);
|
const id = await this.getNodeIdFromParent(fileName, parentId);
|
||||||
return await this.isFileLockedWrite(id);
|
return await this.isFileLockedWrite(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- nodes api isFileLockedByName catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,33 +28,58 @@ 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 {
|
export class PeopleApi extends RepoApi {
|
||||||
peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
|
peopleApi = new AdfPeopleApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async createUser(user: PersonModel) {
|
async createUser(user: PersonModel) {
|
||||||
const person = new Person(user);
|
try {
|
||||||
await this.apiAuth();
|
const person = new Person(user);
|
||||||
return await this.peopleApi.createPerson(person);
|
await this.apiAuth();
|
||||||
|
return await this.peopleApi.createPerson(person);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- people api createUser catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getUser(username: string) {
|
async getUser(username: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.peopleApi.getPerson(username);
|
await this.apiAuth();
|
||||||
|
return await this.peopleApi.getPerson(username);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- people api getUser catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateUser(username: string, userDetails?: PersonModel) {
|
async updateUser(username: string, userDetails?: PersonModel) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return this.peopleApi.updatePerson(username, userDetails);
|
await this.apiAuth();
|
||||||
|
return this.peopleApi.updatePerson(username, userDetails);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- people api updateUser catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async disableUser(username: string) {
|
async disableUser(username: string) {
|
||||||
return await this.updateUser(username, { enabled: false });
|
try {
|
||||||
|
return await this.updateUser(username, { enabled: false });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- people api disableUser catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async changePassword(username: string, newPassword: string) {
|
async changePassword(username: string, newPassword: string) {
|
||||||
return await this.updateUser(username, { password: newPassword });
|
try {
|
||||||
|
return await this.updateUser(username, { password: newPassword });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- people api changePassword catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ export class QueriesApi extends RepoApi {
|
|||||||
queriesApi = new AdfQueriesApi(this.alfrescoJsApi);
|
queriesApi = new AdfQueriesApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?: string, password?: string) {
|
constructor(username?: string, password?: string) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async findSites(searchTerm: string) {
|
async findSites(searchTerm: string) {
|
||||||
@@ -40,18 +40,28 @@ export class QueriesApi extends RepoApi {
|
|||||||
fields: ['title']
|
fields: ['title']
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.apiAuth();
|
try {
|
||||||
return this.queriesApi.findSites(searchTerm, data);
|
await this.apiAuth();
|
||||||
|
return this.queriesApi.findSites(searchTerm, data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- queries api findSites catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async findNodes(searchTerm: string) {
|
async findNodes(searchTerm: string) {
|
||||||
const data = {
|
const data = {
|
||||||
term: searchTerm,
|
term: searchTerm,
|
||||||
fields: ['name']
|
fields: ['name']
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.apiAuth();
|
try {
|
||||||
return this.queriesApi.findNodes(searchTerm, data);
|
await this.apiAuth();
|
||||||
|
return this.queriesApi.findNodes(searchTerm, data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- queries api findNodes catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async waitForSites(searchTerm: string, data: any) {
|
async waitForSites(searchTerm: string, data: any) {
|
||||||
@@ -67,7 +77,7 @@ export class QueriesApi extends RepoApi {
|
|||||||
|
|
||||||
return await Utils.retryCall(sites);
|
return await Utils.retryCall(sites);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('-----> catch queries findSites: ', error);
|
console.log('--- queries api waitForSites catch error: ', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,7 +94,7 @@ export class QueriesApi extends RepoApi {
|
|||||||
|
|
||||||
return await Utils.retryCall(nodes);
|
return await Utils.retryCall(nodes);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('-----> catch queries findFilesAndFolders: ', error);
|
console.log('--- queries api waitForFilesAndFolders catch error: ', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,90 +28,105 @@ import { Utils } from '../../../../utilities/utils';
|
|||||||
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';
|
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class SearchApi extends RepoApi {
|
export class SearchApi extends RepoApi {
|
||||||
searchApi = new AdfSearchApi(this.alfrescoJsApi);
|
searchApi = new AdfSearchApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async queryRecentFiles(username: string) {
|
async queryRecentFiles(username: string) {
|
||||||
const data = {
|
const data = {
|
||||||
query: {
|
|
||||||
query: '*',
|
|
||||||
language: 'afts'
|
|
||||||
},
|
|
||||||
filterQueries: [
|
|
||||||
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
|
||||||
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
|
||||||
{ query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"` }
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
await this.apiAuth();
|
|
||||||
return this.searchApi.search(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
async queryNodesNames(searchTerm: string) {
|
|
||||||
const data = {
|
|
||||||
query: {
|
query: {
|
||||||
query: `cm:name:\"${searchTerm}*\"`,
|
query: '*',
|
||||||
language: 'afts'
|
language: 'afts'
|
||||||
},
|
},
|
||||||
filterQueries: [
|
filterQueries: [
|
||||||
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
||||||
|
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
||||||
|
{ query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"` }
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return this.searchApi.search(data);
|
return this.searchApi.search(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- search api queryRecentFiles catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async queryNodesExactNames(searchTerm: string) {
|
async queryNodesNames(searchTerm: string) {
|
||||||
const data = {
|
const data = {
|
||||||
query: {
|
query: {
|
||||||
query: `cm:name:\"${searchTerm}\"`,
|
query: `cm:name:\"${searchTerm}*\"`,
|
||||||
language: 'afts'
|
language: 'afts'
|
||||||
},
|
},
|
||||||
filterQueries: [
|
filterQueries: [
|
||||||
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return this.searchApi.search(data);
|
return this.searchApi.search(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- search api queryNodesNames catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async waitForApi(username, data) {
|
async queryNodesExactNames(searchTerm: string) {
|
||||||
try {
|
const data = {
|
||||||
const recentFiles = async () => {
|
query: {
|
||||||
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
query: `cm:name:\"${searchTerm}\"`,
|
||||||
if ( totalItems !== data.expect) {
|
language: 'afts'
|
||||||
return Promise.reject(totalItems);
|
},
|
||||||
} else {
|
filterQueries: [
|
||||||
return Promise.resolve(totalItems);
|
{ query: `+TYPE:'cm:folder' OR +TYPE:'cm:content'`}
|
||||||
}
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return this.searchApi.search(data);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- search api queryNodesExactNames catch error: ', error);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForApi(username, data) {
|
||||||
|
try {
|
||||||
|
const recentFiles = async () => {
|
||||||
|
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
||||||
|
if ( totalItems !== data.expect) {
|
||||||
|
return Promise.reject(totalItems);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(totalItems);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(recentFiles);
|
return await Utils.retryCall(recentFiles);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('-----> catch search: ', error);
|
console.log('--- search api waitForApi catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async waitForNodes(searchTerm: string, data) {
|
async waitForNodes(searchTerm: string, data) {
|
||||||
try {
|
try {
|
||||||
const nodes = async () => {
|
const nodes = async () => {
|
||||||
const totalItems = (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
const totalItems = (await this.queryNodesNames(searchTerm)).list.pagination.totalItems;
|
||||||
if ( totalItems !== data.expect) {
|
if ( totalItems !== data.expect) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(nodes);
|
return await Utils.retryCall(nodes);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('-----> catch search nodes: ', error);
|
console.log('--- search api waitForNodes catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,63 +28,81 @@ import { Utils } from '../../../../utilities/utils';
|
|||||||
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry } 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);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
}
|
}
|
||||||
|
|
||||||
async shareFileById(id: string, expireDate?: Date): Promise<SharedLinkEntry|null> {
|
async shareFileById(id: string, expireDate?: Date): Promise<SharedLinkEntry|null> {
|
||||||
try {
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
const data = {
|
const data = {
|
||||||
nodeId: id,
|
nodeId: id,
|
||||||
expiresAt: expireDate
|
expiresAt: expireDate
|
||||||
};
|
};
|
||||||
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;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async shareFilesByIds(ids: string[]) {
|
async shareFilesByIds(ids: string[]) {
|
||||||
return await ids.reduce(async (previous: any, current: any) => {
|
try {
|
||||||
await previous;
|
return await ids.reduce(async (previous: any, current: any) => {
|
||||||
return await this.shareFileById(current);
|
await previous;
|
||||||
}, Promise.resolve());
|
return await this.shareFileById(current);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- shared links api shareFilesByIds catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSharedIdOfNode(name: string) {
|
async getSharedIdOfNode(name: string) {
|
||||||
const sharedLinks = (await this.getSharedLinks()).list.entries;
|
try {
|
||||||
const found = sharedLinks.find(sharedLink => sharedLink.entry.name === name);
|
const sharedLinks = (await this.getSharedLinks()).list.entries;
|
||||||
return (found || { entry: { id: null } }).entry.id;
|
const found = sharedLinks.find(sharedLink => sharedLink.entry.name === name);
|
||||||
|
return (found || { entry: { id: null } }).entry.id;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- shared links api getSharedIdOfNode catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async unshareFile(name: string) {
|
async unshareFile(name: string) {
|
||||||
const id = await this.getSharedIdOfNode(name);
|
try {
|
||||||
return await this.sharedlinksApi.deleteSharedLink(id);
|
const id = await this.getSharedIdOfNode(name);
|
||||||
|
return await this.sharedlinksApi.deleteSharedLink(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- shared links api unshareFile catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSharedLinks() {
|
async getSharedLinks() {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sharedlinksApi.listSharedLinks();
|
await this.apiAuth();
|
||||||
|
return await this.sharedlinksApi.listSharedLinks();
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- shared links api getSharedLinks catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data: { expect: number }) {
|
||||||
try {
|
try {
|
||||||
const sharedFiles = async () => {
|
const sharedFiles = async () => {
|
||||||
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
||||||
if ( totalItems !== data.expect ) {
|
if ( totalItems !== data.expect ) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(sharedFiles);
|
return await Utils.retryCall(sharedFiles);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('-----> catch shared: ', error);
|
console.log('--- shared links api waitForApi catch error: ', error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,144 +30,210 @@ import { Utils } from '../../../../utilities/utils';
|
|||||||
import { SitesApi as AdfSiteApi } from '@alfresco/js-api';
|
import { SitesApi as AdfSiteApi } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class SitesApi extends RepoApi {
|
export class SitesApi extends RepoApi {
|
||||||
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
|
sitesApi = new AdfSiteApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSite(siteId: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.getSite(siteId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getSite catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSite(siteId: string) {
|
async getSites() {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.getSite(siteId);
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.listSiteMembershipsForPerson(this.getUsername());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getSites catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getSites() {
|
async getDocLibId(siteId: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.listSiteMembershipsForPerson(this.getUsername());
|
await this.apiAuth();
|
||||||
|
return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getDocLibId catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getDocLibId(siteId: string) {
|
async getVisibility(siteId: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return (await this.sitesApi.listSiteContainers(siteId)).list.entries[0].entry.id;
|
const site = await this.getSite(siteId);
|
||||||
|
return site.entry.visibility;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getVisibility catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getVisibility(siteId: string) {
|
async getDescription(siteId: string) {
|
||||||
const site = await this.getSite(siteId);
|
try {
|
||||||
return site.entry.visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getDescription(siteId: string) {
|
|
||||||
const site = await this.getSite(siteId);
|
const site = await this.getSite(siteId);
|
||||||
return site.entry.description;
|
return site.entry.description;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getDescription catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getTitle(siteId: string) {
|
async getTitle(siteId: string) {
|
||||||
|
try {
|
||||||
const site = await this.getSite(siteId);
|
const site = await this.getSite(siteId);
|
||||||
return site.entry.title;
|
return site.entry.title;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api getTitle catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createSite(title: string, visibility?: string, description?: string, siteId?: string): Promise<SiteEntry|null> {
|
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,
|
||||||
description: description,
|
description: description,
|
||||||
id: siteId || title
|
id: siteId || title
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
return await this.sitesApi.createSite(site);
|
return await this.sitesApi.createSite(site);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('=== create site catch: ', error);
|
console.log('--- sites api createSite catch error: ', error);
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async createSites(titles: string[], visibility?: string) {
|
async createSites(titles: string[], visibility?: string) {
|
||||||
return titles.reduce(async (previous: any, current: any) => {
|
try {
|
||||||
await previous;
|
return titles.reduce(async (previous: any, current: any) => {
|
||||||
return await this.createSite(current, visibility);
|
await previous;
|
||||||
}, Promise.resolve());
|
return await this.createSite(current, visibility);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api createSites catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteSite(siteId: string, permanent: boolean = true) {
|
async deleteSite(siteId: string, permanent: boolean = true) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.deleteSite(siteId, { permanent });
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.deleteSite(siteId, { permanent });
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api deleteSite catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteSites(siteIds: string[], permanent: boolean = true) {
|
async deleteSites(siteIds: string[], permanent: boolean = true) {
|
||||||
return siteIds.reduce(async (previous, current) => {
|
try {
|
||||||
await previous;
|
return siteIds.reduce(async (previous, current) => {
|
||||||
return await this.deleteSite(current, permanent);
|
await previous;
|
||||||
}, Promise.resolve());
|
return await this.deleteSite(current, permanent);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api deleteSites catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteAllUserSites(permanent: boolean = true) {
|
async deleteAllUserSites(permanent: boolean = true) {
|
||||||
|
try {
|
||||||
const siteIds = (await this.getSites()).list.entries.map(entries => entries.entry.id);
|
const siteIds = (await this.getSites()).list.entries.map(entries => entries.entry.id);
|
||||||
|
|
||||||
return await siteIds.reduce(async (previous, current) => {
|
return await siteIds.reduce(async (previous, current) => {
|
||||||
await previous;
|
await previous;
|
||||||
return await this.deleteSite(current, permanent);
|
return await this.deleteSite(current, permanent);
|
||||||
}, Promise.resolve());
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api deleteAllUserSites catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async updateSiteMember(siteId: string, userId: string, role: string) {
|
async updateSiteMember(siteId: string, userId: string, role: string) {
|
||||||
const siteRole = <SiteMemberRoleBody>{
|
const siteRole = <SiteMemberRoleBody>{
|
||||||
role: role
|
role: role
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole);
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.updateSiteMembership(siteId, userId, siteRole);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api updateSiteMember catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async addSiteMember(siteId: string, userId: string, role: string) {
|
async addSiteMember(siteId: string, userId: string, role: string) {
|
||||||
const memberBody = <SiteMemberBody>{
|
const memberBody = <SiteMemberBody>{
|
||||||
id: userId,
|
id: userId,
|
||||||
role: role
|
role: role
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.createSiteMembership(siteId, memberBody);
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.createSiteMembership(siteId, memberBody);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api addSiteMember catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async deleteSiteMember(siteId: string, userId: string) {
|
async deleteSiteMember(siteId: string, userId: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.sitesApi.deleteSiteMembership(siteId, userId);
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.deleteSiteMembership(siteId, userId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api deleteSiteMember catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async requestToJoin(siteId: string): Promise<SiteMembershipRequestEntry|null> {
|
async requestToJoin(siteId: string): Promise<SiteMembershipRequestEntry|null> {
|
||||||
const body = {
|
const body = {
|
||||||
id: siteId
|
id: siteId
|
||||||
};
|
};
|
||||||
await this.apiAuth();
|
|
||||||
try {
|
|
||||||
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('====== requestToJoin catch ', error);
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async hasMembershipRequest(siteId: string) {
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.sitesApi.createSiteMembershipRequestForPerson('-me-', body);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api requestToJoin catch error: ', error);
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async hasMembershipRequest(siteId: string) {
|
||||||
|
try {
|
||||||
await this.apiAuth();
|
await this.apiAuth();
|
||||||
const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map(e => e.entry.id);
|
const requests = (await this.sitesApi.getSiteMembershipRequests('-me-')).list.entries.map(e => e.entry.id);
|
||||||
return requests.includes(siteId);
|
return requests.includes(siteId);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- sites api hasMembershipRequest catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data: { expect: number }) {
|
||||||
try {
|
try {
|
||||||
const sites = async () => {
|
const sites = async () => {
|
||||||
const totalItems = (await this.getSites()).list.pagination.totalItems;
|
const totalItems = (await this.getSites()).list.pagination.totalItems;
|
||||||
if ( totalItems !== data.expect ) {
|
if ( totalItems !== data.expect ) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return await Utils.retryCall(sites);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('-----> catch sites: ', error);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await Utils.retryCall(sites);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('sites api waitForApi catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -28,53 +28,71 @@ 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 {
|
export class TrashcanApi extends RepoApi {
|
||||||
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
|
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
async permanentlyDelete(id: string) {
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.trashcanApi.deleteDeletedNode(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- trashcan api permanentlyDelete catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async permanentlyDelete(id: string) {
|
async restore(id: string) {
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.trashcanApi.deleteDeletedNode(id);
|
await this.apiAuth();
|
||||||
|
return await this.trashcanApi.restoreDeletedNode(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- trashcan api restore catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async restore(id: string) {
|
async getDeletedNodes() {
|
||||||
await this.apiAuth();
|
const opts = {
|
||||||
return await this.trashcanApi.restoreDeletedNode(id);
|
maxItems: 1000
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.trashcanApi.listDeletedNodes(opts);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- trashcan api getDeletedNodes catch error: ', error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async getDeletedNodes() {
|
async emptyTrash() {
|
||||||
const opts = {
|
try {
|
||||||
maxItems: 1000
|
const ids = (await this.getDeletedNodes()).list.entries.map(entries => entries.entry.id);
|
||||||
};
|
|
||||||
await this.apiAuth();
|
return await ids.reduce(async (previous, current) => {
|
||||||
return await this.trashcanApi.listDeletedNodes(opts);
|
await previous;
|
||||||
|
return await this.permanentlyDelete(current);
|
||||||
|
}, Promise.resolve());
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- trashcan api emptyTrash catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async emptyTrash() {
|
async waitForApi(data: { expect: number }) {
|
||||||
const ids = (await this.getDeletedNodes()).list.entries.map(entries => entries.entry.id);
|
try {
|
||||||
|
const deletedFiles = async () => {
|
||||||
return await ids.reduce(async (previous, current) => {
|
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
|
||||||
await previous;
|
if ( totalItems !== data.expect) {
|
||||||
return await this.permanentlyDelete(current);
|
return Promise.reject(totalItems);
|
||||||
}, Promise.resolve());
|
} else {
|
||||||
}
|
return Promise.resolve(totalItems);
|
||||||
|
|
||||||
async waitForApi(data) {
|
|
||||||
try {
|
|
||||||
const deletedFiles = async () => {
|
|
||||||
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
|
|
||||||
if ( totalItems !== data.expect) {
|
|
||||||
return Promise.reject(totalItems);
|
|
||||||
} else {
|
|
||||||
return Promise.resolve(totalItems);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return await Utils.retryCall(deletedFiles);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('-----> catch trash: ', error);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await Utils.retryCall(deletedFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- trashcan api waitForApi catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,39 +30,40 @@ import { UploadApi as AdfUploadApi } from '@alfresco/js-api';
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
export class UploadApi extends RepoApi {
|
export class UploadApi extends RepoApi {
|
||||||
upload = new AdfUploadApi(this.alfrescoJsApi);
|
upload = new AdfUploadApi(this.alfrescoJsApi);
|
||||||
|
|
||||||
constructor(username?, password?) {
|
constructor(username?, password?) {
|
||||||
super(username, password);
|
super(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
async uploadFile(fileName: string, parentFolderId: string = '-my-') {
|
||||||
|
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
|
||||||
|
const opts = {
|
||||||
|
name: file.name,
|
||||||
|
nodeType: 'cm:content'
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.apiAuth();
|
||||||
|
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- upload api uploadFile catch error: ', error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async uploadFile(fileName: string, parentFolderId: string = '-my-') {
|
async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) {
|
||||||
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
|
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
|
||||||
const opts = {
|
const opts = {
|
||||||
name: file.name,
|
name: newName,
|
||||||
nodeType: 'cm:content'
|
nodeType: 'cm:content'
|
||||||
};
|
};
|
||||||
|
|
||||||
await this.apiAuth();
|
try {
|
||||||
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
|
await this.apiAuth();
|
||||||
|
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('--- upload api uploadFileWithRename catch error: ', error);
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadFileWithRename(fileName: string, parentFolderId: string = '-my-', newName: string) {
|
|
||||||
const file = fs.createReadStream(`${E2E_ROOT_PATH}/resources/test-files/${fileName}`);
|
|
||||||
const opts = {
|
|
||||||
name: newName,
|
|
||||||
nodeType: 'cm:content'
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await this.apiAuth();
|
|
||||||
return await this.upload.uploadFile(file, '', parentFolderId, null, opts);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('=== catch upload file with rename: ', error);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -81,7 +81,7 @@ export class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async waitUntilElementClickable(element: ElementFinder) {
|
static async waitUntilElementClickable(element: ElementFinder) {
|
||||||
return await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
|
await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async typeInField(elem: ElementFinder, value: string) {
|
static async typeInField(elem: ElementFinder, value: string) {
|
||||||
@@ -156,22 +156,21 @@ export class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async pressEscape() {
|
static async pressEscape() {
|
||||||
return await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
await browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async pressTab() {
|
static async pressTab() {
|
||||||
return await browser.actions().sendKeys(protractor.Key.TAB).perform();
|
await browser.actions().sendKeys(protractor.Key.TAB).perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
static async getBrowserLog() {
|
static async getBrowserLog() {
|
||||||
return await browser.manage().logs().get('browser');
|
return browser.manage().logs().get('browser');
|
||||||
}
|
}
|
||||||
|
|
||||||
static formatDate(date: string) {
|
static formatDate(date: string) {
|
||||||
return new Date(date).toLocaleDateString('en-US');
|
return new Date(date).toLocaleDateString('en-US');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static async uploadFileNewVersion(fileFromOS: string) {
|
static async uploadFileNewVersion(fileFromOS: string) {
|
||||||
const el = browser.element(by.id('app-upload-file-version'));
|
const el = browser.element(by.id('app-upload-file-version'));
|
||||||
await el.sendKeys(`${E2E_ROOT_PATH}/resources/test-files/${fileFromOS}`);
|
await el.sendKeys(`${E2E_ROOT_PATH}/resources/test-files/${fileFromOS}`);
|
||||||
|
Reference in New Issue
Block a user