diff --git a/e2e/components/breadcrumb/breadcrumb.ts b/e2e/components/breadcrumb/breadcrumb.ts index 1bc3e6739..543f7a978 100755 --- a/e2e/components/breadcrumb/breadcrumb.ts +++ b/e2e/components/breadcrumb/breadcrumb.ts @@ -23,29 +23,14 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by } from 'protractor'; import { Component } from '../component'; export class Breadcrumb extends Component { - private static selectors = { - root: 'adf-breadcrumb', - item: '.adf-breadcrumb-item', - currentItem: '.adf-breadcrumb-item-current' - }; - - items: ElementArrayFinder = this.component.all(by.css(Breadcrumb.selectors.item)); - currentItem: ElementFinder = this.component.element(by.css(Breadcrumb.selectors.currentItem)); + items = this.allByCss('.adf-breadcrumb-item'); + currentItem = this.byCss('.adf-breadcrumb-item-current'); constructor(ancestor?: string) { - super(Breadcrumb.selectors.root, ancestor); - } - - getNthItem(nth: number): ElementFinder { - return this.items.get(nth - 1); - } - - async getItemsCount(): Promise { - return this.items.count(); + super('adf-breadcrumb', ancestor); } async getAllItems(): Promise { @@ -56,20 +41,8 @@ export class Breadcrumb extends Component { return items; } - getCurrentItem(): ElementFinder { - return this.currentItem; - } - - async getCurrentItemName(): Promise { - return this.currentItem.getText(); - } - async clickItem(name: string): Promise { - const elem = this.component.element(by.css(`${Breadcrumb.selectors.item}[title=${name}]`)); + const elem = this.byCss(`.adf-breadcrumb-item[title=${name}]`); await elem.click(); } - - async getNthItemTooltip(nth: number): Promise { - return this.getNthItem(nth).getAttribute('title'); - } } diff --git a/e2e/components/breadcrumb/dropdown-breadcrumb.ts b/e2e/components/breadcrumb/dropdown-breadcrumb.ts index 9a5cbed69..a31740814 100755 --- a/e2e/components/breadcrumb/dropdown-breadcrumb.ts +++ b/e2e/components/breadcrumb/dropdown-breadcrumb.ts @@ -23,39 +23,33 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by, browser } from 'protractor'; import { Component } from '../component'; +import { waitForPresence, waitForStaleness } from '../../utilities/utils'; export class DropDownBreadcrumb extends Component { - private static selectors = { - root: '.adf-dropdown-breadcrumb', - trigger: '.adf-dropdown-breadcrumb-trigger', - - currentFolder: '.adf-current-folder', - - pathOption: '.adf-dropdown-breadcrumb-path-option .mat-option-text' - }; - - trigger: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.trigger)); - pathItems: ElementArrayFinder = browser.$$(DropDownBreadcrumb.selectors.pathOption); - pathItemsContainer: ElementFinder = browser.element(by.css('.mat-select-panel')); - currentFolder: ElementFinder = this.component.element(by.css(DropDownBreadcrumb.selectors.currentFolder)); + pathOptionCss = '.adf-dropdown-breadcrumb-path-option .mat-option-text'; + trigger = this.byCss('.adf-dropdown-breadcrumb-trigger'); + pathItems = browser.$$(this.pathOptionCss); + pathItemsContainer = this.byCss('.mat-select-panel', browser); + currentFolder = this.byCss('.adf-current-folder'); constructor(ancestor?: string) { - super(DropDownBreadcrumb.selectors.root, ancestor); + super('.adf-dropdown-breadcrumb', ancestor); } async waitForPathListDropdownToOpen(): Promise { - await browser.wait(EC.presenceOf(this.pathItemsContainer), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to open'); + return waitForPresence( + this.pathItemsContainer, + 'Timeout waiting for breadcrumb dropdown to open' + ); } async waitForPathListDropdownToClose(): Promise { - await browser.wait(EC.stalenessOf(browser.$(DropDownBreadcrumb.selectors.pathOption)), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for breadcrumb dropdown to close'); - } - - async getCurrentFolderName(): Promise { - return this.currentFolder.getText(); + return waitForStaleness( + browser.$(this.pathOptionCss), + 'Timeout waiting for breadcrumb dropdown to close' + ); } async openPath(): Promise { @@ -64,7 +58,9 @@ export class DropDownBreadcrumb extends Component { } async clickPathItem(name: string): Promise { - const elem = browser.element(by.cssContainingText(DropDownBreadcrumb.selectors.pathOption, name)); + const elem = browser.element( + by.cssContainingText(this.pathOptionCss, name) + ); await elem.click(); } diff --git a/e2e/components/component.ts b/e2e/components/component.ts index 6a43ea35e..05727340a 100755 --- a/e2e/components/component.ts +++ b/e2e/components/component.ts @@ -23,21 +23,60 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ExpectedConditions as EC, browser } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../configs'; +import { + ElementFinder, + browser, + by, + ElementArrayFinder, + ProtractorBrowser +} from 'protractor'; +import { waitForPresence } from '../utilities/utils'; export abstract class Component { component: ElementFinder; + protected byCss( + css: string, + root: ElementFinder | ProtractorBrowser = this.component + ): ElementFinder { + return root.element(by.css(css)); + } + + protected byCssText( + css: string, + text: string, + root: ElementFinder | ProtractorBrowser = this.component + ): ElementFinder { + return root.element(by.cssContainingText(css, text)); + } + + protected byId( + css: string, + root: ElementFinder | ProtractorBrowser = this.component + ): ElementFinder { + return root.element(by.id(css)); + } + + protected allByCss( + css: string, + root: ElementFinder | ProtractorBrowser = this.component + ): ElementArrayFinder { + return root.all(by.css(css)); + } + constructor(selector: string, ancestor?: string) { const locator = selector; this.component = ancestor - ? browser.$$(ancestor).first().$$(locator).first() + ? browser + .$$(ancestor) + .first() + .$$(locator) + .first() : browser.$$(locator).first(); } async wait() { - await browser.wait(EC.presenceOf(this.component), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.component); } } diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index ed5dd0ad1..ca744ad88 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -23,91 +23,61 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; +import { ElementFinder, ElementArrayFinder, by, browser, protractor } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Component } from '../component'; import { Menu } from '../menu/menu'; -import { Utils } from '../../utilities/utils'; +import { Utils, waitForPresence, waitForClickable } from '../../utilities/utils'; export class DataTable extends Component { private static selectors = { - root: 'adf-datatable', - - head: '.adf-datatable-header', columnHeader: '.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value', sortedColumnHeader: ` .adf-datatable__header--sorted-asc .adf-datatable-cell-value, .adf-datatable__header--sorted-desc .adf-datatable-cell-value `, - - body: '.adf-datatable-body', row: '.adf-datatable-row[role]', - selectedRow: '.adf-datatable-row.adf-is-selected', cell: '.adf-datatable-cell-container', - locationLink: '.aca-location-link', - nameLink: '.adf-datatable-link', - libraryRole: 'adf-library-role-column', - - selectedIcon: '.mat-icon[class*="selected"]', - lockIcon: 'img[src*="lock"]', lockOwner: '.aca-locked-by', - - emptyListContainer: 'div.adf-no-content-container', - emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder', - - emptyListTitle: '.adf-empty-content__title', - emptyListSubtitle: '.adf-empty-content__subtitle', - - emptySearchText: '.empty-search__text', - searchResultsRow: 'aca-search-results-row', searchResultsRowLine: '.line', - searchResultsNameLink: '.link' }; - head: ElementFinder = this.component.element(by.css(DataTable.selectors.head)); - body: ElementFinder = this.component.element(by.css(DataTable.selectors.body)); + head = this.byCss('.adf-datatable-header'); + body = this.byCss('.adf-datatable-body'); + emptyList = this.byCss('div.adf-no-content-container'); + emptyFolderDragAndDrop = this.byCss('.adf-empty-list_template .adf-empty-folder'); + emptyListTitle = this.byCss('.adf-empty-content__title'); + emptyListSubtitle = this.byCss('.adf-empty-content__subtitle'); + emptySearchText = this.byCss('.empty-search__text'); + selectedRow = this.byCss('.adf-datatable-row.adf-is-selected'); - emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer)); - emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop)); - emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle)); - emptyListSubtitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListSubtitle)); - - emptySearchText: ElementFinder = this.component.element(by.css(DataTable.selectors.emptySearchText)); - - menu: Menu = new Menu(); + menu = new Menu(); constructor(ancestor?: string) { - super(DataTable.selectors.root, ancestor); + super('adf-datatable', ancestor); } - // Wait methods (waits for elements) async waitForHeader(): Promise { - await browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT, '--- timeout waitForHeader ---'); + return waitForPresence(this.head, '--- timeout waitForHeader ---'); } async waitForBody(): Promise { - await browser.wait(EC.presenceOf(this.body), BROWSER_WAIT_TIMEOUT, '--- timeout waitForBody ---'); + return waitForPresence(this.body, '--- timeout waitForBody ---'); } async waitForEmptyState(): Promise { - await browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT); + return waitForPresence(this.emptyList); } - // Header/Column methods - getColumnHeaders(): ElementArrayFinder { + private getColumnHeaders(): ElementArrayFinder { const locator = by.css(DataTable.selectors.columnHeader); return this.head.all(locator); } async getColumnHeadersText(): Promise { - const el = this.getColumnHeaders(); - return el.getText(); - } - - getNthColumnHeader(nth: number): ElementFinder { - return this.getColumnHeaders().get(nth - 1); + return this.getColumnHeaders().getText(); } getColumnHeaderByLabel(label: string): ElementFinder { @@ -115,7 +85,7 @@ export class DataTable extends Component { return this.head.element(locator); } - getSortedColumnHeader(): ElementFinder { + private getSortedColumnHeader(): ElementFinder { const locator = by.css(DataTable.selectors.sortedColumnHeader); return this.head.element(locator); } @@ -137,15 +107,7 @@ export class DataTable extends Component { return 'none'; } - async sortByColumn(columnName: string): Promise { - const column = this.getColumnHeaderByLabel(columnName); - const click = browser.actions().mouseMove(column).click(); - - await click.perform(); - } - - // Rows methods - getRows(): ElementArrayFinder { + private getRows(): ElementArrayFinder { return this.body.all(by.css(DataTable.selectors.row)); } @@ -153,12 +115,8 @@ export class DataTable extends Component { return this.getRows().count(); } - async waitForRowToBeSelected(): Promise { - await browser.wait(EC.presenceOf(this.component.element(by.css(DataTable.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT, 'timeout waiting for row to be selected'); - } - - getSelectedRows(): ElementArrayFinder { - return this.body.all(by.css(DataTable.selectors.selectedRow)); + private getSelectedRows(): ElementArrayFinder { + return this.body.all(by.css('.adf-datatable-row.adf-is-selected')); } async getSelectedRowsNames(): Promise { @@ -172,10 +130,6 @@ export class DataTable extends Component { return this.getSelectedRows().count(); } - getNthRow(nth: number): ElementFinder { - return this.getRows().get(nth - 1); - } - getRowByName(name: string, location: string = ''): ElementFinder { if (location) { return this.body.all(by.cssContainingText(DataTable.selectors.row, name)) @@ -193,15 +147,15 @@ export class DataTable extends Component { return this.getRowCells(itemName).count(); } - getRowFirstCell(name: string, location: string = ''): ElementFinder { + private getRowFirstCell(name: string, location: string = ''): ElementFinder { return this.getRowCells(name, location).get(0); } - getRowNameCell(name: string, location: string = ''): ElementFinder { + private getRowNameCell(name: string, location: string = ''): ElementFinder { return this.getRowCells(name, location).get(1); } - getRowNameCellSpan(name: string, location: string = ''): ElementFinder { + private getRowNameCellSpan(name: string, location: string = ''): ElementFinder { return this.getRowNameCell(name, location).$('span'); } @@ -210,17 +164,17 @@ export class DataTable extends Component { } async hasCheckMarkIcon(itemName: string, location: string = ''): Promise { - const row: ElementFinder = this.getRowByName(itemName, location); - return row.element(by.css(DataTable.selectors.selectedIcon)).isPresent(); + const row = this.getRowByName(itemName, location); + return row.element(by.css('.mat-icon[class*="selected"]')).isPresent(); } async hasLockIcon(itemName: string, location: string = ''): Promise { - const row: ElementFinder = this.getRowByName(itemName, location); - return row.element(by.css(DataTable.selectors.lockIcon)).isPresent(); + const row = this.getRowByName(itemName, location); + return row.element(by.css('img[src*="lock"]')).isPresent(); } - async hasLockOwnerInfo(itemName: string, location: string = ''): Promise { - const row: ElementFinder = this.getRowByName(itemName, location); + private async hasLockOwnerInfo(itemName: string, location: string = ''): Promise { + const row = this.getRowByName(itemName, location); return row.element(by.css(DataTable.selectors.lockOwner)).isPresent(); } @@ -232,19 +186,18 @@ export class DataTable extends Component { return ''; } - getNameLink(itemName: string): ElementFinder { - return this.getRowNameCell(itemName).$(DataTable.selectors.nameLink); + private getNameLink(itemName: string): ElementFinder { + return this.getRowNameCell(itemName).$('.adf-datatable-link'); } async hasLinkOnName(itemName: string): Promise { return this.getNameLink(itemName).isPresent(); } - // Navigation/selection methods async doubleClickOnRowByName(name: string, location: string = ''): Promise { try { const item = this.getRowFirstCell(name, location); - await Utils.waitUntilElementClickable(item); + await waitForClickable(item); await browser.actions().mouseMove(item).perform(); await browser.actions().doubleClick().perform(); } catch (error) { @@ -320,8 +273,8 @@ export class DataTable extends Component { await browser.actions().click(protractor.Button.RIGHT).perform(); } - getItemLocationEl(name: string): ElementFinder { - return this.getRowByName(name).element(by.css(DataTable.selectors.locationLink)); + private getItemLocationEl(name: string): ElementFinder { + return this.getRowByName(name).element(by.css('.aca-location-link')); } async getItemLocation(name: string): Promise { @@ -342,17 +295,12 @@ export class DataTable extends Component { await this.getItemLocationEl(name).click(); } - // empty state methods async isEmpty(): Promise { return this.emptyList.isPresent(); } - async isEmptyWithDragAndDrop(): Promise { - return this.emptyFolderDragAndDrop.isDisplayed(); - } - async getEmptyDragAndDropText(): Promise { - const isEmpty = await this.isEmptyWithDragAndDrop(); + const isEmpty = await this.emptyFolderDragAndDrop.isDisplayed(); if (isEmpty) { return this.emptyFolderDragAndDrop.getText(); } @@ -378,17 +326,13 @@ export class DataTable extends Component { async getEmptyListText(): Promise { const isEmpty = await this.isEmpty(); if (isEmpty) { - return this.component.element(by.css('adf-custom-empty-content-template')).getText(); + return this.byCss('adf-custom-empty-content-template').getText(); } return ''; } - async getEmptySearchResultsText(): Promise { - return this.emptySearchText.getText(); - } - async getCellsContainingName(name: string): Promise { - const rows: ElementArrayFinder = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); + const rows = this.getRows().all(by.cssContainingText(DataTable.selectors.cell, name)); const cellsText: string[] = await rows.map(async cell => { return cell.getText(); }); @@ -401,14 +345,14 @@ export class DataTable extends Component { } async getLibraryRole(name: string): Promise { - return this.getRowByName(name).element(by.css(DataTable.selectors.libraryRole)).getText(); + return this.getRowByName(name).element(by.css('adf-library-role-column')).getText(); } async isItemPresent(name: string, location? : string): Promise { return this.getRowByName(name, location).isPresent(); } - async getEntireDataTableText(): Promise { + private async getEntireDataTableText(): Promise { const text: string[] = await this.getRows().map((row) => { return row.all(by.css(DataTable.selectors.cell)).map(async cell => { return cell.getText(); @@ -433,7 +377,7 @@ export class DataTable extends Component { }, {}); } - getSearchResultsRows(): ElementArrayFinder { + private getSearchResultsRows(): ElementArrayFinder { return this.body.all(by.css(DataTable.selectors.searchResultsRow)); } @@ -441,7 +385,7 @@ export class DataTable extends Component { return this.getSearchResultsRows().get(nth - 1); } - getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { + private getSearchResultsRowByName(name: string, location: string = ''): ElementFinder { if (location) { return this.body.all(by.cssContainingText(DataTable.selectors.searchResultsRow, name)) .filter(async (elem) => browser.isElementPresent(elem.element(by.cssContainingText(DataTable.selectors.searchResultsRowLine, location)))) @@ -450,7 +394,7 @@ export class DataTable extends Component { return this.body.element(by.cssContainingText(DataTable.selectors.searchResultsRow, name)); } - getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder { + private getSearchResultRowLines(name: string, location: string = ''): ElementArrayFinder { return this.getSearchResultsRowByName(name, location).all(by.css(DataTable.selectors.searchResultsRowLine)); } @@ -458,7 +402,7 @@ export class DataTable extends Component { return this.getSearchResultRowLines(name, location).count(); } - getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder { + private getSearchResultNthLine(name: string, location: string = '', index: number): ElementFinder { return this.getSearchResultRowLines(name, location).get(index); } @@ -478,8 +422,8 @@ export class DataTable extends Component { return this.getSearchResultNthLine(name, location, 3).getText(); } - getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder { - return this.getSearchResultsRowByName(itemName, location).$(DataTable.selectors.searchResultsNameLink); + private getSearchResultNameLink(itemName: string, location: string = ''): ElementFinder { + return this.getSearchResultsRowByName(itemName, location).$('.link'); } async hasLinkOnSearchResultName(itemName: string, location: string = ''): Promise { diff --git a/e2e/components/datetime-picker/datetime-picker.ts b/e2e/components/datetime-picker/datetime-picker.ts index 3340f4d4c..bfb23abaf 100755 --- a/e2e/components/datetime-picker/datetime-picker.ts +++ b/e2e/components/datetime-picker/datetime-picker.ts @@ -23,44 +23,24 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by, browser } from 'protractor'; import { Component } from '../component'; import * as moment from 'moment'; -import { isPresentAndDisplayed } from '../../utilities/utils'; +import { isPresentAndDisplayed, waitForStaleness } from '../../utilities/utils'; export class DateTimePicker extends Component { - private static selectors = { - root: '.mat-datetimepicker-popup', - - header: '.mat-datetimepicker-calendar-header', - year: '.mat-datetimepicker-calendar-header-year', - date: '.mat-datetimepicker-calendar-header-date', - - content: '.mat-datetimepicker-calendar-content', - dayPicker: 'mat-datetimepicker-month-view', - - today: '.mat-datetimepicker-calendar-body-today', - firstActiveDay: '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content', - }; - - calendar: ElementFinder = browser.element(by.css(DateTimePicker.selectors.root)); - headerDate: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.date)); - headerYear: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.year)); - dayPicker: ElementFinder = this.component.element(by.css(DateTimePicker.selectors.dayPicker)); - - rootElemLocator = by.css(DateTimePicker.selectors.root); + calendar = this.byCss('.mat-datetimepicker-popup', browser); + headerDate = this.byCss('.mat-datetimepicker-calendar-header-date'); + headerYear = this.byCss('.mat-datetimepicker-calendar-header-year'); + dayPicker = this.byCss('mat-datetimepicker-month-view'); + rootElemLocator = by.css('.mat-datetimepicker-popup'); constructor(ancestor?: string) { - super(DateTimePicker.selectors.root, ancestor); - } - - async waitForDateTimePickerToOpen(): Promise { - await browser.wait(EC.presenceOf(this.calendar), BROWSER_WAIT_TIMEOUT); + super('.mat-datetimepicker-popup', ancestor); } async waitForDateTimePickerToClose(): Promise { - await browser.wait(EC.stalenessOf(this.calendar), BROWSER_WAIT_TIMEOUT); + return waitForStaleness(this.calendar); } async isCalendarOpen(): Promise { @@ -69,21 +49,14 @@ export class DateTimePicker extends Component { return isPresentAndDisplayed(element); } - async getDate(): Promise { - return this.headerDate.getText(); - } - - async getYear(): Promise { - return this.headerYear.getText(); - } - async setDefaultDay(): Promise { const today = moment(); const tomorrow = today.add(1, 'day'); const dayOfTomorrow = tomorrow.date(); - const date = await this.getDate(); - const year = await this.getYear(); - const elem = this.dayPicker.element(by.cssContainingText(DateTimePicker.selectors.firstActiveDay, `${dayOfTomorrow}`)); + const date = await this.headerDate.getText(); + const year = await this.headerYear.getText(); + const firstActiveDay = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content'; + const elem = this.dayPicker.element(by.cssContainingText(firstActiveDay, `${dayOfTomorrow}`)); await elem.click(); return `${date} ${year}`; } diff --git a/e2e/components/dialog/confirm-dialog.ts b/e2e/components/dialog/confirm-dialog.ts index f5a8fe416..aa7bd88f0 100755 --- a/e2e/components/dialog/confirm-dialog.ts +++ b/e2e/components/dialog/confirm-dialog.ts @@ -25,20 +25,17 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; +import { isPresentAndEnabled } from '../../utilities/utils'; export class ConfirmDialog extends GenericDialog { - private static selectors = { - root: 'adf-confirm-dialog', - - okButton: by.buttonText('OK'), - cancelButton: by.buttonText('Cancel'), - keepButton: by.buttonText('Keep'), - deleteButton: by.buttonText('Delete'), - removeButton: by.buttonText('Remove') - } + okButton = this.childElement(by.buttonText('OK')); + cancelButton = this.childElement(by.buttonText('Cancel')); + keepButton = this.childElement(by.buttonText('Keep')); + deleteButton = this.childElement(by.buttonText('Delete')); + removeButton = this.childElement(by.buttonText('Remove')); constructor() { - super(ConfirmDialog.selectors.root); + super('adf-confirm-dialog'); } async getText(): Promise { @@ -46,43 +43,22 @@ export class ConfirmDialog extends GenericDialog { } async isOkEnabled(): Promise { - return this.isButtonEnabled(ConfirmDialog.selectors.okButton); + return isPresentAndEnabled(this.okButton); } async isCancelEnabled(): Promise { - return this.isButtonEnabled(ConfirmDialog.selectors.cancelButton); + return isPresentAndEnabled(this.cancelButton); } async isKeepEnabled(): Promise { - return this.isButtonEnabled(ConfirmDialog.selectors.keepButton); + return isPresentAndEnabled(this.keepButton); } async isDeleteEnabled(): Promise { - return this.isButtonEnabled(ConfirmDialog.selectors.deleteButton); + return isPresentAndEnabled(this.deleteButton); } async isRemoveEnabled(): Promise { - return this.isButtonEnabled(ConfirmDialog.selectors.removeButton); + return isPresentAndEnabled(this.removeButton); } - - async clickOk(): Promise { - await this.clickButton(ConfirmDialog.selectors.okButton); - } - - async clickCancel(): Promise { - await this.clickButton(ConfirmDialog.selectors.cancelButton); - } - - async clickKeep(): Promise { - await this.clickButton(ConfirmDialog.selectors.keepButton); - } - - async clickDelete(): Promise { - await this.clickButton(ConfirmDialog.selectors.deleteButton); - } - - async clickRemove(): Promise { - await this.clickButton(ConfirmDialog.selectors.removeButton); - } - } diff --git a/e2e/components/dialog/content-node-selector-dialog.ts b/e2e/components/dialog/content-node-selector-dialog.ts index 78abb9e28..104ad195c 100755 --- a/e2e/components/dialog/content-node-selector-dialog.ts +++ b/e2e/components/dialog/content-node-selector-dialog.ts @@ -23,73 +23,38 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by, browser, protractor } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { Utils, isPresentAndDisplayed } from '../../utilities/utils'; +import { Utils, isPresentAndDisplayed, waitForStaleness, waitForPresence, isPresentAndEnabled, waitForClickable } from '../../utilities/utils'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DataTable } from '../data-table/data-table'; export class ContentNodeSelectorDialog extends GenericDialog { - private static selectors = { - root: '.adf-content-node-selector-dialog', + cancelButton = this.childElement(by.css('[data-automation-id="content-node-selector-actions-cancel"]')); + copyButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy')); + moveButton = this.childElement(by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move')); - locationDropDown: 'site-dropdown-container', - locationOption: '.mat-option .mat-option-text', + locationDropDown = this.rootElem.element(by.id('site-dropdown-container')); + locationPersonalFiles = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'Personal Files')); + locationFileLibraries = browser.element(by.cssContainingText('.mat-option .mat-option-text', 'File Libraries')); - dataTable: '.adf-datatable-body', - selectedRow: '.adf-is-selected', + searchInput = this.rootElem.element(by.css('#searchInput')); + toolbarTitle = this.rootElem.element(by.css('.adf-toolbar-title')); - searchInput: '#searchInput', - toolbarTitle: '.adf-toolbar-title', - - cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]'), - copyButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Copy'), - moveButton: by.cssContainingText('[data-automation-id="content-node-selector-actions-choose"]', 'Move') - }; - - locationDropDown: ElementFinder = this.rootElem.element(by.id(ContentNodeSelectorDialog.selectors.locationDropDown)); - locationPersonalFiles: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'Personal Files')); - locationFileLibraries: ElementFinder = browser.element(by.cssContainingText(ContentNodeSelectorDialog.selectors.locationOption, 'File Libraries')); - - searchInput: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.searchInput)); - toolbarTitle: ElementFinder = this.rootElem.element(by.css(ContentNodeSelectorDialog.selectors.toolbarTitle)); - - breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb(); - dataTable: DataTable = new DataTable(ContentNodeSelectorDialog.selectors.root); + breadcrumb = new DropDownBreadcrumb(); + dataTable = new DataTable('.adf-content-node-selector-dialog'); constructor() { - super(ContentNodeSelectorDialog.selectors.root); - } - - async waitForDropDownToOpen(): Promise { - await browser.wait(EC.presenceOf(this.locationPersonalFiles), BROWSER_WAIT_TIMEOUT); + super('.adf-content-node-selector-dialog'); } async waitForDropDownToClose(): Promise { - await browser.wait(EC.stalenessOf(browser.$(ContentNodeSelectorDialog.selectors.locationOption)), BROWSER_WAIT_TIMEOUT); - } - - async waitForRowToBeSelected(): Promise { - await browser.wait(EC.presenceOf(browser.element(by.css(ContentNodeSelectorDialog.selectors.selectedRow))), BROWSER_WAIT_TIMEOUT); - } - - async clickCancel(): Promise { - await this.clickButton(ContentNodeSelectorDialog.selectors.cancelButton); - await this.waitForDialogToClose(); - } - - async clickCopy(): Promise { - await this.clickButton(ContentNodeSelectorDialog.selectors.copyButton); - } - - async clickMove(): Promise { - await this.clickButton(ContentNodeSelectorDialog.selectors.moveButton); + await waitForStaleness(browser.$('.mat-option .mat-option-text')) } async selectLocation(location: 'Personal Files' | 'File Libraries'): Promise { await this.locationDropDown.click(); - await this.waitForDropDownToOpen(); + await waitForPresence(this.locationPersonalFiles); if (location === 'Personal Files') { await this.locationPersonalFiles.click(); @@ -102,13 +67,9 @@ export class ContentNodeSelectorDialog extends GenericDialog { async selectDestination(folderName: string): Promise { const row = this.dataTable.getRowByName(folderName); - await Utils.waitUntilElementClickable(row); + await waitForClickable(row); await row.click(); - await this.waitForRowToBeSelected(); - } - - async isSearchInputPresent(): Promise { - return this.searchInput.isPresent(); + await waitForPresence(browser.element(by.css('.adf-is-selected'))); } async isSelectLocationDropdownDisplayed(): Promise { @@ -116,11 +77,11 @@ export class ContentNodeSelectorDialog extends GenericDialog { } async isCopyButtonEnabled(): Promise { - return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.copyButton); + return isPresentAndEnabled(this.copyButton); } async isCancelButtonEnabled(): Promise { - return this.isButtonEnabled(ContentNodeSelectorDialog.selectors.cancelButton); + return isPresentAndEnabled(this.cancelButton); } async searchFor(text: string): Promise { diff --git a/e2e/components/dialog/create-edit-folder-dialog.ts b/e2e/components/dialog/create-edit-folder-dialog.ts index 257fb84ad..cb381472c 100755 --- a/e2e/components/dialog/create-edit-folder-dialog.ts +++ b/e2e/components/dialog/create-edit-folder-dialog.ts @@ -23,64 +23,42 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndDisplayed } from '../../utilities/utils'; +import { isPresentAndDisplayed, waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; export class CreateOrEditFolderDialog extends GenericDialog { - private static selectors = { - root: 'adf-folder-dialog', + createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); + cancelButton = this.childElement(by.id('adf-folder-cancel-button')); + updateButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Update')); - nameInput: 'input[placeholder="Name" i]', - descriptionTextArea: 'textarea[placeholder="Description" i]', - - validationMessage: '.mat-hint span', - - createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'), - cancelButton: by.id('adf-folder-cancel-button'), - updateButton: by.cssContainingText('.mat-dialog-actions button', 'Update') - }; - - nameInput: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.nameInput)); - descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.descriptionTextArea)); - validationMessage: ElementFinder = this.rootElem.element(by.css(CreateOrEditFolderDialog.selectors.validationMessage)); + nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]')); + descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]')); + validationMessage = this.rootElem.element(by.css('.mat-hint span')); constructor() { - super(CreateOrEditFolderDialog.selectors.root); + super('adf-folder-dialog'); } async waitForDialogToOpen() { await super.waitForDialogToOpen(); - await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---'); - } - - async isValidationMessageDisplayed(): Promise { - return isPresentAndDisplayed(this.validationMessage); + await waitForClickable(this.nameInput); } async isUpdateButtonEnabled(): Promise { - return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.updateButton); + return isPresentAndEnabled(this.updateButton); } async isCreateButtonEnabled(): Promise { - return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.createButton); + return isPresentAndEnabled(this.createButton); } async isCancelButtonEnabled(): Promise { - return this.isButtonEnabled(CreateOrEditFolderDialog.selectors.cancelButton); - } - - async isNameDisplayed(): Promise { - return this.nameInput.isDisplayed(); - } - - async isDescriptionDisplayed(): Promise { - return this.descriptionTextArea.isDisplayed(); + return isPresentAndEnabled(this.cancelButton); } async getValidationMessage(): Promise { - if (await this.isValidationMessageDisplayed()) { + if (await isPresentAndDisplayed(this.validationMessage)) { return this.validationMessage.getText(); } else { return ''; @@ -96,31 +74,15 @@ export class CreateOrEditFolderDialog extends GenericDialog { } async enterName(name: string): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(name); + await typeText(this.nameInput, name); } async enterDescription(description: string): Promise { - await this.descriptionTextArea.clear(); - await this.descriptionTextArea.sendKeys(description); - } - - async deleteNameWithBackspace(): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); - } - - async clickCreate(): Promise { - await this.clickButton(CreateOrEditFolderDialog.selectors.createButton); + await typeText(this.descriptionTextArea, description); } async clickCancel(): Promise { - await this.clickButton(CreateOrEditFolderDialog.selectors.cancelButton); + await this.cancelButton.click(); await this.waitForDialogToClose(); } - - async clickUpdate(): Promise { - await this.clickButton(CreateOrEditFolderDialog.selectors.updateButton); - } - } diff --git a/e2e/components/dialog/create-from-template-dialog.ts b/e2e/components/dialog/create-from-template-dialog.ts index 65e8bc847..ca838c669 100755 --- a/e2e/components/dialog/create-from-template-dialog.ts +++ b/e2e/components/dialog/create-from-template-dialog.ts @@ -23,30 +23,21 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, protractor } from 'protractor'; +import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { isPresentAndDisplayed } from '../../utilities/utils'; +import { isPresentAndDisplayed, isPresentAndEnabled, typeText } from '../../utilities/utils'; export class CreateFromTemplateDialog extends GenericDialog { - private static selectors = { - root: '.aca-create-from-template-dialog', + createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); + cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'CANCEL')); - nameInput: 'input[placeholder="Name" i]', - titleInput: 'input[placeholder="Title" i]', - descriptionTextArea: 'textarea[placeholder="Description" i]', - validationMessage: '.mat-error', - - createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'), - cancelButton: by.cssContainingText('.mat-dialog-actions button', 'CANCEL') - }; - - nameInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.nameInput)); - titleInput: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.titleInput)); - descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.descriptionTextArea)); - validationMessage: ElementFinder = this.rootElem.element(by.css(CreateFromTemplateDialog.selectors.validationMessage)); + nameInput = this.childElement(by.css('input[placeholder="Name" i]')); + titleInput = this.childElement(by.css('input[placeholder="Title" i]')); + descriptionTextArea = this.childElement(by.css('textarea[placeholder="Description" i]')); + validationMessage = this.childElement(by.css('.mat-error')); constructor() { - super(CreateFromTemplateDialog.selectors.root); + super('.aca-create-from-template-dialog'); } async isValidationMessageDisplayed(): Promise { @@ -54,23 +45,11 @@ export class CreateFromTemplateDialog extends GenericDialog { } async isCreateButtonEnabled(): Promise { - return this.isButtonEnabled(CreateFromTemplateDialog.selectors.createButton); + return isPresentAndEnabled(this.createButton); } async isCancelButtonEnabled(): Promise { - return this.isButtonEnabled(CreateFromTemplateDialog.selectors.cancelButton); - } - - async isNameFieldDisplayed(): Promise { - return this.nameInput.isDisplayed(); - } - - async isTitleFieldDisplayed(): Promise { - return this.titleInput.isDisplayed(); - } - - async isDescriptionFieldDisplayed(): Promise { - return this.descriptionTextArea.isDisplayed(); + return isPresentAndEnabled(this.cancelButton); } async getValidationMessage(): Promise { @@ -90,32 +69,19 @@ export class CreateFromTemplateDialog extends GenericDialog { } async enterName(name: string): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(name); + await typeText(this.nameInput, name); } async enterTitle(title: string): Promise { - await this.titleInput.clear(); - await this.titleInput.sendKeys(title); + await typeText(this.titleInput, title); } async enterDescription(description: string): Promise { - await this.descriptionTextArea.clear(); - await this.descriptionTextArea.sendKeys(description); - } - - async deleteNameWithBackspace(): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); - } - - async clickCreate(): Promise { - await this.clickButton(CreateFromTemplateDialog.selectors.createButton); + await typeText(this.descriptionTextArea, description); } async clickCancel(): Promise { - await this.clickButton(CreateFromTemplateDialog.selectors.cancelButton); + await this.cancelButton.click(); await this.waitForDialogToClose(); } - } diff --git a/e2e/components/dialog/create-library-dialog.ts b/e2e/components/dialog/create-library-dialog.ts index 9e053e70a..4a235759a 100755 --- a/e2e/components/dialog/create-library-dialog.ts +++ b/e2e/components/dialog/create-library-dialog.ts @@ -23,140 +23,78 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, protractor, browser, ExpectedConditions as EC } from 'protractor'; +import { by, ElementFinder } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; export class CreateLibraryDialog extends GenericDialog { - private static selectors = { - root: 'adf-library-dialog', + createButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Create')); + cancelButton = this.childElement(by.cssContainingText('.mat-dialog-actions button', 'Cancel')); - nameInput: 'input[placeholder="Name" i]', - libraryIdInput: 'input[placeholder="Library ID" i]', - descriptionTextArea: 'textarea[placeholder="Description" i]', + nameInput = this.rootElem.element(by.css('input[placeholder="Name" i]')); + libraryIdInput = this.rootElem.element(by.css('input[placeholder="Library ID" i]')); + descriptionTextArea = this.rootElem.element(by.css('textarea[placeholder="Description" i]')); + visibilityPublic = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Public')); + visibilityModerated = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Moderated')); + visibilityPrivate = this.rootElem.element(by.cssContainingText('.mat-radio-label', 'Private')); - radioButton: '.mat-radio-label', - radioChecked: 'mat-radio-checked', - errorMessage: '.mat-error', - - createButton: by.cssContainingText('.mat-dialog-actions button', 'Create'), - cancelButton: by.cssContainingText('.mat-dialog-actions button', 'Cancel') - }; - - nameInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.nameInput)); - libraryIdInput: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.libraryIdInput)); - descriptionTextArea: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.descriptionTextArea)); - visibilityPublic: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Public')); - visibilityModerated: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Moderated')); - visibilityPrivate: ElementFinder = this.rootElem.element(by.cssContainingText(CreateLibraryDialog.selectors.radioButton, 'Private')); - - errorMessage: ElementFinder = this.rootElem.element(by.css(CreateLibraryDialog.selectors.errorMessage)); + errorMessage = this.rootElem.element(by.css('.mat-error')); constructor() { - super(CreateLibraryDialog.selectors.root); + super('adf-library-dialog'); } async waitForDialogToOpen(): Promise { await super.waitForDialogToOpen(); - await browser.wait(EC.elementToBeClickable(this.nameInput), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for input to be clickable ---'); - } - - async isErrorMessageDisplayed(): Promise { - return this.errorMessage.isDisplayed(); + await waitForClickable(this.nameInput); } async getErrorMessage(): Promise { - if (await this.isErrorMessageDisplayed()) { + if (await this.errorMessage.isDisplayed()) { return this.errorMessage.getText(); } return ''; } - async isNameDisplayed(): Promise { - return this.nameInput.isDisplayed(); - } - - async isLibraryIdDisplayed(): Promise { - return this.libraryIdInput.isDisplayed(); - } - - async isDescriptionDisplayed(): Promise { - return this.descriptionTextArea.isDisplayed(); - } - - async isPublicDisplayed(): Promise { - return this.visibilityPublic.isDisplayed(); - } - - async isModeratedDisplayed(): Promise { - return this.visibilityModerated.isDisplayed(); - } - - async isPrivateDisplayed(): Promise { - return this.visibilityPrivate.isDisplayed(); - } - async enterName(name: string): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(name); + await typeText(this.nameInput, name); } async enterLibraryId(id: string): Promise { - await this.libraryIdInput.clear(); - await this.libraryIdInput.sendKeys(id); + await typeText(this.libraryIdInput, id); } async enterDescription(description: string): Promise { - await this.descriptionTextArea.clear(); - await this.descriptionTextArea.sendKeys(description); - } - - async deleteNameWithBackspace(): Promise { - await this.nameInput.clear(); - await this.nameInput.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); + await typeText(this.descriptionTextArea, description); } async isCreateEnabled(): Promise { - return this.isButtonEnabled(CreateLibraryDialog.selectors.createButton); + return isPresentAndEnabled(this.createButton); } async isCancelEnabled(): Promise { - return this.isButtonEnabled(CreateLibraryDialog.selectors.cancelButton); - } - - async clickCreate(): Promise { - await this.clickButton(CreateLibraryDialog.selectors.createButton); + return isPresentAndEnabled(this.cancelButton); } async clickCancel(): Promise { - await this.clickButton(CreateLibraryDialog.selectors.cancelButton); + await this.cancelButton.click(); await this.waitForDialogToClose(); } + private async isChecked(target: ElementFinder): Promise { + const elemClass = await target.element(by.xpath('..')).getAttribute('class'); + return elemClass.includes('mat-radio-checked'); + } + async isPublicChecked(): Promise { - const elemClass = await this.visibilityPublic.element(by.xpath('..')).getAttribute('class'); - return elemClass.includes(CreateLibraryDialog.selectors.radioChecked); + return this.isChecked(this.visibilityPublic); } async isModeratedChecked(): Promise { - const elemClass = await this.visibilityModerated.element(by.xpath('..')).getAttribute('class'); - return elemClass.includes(CreateLibraryDialog.selectors.radioChecked); + return this.isChecked(this.visibilityModerated); } async isPrivateChecked(): Promise { - const elemClass = await this.visibilityPrivate.element(by.xpath('..')).getAttribute('class'); - return elemClass.includes(CreateLibraryDialog.selectors.radioChecked); - } - - async selectPublic(): Promise { - await this.visibilityPublic.click(); - } - - async selectModerated(): Promise { - await this.visibilityModerated.click(); - } - - async selectPrivate(): Promise { - await this.visibilityPrivate.click(); + return this.isChecked(this.visibilityPrivate); } } diff --git a/e2e/components/dialog/generic-dialog.ts b/e2e/components/dialog/generic-dialog.ts index 1570be07a..0c1df3417 100644 --- a/e2e/components/dialog/generic-dialog.ts +++ b/e2e/components/dialog/generic-dialog.ts @@ -23,32 +23,23 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC, Locator } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; -import { isPresentAndDisplayed, isPresentAndEnabled } from '../../utilities/utils'; +import { ElementFinder, by, browser, Locator } from 'protractor'; +import { isPresentAndDisplayed, waitForPresence, waitForVisibility, waitForStaleness } from '../../utilities/utils'; export abstract class GenericDialog { - private static locators = { - title: '.mat-dialog-title', - content: '.mat-dialog-content' - }; - private rootCssSelector: string; - - constructor(selector?: string) { - this.rootCssSelector = selector; - } + constructor(private rootCssSelector?: string) {} get rootElem(): ElementFinder { return browser.element(by.css(this.rootCssSelector)); } get title(): ElementFinder { - return this.rootElem.element(by.css(GenericDialog.locators.title)); + return this.rootElem.element(by.css('.mat-dialog-title')); } get content(): ElementFinder { - return this.rootElem.element(by.css(GenericDialog.locators.content)); + return this.rootElem.element(by.css('.mat-dialog-content')); } async getText(): Promise { @@ -56,13 +47,13 @@ export abstract class GenericDialog { } async waitForDialogToOpen(): Promise { - await browser.wait(EC.presenceOf(this.rootElem), BROWSER_WAIT_TIMEOUT); - await browser.wait(EC.visibilityOf(this.content), BROWSER_WAIT_TIMEOUT); - await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-backdrop'))), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.rootElem); + await waitForVisibility(this.content); + await waitForPresence(browser.element(by.css('.cdk-overlay-backdrop'))); } async waitForDialogToClose(): Promise { - await browser.wait(EC.stalenessOf(this.content), BROWSER_WAIT_TIMEOUT, '---- timeout waiting for dialog to close ----'); + await waitForStaleness(this.content); } async isDialogOpen(): Promise { @@ -73,15 +64,7 @@ export abstract class GenericDialog { return this.title.getText(); } - getActionButton(selector: Locator): ElementFinder { + protected childElement(selector: Locator): ElementFinder { return this.rootElem.element(selector); } - - async isButtonEnabled(selector: Locator): Promise { - return isPresentAndEnabled(this.getActionButton(selector)); - } - - async clickButton(selector: Locator): Promise { - await this.getActionButton(selector).click(); - } } diff --git a/e2e/components/dialog/manage-versions-dialog.ts b/e2e/components/dialog/manage-versions-dialog.ts index 714e2ea74..2989d543e 100755 --- a/e2e/components/dialog/manage-versions-dialog.ts +++ b/e2e/components/dialog/manage-versions-dialog.ts @@ -27,18 +27,14 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; export class ManageVersionsDialog extends GenericDialog { - private static selectors = { - root: '.aca-node-versions-dialog', - - closeButton: by.cssContainingText('.mat-button', 'Close') - }; + closeButton = this.childElement(by.cssContainingText('.mat-button', 'Close')); constructor() { - super(ManageVersionsDialog.selectors.root); + super('.aca-node-versions-dialog'); } async clickClose(): Promise { - await this.clickButton(ManageVersionsDialog.selectors.closeButton); + await this.closeButton.click(); await this.waitForDialogToClose(); } } diff --git a/e2e/components/dialog/password-dialog.ts b/e2e/components/dialog/password-dialog.ts index 8d7a73817..8e4561c6f 100755 --- a/e2e/components/dialog/password-dialog.ts +++ b/e2e/components/dialog/password-dialog.ts @@ -23,35 +23,23 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by, browser } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; +import { waitForClickable, isPresentAndEnabled, typeText } from '../../utilities/utils'; export class PasswordDialog extends GenericDialog { - private static selectors = { - root: 'adf-pdf-viewer-password-dialog', - - passwordInput: 'input[type="Password"]', - errorMessage: '.mat-error', - - closeButton: by.css('[data-automation-id="adf-password-dialog-close"]'), - submitButton: by.css('[data-automation-id="adf-password-dialog-submit"]') - }; - - passwordInput: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.passwordInput)); - errorMessage: ElementFinder = this.rootElem.element(by.css(PasswordDialog.selectors.errorMessage)); + closeButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-close"]')); + submitButton = this.childElement(by.css('[data-automation-id="adf-password-dialog-submit"]')); + passwordInput = this.childElement(by.css('input[type="Password"]')); + errorMessage = this.childElement(by.css('.mat-error')); constructor() { - super(PasswordDialog.selectors.root); - } - - async waitForPasswordInputToBeInteractive() { - await browser.wait(EC.elementToBeClickable(this.passwordInput), BROWSER_WAIT_TIMEOUT, '--- timeout wait for passwordInput ---'); + super('adf-pdf-viewer-password-dialog'); } async waitForDialogToOpen(): Promise { await super.waitForDialogToOpen(); - await this.waitForPasswordInputToBeInteractive(); + await waitForClickable(this.passwordInput); } async isDialogOpen(): Promise { @@ -64,19 +52,11 @@ export class PasswordDialog extends GenericDialog { } async isCloseEnabled(): Promise { - return this.isButtonEnabled(PasswordDialog.selectors.closeButton); + return isPresentAndEnabled(this.closeButton); } async isSubmitEnabled(): Promise { - return this.isButtonEnabled(PasswordDialog.selectors.submitButton); - } - - async clickClose(): Promise { - await this.clickButton(PasswordDialog.selectors.closeButton); - } - - async clickSubmit(): Promise { - await this.clickButton(PasswordDialog.selectors.submitButton); + return isPresentAndEnabled(this.submitButton); } async isPasswordInputDisplayed(): Promise { @@ -106,7 +86,6 @@ export class PasswordDialog extends GenericDialog { } async enterPassword(password: string): Promise { - await this.passwordInput.clear(); - await this.passwordInput.sendKeys(password); + await typeText(this.passwordInput, password); } } diff --git a/e2e/components/dialog/select-template-dialog.ts b/e2e/components/dialog/select-template-dialog.ts index ec68de603..2a3628e7c 100755 --- a/e2e/components/dialog/select-template-dialog.ts +++ b/e2e/components/dialog/select-template-dialog.ts @@ -27,37 +27,39 @@ import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; import { DropDownBreadcrumb } from '../breadcrumb/dropdown-breadcrumb'; import { DataTable } from '../data-table/data-table'; +import { isPresentAndEnabled } from '../../utilities/utils'; export class SelectTemplateDialog extends GenericDialog { - private static selectors = { - root: '.aca-template-node-selector-dialog', + nextButton = this.childElement( + by.css('[data-automation-id="content-node-selector-actions-choose"]') + ); - nextButton: by.css('[data-automation-id="content-node-selector-actions-choose"]'), - cancelButton: by.css('[data-automation-id="content-node-selector-actions-cancel"]') - }; + cancelButton = this.childElement( + by.css('[data-automation-id="content-node-selector-actions-cancel"]') + ); - breadcrumb: DropDownBreadcrumb = new DropDownBreadcrumb(); - dataTable: DataTable = new DataTable(SelectTemplateDialog.selectors.root); + breadcrumb = new DropDownBreadcrumb(); + dataTable = new DataTable('.aca-template-node-selector-dialog'); constructor() { - super(SelectTemplateDialog.selectors.root); + super('.aca-template-node-selector-dialog'); } async isCancelButtonEnabled(): Promise { - return this.isButtonEnabled(SelectTemplateDialog.selectors.cancelButton); + return isPresentAndEnabled(this.cancelButton); } async isNextButtonEnabled(): Promise { - return this.isButtonEnabled(SelectTemplateDialog.selectors.nextButton); + return isPresentAndEnabled(this.nextButton); } async clickCancel(): Promise { - await this.clickButton(SelectTemplateDialog.selectors.cancelButton); + await this.cancelButton.click(); await this.waitForDialogToClose(); } async clickNext(): Promise { - await this.clickButton(SelectTemplateDialog.selectors.nextButton); + await this.nextButton.click(); await this.waitForDialogToClose(); } } diff --git a/e2e/components/dialog/share-dialog.ts b/e2e/components/dialog/share-dialog.ts index d44e59c8b..f438b02ab 100755 --- a/e2e/components/dialog/share-dialog.ts +++ b/e2e/components/dialog/share-dialog.ts @@ -23,41 +23,28 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by } from 'protractor'; +import { by } from 'protractor'; import { DateTimePicker } from '../../components/datetime-picker/datetime-picker'; import { GenericDialog } from '../dialog/generic-dialog'; +import { isPresentAndEnabled } from '../../utilities/utils'; export class ShareDialog extends GenericDialog { - private static selectors = { - root: '.adf-share-dialog', - - dialogTitle: `[data-automation-id='adf-share-dialog-title']`, - info: '.adf-share-link__info', - label: '.adf-share-link__label', - shareToggle: `[data-automation-id='adf-share-toggle']`, - linkUrl: `[data-automation-id='adf-share-link']`, - inputAction: '.adf-input-action', - expireToggle: `[data-automation-id='adf-expire-toggle']`, - datetimePickerButton: '.mat-datetimepicker-toggle', - expirationInput: 'input[formcontrolname="time"]', - - closeButton: by.css(`[data-automation-id='adf-share-dialog-close']`) - }; - dateTimePicker = new DateTimePicker(); - dialogTitle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.dialogTitle)); - infoText: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.info)); - labels: ElementArrayFinder = this.rootElem.all(by.css(ShareDialog.selectors.label)); - shareToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.shareToggle)); - url: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.linkUrl)); - urlAction: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.inputAction)); - expireToggle: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expireToggle)); - expireInput: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.expirationInput)); - datetimePickerButton: ElementFinder = this.rootElem.element(by.css(ShareDialog.selectors.datetimePickerButton)); + dialogTitle = this.childElement(by.css(`[data-automation-id='adf-share-dialog-title']`)); + infoText = this.childElement(by.css('.adf-share-link__info')); + labels = this.rootElem.all(by.css('.adf-share-link__label')); + shareToggle = this.childElement(by.css(`[data-automation-id='adf-share-toggle']`)); + url = this.childElement(by.css(`[data-automation-id='adf-share-link']`)); + urlAction = this.childElement(by.css('.adf-input-action')); + expireToggle = this.childElement(by.css(`[data-automation-id='adf-expire-toggle']`)); + expireInput = this.childElement(by.css('input[formcontrolname="time"]')); + datetimePickerButton = this.childElement(by.css('.mat-datetimepicker-toggle')); + + closeButton = this.childElement(by.css(`[data-automation-id='adf-share-dialog-close']`)); constructor() { - super(ShareDialog.selectors.root); + super('.adf-share-dialog'); } async getTitle(): Promise { @@ -68,10 +55,6 @@ export class ShareDialog extends GenericDialog { return this.infoText.getText(); } - getLabels(): ElementArrayFinder { - return this.labels; - } - async getLinkUrl(): Promise { return this.url.getAttribute('value'); } @@ -82,49 +65,29 @@ export class ShareDialog extends GenericDialog { } async isCloseEnabled(): Promise { - return this.isButtonEnabled(ShareDialog.selectors.closeButton); + return isPresentAndEnabled(this.closeButton); } async clickClose(): Promise { - await this.clickButton(ShareDialog.selectors.closeButton); + await this.closeButton.click(); await this.waitForDialogToClose(); } - getShareToggle(): ElementFinder { - return this.shareToggle; - } - - getExpireToggle(): ElementFinder { - return this.expireToggle; - } - - getExpireInput(): ElementFinder { - return this.expireInput; - } - async isShareToggleChecked(): Promise { - const toggleClass = await this.getShareToggle().getAttribute('class'); + const toggleClass = await this.shareToggle.getAttribute('class'); return toggleClass.includes('checked'); } async isShareToggleDisabled(): Promise { - const toggleClass = await this.getShareToggle().getAttribute('class'); + const toggleClass = await this.shareToggle.getAttribute('class'); return toggleClass.includes('mat-disabled'); } async isExpireToggleEnabled(): Promise { - const toggleClass = await this.getExpireToggle().getAttribute('class'); + const toggleClass = await this.expireToggle.getAttribute('class'); return toggleClass.includes('checked'); } - async copyUrl(): Promise { - await this.urlAction.click(); - } - - async openDatetimePicker(): Promise { - await this.datetimePickerButton.click(); - } - async closeDatetimePicker(): Promise { if (await this.dateTimePicker.isCalendarOpen()) { await this.datetimePickerButton.click(); @@ -132,14 +95,6 @@ export class ShareDialog extends GenericDialog { } async getExpireDate(): Promise { - return this.getExpireInput().getAttribute('value'); - } - - async clickExpirationToggle(): Promise { - await this.expireToggle.click(); - } - - async clickShareToggle(): Promise { - await this.shareToggle.click(); + return this.expireInput.getAttribute('value'); } } diff --git a/e2e/components/dialog/upload-new-version-dialog.ts b/e2e/components/dialog/upload-new-version-dialog.ts index d09459d3b..d29ab14f5 100755 --- a/e2e/components/dialog/upload-new-version-dialog.ts +++ b/e2e/components/dialog/upload-new-version-dialog.ts @@ -23,71 +23,35 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by } from 'protractor'; +import { by } from 'protractor'; import { GenericDialog } from '../dialog/generic-dialog'; +import { isPresentAndEnabled, typeText } from '../../utilities/utils'; export class UploadNewVersionDialog extends GenericDialog { - private static selectors = { - root: '.aca-node-version-upload-dialog', - - cancelButton: by.cssContainingText('.mat-button', 'Cancel'), - uploadButton: by.cssContainingText('.mat-button', 'Upload'), - - radioButton: `.mat-radio-label`, - - descriptionTextArea: 'textarea' - }; - - - majorOption: ElementFinder = this.rootElem.element(by.cssContainingText(UploadNewVersionDialog.selectors.radioButton, 'Major')); - minorOption: ElementFinder = this.rootElem.element(by.cssContainingText(UploadNewVersionDialog.selectors.radioButton, 'Minor')); - - description: ElementFinder = this.rootElem.element(by.css(UploadNewVersionDialog.selectors.descriptionTextArea)); + cancelButton = this.childElement(by.cssContainingText('.mat-button', 'Cancel')); + uploadButton = this.childElement(by.cssContainingText('.mat-button', 'Upload')); + majorOption = this.childElement(by.cssContainingText(`.mat-radio-label`, 'Major')); + minorOption = this.childElement(by.cssContainingText(`.mat-radio-label`, 'Minor')); + description = this.childElement(by.css('textarea')); constructor() { - super(UploadNewVersionDialog.selectors.root); - } - - async isDescriptionDisplayed(): Promise { - return this.description.isDisplayed(); - } - - async isMinorOptionDisplayed(): Promise { - return this.minorOption.isDisplayed(); - } - - async isMajorOptionDisplayed(): Promise { - return this.majorOption.isDisplayed(); + super('.aca-node-version-upload-dialog'); } async isCancelButtonEnabled(): Promise { - return this.isButtonEnabled(UploadNewVersionDialog.selectors.cancelButton); + return isPresentAndEnabled(this.cancelButton); } async isUploadButtonEnabled(): Promise { - return this.isButtonEnabled(UploadNewVersionDialog.selectors.uploadButton); + return isPresentAndEnabled(this.uploadButton); } async clickCancel(): Promise { - await this.clickButton(UploadNewVersionDialog.selectors.cancelButton); + await this.cancelButton.click(); await this.waitForDialogToClose(); } - async clickUpload(): Promise { - await this.clickButton(UploadNewVersionDialog.selectors.uploadButton); - } - - async clickMajor(): Promise { - await this.majorOption.click(); - } - - async clickMinor(): Promise { - await this.minorOption.click(); - } - async enterDescription(description: string): Promise { - await this.description.clear(); - await this.description.sendKeys(description); + await typeText(this.description, description); } - } diff --git a/e2e/components/header/header.ts b/e2e/components/header/header.ts index 3faf45cf1..785d1c24f 100755 --- a/e2e/components/header/header.ts +++ b/e2e/components/header/header.ts @@ -23,71 +23,54 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, until } from 'protractor'; +import { by, browser } from 'protractor'; import { Component } from '../component'; import { UserInfo } from './user-info'; import { Menu } from '../menu/menu'; import { Toolbar } from './../toolbar/toolbar'; import { SearchInput } from '../search/search-input'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { waitElement } from '../../utilities/utils'; export class Header extends Component { - private static selectors = { - root: 'app-header', - logoLink: by.css('.app-menu__title'), - userInfo: by.css('aca-current-user'), - moreActions: by.id('app.header.more'), + logoLink = this.byCss('.app-menu__title'); + moreActions = browser.element(by.id('app.header.more')); + sidenavToggle = this.byCss(`[id='adf-sidebar-toggle-start']`); - sidenavToggle: `[id='adf-sidebar-toggle-start']`, - expandedSidenav: by.css(`[data-automation-id='expanded']`), - collapsedSidenav: by.css(`[data-automation-id='collapsed']`) - }; - - logoLink: ElementFinder = this.component.element(Header.selectors.logoLink); - moreActions: ElementFinder = browser.element(Header.selectors.moreActions); - sidenavToggle: ElementFinder = this.component.element(by.css(Header.selectors.sidenavToggle)); - - userInfo: UserInfo = new UserInfo(); - menu: Menu = new Menu(); - toolbar: Toolbar = new Toolbar(); - searchInput: SearchInput = new SearchInput(); + userInfo = new UserInfo(); + menu = new Menu(); + toolbar = new Toolbar(); + searchInput = new SearchInput(); constructor(ancestor?: string) { super('adf-layout-header', ancestor); } - async openMoreMenu() { + async openMoreMenu(): Promise { await this.moreActions.click(); await this.menu.waitForMenuToOpen(); } - async isSignOutDisplayed() { + async isSignOutDisplayed(): Promise { return this.userInfo.menu.isMenuItemPresent('Sign out'); } - async clickSidenavToggle() { - await this.sidenavToggle.click(); + async isSidenavExpanded(): Promise { + return browser.isElementPresent(by.css(`[data-automation-id='expanded']`)); } - async isSidenavExpanded() { - return browser.isElementPresent(Header.selectors.expandedSidenav); - } - - async expandSideNav() { + async expandSideNav(): Promise { const expanded = await this.isSidenavExpanded(); - if ( !expanded ) { - await this.clickSidenavToggle(); - await browser.wait(until.elementLocated(Header.selectors.expandedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for expanded sidenav' ); + if (!expanded) { + await this.sidenavToggle.click(); + await waitElement(`[data-automation-id='expanded']`); } } - async collapseSideNav() { + async collapseSideNav(): Promise { const expanded = await this.isSidenavExpanded(); - if ( expanded ) { - await this.clickSidenavToggle(); - await browser.wait(until.elementLocated(Header.selectors.collapsedSidenav), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for collapsed sidenav') + if (expanded) { + await this.sidenavToggle.click(); + await waitElement(`[data-automation-id='collapsed']`); } } - } - diff --git a/e2e/components/header/user-info.ts b/e2e/components/header/user-info.ts index 88a3c9b93..0437b99fa 100755 --- a/e2e/components/header/user-info.ts +++ b/e2e/components/header/user-info.ts @@ -23,39 +23,27 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by } from 'protractor'; import { Menu } from '../menu/menu'; import { Component } from '../component'; export class UserInfo extends Component { - private static selectors = { - avatar: by.css('.current-user__avatar'), - fullName: by.css('.current-user__full-name'), - menuItems: by.css('[mat-menu-item]') - }; + fullName = this.byCss('.current-user__full-name'); + avatar = this.byCss('.current-user__avatar'); - fullName: ElementFinder = this.component.element(UserInfo.selectors.fullName); - avatar: ElementFinder = this.component.element(UserInfo.selectors.avatar); - - menu: Menu = new Menu(); + menu = new Menu(); constructor(ancestor?: string) { super('aca-current-user', ancestor); } - async openMenu() { - const { menu, avatar } = this; + async openMenu(): Promise { + await this.avatar.click(); + await this.menu.wait(); - await avatar.click(); - await menu.wait(); - return menu; + return this.menu; } - getName() { - return this.fullName.getText(); - } - - async signOut() { + async signOut(): Promise { const menu = await this.openMenu(); await menu.clickMenuItem('Sign out'); } diff --git a/e2e/components/info-drawer/info-drawer-comments-tab.ts b/e2e/components/info-drawer/info-drawer-comments-tab.ts index 5c5f8b877..d46821b66 100755 --- a/e2e/components/info-drawer/info-drawer-comments-tab.ts +++ b/e2e/components/info-drawer/info-drawer-comments-tab.ts @@ -23,58 +23,39 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, until } from 'protractor'; +import { by, browser, until } from 'protractor'; import { Component } from '../component'; import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { waitForVisibility, typeText } from '../../utilities/utils'; export class CommentsTab extends Component { - private static selectors = { - root: 'adf-comments', - - commentsContainer: '.adf-comments-container', - commentsHeader: '.adf-comments-header', - commentsTextArea: '.adf-comments-input-container textarea', - addCommentButton: 'button.adf-comments-input-add', - commentsList: '.adf-comment-list', - commentsListItem: '.adf-comment-list-item', - commentById: `adf-comment-`, - commentUserName: 'comment-user', - commentUserAvatar: 'comment-user-icon', - commentMessage: 'comment-message', - commentTime: 'comment-time' - }; - - commentsContainer: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsContainer)); - commentsHeader: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsHeader)); - commentTextarea: ElementFinder = this.component.element(by.css(CommentsTab.selectors.commentsTextArea)); - addCommentButton: ElementFinder = this.component.element(by.css(CommentsTab.selectors.addCommentButton)); - commentsList: ElementArrayFinder = this.component.all(by.css(CommentsTab.selectors.commentsListItem)); - - commentListItem = by.css(CommentsTab.selectors.commentsListItem); - - commentUserAvatar = by.id(CommentsTab.selectors.commentUserAvatar); - commentUser = by.id(CommentsTab.selectors.commentUserName) - commentText = by.id(CommentsTab.selectors.commentMessage); - commentTime = by.id(CommentsTab.selectors.commentTime); - + commentsContainer = this.byCss('.adf-comments-container'); + commentsHeader = this.byCss('.adf-comments-header'); + commentTextarea = this.byCss('.adf-comments-input-container textarea'); + addCommentButton = this.byCss('button.adf-comments-input-add'); + commentListItem = by.css('.adf-comment-list-item'); + commentUserAvatar = by.id('comment-user-icon'); + commentUser = by.id('comment-user') + commentText = by.id('comment-message'); + commentTime = by.id('comment-time'); constructor(ancestor?: string) { - super(CommentsTab.selectors.root, ancestor); + super('adf-comments', ancestor); } async waitForCommentsContainer() { - await browser.wait(EC.visibilityOf(this.commentsContainer), BROWSER_WAIT_TIMEOUT); + await waitForVisibility(this.commentsContainer); } - async getCommentsTabHeaderText() { + async getCommentsTabHeaderText(): Promise { return this.commentsHeader.getText(); } - async isCommentTextAreaDisplayed() { + async isCommentTextAreaDisplayed(): Promise { return browser.isElementPresent(this.commentTextarea); } - async isAddCommentButtonEnabled() { + async isAddCommentButtonEnabled(): Promise { const present = await browser.isElementPresent(this.addCommentButton); if (present) { return this.addCommentButton.isEnabled(); @@ -82,13 +63,13 @@ export class CommentsTab extends Component { return false; } - async getCommentListItem() { + private async getCommentListItem() { return browser.wait(until.elementLocated(this.commentListItem), BROWSER_WAIT_TIMEOUT / 2); } async getCommentById(commentId?: string) { if (commentId) { - return browser.wait(until.elementLocated(by.id(`${CommentsTab.selectors.commentById}${commentId}`)), BROWSER_WAIT_TIMEOUT / 2); + return browser.wait(until.elementLocated(by.id(`adf-comment-${commentId}`)), BROWSER_WAIT_TIMEOUT / 2); } return this.getCommentListItem(); } @@ -108,31 +89,32 @@ export class CommentsTab extends Component { return message.getText(); } - async getCommentUserName(commentId?: string) { + async getCommentUserName(commentId?: string): Promise { const commentElement = await this.getCommentById(commentId); const user = await commentElement.findElement(this.commentUser); return user.getText(); } - async getCommentTime(commentId?: string) { + async getCommentTime(commentId?: string): Promise { const commentElement = await this.getCommentById(commentId); const time = await commentElement.findElement(this.commentTime); return time.getText(); } - async getNthCommentId(index: number) { - return this.commentsList.get(index - 1).getAttribute('id'); + async getNthCommentId(index: number): Promise { + const list = this.allByCss('.adf-comment-list-item'); + return list.get(index - 1).getAttribute('id'); } - async typeComment(text: string) { - await this.commentTextarea.sendKeys(text); + async typeComment(text: string): Promise { + await typeText(this.commentTextarea, text); } - async clickAddButton() { + async clickAddButton(): Promise { await this.addCommentButton.click(); } - async getCommentTextFromTextArea() { + async getCommentTextFromTextArea(): Promise { return this.commentTextarea.getAttribute('value'); } diff --git a/e2e/components/info-drawer/info-drawer-metadata-content.ts b/e2e/components/info-drawer/info-drawer-metadata-content.ts index deed4021d..8e525bc50 100755 --- a/e2e/components/info-drawer/info-drawer-metadata-content.ts +++ b/e2e/components/info-drawer/info-drawer-metadata-content.ts @@ -23,57 +23,41 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { by, browser, ElementFinder } from 'protractor'; import { Component } from '../component'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; -import { isPresentAndEnabled, isPresentAndDisplayed } from '../../utilities/utils'; +import { isPresentAndEnabled, isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils'; export class ContentMetadata extends Component { - private static selectors = { - root: 'adf-content-metadata-card', - - expandedPanel: '.mat-expansion-panel.mat-expanded', - propertyList: '.adf-property-list', - property: '.adf-property', - propertyLabel: '.adf-property-label', - propertyValue: '.adf-property-value', - editProperties: `button[title='Edit']`, - editProperty: `.mat-icon[title='Edit']`, - editDateItem: `.adf-dateitem-editable`, - moreLessInformation: `[data-automation-id='meta-data-card-toggle-expand']` - }; - - expandedPanel: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.expandedPanel)); - propertyList: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyList)); - propertyListElements: ElementArrayFinder = this.component.all(by.css(ContentMetadata.selectors.property)); - propertyValue: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.propertyValue)); - editPropertiesButton: ElementFinder = this.component.element(by.css(ContentMetadata.selectors.editProperties)); - lessInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'Less information')); - moreInfoButton: ElementFinder = this.component.element(by.cssContainingText(ContentMetadata.selectors.moreLessInformation, 'More information')); - - imagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`)); - expandedImagePropertiesPanel: ElementFinder = this.component.element(by.css(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`)); + expandedPanel = this.byCss('.mat-expansion-panel.mat-expanded'); + propertyList = this.byCss('.adf-property-list'); + propertyListElements = this.allByCss('.adf-property'); + propertyValue = this.byCss('.adf-property-value'); + editPropertiesButton = this.byCss(`button[title='Edit']`); + lessInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'Less information'); + moreInfoButton = this.byCssText(`[data-automation-id='meta-data-card-toggle-expand']`, 'More information'); + imagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE']`); + expandedImagePropertiesPanel = this.byCss(`[data-automation-id='adf-metadata-group-APP.CONTENT_METADATA.EXIF_GROUP_TITLE'].mat-expanded`); constructor(ancestor?: string) { - super(ContentMetadata.selectors.root, ancestor); + super('adf-content-metadata-card', ancestor); } - async isPropertiesListExpanded() { + async isPropertiesListExpanded(): Promise { return browser.isElementPresent(this.expandedPanel); } - async waitForImagePropertiesPanelToExpand() { - await browser.wait(EC.visibilityOf(this.expandedImagePropertiesPanel), BROWSER_WAIT_TIMEOUT); + async waitForImagePropertiesPanelToExpand(): Promise { + await waitForVisibility(this.expandedImagePropertiesPanel); } - async getVisiblePropertiesLabels() { - return this.component.all(by.css(ContentMetadata.selectors.propertyLabel)) + async getVisiblePropertiesLabels(): Promise { + return this.allByCss('.adf-property-label') .filter(async (elem) => elem.isDisplayed()) .map(async (elem) => elem.getText()); } async getVisiblePropertiesValues() { - return this.component.all(by.css(ContentMetadata.selectors.propertyValue)) + return this.allByCss('.adf-property-value') .filter(async (elem) => elem.isDisplayed()) .map(async (elem) => { if (await elem.isElementPresent(by.css('.mat-checkbox'))) { @@ -82,7 +66,8 @@ export class ContentMetadata extends Component { } return false } - return elem.getText(); + + return this.getElementValue(elem); }); } @@ -98,29 +83,22 @@ export class ContentMetadata extends Component { return isPresentAndEnabled(this.moreInfoButton); } - async isLessInfoButtonDisplayed() { - return browser.isElementPresent(this.lessInfoButton); - } - async isMoreInfoButtonDisplayed(): Promise { return browser.isElementPresent(this.moreInfoButton); } - async clickLessInformationButton() { - await this.lessInfoButton.click(); - } - - async clickMoreInformationButton() { - await this.moreInfoButton.click(); - } - async isImagePropertiesPanelDisplayed(): Promise { return isPresentAndDisplayed(this.imagePropertiesPanel); } - async clickImagePropertiesPanel() { - await this.imagePropertiesPanel.click(); - } + private async getElementValue(elem: ElementFinder): Promise { + const tagName = await elem.getTagName(); + if (tagName === 'input' || tagName === 'textarea') { + return elem.getAttribute('value'); + } + + return elem.getText(); + } } diff --git a/e2e/components/info-drawer/info-drawer-metadata-library.ts b/e2e/components/info-drawer/info-drawer-metadata-library.ts index 2b752003e..eaed6a060 100755 --- a/e2e/components/info-drawer/info-drawer-metadata-library.ts +++ b/e2e/components/info-drawer/info-drawer-metadata-library.ts @@ -23,96 +23,85 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { by, browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { Component } from '../component'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { waitForPresence, waitForStaleness, typeText } from '../../utilities/utils'; export class LibraryMetadata extends Component { - private static selectors = { - root: 'app-library-metadata-form', - - metadataTabContent: '.mat-card-content', - metadataTabAction: '.mat-card-actions .mat-button', - field: '.mat-form-field', - fieldLabelWrapper: '.mat-form-field-label-wrapper', - fieldInput: '.mat-input-element', - dropDown: '.mat-select', - - visibilityOption: '.mat-option .mat-option-text', - - hint: '.mat-hint', - error: '.mat-error' - }; - - metadataTabContent: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabContent)); - metadataTabAction: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.metadataTabAction)); - fieldLabelWrapper: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldLabelWrapper)); - fieldInput: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.fieldInput)); - - visibilityDropDown: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.dropDown)); - visibilityPublic: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Public')); - visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Private')); - visibilityModerated: ElementFinder = browser.element(by.cssContainingText(LibraryMetadata.selectors.visibilityOption, 'Moderated')); - - hint: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.hint)); - error: ElementFinder = this.component.element(by.css(LibraryMetadata.selectors.error)); - + metadataTabContent = this.byCss('.mat-card-content'); + metadataTabAction = this.byCss('.mat-card-actions .mat-button'); + fieldLabelWrapper = this.byCss('.mat-form-field-label-wrapper'); + fieldInput = this.byCss('.mat-input-element'); + visibilityDropDown = this.component.element(by.css('.mat-select')); + visibilityPublic = this.byCssText( + '.mat-option .mat-option-text', + 'Public', + browser + ); + visibilityPrivate = this.byCssText( + '.mat-option .mat-option-text', + 'Private', + browser + ); + visibilityModerated = this.byCssText( + '.mat-option .mat-option-text', + 'Moderated', + browser + ); + hint = this.byCss('.mat-hint'); + error = this.byCss('.mat-error'); constructor(ancestor?: string) { - super(LibraryMetadata.selectors.root, ancestor); + super('app-library-metadata-form', ancestor); } - getLabelWrapper(label: string) { - return this.component.element(by.cssContainingText(LibraryMetadata.selectors.fieldLabelWrapper, label)); + private getLabelWrapper(label: string) { + return this.byCssText('.mat-form-field-label-wrapper', label); } - getFieldByName(fieldName: string) { + private getFieldByName(fieldName: string) { const wrapper = this.getLabelWrapper(fieldName); - return wrapper.element(by.xpath('..')).element(by.css(LibraryMetadata.selectors.fieldInput)); + return wrapper + .element(by.xpath('..')) + .element(by.css('.mat-input-element')); } - async isFieldDisplayed(fieldName: string) { + private async isFieldDisplayed(fieldName: string) { return browser.isElementPresent(this.getFieldByName(fieldName)); } - async isInputEnabled(fieldName: string) { + private async isInputEnabled(fieldName: string) { return this.getFieldByName(fieldName).isEnabled(); } - async getValueOfField(fieldName: string) { + private async getValueOfField(fieldName: string) { return this.getFieldByName(fieldName).getText(); } - async enterTextInInput(fieldName: string, text: string) { + private async enterTextInInput(fieldName: string, text: string) { const input = this.getFieldByName(fieldName); - await input.clear(); - await input.sendKeys(text); + await typeText(input, text); } - - getButton(button: string) { - return this.component.element(by.cssContainingText(LibraryMetadata.selectors.metadataTabAction, button)); + private getButton(button: string) { + return this.byCssText('.mat-card-actions .mat-button', button); } - async isButtonDisplayed(button: string) { + private async isButtonDisplayed(button: string) { return browser.isElementPresent(this.getButton(button)); } - async isButtonEnabled(button: string) { + private async isButtonEnabled(button: string) { return this.getButton(button).isEnabled(); } - async clickButton(button: string) { + private async clickButton(button: string) { await this.getButton(button).click(); } - async waitForVisibilityDropDownToOpen() { - await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT); - } - async waitForVisibilityDropDownToClose() { - await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT); + await waitForStaleness(browser.$('.mat-option .mat-option-text')); } async isMessageDisplayed() { @@ -131,7 +120,6 @@ export class LibraryMetadata extends Component { return this.error.getText(); } - async isNameDisplayed() { return this.isFieldDisplayed('Name'); } @@ -140,15 +128,14 @@ export class LibraryMetadata extends Component { return this.isInputEnabled('Name'); } - async getName() { + async getName(): Promise { return this.getValueOfField('Name'); } - async enterName(name: string) { + async enterName(name: string): Promise { await this.enterTextInInput('Name', name); } - async isDescriptionDisplayed() { return this.isFieldDisplayed('Description'); } @@ -157,7 +144,7 @@ export class LibraryMetadata extends Component { return this.isInputEnabled('Description'); } - async getDescription() { + async getDescription(): Promise { return this.getValueOfField('Description'); } @@ -165,10 +152,11 @@ export class LibraryMetadata extends Component { await this.enterTextInInput('Description', desc); } - async isVisibilityEnabled() { 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('.mat-select')); return field.isEnabled(); } @@ -176,7 +164,7 @@ export class LibraryMetadata extends Component { return this.isFieldDisplayed('Visibility'); } - async getVisibility() { + async getVisibility(): Promise { return this.getValueOfField('Visibility'); } @@ -184,7 +172,7 @@ export class LibraryMetadata extends Component { const val = visibility.toLowerCase(); await this.visibilityDropDown.click(); - await this.waitForVisibilityDropDownToOpen(); + await waitForPresence(this.visibilityDropDown); if (val === 'public') { await this.visibilityPublic.click(); @@ -199,7 +187,6 @@ export class LibraryMetadata extends Component { await this.waitForVisibilityDropDownToClose(); } - async isLibraryIdDisplayed() { return this.isFieldDisplayed('Library ID'); } @@ -212,7 +199,6 @@ export class LibraryMetadata extends Component { return this.getValueOfField('Library ID'); } - async isEditLibraryPropertiesEnabled() { return this.isButtonEnabled('Edit'); } @@ -225,7 +211,6 @@ export class LibraryMetadata extends Component { await this.clickButton('Edit'); } - async isUpdateEnabled() { return this.isButtonEnabled('Update'); } @@ -238,7 +223,6 @@ export class LibraryMetadata extends Component { await this.clickButton('Update'); } - async isCancelEnabled() { return this.isButtonEnabled('Cancel'); } @@ -250,6 +234,4 @@ export class LibraryMetadata extends Component { async clickCancel() { await this.clickButton('Cancel'); } - } - diff --git a/e2e/components/info-drawer/info-drawer.ts b/e2e/components/info-drawer/info-drawer.ts index 7a0880b82..8580d7c94 100755 --- a/e2e/components/info-drawer/info-drawer.ts +++ b/e2e/components/info-drawer/info-drawer.ts @@ -23,54 +23,33 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { by, browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { Component } from '../component'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { CommentsTab } from './info-drawer-comments-tab'; import { LibraryMetadata } from './info-drawer-metadata-library'; import { ContentMetadata } from './info-drawer-metadata-content'; +import { waitForVisibility, waitForInvisibility, waitForPresence } from '../../utilities/utils'; export class InfoDrawer extends Component { - private static selectors = { - root: 'adf-info-drawer', - - header: '.adf-info-drawer-layout-header', - content: '.adf-info-drawer-layout-content', - - tabs: '.adf-info-drawer-tabs', - tabLabel: '.mat-tab-label-content', - tabActiveLabel: '.mat-tab-label-active', - - activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab', - next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron', - previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron', - - headerTitle: '.adf-info-drawer-layout-header-title' - }; - - commentsTab = new CommentsTab(InfoDrawer.selectors.root); - aboutTab = new LibraryMetadata(InfoDrawer.selectors.root); - propertiesTab = new ContentMetadata(InfoDrawer.selectors.root); - - header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header)); - headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle)); - tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel)); - tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel)); - tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel)); - - tabActiveContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.activeTabContent)); - - nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next)); - previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous)); - + commentsTab = new CommentsTab('adf-info-drawer'); + aboutTab = new LibraryMetadata('adf-info-drawer'); + propertiesTab = new ContentMetadata('adf-info-drawer'); + header = this.byCss('.adf-info-drawer-layout-header'); + headerTitle = this.byCss('.adf-info-drawer-layout-header-title'); + tabLabel = this.byCss('.mat-tab-label-content'); + tabLabelsList = this.allByCss('.mat-tab-label-content'); + tabActiveLabel = this.byCss('.mat-tab-label-active'); + tabActiveContent = this.byCss('.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab'); + nextButton = this.byCss('.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron'); + previousButton = this.byCss('.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'); constructor(ancestor?: string) { - super(InfoDrawer.selectors.root, ancestor); + super('adf-info-drawer', ancestor); } async waitForInfoDrawerToOpen() { - await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.header); } async isOpen() { @@ -78,15 +57,15 @@ export class InfoDrawer extends Component { } async isEmpty() { - return !(await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))); + return !(await browser.isElementPresent(by.css('.adf-info-drawer-tabs'))); } getTabByTitle(title: string) { - return this.component.element(by.cssContainingText(InfoDrawer.selectors.tabLabel, title)); + return this.byCssText('.mat-tab-label-content', title); } - async getTabsCount() { - return this.component.all(by.css(InfoDrawer.selectors.tabLabel)).count(); + async getTabsCount(): Promise { + return this.allByCss('.mat-tab-label-content').count(); } async isTabPresent(title: string) { @@ -101,11 +80,11 @@ export class InfoDrawer extends Component { return false; } - async getTabTitle(index: number) { + async getTabTitle(index: number): Promise { return this.tabLabelsList.get(index - 1).getAttribute('innerText'); } - async getActiveTabTitle() { + async getActiveTabTitle(): Promise { return this.tabActiveLabel.getText(); } @@ -113,11 +92,11 @@ export class InfoDrawer extends Component { await this.getTabByTitle(title).click(); } - async getComponentIdOfTab() { + async getComponentIdOfTab(): Promise { return this.tabActiveContent.getAttribute('data-automation-id'); } - async getHeaderTitle() { + async getHeaderTitle(): Promise { return this.headerTitle.getText(); } @@ -142,8 +121,8 @@ export class InfoDrawer extends Component { await this.getTabByTitle('Comments').click(); await this.commentsTab.waitForCommentsContainer(); await Promise.all([ - browser.wait(EC.visibilityOf(this.commentsTab.component), BROWSER_WAIT_TIMEOUT), - browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT) + waitForVisibility(this.commentsTab.component), + waitForInvisibility(this.propertiesTab.component) ]); } catch (error) { Logger.error('--- info-drawer clickCommentsTab catch error: ', error); diff --git a/e2e/components/login/login.ts b/e2e/components/login/login.ts index cd7872e28..c95076e3c 100755 --- a/e2e/components/login/login.ts +++ b/e2e/components/login/login.ts @@ -23,71 +23,37 @@ * along with Alfresco. If not, see . */ -import { by, ElementFinder } from 'protractor'; import { Component } from '../component'; +import { typeText } from '../../utilities/utils'; export class LoginComponent extends Component { - private static selectors = { - root: 'adf-login', - - usernameInput: by.css('input#username'), - passwordInput: by.css('input#password'), - passwordVisibility: by.css('.adf-login-password-icon'), - submitButton: by.css('button#login-button'), - errorMessage: by.css('.adf-login-error-message'), - copyright: by.css('.adf-copyright') - }; - - usernameInput: ElementFinder = this.component.element(LoginComponent.selectors.usernameInput); - passwordInput: ElementFinder = this.component.element(LoginComponent.selectors.passwordInput); - submitButton: ElementFinder = this.component.element(LoginComponent.selectors.submitButton); - errorMessage: ElementFinder = this.component.element(LoginComponent.selectors.errorMessage); - copyright: ElementFinder = this.component.element(LoginComponent.selectors.copyright); - passwordVisibility: ElementFinder = this.component.element(LoginComponent.selectors.passwordVisibility); + usernameInput = this.byCss('input#username'); + passwordInput = this.byCss('input#password'); + submitButton = this.byCss('button#login-button'); + errorMessage = this.byCss('.adf-login-error-message'); + copyright = this.byCss('.adf-copyright'); + passwordVisibility = this.byCss('.adf-login-password-icon'); constructor(ancestor?: string) { - super(LoginComponent.selectors.root, ancestor); + super('adf-login', ancestor); } - async enterUsername(username: string) { - const { usernameInput } = this; - - await usernameInput.clear(); - await usernameInput.sendKeys(username); + async enterUsername(username: string): Promise { + await typeText(this.usernameInput, username); } - async enterPassword(password: string) { - const { passwordInput } = this; - - await passwordInput.clear(); - await passwordInput.sendKeys(password); + async enterPassword(password: string): Promise { + await typeText(this.passwordInput, password); } - async enterCredentials(username: string, password: string) { + async enterCredentials(username: string, password: string): Promise { await this.enterUsername(username); await this.enterPassword(password); } - async submit() { - await this.submitButton.click(); - } - - async clickPasswordVisibility() { - await this.passwordVisibility.click(); - } - - async getPasswordVisibility(): Promise { + private async getPasswordVisibility(): Promise { const text = await this.passwordVisibility.getText(); - if (text.endsWith('visibility_off')) { - return false; - } - else { - if (text.endsWith('visibility')) { - return true; - } - } - - return false; + return text.endsWith('visibility'); } async isPasswordDisplayed(): Promise { @@ -104,18 +70,6 @@ export class LoginComponent extends Component { return false; } - async isUsernameEnabled() { - return this.usernameInput.isEnabled(); - } - - async isPasswordEnabled() { - return this.passwordInput.isEnabled(); - } - - async isSubmitEnabled() { - return this.submitButton.isEnabled(); - } - async isPasswordHidden() { return !(await this.getPasswordVisibility()); } diff --git a/e2e/components/menu/menu.ts b/e2e/components/menu/menu.ts index 69038b2c2..1eb5b62d9 100755 --- a/e2e/components/menu/menu.ts +++ b/e2e/components/menu/menu.ts @@ -23,84 +23,60 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { ElementFinder, by, browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Component } from '../component'; -import { Utils, isPresentAndEnabled } from '../../utilities/utils' +import { Utils, isPresentAndEnabled, waitForPresence, waitForVisibility, waitForStaleness, waitForClickable } from '../../utilities/utils' export class Menu extends Component { - private static selectors = { - root: '.mat-menu-panel', - item: '.mat-menu-item', - icon: '.mat-icon', + items = this.allByCss('.mat-menu-item'); + backdrop = this.byCss('.cdk-overlay-backdrop', browser); - uploadFilesInput: 'app-upload-files', + uploadFilesInput = this.byId('app-upload-files', browser); + submenus = browser.element.all(by.css('app-context-menu-item .mat-menu-item')); - uploadFile: 'app.create.uploadFile', - uploadFolder: 'app.create.uploadFolder', - createFolder: 'app.create.folder', - createLibrary: 'app.create.library', - createFileFromTemplate: 'app.create.fileFromTemplate', - createFolderFromTemplate: 'app.create.folderFromTemplate', + uploadFileAction = this.byId('app.create.uploadFile'); + uploadFolderAction = this.byId('app.create.uploadFolder'); + createFolderAction = this.byId('app.create.folder'); + createLibraryAction = this.byId('app.create.library'); + createFileFromTemplateAction = this.byId('app.create.fileFromTemplate'); + createFolderFromTemplateAction = this.byId('app.create.folderFromTemplate'); - submenu: 'app-context-menu-item .mat-menu-item', - - editFolder: `.mat-menu-item[id$='editFolder']`, - favoriteAction: `.mat-menu-item[id$='favorite.add']`, - removeFavoriteAction: `.mat-menu-item[id$='favorite.remove']`, - editOffline: `.mat-menu-item[title='Edit Offline']`, - cancelEditing: `.mat-menu-item[title='Cancel Editing']` - }; - - items: ElementArrayFinder = this.component.all(by.css(Menu.selectors.item)); - backdrop: ElementFinder = browser.element(by.css('.cdk-overlay-backdrop')); - - uploadFilesInput: ElementFinder = browser.element(by.id(Menu.selectors.uploadFilesInput)); - submenus: ElementArrayFinder = browser.element.all(by.css(Menu.selectors.submenu)); - - uploadFileAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFile)); - uploadFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.uploadFolder)); - createFolderAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolder)); - createLibraryAction: ElementFinder = this.component.element(by.id(Menu.selectors.createLibrary)); - createFileFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFileFromTemplate)); - createFolderFromTemplateAction: ElementFinder = this.component.element(by.id(Menu.selectors.createFolderFromTemplate)); - - cancelEditingAction: ElementFinder = this.component.element(by.css(Menu.selectors.cancelEditing)); - cancelJoinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Cancel Join')); - copyAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Copy')); - deleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Delete')); - downloadAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Download')); - editFolderAction: ElementFinder = this.component.element(by.css(Menu.selectors.editFolder)); - editOfflineAction: ElementFinder = this.component.element(by.css(Menu.selectors.editOffline)); - favoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.favoriteAction)); - removeFavoriteAction: ElementFinder = this.component.element(by.css(Menu.selectors.removeFavoriteAction)); - toggleFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Favorite')); - toggleRemoveFavoriteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Remove Favorite')); - joinAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Join')); - leaveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Leave')); - managePermissionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permissions')); - manageVersionsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Manage Versions')); - uploadNewVersionAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Upload New Version')); - moveAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Move')); - permanentDeleteAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Permanently Delete')); - restoreAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Restore')); - shareAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Share')); - shareEditAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'Shared Link Settings')); - viewAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View')); - viewDetailsAction: ElementFinder = this.component.element(by.cssContainingText(Menu.selectors.item, 'View Details')); + cancelEditingAction = this.byCss(`.mat-menu-item[title='Cancel Editing']`); + cancelJoinAction = this.byCssText('.mat-menu-item', 'Cancel Join'); + copyAction = this.byCssText('.mat-menu-item', 'Copy'); + deleteAction = this.byCssText('.mat-menu-item', 'Delete'); + downloadAction = this.byCssText('.mat-menu-item', 'Download'); + editFolderAction = this.byCss(`.mat-menu-item[id$='editFolder']`); + editOfflineAction = this.byCss(`.mat-menu-item[title='Edit Offline']`); + favoriteAction = this.byCss(`.mat-menu-item[id$='favorite.add']`); + removeFavoriteAction = this.byCss(`.mat-menu-item[id$='favorite.remove']`); + toggleFavoriteAction = this.byCssText('.mat-menu-item', 'Favorite'); + toggleRemoveFavoriteAction = this.byCssText('.mat-menu-item', 'Remove Favorite'); + joinAction = this.byCssText('.mat-menu-item', 'Join'); + leaveAction = this.byCssText('.mat-menu-item', 'Leave'); + managePermissionsAction = this.byCssText('.mat-menu-item', 'Permissions'); + manageVersionsAction = this.byCssText('.mat-menu-item', 'Manage Versions'); + uploadNewVersionAction = this.byCssText('.mat-menu-item', 'Upload New Version'); + moveAction = this.byCssText('.mat-menu-item', 'Move'); + permanentDeleteAction = this.byCssText('.mat-menu-item', 'Permanently Delete'); + restoreAction = this.byCssText('.mat-menu-item', 'Restore'); + shareAction = this.byCssText('.mat-menu-item', 'Share'); + shareEditAction = this.byCssText('.mat-menu-item', 'Shared Link Settings'); + viewAction = this.byCssText('.mat-menu-item', 'View'); + viewDetailsAction = this.byCssText('.mat-menu-item', 'View Details'); constructor(ancestor?: string) { - super(Menu.selectors.root, ancestor); + super('.mat-menu-panel', ancestor); } async waitForMenuToOpen(): Promise { - await browser.wait(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))), BROWSER_WAIT_TIMEOUT); - await browser.wait(EC.visibilityOf(this.items.get(0)), BROWSER_WAIT_TIMEOUT); + await waitForPresence(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))); + await waitForVisibility(this.items.get(0)); } async waitForMenuToClose(): Promise { - await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')))), BROWSER_WAIT_TIMEOUT); + await waitForStaleness(browser.element(by.css('.cdk-overlay-container .mat-menu-panel'))); } async closeMenu(): Promise { @@ -112,44 +88,24 @@ export class Menu extends Component { return this.items.get(nth - 1); } - getItemByLabel(menuItem: string): ElementFinder { - return this.component.element(by.cssContainingText(Menu.selectors.item, menuItem)); + private getItemByLabel(menuItem: string): ElementFinder { + return this.byCssText('.mat-menu-item', menuItem); } - getSubItemByLabel(subMenuItem: string): ElementFinder { - return this.component.element(by.cssContainingText(Menu.selectors.submenu, subMenuItem)); + private getSubItemByLabel(subMenuItem: string): ElementFinder { + return this.byCssText('app-context-menu-item .mat-menu-item', subMenuItem); } getItemById(id: string): ElementFinder { - return this.component.element(by.id(id)); + return this.byId(id); } async getItemTooltip(menuItem: string): Promise { return this.getItemByLabel(menuItem).getAttribute('title'); } - async getTooltipForUploadFile(): Promise { - return this.getItemTooltip('Upload File'); - } - - async getTooltipForUploadFolder(): Promise { - return this.getItemTooltip('Upload Folder'); - } - - async getTooltipForCreateFolder(): Promise { - return this.getItemTooltip('Create Folder'); - } - - async getTooltipForCreateLibrary(): Promise { - return this.getItemTooltip('Create Library'); - } - - async getTooltipForCreateFileFromTemplate(): Promise { - return this.getItemTooltip('Create file from template'); - } - async getItemIconText(menuItem: string): Promise { - return this.getItemByLabel(menuItem).element(by.css(Menu.selectors.icon)).getText(); + return this.getItemByLabel(menuItem).element(by.css('.mat-icon')).getText(); } async getItemIdAttribute(menuItem: string): Promise { @@ -162,7 +118,7 @@ export class Menu extends Component { async getMenuItems(): Promise { const items: string[] = await this.items.map(async (elem) => { - const span: ElementFinder = elem.element(by.css('span')); + const span = elem.element(by.css('span')); return span.getText(); }); return items; @@ -171,7 +127,7 @@ export class Menu extends Component { async clickNthItem(nth: number): Promise { try { const elem = this.getNthItem(nth); - await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); + await waitForClickable(elem); await browser.actions().mouseMove(elem).perform(); await browser.actions().click().perform(); await this.waitForMenuToClose(); @@ -183,7 +139,7 @@ export class Menu extends Component { async clickMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable'); + await waitForClickable(elem); await elem.click(); } catch (e) { Logger.error('___click menu item catch___', e); @@ -193,7 +149,7 @@ export class Menu extends Component { async mouseOverMenuItem(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); + await waitForClickable(elem); await browser.actions().mouseMove(elem).perform(); await browser.sleep(500); } catch (error) { @@ -204,7 +160,7 @@ export class Menu extends Component { async hasSubMenu(menuItem: string): Promise { try { const elem = this.getItemByLabel(menuItem); - await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); + await waitForClickable(elem); const elemClass = await elem.getAttribute('class'); return elemClass.includes('mat-menu-item-submenu-trigger'); } catch (error) { @@ -216,7 +172,7 @@ export class Menu extends Component { async clickSubMenuItem(subMenuItem: string): Promise { try { const elem = this.getSubItemByLabel(subMenuItem); - await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT); + await waitForClickable(elem); await elem.click(); } catch (e) { Logger.error('___click submenu item catch___', e); @@ -224,11 +180,11 @@ export class Menu extends Component { } async isMenuItemPresent(title: string): Promise { - return browser.element(by.cssContainingText(Menu.selectors.item, title)).isPresent(); + return browser.element(by.cssContainingText('.mat-menu-item', title)).isPresent(); } async isSubMenuItemPresent(title: string): Promise { - return browser.element(by.cssContainingText(Menu.selectors.submenu, title)).isPresent(); + return browser.element(by.cssContainingText('app-context-menu-item .mat-menu-item', title)).isPresent(); } async getSubmenuItemsCount(): Promise { @@ -246,116 +202,6 @@ export class Menu extends Component { } } - uploadFile(): ElementFinder { - return this.uploadFilesInput; - } - - async clickEditFolder(): Promise { - await this.editFolderAction.click(); - } - - async clickShare(): Promise { - const action = this.shareAction; - await action.click(); - } - - async clickSharedLinkSettings(): Promise { - const action = this.shareEditAction; - await action.click(); - } - - async isViewPresent(): Promise { - return this.viewAction.isPresent(); - } - - async isDownloadPresent(): Promise { - return this.downloadAction.isPresent(); - } - - async isEditFolderPresent(): Promise { - return this.editFolderAction.isPresent(); - } - - async isEditOfflinePresent(): Promise { - return this.editOfflineAction.isPresent(); - } - - async isCancelEditingPresent(): Promise { - return this.cancelEditingAction.isPresent(); - } - - async isCopyPresent(): Promise { - return this.copyAction.isPresent(); - } - - async isMovePresent(): Promise { - return this.moveAction.isPresent(); - } - - async isDeletePresent(): Promise { - return this.deleteAction.isPresent(); - } - - async isManagePermissionsPresent(): Promise { - return this.managePermissionsAction.isPresent(); - } - - async isManageVersionsPresent(): Promise { - return this.manageVersionsAction.isPresent(); - } - - async isUploadNewVersionPresent(): Promise { - return this.uploadNewVersionAction.isPresent(); - } - - async isFavoritePresent(): Promise { - return this.favoriteAction.isPresent(); - } - - async isRemoveFavoritePresent(): Promise { - return this.removeFavoriteAction.isPresent(); - } - - async isToggleFavoritePresent(): Promise { - return this.toggleFavoriteAction.isPresent(); - } - - async isToggleRemoveFavoritePresent(): Promise { - return this.toggleRemoveFavoriteAction.isPresent(); - } - - async isJoinLibraryPresent(): Promise { - return this.joinAction.isPresent(); - } - - async isCancelJoinPresent(): Promise { - return this.cancelJoinAction.isPresent(); - } - - async isLeaveLibraryPresent(): Promise { - return this.leaveAction.isPresent(); - } - - async isPermanentDeletePresent(): Promise { - return this.permanentDeleteAction.isPresent(); - } - - async isRestorePresent(): Promise { - return this.restoreAction.isPresent(); - } - - async isSharePresent(): Promise { - return this.shareAction.isPresent(); - } - - async isSharedLinkSettingsPresent(): Promise { - return this.shareEditAction.isPresent(); - } - - async isViewDetailsPresent(): Promise { - return this.viewDetailsAction.isPresent(); - } - async isCreateFolderEnabled(): Promise { return isPresentAndEnabled(this.createFolderAction); } @@ -379,24 +225,4 @@ export class Menu extends Component { async isCreateFolderFromTemplateEnabled(): Promise { return isPresentAndEnabled(this.createFolderFromTemplateAction); } - - async clickCreateFolder(): Promise { - const action = this.createFolderAction; - await action.click(); - } - - async clickCreateLibrary(): Promise { - const action = this.createLibraryAction; - await action.click(); - } - - async clickCreateFileFromTemplate(): Promise { - const action = this.createFileFromTemplateAction; - await action.click(); - } - - async clickCreateFolderFromTemplate(): Promise { - const action = this.createFolderFromTemplateAction; - await action.click(); - } } diff --git a/e2e/components/metadata-card/metadata-card.ts b/e2e/components/metadata-card/metadata-card.ts index 3dfd5cd3e..9907956cf 100644 --- a/e2e/components/metadata-card/metadata-card.ts +++ b/e2e/components/metadata-card/metadata-card.ts @@ -23,43 +23,31 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; import { Component } from '../component'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { waitForPresence } from '../../utilities/utils'; export class MetadataCard extends Component { - private static selectors = { - root: 'adf-content-metadata-card', - footer: '.adf-content-metadata-card-footer', - expandButton: '[data-automation-id="meta-data-card-toggle-expand"]', - expansionPanel: '.adf-metadata-grouped-properties-container mat-expansion-panel' - }; - - footer: ElementFinder = this.component.element(by.css(MetadataCard.selectors.footer)); - expandButton: ElementFinder = this.component.element(by.css(MetadataCard.selectors.expandButton)); - expansionPanels: ElementArrayFinder = this.component.all(by.css(MetadataCard.selectors.expansionPanel)); + footer = this.byCss('.adf-content-metadata-card-footer'); + expandButton = this.byCss('[data-automation-id="meta-data-card-toggle-expand"]'); + expansionPanels = this.allByCss('.adf-metadata-grouped-properties-container mat-expansion-panel'); constructor(ancestor?: string) { - super(MetadataCard.selectors.root, ancestor); + super('adf-content-metadata-card', ancestor); } async isExpandPresent() { return this.expandButton.isPresent(); } - async clickExpandButton() { - await this.expandButton.click(); - } - async waitForFirstExpansionPanel() { - await browser.wait(EC.presenceOf(this.expansionPanels.get(0)), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.expansionPanels.get(0)); } - async isExpansionPanelPresent(index) { + async isExpansionPanelPresent(index: number) { return this.expansionPanels.get(index).isPresent(); } - async getComponentIdOfPanel(index) { + async getComponentIdOfPanel(index: number) { return this.expansionPanels.get(index).getAttribute('data-automation-id'); } } diff --git a/e2e/components/pagination/pagination.ts b/e2e/components/pagination/pagination.ts index cadf9df4e..fb98f2fea 100755 --- a/e2e/components/pagination/pagination.ts +++ b/e2e/components/pagination/pagination.ts @@ -23,60 +23,43 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor'; +import { browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Menu } from '../menu/menu'; import { Component } from '../component'; +import { waitForClickable } from '../../utilities/utils'; export class Pagination extends Component { - private static selectors = { - root: 'adf-pagination', - range: '.adf-pagination__range', - maxItems: '.adf-pagination__max-items', - currentPage: '.adf-pagination__current-page', - totalPages: '.adf-pagination__total-pages', - - previousButton: '.adf-pagination__previous-button', - nextButton: '.adf-pagination__next-button', - maxItemsButton: '.adf-pagination__max-items + button[mat-icon-button]', - pagesButton: '.adf-pagination__current-page + button[mat-icon-button]' - }; - - range: ElementFinder = this.component.element(by.css(Pagination.selectors.range)); - maxItems: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItems)); - currentPage: ElementFinder = this.component.element(by.css(Pagination.selectors.currentPage)); - totalPages: ElementFinder = this.component.element(by.css(Pagination.selectors.totalPages)); - previousButton: ElementFinder = this.component.element(by.css(Pagination.selectors.previousButton)); - nextButton: ElementFinder = this.component.element(by.css(Pagination.selectors.nextButton)); - maxItemsButton: ElementFinder = this.component.element(by.css(Pagination.selectors.maxItemsButton)); - pagesButton: ElementFinder = this.component.element(by.css(Pagination.selectors.pagesButton)); + range = this.byCss('.adf-pagination__range'); + maxItems = this.byCss('.adf-pagination__max-items'); + currentPage = this.byCss('.adf-pagination__current-page'); + totalPages = this.byCss('.adf-pagination__total-pages'); + previousButton = this.byCss('.adf-pagination__previous-button'); + nextButton = this.byCss('.adf-pagination__next-button'); + maxItemsButton = this.byCss('.adf-pagination__max-items + button[mat-icon-button]'); + pagesButton = this.byCss('.adf-pagination__current-page + button[mat-icon-button]'); menu: Menu = new Menu(); constructor(ancestor?: string) { - super(Pagination.selectors.root, ancestor); + super('adf-pagination', ancestor); } async openMaxItemsMenu() { - const { menu, maxItemsButton } = this; - try { - await browser.wait(EC.elementToBeClickable(maxItemsButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for maxItemsButton to be clickable'); - await maxItemsButton.click(); - await menu.waitForMenuToOpen(); + await waitForClickable(this.maxItemsButton, 'timeout waiting for maxItemsButton to be clickable'); + await this.maxItemsButton.click(); + await this.menu.waitForMenuToOpen(); } catch (error) { Logger.error('____ open max items catch ___', error); } } async openCurrentPageMenu() { - const { menu, pagesButton } = this; - try { - await browser.wait(EC.elementToBeClickable(pagesButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for pagesButton to be clickable'); - await pagesButton.click(); - await menu.waitForMenuToOpen(); + await waitForClickable(this.pagesButton, 'timeout waiting for pagesButton to be clickable'); + await this.pagesButton.click(); + await this.menu.waitForMenuToOpen(); } catch (error) { Logger.error('____ open current page menu ___', error); } diff --git a/e2e/components/search/search-filters.ts b/e2e/components/search/search-filters.ts index db4a43234..20e5e5eeb 100755 --- a/e2e/components/search/search-filters.ts +++ b/e2e/components/search/search-filters.ts @@ -23,7 +23,7 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser } from 'protractor'; +import { by, browser } from 'protractor'; import { Component } from '../component'; import { SizeFilter } from './filters/size-filter'; import { CreatedDateFilter } from './filters/created-date-filter'; @@ -31,12 +31,8 @@ import { FacetFilter } from './filters/facet-filter'; import { isPresentAndDisplayed } from '../../utilities/utils'; export class SearchFilters extends Component { - private static selectors = { - root: 'adf-search-filter', - }; - - mainPanel: ElementFinder = browser.element(by.css(SearchFilters.selectors.root)); - resetAllButton: ElementFinder = this.component.element(by.cssContainingText('.mat-button', 'Reset all')); + mainPanel = browser.element(by.css('adf-search-filter')); + resetAllButton = this.byCssText('.mat-button', 'Reset all'); size = new SizeFilter(); createdDate = new CreatedDateFilter(); @@ -47,15 +43,10 @@ export class SearchFilters extends Component { modifiedDate = new FacetFilter('Modified date'); constructor(ancestor?: string) { - super(SearchFilters.selectors.root, ancestor); + super('adf-search-filter', ancestor); } async isSearchFiltersPanelDisplayed(): Promise { return isPresentAndDisplayed(this.mainPanel); } - - async clickResetAllButton(): Promise { - await this.resetAllButton.click(); - } - } diff --git a/e2e/components/search/search-input.ts b/e2e/components/search/search-input.ts index 55bba754b..59803fb43 100755 --- a/e2e/components/search/search-input.ts +++ b/e2e/components/search/search-input.ts @@ -23,43 +23,31 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, browser, by, until, protractor, ExpectedConditions as EC } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { browser, by, protractor } from 'protractor'; import { Component } from '../component'; -import { Utils } from '../../utilities/utils'; +import { Utils, waitForPresence, waitForClickable, waitElement } from '../../utilities/utils'; export class SearchInput extends Component { - private static selectors = { - root: 'aca-search-input', - searchContainer: '.app-search-container', - searchButton: '.app-search-button', - searchControl: '.app-search-control', - searchInput: `input[id='app-control-input']`, - searchOptionsArea: 'search-options', - optionCheckbox: '.mat-checkbox', - clearButton: '.app-clear-icon' - }; - - searchButton: ElementFinder = this.component.element(by.css(SearchInput.selectors.searchButton)); - searchContainer: ElementFinder = browser.element(by.css(SearchInput.selectors.searchContainer)); - searchControl: ElementFinder = browser.element(by.css(SearchInput.selectors.searchControl)); - searchInput: ElementFinder = browser.element(by.css(SearchInput.selectors.searchInput)); - searchOptionsArea: ElementFinder = browser.element(by.id(SearchInput.selectors.searchOptionsArea)); - searchFilesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Files')); - searchFoldersOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Folders')); - searchLibrariesOption: ElementFinder = this.searchOptionsArea.element(by.cssContainingText(SearchInput.selectors.optionCheckbox, 'Libraries')); - clearSearchButton: ElementFinder = this.searchContainer.$(SearchInput.selectors.clearButton); + searchButton = this.component.element(by.css('.app-search-button')); + searchContainer = browser.element(by.css('.app-search-container')); + searchControl = browser.element(by.css('.app-search-control')); + searchInput = browser.element(by.css(`input[id='app-control-input']`)); + searchOptionsArea = browser.element(by.id('search-options')); + searchFilesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Files')); + searchFoldersOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Folders')); + searchLibrariesOption = this.searchOptionsArea.element(by.cssContainingText('.mat-checkbox', 'Libraries')); + clearSearchButton = this.searchContainer.$('.app-clear-icon'); constructor(ancestor?: string) { - super(SearchInput.selectors.root, ancestor); + super('aca-search-input', ancestor); } async waitForSearchControl() { - await browser.wait(EC.presenceOf(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); + await waitForPresence(this.searchControl); } async waitForSearchInputToBeInteractive() { - await browser.wait(EC.elementToBeClickable(this.searchControl), BROWSER_WAIT_TIMEOUT, '--- timeout waitForSearchControl ---'); + waitForClickable(this.searchControl); } async isSearchContainerDisplayed() { @@ -70,28 +58,28 @@ export class SearchInput extends Component { } async clickSearchButton() { - await Utils.waitUntilElementClickable(this.searchButton); + await waitForClickable(this.searchButton); await this.searchButton.click(); await this.waitForSearchControl(); } async isOptionsAreaDisplayed() { - await browser.wait(until.elementLocated(by.css(SearchInput.selectors.searchControl)), BROWSER_WAIT_TIMEOUT); + await waitElement('.app-search-control'); return browser.isElementPresent(this.searchOptionsArea); } async clickFilesOption() { - await browser.wait(EC.elementToBeClickable(this.searchFilesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Files to be clickable'); + await waitForClickable(this.searchFilesOption); await this.searchFilesOption.click(); } async clickFoldersOption() { - await browser.wait(EC.elementToBeClickable(this.searchFoldersOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Folders to be clickable'); + await waitForClickable(this.searchFoldersOption); await this.searchFoldersOption.click(); } async clickLibrariesOption() { - await browser.wait(EC.elementToBeClickable(this.searchLibrariesOption), BROWSER_WAIT_TIMEOUT, '--- timeout waiting for Libraries to be clickable'); + await waitForClickable(this.searchLibrariesOption); await this.searchLibrariesOption.click(); } diff --git a/e2e/components/search/search-sorting-picker.ts b/e2e/components/search/search-sorting-picker.ts index 36bf65736..d45c8db2f 100755 --- a/e2e/components/search/search-sorting-picker.ts +++ b/e2e/components/search/search-sorting-picker.ts @@ -23,45 +23,53 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; +import { by, browser } from 'protractor'; import { Component } from '../component'; -import { isPresentAndDisplayed } from '../../utilities/utils'; +import { isPresentAndDisplayed, waitForVisibility } from '../../utilities/utils'; + +export type SortByType = + | 'Relevance' + | 'Title' + | 'Filename' + | 'Modified date' + | 'Modifier' + | 'Created date' + | 'Size' + | 'Type'; + +export type SortOrderType = + | 'ASC' + | 'DESC' + | ''; export class SearchSortingPicker extends Component { - private static selectors = { - root: 'adf-search-sorting-picker', - - sortByOption: '.mat-option .mat-option-text' - }; - - sortOrderButton: ElementFinder = this.component.element(by.css('button[mat-icon-button]')); - sortByDropdownCollapsed: ElementFinder = this.component.element(by.css('.mat-select')); - sortByDropdownExpanded: ElementFinder = browser.element(by.css('.mat-select-panel')); - sortByList: ElementArrayFinder = this.sortByDropdownExpanded.all(by.css(SearchSortingPicker.selectors.sortByOption)); + sortOrderButton = this.byCss('button[mat-icon-button]'); + sortByDropdownCollapsed = this.byCss('.mat-select'); + sortByDropdownExpanded = browser.element(by.css('.mat-select-panel')); + sortByList = this.sortByDropdownExpanded.all(by.css('.mat-option .mat-option-text')); constructor(ancestor?: string) { - super(SearchSortingPicker.selectors.root, ancestor); + super('adf-search-sorting-picker', ancestor); } async waitForSortByDropdownToExpand(): Promise { - await browser.wait(EC.visibilityOf(this.sortByDropdownExpanded), BROWSER_WAIT_TIMEOUT, 'Timeout waiting for sortBy dropdown to expand'); + await waitForVisibility(this.sortByDropdownExpanded, 'Timeout waiting for sortBy dropdown to expand'); } async isSortOrderButtonDisplayed(): Promise { return isPresentAndDisplayed(this.sortOrderButton); } - async getSortOrder(): Promise<'ASC' | 'DESC' | ''> { + async getSortOrder(): Promise { const orderArrow = await this.sortOrderButton.getText(); if ( orderArrow.includes('upward') ) { return 'ASC' } else if ( orderArrow.includes('downward') ) { - return 'DESC' - } else { - return ''; - } + return 'DESC' + } else { + return ''; + } } async isSortByOptionDisplayed(): Promise { @@ -88,46 +96,14 @@ export class SearchSortingPicker extends Component { return list; } - async sortByOption(option: string): Promise { + async sortBy(option: SortByType): Promise { if ( !(await this.isSortByDropdownExpanded()) ) { await this.clickSortByDropdown(); } - const elem = browser.element(by.cssContainingText(SearchSortingPicker.selectors.sortByOption, option)); + const elem = browser.element(by.cssContainingText('.mat-option .mat-option-text', option)); await elem.click(); } - async sortByName(): Promise { - await this.sortByOption('Filename'); - } - - async sortByRelevance(): Promise { - await this.sortByOption('Relevance'); - } - - async sortByTitle(): Promise { - await this.sortByOption('Title'); - } - - async sortByModifiedDate(): Promise { - await this.sortByOption('Modified date'); - } - - async sortByModifier(): Promise { - await this.sortByOption('Modifier'); - } - - async sortByCreatedDate(): Promise { - await this.sortByOption('Created date'); - } - - async sortBySize(): Promise { - await this.sortByOption('Size'); - } - - async sortByType(): Promise { - await this.sortByOption('Type'); - } - async setSortOrderASC(): Promise { if ( (await this.getSortOrder()) !== 'ASC' ) { await this.sortOrderButton.click(); diff --git a/e2e/components/sidenav/sidenav.ts b/e2e/components/sidenav/sidenav.ts index 0d29c4a40..56efad686 100755 --- a/e2e/components/sidenav/sidenav.ts +++ b/e2e/components/sidenav/sidenav.ts @@ -23,55 +23,30 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, element, browser } from 'protractor'; +import { ElementFinder, by, element, browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Menu } from '../menu/menu'; import { Component } from '../component'; -import { Utils } from '../../utilities/utils'; +import { waitForClickable } from '../../utilities/utils'; export class Sidenav extends Component { - private static selectors = { - root: 'app-sidenav', - link: '.item', - label: '.action-button__label', - expansion_panel: ".mat-expansion-panel-header", - expansion_panel_content: ".mat-expansion-panel-body", - active: 'mat-accent', - activeClass: '.action-button--active', - activeClassName: 'action-button--active', - activeChild: 'action-button--active', - - newButton: '[data-automation-id="create-button"]', - - personalFiles: `[data-automation-id='app.navbar.personalFiles']`, - fileLibraries: `[data-automation-id='app.navbar.libraries.menu']`, - myLibraries: `[data-automation-id='app.navbar.libraries.files']`, - favoriteLibraries: `[data-automation-id='app.navbar.libraries.favorite']`, - shared: `[data-automation-id='app.navbar.shared']`, - recentFiles: `[data-automation-id='app.navbar.recentFiles']`, - favorites: `[data-automation-id='app.navbar.favorites']`, - trash: `[data-automation-id='app.navbar.trashcan']` - }; - - links: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.link)); - activeLink: ElementFinder = this.component.element(by.css(Sidenav.selectors.activeClass)); - - newButton: ElementArrayFinder = this.component.all(by.css(Sidenav.selectors.newButton)); - - personalFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.personalFiles)); - fileLibraries: ElementFinder = this.component.element(by.css(Sidenav.selectors.fileLibraries)); - myLibraries: ElementFinder = browser.element(by.css(Sidenav.selectors.myLibraries)); - favoriteLibraries: ElementFinder = browser.element(by.css(Sidenav.selectors.favoriteLibraries)); - shared: ElementFinder = this.component.element(by.css(Sidenav.selectors.shared)); - recentFiles: ElementFinder = this.component.element(by.css(Sidenav.selectors.recentFiles)); - favorites: ElementFinder = this.component.element(by.css(Sidenav.selectors.favorites)); - trash: ElementFinder = this.component.element(by.css(Sidenav.selectors.trash)); + links = this.component.all(by.css('.item')); + activeLink = this.byCss('.action-button--active'); + newButton = this.allByCss('[data-automation-id="create-button"]'); + personalFiles = this.byCss(`[data-automation-id='app.navbar.personalFiles']`); + fileLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.menu']`); + myLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.files']`, browser); + favoriteLibraries = this.byCss(`[data-automation-id='app.navbar.libraries.favorite']`, browser); + shared = this.byCss(`[data-automation-id='app.navbar.shared']`); + recentFiles = this.byCss(`[data-automation-id='app.navbar.recentFiles']`); + favorites = this.byCss(`[data-automation-id='app.navbar.favorites']`); + trash = this.byCss(`[data-automation-id='app.navbar.trashcan']`); menu: Menu = new Menu(); constructor(ancestor?: string) { - super(Sidenav.selectors.root, ancestor); + super('app-sidenav', ancestor); } private async expandMenu(name: string): Promise { @@ -81,9 +56,9 @@ export class Sidenav extends Component { return Promise.resolve(); } else { const link = this.getLink(name); - await Utils.waitUntilElementClickable(link); + await waitForClickable(link); await link.click(); - await element(by.css(Sidenav.selectors.expansion_panel_content)).isPresent(); + await element(by.css('.mat-expansion-panel-body')).isPresent(); } } catch (e) { @@ -98,38 +73,39 @@ export class Sidenav extends Component { async openCreateFolderDialog(): Promise { await this.openNewMenu(); - await this.menu.clickCreateFolder(); + await this.menu.createFolderAction.click(); } async openCreateLibraryDialog(): Promise { await this.openNewMenu(); - await this.menu.clickCreateLibrary(); + await this.menu.createLibraryAction.click(); } async openCreateFileFromTemplateDialog(): Promise { await this.openNewMenu(); - await this.menu.clickCreateFileFromTemplate(); + await this.menu.createFileFromTemplateAction.click(); } async openCreateFolderFromTemplateDialog(): Promise { await this.openNewMenu(); - await this.menu.clickCreateFolderFromTemplate(); + await this.menu.createFolderFromTemplateAction.click(); } async isActive(name: string): Promise { - return (await this.getLinkLabel(name).getAttribute('class')).includes(Sidenav.selectors.activeClassName); + const cssClass = await this.getLinkLabel(name).getAttribute('class'); + return cssClass.includes('action-button--active'); } async childIsActive(name: string): Promise { const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class'); - return childClass.includes(Sidenav.selectors.activeChild); + return childClass.includes('action-button--active'); } getLink(name: string): ElementFinder { return this.getLinkLabel(name).element(by.xpath('..')); } - getLinkLabel(name: string): ElementFinder { + private getLinkLabel(name: string): ElementFinder { switch (name) { case 'Personal Files': return this.personalFiles; case 'File Libraries': return this.fileLibraries; @@ -143,10 +119,6 @@ export class Sidenav extends Component { } } - getActiveLink(): ElementFinder { - return this.activeLink; - } - async getLinkTooltip(name: string): Promise { const link = this.getLinkLabel(name); const condition = () => link.getAttribute('title').then(value => value && value.length > 0); @@ -160,7 +132,7 @@ export class Sidenav extends Component { async clickLink(name: string): Promise { try{ const link = this.getLinkLabel(name); - await Utils.waitUntilElementClickable(link); + await waitForClickable(link); await link.click(); } catch (error) { Logger.error('---- sidebar navigation clickLink catch error: ', error); diff --git a/e2e/components/toolbar/toolbar.ts b/e2e/components/toolbar/toolbar.ts index 7309fbdc1..01bb1a631 100755 --- a/e2e/components/toolbar/toolbar.ts +++ b/e2e/components/toolbar/toolbar.ts @@ -23,60 +23,38 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, ElementArrayFinder, by, browser } from 'protractor'; +import { ElementFinder, by, browser } from 'protractor'; import { Menu } from '../menu/menu'; import { Component } from '../component'; import { Utils } from '../../utilities/utils'; export class Toolbar extends Component { - private static selectors = { - root: '.adf-toolbar', - button: 'button', + menu = new Menu(); - share: `.mat-icon-button[title='Share']`, - shareEdit: `.mat-icon-button[title='Shared Link Settings']`, - view: `.mat-icon-button[title='View']`, - searchFilterToggle: `.mat-icon-button[title='Toggle search filter']`, - download: `.mat-icon-button[title='Download']`, - editFolder: 'app.toolbar.editFolder', - viewDetails: `.mat-icon-button[title='View Details']`, - print: `.mat-icon-button[title='Print']`, - fullScreen: `.mat-icon-button[title='Activate full-screen mode']`, - joinLibrary: `.mat-icon-button[title='Join']`, - leaveLibrary: `.mat-icon-button[title='Leave Library']`, - permanentlyDelete: `.mat-icon-button[title='Permanently Delete']`, - restore: `.mat-icon-button[title='Restore']` - }; - - menu: Menu = new Menu(); - buttons: ElementArrayFinder = this.component.all(by.css(Toolbar.selectors.button)); - shareButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.share)); - shareEditButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.shareEdit)); - viewButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.view)); - searchFiltersToggleButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.searchFilterToggle)); - downloadButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.download)); - editFolderButton: ElementFinder = this.component.element(by.id(Toolbar.selectors.editFolder)); - viewDetailsButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.viewDetails)); - printButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.print)); - fullScreenButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.fullScreen)); - joinButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.joinLibrary)); - leaveButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.leaveLibrary)); - permanentlyDeleteButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.permanentlyDelete)); - restoreButton: ElementFinder = this.component.element(by.css(Toolbar.selectors.restore)); + buttons = this.allByCss('button'); + shareButton = this.byCss(`.mat-icon-button[title='Share']`); + shareEditButton = this.byCss(`.mat-icon-button[title='Shared Link Settings']`); + viewButton = this.byCss(`.mat-icon-button[title='View']`); + searchFiltersToggleButton = this.byCss(`.mat-icon-button[title='Toggle search filter']`); + downloadButton = this.byCss(`.mat-icon-button[title='Download']`); + editFolderButton = this.byId('app.toolbar.editFolder'); + viewDetailsButton = this.byCss(`.mat-icon-button[title='View Details']`); + printButton = this.byCss(`.mat-icon-button[title='Print']`); + fullScreenButton = this.byCss(`.mat-icon-button[title='Activate full-screen mode']`); + joinButton = this.byCss(`.mat-icon-button[title='Join']`); + leaveButton = this.byCss(`.mat-icon-button[title='Leave Library']`); + permanentlyDeleteButton = this.byCss(`.mat-icon-button[title='Permanently Delete']`); + restoreButton = this.byCss(`.mat-icon-button[title='Restore']`); constructor(ancestor?: string) { - super(Toolbar.selectors.root, ancestor); + super('.adf-toolbar', ancestor); } - async isEmpty() { + async isEmpty(): Promise { const count = await this.buttons.count(); return count === 0; } - async numberOfAvailableActions() { - return this.buttons.count(); - } - async getButtons(): Promise { return this.buttons.map(async elem => { return elem.getAttribute('title'); @@ -84,26 +62,24 @@ export class Toolbar extends Component { } async isButtonPresent(title: string) { - const elem = this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)); - return elem.isPresent(); - } - - getButtonByLabel(label: string) { - return this.component.element(by.cssContainingText(Toolbar.selectors.button, label)); + const element = this.byCss(`button[title="${title}"]`); + return element.isPresent(); } getButtonByTitleAttribute(title: string) { - return this.component.element(by.css(`${Toolbar.selectors.button}[title="${title}"]`)); + return this.byCss(`button[title="${title}"]`); } getButtonById(id: string) { return this.component.element(by.id(id)); } - async openMoreMenu() { + async openMoreMenu(): Promise { await this.isButtonPresent('More Actions'); + const moreMenu = this.getButtonByTitleAttribute('More Actions'); await moreMenu.click(); + await this.menu.waitForMenuToOpen(); } @@ -111,150 +87,61 @@ export class Toolbar extends Component { await Utils.pressEscape(); } - async getButtonTooltip(button: ElementFinder) { + async getButtonTooltip(button: ElementFinder): Promise { return button.getAttribute('title'); } - async clickButton(title: string) { - const btn = this.getButtonByTitleAttribute(title); - await btn.click(); - } - - - async isSharedLinkSettingsPresent() { - return browser.isElementPresent(this.shareEditButton); - } - - async isSharePresent() { - return browser.isElementPresent(this.shareButton); - } - - async isViewPresent() { - return browser.isElementPresent(this.viewButton); - } - - async isToggleSearchFiltersPresent() { - return browser.isElementPresent(this.searchFiltersToggleButton); - } - - async isDownloadPresent() { - return browser.isElementPresent(this.downloadButton); - } - - async isPermanentlyDeletePresent() { - return browser.isElementPresent(this.permanentlyDeleteButton); - } - - async isRestorePresent() { - return browser.isElementPresent(this.restoreButton); - } - - async isEditFolderPresent() { - return browser.isElementPresent(this.editFolderButton); - } - - async isViewDetailsPresent() { - return browser.isElementPresent(this.viewDetailsButton); + async clickButton(title: string): Promise { + await this.getButtonByTitleAttribute(title).click(); } async isPrintPresent() { return browser.isElementPresent(this.printButton); } - async isFullScreenPresent() { - return browser.isElementPresent(this.fullScreenButton); - } - - - async clickShare() { - const btn = this.shareButton; - await btn.click(); - } - - async clickSharedLinkSettings() { - const btn = this.shareEditButton; - await btn.click(); - } - - async clickView() { - await this.viewButton.click(); - } - - async clickEditFolder() { - await this.editFolderButton.click(); - } - - async clickViewDetails() { - await this.viewDetailsButton.click(); - } - - async clickDownload() { - await this.downloadButton.click(); - } - - async clickJoin() { - await this.joinButton.click(); - } - - async clickLeave() { - await this.leaveButton.click(); - } - - async clickPermanentlyDelete() { - await this.permanentlyDeleteButton.click(); - } - async clickRestore() { - await this.restoreButton.click(); - } - - - async clickMoreActionsFavorite() { + async clickMoreActionsFavorite(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Favorite'); } - async clickMoreActionsRemoveFavorite() { + async clickMoreActionsRemoveFavorite(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Remove Favorite'); } - async clickMoreActionsDelete() { + async clickMoreActionsDelete(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Delete'); } - async clickMoreActionsManageVersions() { + async clickMoreActionsManageVersions(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Manage Versions'); } - async clickMoreActionsMove() { + async clickMoreActionsMove(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Move'); } - async clickMoreActionsCopy() { + async clickMoreActionsCopy(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Copy'); } - async clickMoreActionsEditOffline() { + async clickMoreActionsEditOffline(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Edit Offline'); } - async clickMoreActionsCancelEditing() { + async clickMoreActionsCancelEditing(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Cancel Editing'); } - async clickMoreActionsUploadNewVersion() { + async clickMoreActionsUploadNewVersion(): Promise { await this.openMoreMenu(); await this.menu.clickMenuItem('Upload New Version'); } - async clickFullScreen() { - await this.fullScreenButton.click(); - } - } diff --git a/e2e/components/viewer/viewer.ts b/e2e/components/viewer/viewer.ts index 860d6a3a7..0343cd01f 100755 --- a/e2e/components/viewer/viewer.ts +++ b/e2e/components/viewer/viewer.ts @@ -23,44 +23,31 @@ * along with Alfresco. If not, see . */ -import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor'; +import { browser } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; import { Component } from '../component'; -import { BROWSER_WAIT_TIMEOUT } from '../../configs'; import { Toolbar } from '../toolbar/toolbar'; +import { waitForPresence } from '../../utilities/utils'; export class Viewer extends Component { - private static selectors = { - root: 'adf-viewer', + root = browser.$('adf-viewer'); + viewerLayout = this.byCss('.adf-viewer-layout-content'); + viewerContainer = this.byCss('.adf-viewer-content-container'); + closeButton = this.byCss('.adf-viewer-close-button'); + fileTitle = this.byCss('.adf-viewer__file-title'); + viewerExtensionContent = this.byCss('adf-preview-extension'); + pdfViewerContentPages = this.allByCss('.adf-pdf-viewer__content .page'); - layout: '.adf-viewer-layout-content', - contentContainer: '.adf-viewer-content-container', - closeBtn: '.adf-viewer-close-button', - fileTitle: '.adf-viewer__file-title', - - viewerExtensionContent: 'adf-preview-extension', - - pdfViewerContentPage: '.adf-pdf-viewer__content .page' - }; - - root: ElementFinder = browser.$(Viewer.selectors.root); - viewerLayout: ElementFinder = this.component.element(by.css(Viewer.selectors.layout)); - viewerContainer: ElementFinder = this.component.element(by.css(Viewer.selectors.contentContainer)); - closeButton: ElementFinder = this.component.element(by.css(Viewer.selectors.closeBtn)); - fileTitle: ElementFinder = this.component.element(by.css(Viewer.selectors.fileTitle)); - viewerExtensionContent: ElementFinder = this.component.element(by.css(Viewer.selectors.viewerExtensionContent)); - pdfViewerContentPages: ElementArrayFinder = this.component.all(by.css(Viewer.selectors.pdfViewerContentPage)); - - toolbar = new Toolbar(Viewer.selectors.root); + toolbar = new Toolbar('adf-viewer'); constructor(ancestor?: string) { - super(Viewer.selectors.root, ancestor); + super('adf-viewer', ancestor); } async waitForViewerToOpen() { try { - await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT); - await browser.wait(EC.presenceOf(this.viewerLayout), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.viewerContainer); + await waitForPresence(this.viewerLayout); } catch (error) { Logger.error('\n-----> catch waitForViewerToOpen <-----\n', error) } @@ -70,10 +57,6 @@ export class Viewer extends Component { return browser.isElementPresent(this.viewerLayout); } - async isViewerContentDisplayed() { - return browser.isElementPresent(this.viewerContainer); - } - async isViewerToolbarDisplayed() { return browser.isElementPresent(this.toolbar.component); } @@ -86,15 +69,11 @@ export class Viewer extends Component { return browser.isElementPresent(this.fileTitle); } - async clickClose() { - await this.closeButton.click(); - } - - async getCloseButtonTooltip() { + async getCloseButtonTooltip(): Promise { return this.toolbar.getButtonTooltip(this.closeButton); } - async getFileTitle() { + async getFileTitle(): Promise { return this.fileTitle.getText(); } @@ -110,7 +89,7 @@ export class Viewer extends Component { return ''; } - async isPdfViewerContentDisplayed() { + async isPdfViewerContentDisplayed(): Promise { const count = await this.pdfViewerContentPages.count(); return count > 0; } diff --git a/e2e/pages/browsing-page.ts b/e2e/pages/browsing-page.ts index c3d86b06d..f6e4c6f9a 100755 --- a/e2e/pages/browsing-page.ts +++ b/e2e/pages/browsing-page.ts @@ -35,97 +35,84 @@ export class BrowsingPage extends Page { dataTable = new DataTable(this.appRoot); pagination = new Pagination(this.appRoot); - async signOut() { + async signOut(): Promise { await this.header.userInfo.signOut(); } - async isSnackBarPresent() { - return this.snackBar.isPresent(); - } - - // helper methods - - async clickPersonalFiles() { + async clickPersonalFiles(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.PERSONAL_FILES); } - async clickPersonalFilesAndWait() { + async clickPersonalFilesAndWait(): Promise { await this.clickPersonalFiles(); await this.dataTable.waitForHeader(); } - - async clickFileLibraries() { + async clickFileLibraries(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.FILE_LIBRARIES); } - async clickFileLibrariesAndWait() { + async clickFileLibrariesAndWait(): Promise { await this.clickFileLibraries(); await this.dataTable.waitForHeader(); } - - async goToFavoriteLibraries() { + async goToFavoriteLibraries(): Promise { if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) { await this.sidenav.expandFileLibraries(); } await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES); } - async goToFavoriteLibrariesAndWait() { + async goToFavoriteLibrariesAndWait(): Promise { await this.goToFavoriteLibraries(); await this.dataTable.waitForHeader(); } - - async goToMyLibraries() { + async goToMyLibraries(): Promise { if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) { await this.sidenav.expandFileLibraries(); } await this.sidenav.clickLink(SIDEBAR_LABELS.MY_LIBRARIES); } - async goToMyLibrariesAndWait() { + async goToMyLibrariesAndWait(): Promise { await this.goToMyLibraries(); await this.dataTable.waitForHeader(); } - - async clickRecentFiles() { + async clickRecentFiles(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.RECENT_FILES); } - async clickRecentFilesAndWait() { + async clickRecentFilesAndWait(): Promise { await this.clickRecentFiles(); await this.dataTable.waitForHeader(); } - - async clickSharedFiles() { + async clickSharedFiles(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.SHARED_FILES); } - async clickSharedFilesAndWait() { + async clickSharedFilesAndWait(): Promise { await this.clickSharedFiles(); await this.dataTable.waitForHeader(); } - - async clickFavorites() { + async clickFavorites(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITES); } - async clickFavoritesAndWait() { + async clickFavoritesAndWait(): Promise { await this.clickFavorites(); await this.dataTable.waitForHeader(); } - - async clickTrash() { + async clickTrash(): Promise { await this.sidenav.clickLink(SIDEBAR_LABELS.TRASH); } - async clickTrashAndWait() { + async clickTrashAndWait(): Promise { await this.clickTrash(); await this.dataTable.waitForHeader(); } diff --git a/e2e/pages/login-page.ts b/e2e/pages/login-page.ts index 12a33da7b..2345e9a86 100755 --- a/e2e/pages/login-page.ts +++ b/e2e/pages/login-page.ts @@ -22,33 +22,30 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -import { browser, ExpectedConditions as EC } from 'protractor'; +import { browser } from 'protractor'; import { LoginComponent } from '../components/components'; import { Page } from './page'; -import { BROWSER_WAIT_TIMEOUT, APP_ROUTES } from '../configs'; +import { APP_ROUTES } from '../configs'; +import { waitForPresence } from '../utilities/utils'; export class LoginPage extends Page { - login: LoginComponent = new LoginComponent(this.appRoot); + login = new LoginComponent(this.appRoot); - /** @override */ constructor() { super(APP_ROUTES.LOGIN); } - /** @override */ async load() { await super.load(); - const { submitButton } = this.login; - const hasSubmitButton = EC.presenceOf(submitButton); - return browser.wait(hasSubmitButton, BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.login.submitButton); } async loginWith(username: string, password?: string) { const pass = password || username; await this.load(); await this.login.enterCredentials(username, pass) - await this.login.submit(); + await this.login.submitButton.click(); return super.waitForApp(); } @@ -61,7 +58,7 @@ export class LoginPage extends Page { const pass = password || username; await this.load(); await this.login.enterCredentials(username, pass); - await this.login.submit(); - return browser.wait(EC.presenceOf(this.login.errorMessage), BROWSER_WAIT_TIMEOUT); + await this.login.submitButton.click(); + await waitForPresence(this.login.errorMessage); } } diff --git a/e2e/pages/page.ts b/e2e/pages/page.ts index 549837f79..45f1773d1 100755 --- a/e2e/pages/page.ts +++ b/e2e/pages/page.ts @@ -23,43 +23,28 @@ * along with Alfresco. If not, see . */ -import { browser, by, ElementFinder, ExpectedConditions as EC, until } from 'protractor'; +import { browser, by, ElementFinder } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; -import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs'; -import { Utils } from '../utilities/utils'; +import { USE_HASH_STRATEGY } from './../configs'; +import { Utils, waitElement, waitForPresence, waitForVisibility } from '../utilities/utils'; export abstract class Page { - protected static locators = { - root: 'app-root', - layout: 'app-layout', - overlay: '.cdk-overlay-container', - dialogContainer: '.mat-dialog-container', - snackBarContainer: '.mat-snack-bar-container', - snackBar: '.mat-simple-snackbar', - snackBarAction: '.mat-simple-snackbar-action button', + appRoot = 'app-root'; - genericError: 'aca-generic-error', - genericErrorIcon: 'aca-generic-error .mat-icon', - genericErrorTitle: '.generic-error__title' - }; - - appRoot: string = Page.locators.root; - - layout: ElementFinder = browser.element(by.css(Page.locators.layout)); - overlay: ElementFinder = browser.element(by.css(Page.locators.overlay)); - snackBar: ElementFinder = browser.element(by.css(Page.locators.snackBar)); - dialogContainer: ElementFinder = browser.element(by.css(Page.locators.dialogContainer)); - snackBarContainer: ElementFinder = browser.element(by.css(Page.locators.snackBarContainer)); - snackBarAction: ElementFinder = browser.element(by.css(Page.locators.snackBarAction)); - - genericError: ElementFinder = browser.element(by.css(Page.locators.genericError)); - genericErrorIcon: ElementFinder = browser.element(by.css(Page.locators.genericErrorIcon)); - genericErrorTitle: ElementFinder = browser.element(by.css(Page.locators.genericErrorTitle)); + layout = this.byCss('app-layout'); + overlay = this.byCss('.cdk-overlay-container'); + snackBar = this.byCss('.mat-simple-snackbar-action button'); + dialogContainer = this.byCss('.mat-dialog-container'); + snackBarContainer = this.byCss('.mat-snack-bar-container'); + snackBarAction = this.byCss('.mat-simple-snackbar-action button'); + genericError = this.byCss('aca-generic-error'); + genericErrorIcon = this.byCss('aca-generic-error .mat-icon'); + genericErrorTitle = this.byCss('.generic-error__title'); constructor(public url: string = '') {} - async getTitle() { - return browser.getTitle(); + protected byCss(css: string): ElementFinder { + return browser.element(by.css(css)); } async load(relativeUrl: string = '') { @@ -69,19 +54,11 @@ export abstract class Page { } async waitForApp() { - await browser.wait(EC.presenceOf(this.layout), BROWSER_WAIT_TIMEOUT); - } - - async waitForSnackBarToAppear() { - return browser.wait(until.elementLocated(by.css('.mat-snack-bar-container')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snackbar to appear'); - } - - async waitForSnackBarToClose() { - await browser.wait(EC.not(EC.visibilityOf(this.snackBarContainer)), BROWSER_WAIT_TIMEOUT); + await waitForPresence(this.layout); } async waitForDialog() { - await browser.wait(EC.visibilityOf(this.dialogContainer), BROWSER_WAIT_TIMEOUT); + await waitForVisibility(this.dialogContainer); } async isDialogOpen() { @@ -94,36 +71,22 @@ export abstract class Page { } } - async refresh() { + async refresh(): Promise { await browser.refresh(); await this.waitForApp(); } - async getSnackBarMessage() { - const elem = await this.waitForSnackBarToAppear(); + async getSnackBarMessage(): Promise { + const elem = await waitElement('.mat-snack-bar-container'); return elem.getAttribute('innerText'); } - async clickSnackBarAction() { + async clickSnackBarAction(): Promise { try { - const action = await browser.wait(until.elementLocated(by.css('.mat-simple-snackbar-action button')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snack action to appear'); + const action = await waitElement('.mat-simple-snackbar-action button'); await action.click(); } catch (e) { Logger.error(e, '.......failed on click snack bar action.........'); } } - - async isGenericErrorDisplayed() { - return this.genericError.isDisplayed(); - } - - async getGenericErrorTitle() { - return this.genericErrorTitle.getText(); - } - - async isUndoActionPresent() { - const message = await this.snackBar.getAttribute('innerText'); - return message.includes('Undo'); - } - } diff --git a/e2e/pages/search-results-page.ts b/e2e/pages/search-results-page.ts index c2a63e118..ceac9af3c 100755 --- a/e2e/pages/search-results-page.ts +++ b/e2e/pages/search-results-page.ts @@ -23,44 +23,29 @@ * along with Alfresco. If not, see . */ -import { browser, by, By, ElementFinder, ElementArrayFinder } from 'protractor'; +import { browser, by, By } from 'protractor'; import { BrowsingPage } from './browsing-page'; import { SearchSortingPicker } from '../components/search/search-sorting-picker'; import { SearchFilters } from '../components/search/search-filters'; export class SearchResultsPage extends BrowsingPage { + root = this.byCss('aca-search-results'); + chipList = this.root.element(by.css('.adf-search-chip-list')); + infoText = this.root.element(by.css('.adf-search-results--info-text')); - private static selectors = { - root: 'aca-search-results', - - resultsContentHeader: '.adf-search-results__content-header', - infoText: '.adf-search-results--info-text', - chipList: '.adf-search-chip-list', - chip: '.mat-chip', - chipCloseIcon: '.mat-chip-remove' - }; - - root: ElementFinder = browser.element(by.css(SearchResultsPage.selectors.root)); - chipList: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.chipList)); - infoText: ElementFinder = this.root.element(by.css(SearchResultsPage.selectors.infoText)); - - sortingPicker = new SearchSortingPicker(SearchResultsPage.selectors.root); - filters = new SearchFilters(SearchResultsPage.selectors.root); + sortingPicker = new SearchSortingPicker('aca-search-results'); + filters = new SearchFilters('aca-search-results'); async waitForResults(): Promise { await this.dataTable.waitForBody(); } - async getResultsHeader(): Promise { - return browser.element(by.css(SearchResultsPage.selectors.resultsContentHeader)).getText(); - } - async getResultsFoundText(): Promise { return this.infoText.getText(); } async getResultsChipsValues(): Promise { - const chips: ElementArrayFinder = this.chipList.all(by.css(SearchResultsPage.selectors.chip)); + const chips = this.chipList.all(by.css('.mat-chip')); const chipsValues: string[] = await chips.map(async elem => { return (await elem.getText()).replace(`\ncancel`, ''); }); @@ -68,8 +53,8 @@ export class SearchResultsPage extends BrowsingPage { } async removeChip(chipName: string): Promise { - const chip: ElementFinder = browser.element(By.cssContainingText(SearchResultsPage.selectors.chip, chipName)); - const closeChip: ElementFinder = chip.element(by.css(SearchResultsPage.selectors.chipCloseIcon)); + const chip = browser.element(By.cssContainingText('.mat-chip', chipName)); + const closeChip = chip.element(by.css('.mat-chip-remove')); await closeChip.click(); } } diff --git a/e2e/suites/actions-available/generic.test.ts b/e2e/suites/actions-available/generic.test.ts index e3e29d0a5..caa757bc9 100755 --- a/e2e/suites/actions-available/generic.test.ts +++ b/e2e/suites/actions-available/generic.test.ts @@ -112,7 +112,7 @@ describe('Generic tests : ', () => { it('[C280619] Context menu closes when clicking away from it', async () => { await dataTable.rightClickOnItem(file1); expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed'); - await page.breadcrumb.getCurrentItem().click(); + await page.breadcrumb.currentItem.click(); expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed'); }); }); @@ -183,7 +183,7 @@ describe('Generic tests : ', () => { expect(await dataTable.hasContextMenu()).toBe(true, `Context menu is not displayed for ${file1}`); expect(await dataTable.getSelectedRowsCount()).toEqual(1, 'incorrect number of selected rows'); - expect(await contextMenu.isEditFolderPresent()).toBe(false, `Edit folder is displayed for ${file1}`); + expect(await contextMenu.editFolderAction.isPresent()).toBe(false, `Edit folder is displayed for ${file1}`); expect(await dataTable.hasCheckMarkIcon(file1)).toBe(true, `${file1} is not selected`); expect(await dataTable.hasCheckMarkIcon(file2)).toBe(false, `${file2} is selected`); expect(await dataTable.hasCheckMarkIcon(folder1)).toBe(false, `${folder1} is selected`); diff --git a/e2e/suites/actions-available/test-util.ts b/e2e/suites/actions-available/test-util.ts index 1ede1e179..857afb30e 100644 --- a/e2e/suites/actions-available/test-util.ts +++ b/e2e/suites/actions-available/test-util.ts @@ -106,7 +106,7 @@ export async function checkMultipleSelToolbarActions(items: string[], expectedTo export async function checkViewerActions(item: string, expectedToolbarPrimary: string[], expectedToolbarMore: string[]): Promise { await dataTable.selectItem(item); - await toolbar.clickView(); + await toolbar.viewButton.click(); await viewer.waitForViewerToOpen(); let actualPrimaryActions = await viewerToolbar.getButtons(); diff --git a/e2e/suites/actions/copy-move/copy.test.ts b/e2e/suites/actions/copy-move/copy.test.ts index 2a7a75cc6..48282adf9 100755 --- a/e2e/suites/actions/copy-move/copy.test.ts +++ b/e2e/suites/actions/copy-move/copy.test.ts @@ -430,7 +430,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -450,7 +450,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -474,7 +474,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 2 items'); expect(msg).toContain('Undo'); @@ -496,7 +496,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -516,7 +516,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -542,7 +542,7 @@ describe('Copy content', () => { await copyDialog.dataTable.doubleClickOnRowByName(siteName); await copyDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`Copied ${noOfItems} ${ noOfItems === 1 ? 'item' : 'items'}`); expect(msg).toContain('Undo'); @@ -570,7 +570,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -593,7 +593,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -619,7 +619,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -642,7 +642,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -667,7 +667,7 @@ describe('Copy content', () => { await copyDialog.selectLocation('Personal Files'); await copyDialog.dataTable.doubleClickOnRowByName(source); await copyDialog.selectDestination(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); @@ -693,7 +693,7 @@ describe('Copy content', () => { await toolbar.clickMoreActionsCopy(); await copyDialog.selectLocation('Personal Files'); await copyDialog.dataTable.doubleClickOnRowByName(destination); - await copyDialog.clickCopy(); + await copyDialog.copyButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Copied 1 item'); expect(msg).toContain('Undo'); diff --git a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts index 877c5e35f..617e9b02c 100755 --- a/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts +++ b/e2e/suites/actions/copy-move/destination-picker-dialog.test.ts @@ -31,7 +31,6 @@ import { AdminActions } from '../../../utilities/admin-actions'; describe('Destination picker dialog : ', () => { const random = Utils.random(); - const username = `user-${random}`; const consumer = `consumer-${random}`; @@ -72,8 +71,10 @@ describe('Destination picker dialog : ', () => { const loginPage = new LoginPage(); const page = new BrowsingPage(); - const { dataTable, toolbar } = page; - const contentNodeSelector = new ContentNodeSelectorDialog(); + + const dialog = new ContentNodeSelectorDialog(); + const breadcrumb = dialog.breadcrumb; + const dataTable = dialog.dataTable; beforeAll(async () => { await adminApiActions.createUser({ username }); @@ -133,53 +134,56 @@ describe('Destination picker dialog : ', () => { }); beforeEach(async () => { - await dataTable.selectItem(file); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(file); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); }); it('[C263875] Dialog UI', async () => { - expect(await contentNodeSelector.getTitle()).toEqual(`Copy '${file}' to...`); - expect(await contentNodeSelector.isSearchInputPresent()).toBe(true, 'Search input is not displayed'); - expect(await contentNodeSelector.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed'); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); - expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'Personal Files content not displayed'); - expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy button is not disabled'); - expect(await contentNodeSelector.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); + expect(await dialog.getTitle()).toEqual(`Copy '${file}' to...`); + expect(await dialog.searchInput.isPresent()).toBe(true, 'Search input is not displayed'); + expect(await dialog.isSelectLocationDropdownDisplayed()).toBe(true, 'Select Location dropdown not displayed'); + expect(await breadcrumb.currentFolder.getText()).toEqual('Personal Files'); + expect(await dataTable.isItemPresent(destination)).toBe(true, 'Personal Files content not displayed'); + expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy button is not disabled'); + expect(await dialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); }); it('[C263880] Files are not displayed', async () => { - await contentNodeSelector.selectLocation('Personal Files'); - expect(await contentNodeSelector.dataTable.isItemPresent(destination)).toBe(true, 'destination folder not displayed'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); - expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, 'folder is not displayed'); - expect(await contentNodeSelector.dataTable.isItemPresent(fileInDestination)).toBe(false, 'file is displayed'); + await dialog.selectLocation('Personal Files'); + expect(await dataTable.isItemPresent(destination)).toBe(true, 'destination folder not displayed'); + + await dataTable.doubleClickOnRowByName(destination); + expect(await dataTable.isItemPresent(folderInDestination)).toBe(true, 'folder is not displayed'); + expect(await dataTable.isItemPresent(fileInDestination)).toBe(false, 'file is displayed'); }); it('[C263881] Folder links are not displayed', async() => { - await contentNodeSelector.selectLocation('Personal Files'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); + await dialog.selectLocation('Personal Files'); + await dataTable.doubleClickOnRowByName(destination); - expect(await contentNodeSelector.dataTable.isItemPresent(folderInDestination)).toBe(true, `${folderInDestination} is not displayed`); - expect(await contentNodeSelector.dataTable.isItemPresent(folder2InDestination)).toBe(true, `${folder2InDestination} is not displayed`); - expect(await contentNodeSelector.dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed'); + expect(await dataTable.isItemPresent(folderInDestination)).toBe(true, `${folderInDestination} is not displayed`); + expect(await dataTable.isItemPresent(folder2InDestination)).toBe(true, `${folder2InDestination} is not displayed`); + expect(await dataTable.isItemPresent(folderLink)).toBe(false, 'Link to folder is displayed'); }); it('[C263885] User can see his Libraries', async () => { - await contentNodeSelector.selectLocation('File Libraries'); - expect(await contentNodeSelector.dataTable.isItemPresent(site)).toBe(true, 'user site is not displayed'); + await dialog.selectLocation('File Libraries'); + expect(await dataTable.isItemPresent(site)).toBe(true, 'user site is not displayed'); }); it('[C263889] Search - No results displayed', async () => { - await contentNodeSelector.searchFor('nonexistent-folder'); - expect(await contentNodeSelector.dataTable.isEmpty()).toBe(true, 'datatable not empty'); - expect(await contentNodeSelector.dataTable.getEmptyListText()).toEqual('No results found'); + await dialog.searchFor('nonexistent-folder'); + + expect(await dataTable.isEmpty()).toBe(true, 'datatable not empty'); + expect(await dataTable.getEmptyListText()).toEqual('No results found'); }); it('[C263888] Search - results found', async () => { - await contentNodeSelector.searchFor(searchFolder); - expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, username)).toBe(true, 'folder from Personal Files not displayed'); - expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder, site)).toBe(true, 'folder from site not displayed'); + await dialog.searchFor(searchFolder); + + expect(await dataTable.isItemPresent(searchFolder, username)).toBe(true, 'folder from Personal Files not displayed'); + expect(await dataTable.isItemPresent(searchFolder, site)).toBe(true, 'folder from site not displayed'); }); }); @@ -189,13 +193,13 @@ describe('Destination picker dialog : ', () => { }); beforeEach(async () => { - await dataTable.selectMultipleItems([file, destination]); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectMultipleItems([file, destination]); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); }); it('[C263879] Dialog title - multiple selection', async () => { - expect(await contentNodeSelector.getTitle()).toEqual(`Copy 2 items to...`); + expect(await dialog.getTitle()).toEqual(`Copy 2 items to...`); }); }); @@ -205,73 +209,80 @@ describe('Destination picker dialog : ', () => { }); beforeEach(async () => { - await dataTable.selectItem(file); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(file); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); }); it('[C263890] Personal Files breadcrumb - main node', async () => { - await contentNodeSelector.selectLocation('Personal Files'); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Personal Files'); + await dialog.selectLocation('Personal Files'); + expect(await breadcrumb.currentFolder.getText()).toEqual('Personal Files'); }); it('[C263891] File Libraries breadcrumb - main node', async () => { - await contentNodeSelector.selectLocation('File Libraries'); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('File Libraries'); + await dialog.selectLocation('File Libraries'); + expect(await breadcrumb.currentFolder.getText()).toEqual('File Libraries'); }); it('[C263899] Search results breadcrumb', async () => { - await contentNodeSelector.searchFor(searchFolder); - expect(await contentNodeSelector.getToolbarTitle()).toEqual('Search results'); + await dialog.searchFor(searchFolder); + expect(await dialog.getToolbarTitle()).toEqual('Search results'); }); it('[C263900] Search results breadcrumb when selecting a folder', async () => { - await contentNodeSelector.searchFor(searchFolder); - await contentNodeSelector.dataTable.selectItem(searchFolder, site); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); + await dialog.searchFor(searchFolder); + await dataTable.selectItem(searchFolder, site); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder); }); it('[C263897] Personal Files breadcrumb - folder structure', async () => { - await contentNodeSelector.selectLocation('Personal Files'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2); - await contentNodeSelector.breadcrumb.openPath(); - expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, destination, 'Personal Files']); + await dialog.selectLocation('Personal Files'); + await dataTable.doubleClickOnRowByName(destination); + + expect(await breadcrumb.currentFolder.getText()).toEqual(destination); + await dataTable.doubleClickOnRowByName(searchFolder); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder); + await dataTable.doubleClickOnRowByName(searchSubFolder1); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder1); + await dataTable.doubleClickOnRowByName(searchSubFolder2); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder2); + await breadcrumb.openPath(); + expect(await breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, destination, 'Personal Files']); }); it('[C263898] File Libraries breadcrumb - folder structure', async () => { - await contentNodeSelector.selectLocation('File Libraries'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(site); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site); - await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(site); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchFolder); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder1); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(searchSubFolder2); - await contentNodeSelector.breadcrumb.openPath(); - expect(await contentNodeSelector.breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, site, 'File Libraries']); + await dialog.selectLocation('File Libraries'); + + await dataTable.doubleClickOnRowByName(site); + expect(await breadcrumb.currentFolder.getText()).toEqual(site); + + await dataTable.doubleClickOnRowByName('documentLibrary'); + expect(await breadcrumb.currentFolder.getText()).toEqual(site); + + await dataTable.doubleClickOnRowByName(searchFolder); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchFolder); + + await dataTable.doubleClickOnRowByName(searchSubFolder1); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder1); + + await dataTable.doubleClickOnRowByName(searchSubFolder2); + expect(await breadcrumb.currentFolder.getText()).toEqual(searchSubFolder2); + + await breadcrumb.openPath(); + expect(await breadcrumb.getPathItems()).toEqual([searchSubFolder1, searchFolder, site, 'File Libraries']); }); it('[C263895] Select a node from the breadcrumb path', async () => { - await contentNodeSelector.selectLocation('Personal Files'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(destination); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchFolder); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder1); - await contentNodeSelector.dataTable.doubleClickOnRowByName(searchSubFolder2); - await contentNodeSelector.breadcrumb.openPath(); + await dialog.selectLocation('Personal Files'); + await dataTable.doubleClickOnRowByName(destination); + await dataTable.doubleClickOnRowByName(searchFolder); + await dataTable.doubleClickOnRowByName(searchSubFolder1); + await dataTable.doubleClickOnRowByName(searchSubFolder2); + await breadcrumb.openPath(); - await contentNodeSelector.breadcrumb.clickPathItem(destination); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual(destination); - expect(await contentNodeSelector.dataTable.isItemPresent(searchFolder)).toBe(true, 'folder not displayed'); + await breadcrumb.clickPathItem(destination); + expect(await breadcrumb.currentFolder.getText()).toEqual(destination); + expect(await dataTable.isItemPresent(searchFolder)).toBe(true, 'folder not displayed'); }); }); @@ -279,54 +290,54 @@ describe('Destination picker dialog : ', () => { it('[C263876] Consumer user cannot select the folder as destination', async () => { await loginPage.loginWith(consumer); - await dataTable.selectItem(file); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(file); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); - await contentNodeSelector.selectLocation('File Libraries'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(site); - await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); - await contentNodeSelector.dataTable.selectItem(searchFolder); + await dialog.selectLocation('File Libraries'); + await dataTable.doubleClickOnRowByName(site); + await dataTable.doubleClickOnRowByName('documentLibrary'); + await dataTable.selectItem(searchFolder); - expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(false, 'Copy should be disabled'); + expect(await dialog.isCopyButtonEnabled()).toBe(false, 'Copy should be disabled'); }); it('[C263877] Contributor user can select the folder as destination', async () => { await loginPage.loginWith(contributor); - await dataTable.selectItem(file); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(file); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); - await contentNodeSelector.selectLocation('File Libraries'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(site); - await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); - await contentNodeSelector.dataTable.selectItem(searchFolder); + await dialog.selectLocation('File Libraries'); + await dataTable.doubleClickOnRowByName(site); + await dataTable.doubleClickOnRowByName('documentLibrary'); + await dataTable.selectItem(searchFolder); - expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); + expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); }); it('[C263878] Collaborator user can select the folder as destination', async () => { await loginPage.loginWith(collaborator); - await dataTable.selectItem(file); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(file); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); - await contentNodeSelector.selectLocation('File Libraries'); - await contentNodeSelector.dataTable.doubleClickOnRowByName(site); - await contentNodeSelector.dataTable.doubleClickOnRowByName('documentLibrary'); - await contentNodeSelector.dataTable.selectItem(searchFolder); + await dialog.selectLocation('File Libraries'); + await dataTable.doubleClickOnRowByName(site); + await dataTable.doubleClickOnRowByName('documentLibrary'); + await dataTable.selectItem(searchFolder); - expect(await contentNodeSelector.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); + expect(await dialog.isCopyButtonEnabled()).toBe(true, 'Copy should be disabled'); }); it('[C263892] Admin user - Personal Files breadcrumb main node', async () => { await loginPage.loginWithAdmin(); - await dataTable.selectItem(adminFolder); - await toolbar.clickMoreActionsCopy(); - await contentNodeSelector.waitForDialogToOpen(); + await page.dataTable.selectItem(adminFolder); + await page.toolbar.clickMoreActionsCopy(); + await dialog.waitForDialogToOpen(); - await contentNodeSelector.selectLocation('Personal Files'); - expect(await contentNodeSelector.breadcrumb.getCurrentFolderName()).toEqual('Company Home'); + await dialog.selectLocation('Personal Files'); + expect(await breadcrumb.currentFolder.getText()).toEqual('Company Home'); }); }); }); diff --git a/e2e/suites/actions/copy-move/move.test.ts b/e2e/suites/actions/copy-move/move.test.ts index a5ebed038..3ceed7644 100755 --- a/e2e/suites/actions/copy-move/move.test.ts +++ b/e2e/suites/actions/copy-move/move.test.ts @@ -155,7 +155,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -173,7 +173,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -195,7 +195,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -215,7 +215,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -234,7 +234,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationPF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -257,7 +257,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSitePF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -314,7 +314,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -333,7 +333,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -355,7 +355,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationRF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -377,7 +377,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteRF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -436,7 +436,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -455,7 +455,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -477,7 +477,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationSF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -499,7 +499,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteSF); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -581,7 +581,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -600,7 +600,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -623,7 +623,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); @@ -645,7 +645,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Move unsuccessful, a file with the same name already exists'); expect(msg).not.toContain('Undo'); @@ -665,7 +665,7 @@ describe('Move content', () => { await toolbar.clickMoreActionsMove(); await moveDialog.selectLocation('Personal Files'); await moveDialog.selectDestination(destinationFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 1 item'); expect(msg).toContain('Undo'); @@ -689,7 +689,7 @@ describe('Move content', () => { await moveDialog.dataTable.doubleClickOnRowByName(siteName); await moveDialog.dataTable.doubleClickOnRowByName('documentLibrary'); await moveDialog.selectDestination(folderSiteFav); - await moveDialog.clickMove(); + await moveDialog.moveButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain('Moved 2 items'); expect(msg).toContain('Undo'); diff --git a/e2e/suites/actions/create-file-from-template.test.ts b/e2e/suites/actions/create-file-from-template.test.ts index 24cc93b7b..fbc9eaca3 100755 --- a/e2e/suites/actions/create-file-from-template.test.ts +++ b/e2e/suites/actions/create-file-from-template.test.ts @@ -26,7 +26,7 @@ import { LoginPage, BrowsingPage } from '../../pages/pages'; import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; -import { Utils } from '../../utilities/utils'; +import { Utils, clearTextWithBackspace } from '../../utilities/utils'; import { AdminActions } from '../../utilities/admin-actions'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; @@ -110,7 +110,7 @@ describe('Create file from template', () => { expect(await selectTemplateDialog.getTitle()).toEqual('Select a document template'); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'Datatable is not empty'); expect(await selectTemplateDialog.dataTable.getEmptyListText()).toEqual('No results found'); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Node Templates'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); }); @@ -159,7 +159,7 @@ describe('Create file from template', () => { expect(await selectTemplateDialog.dataTable.isItemPresent(templatesFolder2)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(true, 'template not displayed'); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Node Templates'); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Node Templates'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); }); @@ -177,11 +177,11 @@ describe('Create file from template', () => { expect(await selectTemplateDialog.dataTable.isItemPresent(template1InFolder2)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template1InRootFolder)).toBe(false, 'template is displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(template2InRootFolder)).toBe(false, 'template is displayed'); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesFolder2); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templatesFolder2); await selectTemplateDialog.dataTable.doubleClickOnRowByName(templatesSubFolder); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templatesSubFolder); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templatesSubFolder); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); await selectTemplateDialog.breadcrumb.openPath(); @@ -236,16 +236,16 @@ describe('Create file from template', () => { it('[C325020] Create file from template - dialog UI', async () => { expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new document from '${template1InRootFolder}'`); - expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); - expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); - expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); + expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed'); + expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed'); + expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed'); expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); }); it('[C325031] File name is required', async () => { expect(await createFromTemplateDialog.getName()).toEqual(template1InRootFolder); - await createFromTemplateDialog.deleteNameWithBackspace(); + await clearTextWithBackspace(createFromTemplateDialog.nameInput); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); @@ -305,7 +305,7 @@ describe('Create file from template', () => { it('[C325030] Create a file from a template - with a new Name', async () => { await createFromTemplateDialog.enterName(file1.name); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -316,7 +316,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(file2.name); await createFromTemplateDialog.enterTitle(file2.title); await createFromTemplateDialog.enterDescription(file2.description); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -329,7 +329,7 @@ describe('Create file from template', () => { it('[C325028] Create a file with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFileName); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -345,7 +345,7 @@ describe('Create file from template', () => { it('[C325042] Trim spaces from file Name', async () => { await createFromTemplateDialog.enterName(nameWithSpaces); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -370,7 +370,7 @@ describe('Create file from template', () => { await createFromTemplateDialog.enterName(fileSite.name); await createFromTemplateDialog.enterTitle(fileSite.title); await createFromTemplateDialog.enterDescription(fileSite.description); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -391,7 +391,7 @@ describe('Create file from template', () => { it('[C325025] Create a file with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFileSite); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-folder-from-template.test.ts b/e2e/suites/actions/create-folder-from-template.test.ts index cf19f8633..bef89f95a 100755 --- a/e2e/suites/actions/create-folder-from-template.test.ts +++ b/e2e/suites/actions/create-folder-from-template.test.ts @@ -26,7 +26,7 @@ import { LoginPage, BrowsingPage } from '../../pages/pages'; import { SelectTemplateDialog } from '../../components/dialog/select-template-dialog'; import { CreateFromTemplateDialog } from '../../components/dialog/create-from-template-dialog'; -import { Utils } from '../../utilities/utils'; +import { Utils, clearTextWithBackspace } from '../../utilities/utils'; import { AdminActions } from '../../utilities/admin-actions'; import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client'; @@ -146,7 +146,7 @@ describe('Create folder from template', () => { expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder2)).toBe(true, 'template folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(fileInRootFolder)).toBe(true, 'file not displayed'); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual('Space Templates'); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual('Space Templates'); expect(await selectTemplateDialog.isNextButtonEnabled()).toBe(false, 'Next button is not disabled'); expect(await selectTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); }); @@ -163,11 +163,11 @@ describe('Create folder from template', () => { expect(await selectTemplateDialog.dataTable.isItemPresent(templateSubFolder)).toBe(true, 'template sub-folder not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(fileInFolder2)).toBe(true, 'template not displayed'); expect(await selectTemplateDialog.dataTable.isItemPresent(templateFolder1)).toBe(false, 'template folder is displayed'); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateFolder2); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templateFolder2); await selectTemplateDialog.dataTable.doubleClickOnRowByName(templateSubFolder); - expect(await selectTemplateDialog.breadcrumb.getCurrentFolderName()).toEqual(templateSubFolder); + expect(await selectTemplateDialog.breadcrumb.currentFolder.getText()).toEqual(templateSubFolder); expect(await selectTemplateDialog.dataTable.isEmpty()).toBe(true, 'datatable is not empty'); await selectTemplateDialog.breadcrumb.openPath(); @@ -222,16 +222,16 @@ describe('Create folder from template', () => { it('[C325142] Create folder from template - dialog UI', async () => { expect(await createFromTemplateDialog.getTitle()).toEqual(`Create new folder from '${templateFolder1}'`); - expect(await createFromTemplateDialog.isNameFieldDisplayed()).toBe(true, 'Name field not displayed'); - expect(await createFromTemplateDialog.isTitleFieldDisplayed()).toBe(true, 'Title field not displayed'); - expect(await createFromTemplateDialog.isDescriptionFieldDisplayed()).toBe(true, 'Description field not displayed'); + expect(await createFromTemplateDialog.nameInput.isDisplayed()).toBe(true, 'Name field not displayed'); + expect(await createFromTemplateDialog.titleInput.isDisplayed()).toBe(true, 'Title field not displayed'); + expect(await createFromTemplateDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field not displayed'); expect(await createFromTemplateDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(true, 'Create button is not enabled'); }); it('[C325143] Folder name is required', async () => { expect(await createFromTemplateDialog.getName()).toEqual(templateFolder1); - await createFromTemplateDialog.deleteNameWithBackspace(); + await clearTextWithBackspace(createFromTemplateDialog.nameInput); expect(await createFromTemplateDialog.getValidationMessage()).toEqual('Name is required'); expect(await createFromTemplateDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); @@ -291,7 +291,7 @@ describe('Create folder from template', () => { it('[C325157] Create a folder from a template - with a new Name', async () => { await createFromTemplateDialog.enterName(folder1.name); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -302,7 +302,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folder2.name); await createFromTemplateDialog.enterTitle(folder2.title); await createFromTemplateDialog.enterDescription(folder2.description); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -315,7 +315,7 @@ describe('Create folder from template', () => { it('[C325156] Create a folder with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFolderName); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -331,7 +331,7 @@ describe('Create folder from template', () => { it('[C325158] Trim spaces from folder Name', async () => { await createFromTemplateDialog.enterName(nameWithSpaces); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -356,7 +356,7 @@ describe('Create folder from template', () => { await createFromTemplateDialog.enterName(folderSite.name); await createFromTemplateDialog.enterTitle(folderSite.title); await createFromTemplateDialog.enterDescription(folderSite.description); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); await createFromTemplateDialog.waitForDialogToClose(); await page.dataTable.waitForHeader(); @@ -377,7 +377,7 @@ describe('Create folder from template', () => { it('[C325163] Create a folder with a duplicate name', async () => { await createFromTemplateDialog.enterName(duplicateFolderSite); - await createFromTemplateDialog.clickCreate(); + await createFromTemplateDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`This name is already in use, try a different name.`); expect(await createFromTemplateDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-folder.test.ts b/e2e/suites/actions/create-folder.test.ts index 7e3e7b3de..95a7f75b3 100755 --- a/e2e/suites/actions/create-folder.test.ts +++ b/e2e/suites/actions/create-folder.test.ts @@ -25,7 +25,7 @@ import { LoginPage, BrowsingPage } from '../../pages/pages'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; -import { Utils } from '../../utilities/utils'; +import { Utils, clearTextWithBackspace } from '../../utilities/utils'; import { RepoClient } from '../../utilities/repo-client/repo-client'; describe('Create folder', () => { @@ -90,7 +90,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderName1); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -103,7 +103,7 @@ describe('Create folder', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderName2); await createDialog.enterDescription(folderDescription); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -119,8 +119,8 @@ describe('Create folder', () => { await createDialog.waitForDialogToOpen(); expect(await createDialog.getTitle()).toMatch('Create new folder'); - expect(await createDialog.isNameDisplayed()).toBe(true, 'Name input is not displayed'); - expect(await createDialog.isDescriptionDisplayed()).toBe(true, 'Description field is not displayed'); + expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed'); + expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed'); expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is not disabled'); expect(await createDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button is not enabled'); }); @@ -129,7 +129,7 @@ describe('Create folder', () => { await page.dataTable.doubleClickOnRowByName(parent); await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); - await createDialog.deleteNameWithBackspace(); + await clearTextWithBackspace(createDialog.nameInput); expect(await createDialog.isCreateButtonEnabled()).toBe(false, 'Create button is enabled'); expect(await createDialog.getValidationMessage()).toMatch('Folder name is required'); @@ -185,7 +185,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateFolderName); - await createDialog.clickCreate(); + await createDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -196,7 +196,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(nameWithSpaces); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -223,7 +223,7 @@ describe('Create folder', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(folderSite); await createDialog.enterDescription(folderDescription); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -248,7 +248,7 @@ describe('Create folder', () => { await page.sidenav.openCreateFolderDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateFolderSite); - await createDialog.clickCreate(); + await createDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await createDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/create-library.test.ts b/e2e/suites/actions/create-library.test.ts index 909fe898c..68b765a4c 100755 --- a/e2e/suites/actions/create-library.test.ts +++ b/e2e/suites/actions/create-library.test.ts @@ -87,12 +87,12 @@ describe('Create library', () => { await createDialog.waitForDialogToOpen(); expect(await createDialog.getTitle()).toMatch('Create Library'); - expect(await createDialog.isNameDisplayed()).toBe(true, 'Name input is not displayed'); - expect(await createDialog.isLibraryIdDisplayed()).toBe(true, 'Library ID input is not displayed'); - expect(await createDialog.isDescriptionDisplayed()).toBe(true, 'Description field is not displayed'); - expect(await createDialog.isPublicDisplayed()).toBe(true, 'Public option is not displayed'); - expect(await createDialog.isModeratedDisplayed()).toBe(true, 'Moderated option is not displayed'); - expect(await createDialog.isPrivateDisplayed()).toBe(true, 'Private option is not displayed'); + expect(await createDialog.nameInput.isDisplayed()).toBe(true, 'Name input is not displayed'); + expect(await createDialog.libraryIdInput.isDisplayed()).toBe(true, 'Library ID input is not displayed'); + expect(await createDialog.descriptionTextArea.isDisplayed()).toBe(true, 'Description field is not displayed'); + expect(await createDialog.visibilityPublic.isDisplayed()).toBe(true, 'Public option is not displayed'); + expect(await createDialog.visibilityModerated.isDisplayed()).toBe(true, 'Moderated option is not displayed'); + expect(await createDialog.visibilityPrivate.isDisplayed()).toBe(true, 'Private option is not displayed'); expect(await createDialog.isPublicChecked()).toBe(true, 'Public option not checked'); expect(await createDialog.isCreateEnabled()).toBe(false, 'Create button is not disabled'); expect(await createDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); @@ -102,10 +102,10 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site1Name); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual(site1Name, `Not navigated into ${site1Name}`); + expect(await page.breadcrumb.currentItem.getText()).toEqual(site1Name, `Not navigated into ${site1Name}`); await page.goToMyLibrariesAndWait(); expect(await dataTable.isItemPresent(site1Name)).toBe(true, `${site1Name} not in the list`); expect(await apis.user.sites.getVisibility(site1Name)).toEqual(SITE_VISIBILITY.PUBLIC); @@ -115,11 +115,11 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site2Name); - await createDialog.selectModerated(); - await createDialog.clickCreate(); + await createDialog.visibilityModerated.click(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual(site2Name, `Not navigated into ${site2Name}`); + expect(await page.breadcrumb.currentItem.getText()).toEqual(site2Name, `Not navigated into ${site2Name}`); await page.goToMyLibrariesAndWait(); expect(await dataTable.isItemPresent(site2Name)).toBe(true, `${site2Name} not in the list`); expect(await apis.user.sites.getVisibility(site2Name)).toEqual(SITE_VISIBILITY.MODERATED); @@ -129,11 +129,11 @@ describe('Create library', () => { await page.sidenav.openCreateLibraryDialog(); await createDialog.waitForDialogToOpen(); await createDialog.enterName(site3Name); - await createDialog.selectPrivate(); - await createDialog.clickCreate(); + await createDialog.visibilityPrivate.click(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual(site3Name, `Not navigated into ${site3Name}`); + expect(await page.breadcrumb.currentItem.getText()).toEqual(site3Name, `Not navigated into ${site3Name}`); await page.goToMyLibrariesAndWait(); expect(await dataTable.isItemPresent(site3Name)).toBe(true, `${site3Name} not in the list`); expect(await apis.user.sites.getVisibility(site3Name)).toEqual(SITE_VISIBILITY.PRIVATE); @@ -145,11 +145,11 @@ describe('Create library', () => { await createDialog.enterName(site4.name); await createDialog.enterLibraryId(site4.id); await createDialog.enterDescription(site4.description); - await createDialog.selectPublic(); - await createDialog.clickCreate(); + await createDialog.visibilityPublic.click(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual(site4.name, `Not navigated into ${site4.name}`); + expect(await page.breadcrumb.currentItem.getText()).toEqual(site4.name, `Not navigated into ${site4.name}`); await page.goToMyLibrariesAndWait(); expect(await dataTable.isItemPresent(site4.name)).toBe(true, `${site4.name} not in the list`); expect(await apis.user.sites.getVisibility(site4.id)).toEqual(SITE_VISIBILITY.PUBLIC); @@ -171,7 +171,7 @@ describe('Create library', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(siteInTrash.name); await createDialog.enterLibraryId(siteInTrash.id); - await createDialog.clickCreate(); + await createDialog.createButton.click(); expect(await createDialog.getErrorMessage()).toEqual(`This Library ID is already used. Check the trashcan.`); }); @@ -205,10 +205,10 @@ describe('Create library', () => { await createDialog.waitForDialogToOpen(); await createDialog.enterName(duplicateSite.name); await createDialog.enterLibraryId(`${duplicateSite.id}-2`); - await createDialog.clickCreate(); + await createDialog.createButton.click(); await createDialog.waitForDialogToClose(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual(duplicateSite.name, `Not navigated into ${duplicateSite.name}`); + expect(await page.breadcrumb.currentItem.getText()).toEqual(duplicateSite.name, `Not navigated into ${duplicateSite.name}`); await page.goToMyLibrariesAndWait(); expect(await dataTable.isItemPresent(`${duplicateSite.name} (${duplicateSite.id}-2)`)).toBe(true, `${duplicateSite.name} not in the list`); expect(await apis.user.sites.getTitle(`${duplicateSite.id}-2`)).toEqual(duplicateSite.name); diff --git a/e2e/suites/actions/download.test.ts b/e2e/suites/actions/download.test.ts index af1d48bfe..df3f889de 100755 --- a/e2e/suites/actions/download.test.ts +++ b/e2e/suites/actions/download.test.ts @@ -121,14 +121,14 @@ describe('Download', () => { it('[C213179] Download a file', async () => { await dataTable.selectItem(filePersonal); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(filePersonal)).toBe(true, 'File not found in download location'); }); it('[C216352] Download a folder', async () => { await dataTable.selectItem(folderPersonal); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); const folderZip = `${folderPersonal}.zip`; @@ -141,7 +141,7 @@ describe('Download', () => { it('[C216353] Download multiple items', async () => { await dataTable.selectMultipleItems([filePersonal, folderPersonal]); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -168,14 +168,14 @@ describe('Download', () => { it('[C280173] Download a file', async () => { await dataTable.selectItem(fileFavorites); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(fileFavorites)).toBe(true, 'File not found in download location'); }); it('[C280188] Download a folder', async () => { await dataTable.selectItem(folderFavorites); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); const folderZip = `${folderFavorites}.zip`; @@ -188,7 +188,7 @@ describe('Download', () => { it('[C280189] Download multiple items', async () => { await dataTable.selectMultipleItems([fileFavorites, folderFavorites]); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -215,14 +215,14 @@ describe('Download', () => { it('[C280170] Download a file', async () => { await dataTable.selectItem(fileShared1); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(fileShared1)).toBe(true, 'File not found in download location'); }); it('[C280183] Download multiple items', async () => { await dataTable.selectMultipleItems([fileShared1, fileShared2]); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -248,14 +248,14 @@ describe('Download', () => { it('[C280167] Download a file', async () => { await dataTable.selectItem(fileRecent1); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(fileRecent1)).toBe(true, 'File not found in download location'); }); it('[C280177] Download multiple items', async () => { await dataTable.selectMultipleItems([fileRecent1, fileRecent2]); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); @@ -279,14 +279,14 @@ describe('Download', () => { it('[C279164] Download a file', async () => { await dataTable.selectItem(fileSearch, parent); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(fileSearch)).toBe(true, 'File not found in download location'); }); it('[C297694] Download a folder', async () => { await dataTable.selectItem(folderSearch, parent); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); const folderZip = `${folderSearch}.zip`; @@ -299,7 +299,7 @@ describe('Download', () => { it('[C297695] Download multiple items', async () => { await dataTable.selectMultipleItems([fileSearch, folderSearch], parent); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(archiveZip)).toBe(true, 'File not found in download location'); diff --git a/e2e/suites/actions/edit-folder.test.ts b/e2e/suites/actions/edit-folder.test.ts index a5ee5738f..812208154 100755 --- a/e2e/suites/actions/edit-folder.test.ts +++ b/e2e/suites/actions/edit-folder.test.ts @@ -27,7 +27,7 @@ import { LoginPage, BrowsingPage } from '../../pages/pages'; import { SITE_VISIBILITY, SITE_ROLES } from '../../configs'; import { RepoClient } from '../../utilities/repo-client/repo-client'; import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog'; -import { Utils } from '../../utilities/utils'; +import { Utils, clearTextWithBackspace } from '../../utilities/utils'; describe('Edit folder', () => { const username = `user-${Utils.random()}`; @@ -122,7 +122,7 @@ describe('Edit folder', () => { await dataTable.doubleClickOnRowByName(parent); await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); expect(await editDialog.getTitle()).toEqual('Edit folder'); expect(await editDialog.getName()).toBe(folderName); @@ -142,11 +142,11 @@ describe('Edit folder', () => { it('[C216335] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderNameToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -159,8 +159,8 @@ describe('Edit folder', () => { it('[C216332] with empty folder name', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); - await editDialog.deleteNameWithBackspace(); + await toolbar.menu.editFolderAction.click(); + await clearTextWithBackspace(editDialog.nameInput); expect(await editDialog.isUpdateButtonEnabled()).toBe(false, 'upload button is not enabled'); expect(await editDialog.getValidationMessage()).toMatch('Folder name is required'); @@ -171,7 +171,7 @@ describe('Edit folder', () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); for (const name of namesWithSpecialChars) { await editDialog.enterName(name); @@ -183,7 +183,7 @@ describe('Edit folder', () => { it('[C216334] with name ending with a dot', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.nameInput.sendKeys('.'); @@ -194,7 +194,7 @@ describe('Edit folder', () => { it('[C216336] Cancel button', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.clickCancel(); @@ -204,10 +204,10 @@ describe('Edit folder', () => { it('[C216337] with duplicate folder name', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterName(duplicateFolderName); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -216,12 +216,12 @@ describe('Edit folder', () => { it('[C216338] trim ending spaces', async () => { await dataTable.selectItem(folderName); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.nameInput.sendKeys(' '); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); await editDialog.waitForDialogToClose(); - expect(await page.isSnackBarPresent()).not.toBe(true, 'notification appears'); + expect(await page.snackBar.isPresent()).not.toBe(true, 'notification appears'); expect(await dataTable.isItemPresent(folderName)).toBe(true, 'Folder not displayed in list view'); }); }); @@ -235,11 +235,11 @@ describe('Edit folder', () => { it('[C280384] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderFavoriteToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -252,10 +252,10 @@ describe('Edit folder', () => { it('[C280386] with duplicate folder name', async () => { await dataTable.selectItem(folderFavorite); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterName(folderFavoriteDuplicate); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -272,11 +272,11 @@ describe('Edit folder', () => { it('[C280509] properties are modified when pressing OK', async (done) => { await dataTable.selectItem(folderSiteToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); await editDialog.waitForDialogToClose(); await dataTable.waitForHeader(); @@ -289,10 +289,10 @@ describe('Edit folder', () => { it('[C280511] with duplicate folder name', async () => { await dataTable.selectItem(folderSite); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterName(duplicateFolderSite); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); @@ -314,11 +314,11 @@ describe('Edit folder', () => { await dataTable.selectItem(folderSearchToEdit); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterDescription(folderDescriptionEdited); await editDialog.enterName(folderNameEdited2); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); await editDialog.waitForDialogToClose(); await page.refresh(); @@ -336,10 +336,10 @@ describe('Edit folder', () => { await dataTable.selectItem(folderSearch); await toolbar.openMoreMenu(); - await toolbar.menu.clickEditFolder(); + await toolbar.menu.editFolderAction.click(); await editDialog.waitForDialogToOpen(); await editDialog.enterName(folderSearchDuplicate); - await editDialog.clickUpdate(); + await editDialog.updateButton.click(); expect(await page.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`); expect(await editDialog.isDialogOpen()).toBe(true, 'dialog is not present'); diff --git a/e2e/suites/actions/library-actions.test.ts b/e2e/suites/actions/library-actions.test.ts index 1ffd061fb..a1fbb32f2 100755 --- a/e2e/suites/actions/library-actions.test.ts +++ b/e2e/suites/actions/library-actions.test.ts @@ -128,7 +128,7 @@ describe('Library actions', () => { it('[C290105] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(sitePublic1Admin); - await toolbar.clickJoin(); + await toolbar.joinButton.click(); expect(await dataTable.getLibraryRole(sitePublic1Admin)).toEqual('Consumer'); }); @@ -140,7 +140,7 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic1Admin); - await toolbar.clickJoin(); + await toolbar.joinButton.click(); expect(await dataTable.getLibraryRole(siteSearchPublic1Admin)).toEqual('Consumer'); }); @@ -159,7 +159,7 @@ describe('Library actions', () => { it('[C290109] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(siteModerated1Admin); - await toolbar.clickJoin(); + await toolbar.joinButton.click(); expect(await dataTable.getLibraryRole(siteModerated1Admin)).toEqual(''); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteModerated1Admin); @@ -173,7 +173,7 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchModerated1Admin); - await toolbar.clickJoin(); + await toolbar.joinButton.click(); expect(await dataTable.getLibraryRole(siteSearchModerated1Admin)).toEqual(''); const hasJoinRequest = await apis.user.sites.hasMembershipRequest(siteSearchModerated1Admin); @@ -203,9 +203,9 @@ describe('Library actions', () => { it('[C290106] from My Libraries', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic2Admin); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); - await confirmDialog.clickOk(); + await confirmDialog.okButton.click(); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(sitePublic2Admin)).toBe(false, `${sitePublic2Admin} is displayed`); @@ -214,9 +214,9 @@ describe('Library actions', () => { it('[C290110] from Favorite Libraries', async () => { await page.goToFavoriteLibrariesAndWait(); await dataTable.selectItem(sitePublic3Admin); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); - await confirmDialog.clickOk(); + await confirmDialog.okButton.click(); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(sitePublic3Admin)).toBe(true, `${sitePublic3Admin} is not displayed`); @@ -229,9 +229,9 @@ describe('Library actions', () => { await dataTable.waitForBody(); await dataTable.selectItem(siteSearchPublic2Admin); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); - await confirmDialog.clickOk(); + await confirmDialog.okButton.click(); expect(await page.getSnackBarMessage()).toEqual(`You have left the library`); expect(await dataTable.isItemPresent(siteSearchPublic2Admin)).toBe(true, `${siteSearchPublic2Admin} is not displayed`); @@ -240,7 +240,7 @@ describe('Library actions', () => { it('[C290136] Confirmation dialog UI', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic4Admin); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); @@ -253,20 +253,20 @@ describe('Library actions', () => { it('[C290111] Cancel Leave Library', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublic5Admin); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); expect(await confirmDialog.isCancelEnabled()).toBe(true, 'Cancel button is not enabled'); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); expect(await dataTable.isItemPresent(sitePublic5Admin)).toBe(true, `${sitePublic5Admin} was deleted`); }); it('[C290107] Leave a library - failure notification', async () => { await page.goToMyLibrariesAndWait(); await dataTable.selectItem(sitePublicUser); - await toolbar.clickLeave(); + await toolbar.leaveButton.click(); await page.waitForDialog(); - await confirmDialog.clickOk(); + await confirmDialog.okButton.click(); expect(await page.getSnackBarMessage()).toEqual(`Cannot leave this library`); }); diff --git a/e2e/suites/actions/new-menu.test.ts b/e2e/suites/actions/new-menu.test.ts index 2be5fbe25..e80eab988 100755 --- a/e2e/suites/actions/new-menu.test.ts +++ b/e2e/suites/actions/new-menu.test.ts @@ -116,19 +116,19 @@ describe('New menu', () => { let tooltip: string; - tooltip = await menu.getTooltipForUploadFile(); + tooltip = await menu.getItemTooltip('Upload File'); expect(tooltip).toContain('Select files to upload'); - tooltip = await menu.getTooltipForUploadFolder(); + tooltip = await menu.getItemTooltip('Upload Folder'); expect(tooltip).toContain('Select folders to upload'); - tooltip = await menu.getTooltipForCreateFolder(); + tooltip = await menu.getItemTooltip('Create Folder'); expect(tooltip).toContain('Create new folder'); - tooltip = await menu.getTooltipForCreateLibrary(); + tooltip = await menu.getItemTooltip('Create Library'); expect(tooltip).toContain('Create a new File Library'); - tooltip = await menu.getTooltipForCreateFileFromTemplate(); + tooltip = await menu.getItemTooltip('Create file from template'); expect(tooltip).toContain('Create file from template'); }); @@ -139,16 +139,16 @@ describe('New menu', () => { let tooltip: string; - tooltip = await menu.getTooltipForUploadFile(); + tooltip = await menu.getItemTooltip('Upload File'); expect(tooltip).toContain('Files cannot be uploaded whilst viewing the current items'); - tooltip = await menu.getTooltipForUploadFolder(); + tooltip = await menu.getItemTooltip('Upload Folder'); expect(tooltip).toContain('Folders cannot be uploaded whilst viewing the current items'); - tooltip = await menu.getTooltipForCreateFolder(); + tooltip = await menu.getItemTooltip('Create Folder'); expect(tooltip).toContain('Folders cannot be created whilst viewing the current items'); - tooltip = await menu.getTooltipForCreateFileFromTemplate(); + tooltip = await menu.getItemTooltip('Create file from template'); expect(tooltip).toContain('Files cannot be created whilst viewing the current items'); }); diff --git a/e2e/suites/actions/permanently-delete.test.ts b/e2e/suites/actions/permanently-delete.test.ts index 2765d8415..10cbe8790 100755 --- a/e2e/suites/actions/permanently-delete.test.ts +++ b/e2e/suites/actions/permanently-delete.test.ts @@ -79,9 +79,9 @@ describe('Permanently delete from Trash', () => { it('[C217091] delete a file', async () => { await dataTable.selectItem(file1); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); - await confirmDialog.clickDelete(); + await confirmDialog.deleteButton.click(); expect(await page.getSnackBarMessage()).toEqual(`${file1} deleted`); expect(await dataTable.isItemPresent(file1)).toBe(false, 'Item was not deleted'); @@ -89,9 +89,9 @@ describe('Permanently delete from Trash', () => { it('[C280416] delete a folder', async () => { await dataTable.selectItem(folder1); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); - await confirmDialog.clickDelete(); + await confirmDialog.deleteButton.click(); expect(await page.getSnackBarMessage()).toEqual(`${folder1} deleted`); expect(await dataTable.isItemPresent(folder1)).toBe(false, 'Item was not deleted'); @@ -99,9 +99,9 @@ describe('Permanently delete from Trash', () => { it('[C290103] delete a library', async () => { await dataTable.selectItem(site); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); - await confirmDialog.clickDelete(); + await confirmDialog.deleteButton.click(); expect(await page.getSnackBarMessage()).toEqual(`${site} deleted`); expect(await dataTable.isItemPresent(site)).toBe(false, `${site} was not deleted`); @@ -109,9 +109,9 @@ describe('Permanently delete from Trash', () => { it('[C280417] delete multiple items', async () => { await dataTable.selectMultipleItems([ file2, folder2 ]); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); - await confirmDialog.clickDelete(); + await confirmDialog.deleteButton.click(); expect(await page.getSnackBarMessage()).toEqual(`2 items deleted`); expect(await dataTable.isItemPresent(file2)).toBe(false, 'Item was not deleted'); @@ -120,7 +120,7 @@ describe('Permanently delete from Trash', () => { it('[C269113] Confirmation dialog UI', async () => { await dataTable.selectItem(file3); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Confirm delete dialog not open'); @@ -135,11 +135,11 @@ describe('Permanently delete from Trash', () => { it('[C269115] Keep action cancels the deletion', async () => { await dataTable.selectItem(file3); - await toolbar.clickPermanentlyDelete(); + await toolbar.permanentlyDeleteButton.click(); await page.waitForDialog(); expect(await confirmDialog.isKeepEnabled()).toBe(true, 'KEEP button is not enabled'); - await confirmDialog.clickKeep(); + await confirmDialog.keepButton.click(); expect(await dataTable.isItemPresent(file3)).toBe(true, 'Item was deleted'); }); }); diff --git a/e2e/suites/actions/restore.test.ts b/e2e/suites/actions/restore.test.ts index a4d6c973b..0a908516e 100755 --- a/e2e/suites/actions/restore.test.ts +++ b/e2e/suites/actions/restore.test.ts @@ -79,7 +79,7 @@ describe('Restore from Trash', () => { it('[C217177] restore file', async () => { await dataTable.selectItem(file); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); const text = await page.getSnackBarMessage(); expect(text).toContain(`${file} restored`); expect(text).toContain(`View`); @@ -92,7 +92,7 @@ describe('Restore from Trash', () => { it('[C280438] restore folder', async () => { await dataTable.selectItem(folder); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); const text = await page.getSnackBarMessage(); expect(text).toContain(`${folder} restored`); expect(text).toContain(`View`); @@ -105,7 +105,7 @@ describe('Restore from Trash', () => { it('[C290104] restore library', async () => { await dataTable.selectItem(site); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); const text = await page.getSnackBarMessage(); expect(text).toContain(`${site} restored`); expect(text).toContain(`View`); @@ -116,7 +116,7 @@ describe('Restore from Trash', () => { it('[C217182] restore multiple items', async () => { await dataTable.selectMultipleItems([file, folder]); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); const text = await page.getSnackBarMessage(); expect(text).toContain(`Restore successful`); expect(text).not.toContain(`View`); @@ -131,7 +131,7 @@ describe('Restore from Trash', () => { it('[C217181] View from notification', async () => { await dataTable.selectItem(file); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); await page.clickSnackBarAction(); await page.dataTable.waitForHeader(); expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active'); @@ -182,14 +182,14 @@ describe('Restore from Trash', () => { it('[C217178] Restore a file when another file with same name exists on the restore location', async () => { await page.clickTrashAndWait(); await dataTable.selectItem(file1); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); expect(await page.getSnackBarMessage()).toEqual(`Can't restore, ${file1} already exists`); }); it('[C217179] Restore a file when original location no longer exists', async () => { await page.clickTrashAndWait(); await dataTable.selectItem(file2); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file2}, the original location no longer exists`); }); }); @@ -250,13 +250,13 @@ describe('Restore from Trash', () => { it('[C217183] one failure', async () => { await dataTable.selectMultipleItems([file1, file2]); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); expect(await page.getSnackBarMessage()).toEqual(`Can't restore ${file1}, the original location no longer exists`); }); it('[C217184] multiple failures', async () => { await dataTable.selectMultipleItems([file3, file4, file5]); - await toolbar.clickRestore(); + await toolbar.restoreButton.click(); expect(await page.getSnackBarMessage()).toEqual('2 items not restored because of issues with the restore location'); }); }); diff --git a/e2e/suites/actions/share-file.test.ts b/e2e/suites/actions/share-file.test.ts index 9a014f0dd..f609485bd 100755 --- a/e2e/suites/actions/share-file.test.ts +++ b/e2e/suites/actions/share-file.test.ts @@ -88,7 +88,7 @@ describe('Share a file', () => { expect(await viewer.isViewerOpened()).toBe(true, 'viewer is not open'); expect(await viewer.getFileTitle()).toEqual(file6); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(file6)).toBe(true, 'File not found in download location'); }); }) @@ -152,23 +152,23 @@ describe('Share a file', () => { it('[C286327] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); it('[C286328] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -178,7 +178,7 @@ describe('Share a file', () => { it('[C286329] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -190,12 +190,12 @@ describe('Share a file', () => { it('[C286330] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.copyUrl(); + await shareDialog.urlAction.click(); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -207,12 +207,12 @@ describe('Share a file', () => { it('[C286332] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.openDatetimePicker(); + await shareDialog.datetimePickerButton.click(); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -229,7 +229,7 @@ describe('Share a file', () => { it('[C286337] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -240,13 +240,13 @@ describe('Share a file', () => { it('[C286333] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -256,7 +256,7 @@ describe('Share a file', () => { it('[C286335] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -264,7 +264,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -274,7 +274,7 @@ describe('Share a file', () => { it('[C286345] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickShare(); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -333,23 +333,23 @@ describe('Share a file', () => { it('[C286639] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); it('[C286640] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -359,7 +359,7 @@ describe('Share a file', () => { it('[C286641] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -371,12 +371,12 @@ describe('Share a file', () => { it('[C286642] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.copyUrl(); + await shareDialog.urlAction.click(); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -388,12 +388,12 @@ describe('Share a file', () => { it('[C286643] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.openDatetimePicker(); + await shareDialog.datetimePickerButton.click(); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -410,7 +410,7 @@ describe('Share a file', () => { it('[C286644] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -421,13 +421,13 @@ describe('Share a file', () => { it('[C286645] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -437,7 +437,7 @@ describe('Share a file', () => { it('[C286646] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -445,7 +445,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -455,7 +455,7 @@ describe('Share a file', () => { it('[C286647] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickShare(); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -511,23 +511,23 @@ describe('Share a file', () => { it('[C286657] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); it('[C286658] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -537,7 +537,7 @@ describe('Share a file', () => { it('[C286659] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -549,12 +549,12 @@ describe('Share a file', () => { it('[C286660] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.copyUrl(); + await shareDialog.urlAction.click(); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -566,12 +566,12 @@ describe('Share a file', () => { it('[C286661] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.openDatetimePicker(); + await shareDialog.datetimePickerButton.click(); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -588,7 +588,7 @@ describe('Share a file', () => { it('[C286662] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -599,13 +599,13 @@ describe('Share a file', () => { it('[C286663] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -615,7 +615,7 @@ describe('Share a file', () => { it('[C286664] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -623,7 +623,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -633,7 +633,7 @@ describe('Share a file', () => { it('[C286665] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickShare(); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -691,23 +691,23 @@ describe('Share a file', () => { it('[C286648] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); it('[C286649] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -717,12 +717,12 @@ describe('Share a file', () => { it('[C286651] Copy shared file URL', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.copyUrl(); + await shareDialog.urlAction.click(); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -734,7 +734,7 @@ describe('Share a file', () => { it('[C286653] Expire date is displayed correctly', async () => { await dataTable.selectItem(file4); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file4Id); @@ -745,13 +745,13 @@ describe('Share a file', () => { it('[C286654] Disable the share link expiration', async () => { await dataTable.selectItem(file5); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -761,7 +761,7 @@ describe('Share a file', () => { it('[C286655] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -769,7 +769,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -779,16 +779,16 @@ describe('Share a file', () => { it('[C286656] Open Share dialog from context menu', async () => { await dataTable.rightClickOnItem(file7); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file7}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); @@ -851,23 +851,23 @@ describe('Share a file', () => { it('[C286666] Share dialog default values', async () => { await dataTable.selectItem(file1); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.getTitle()).toEqual(`Share ${file1}`); expect(await shareDialog.getInfoText()).toEqual('Click the link below to copy it to the clipboard.'); - expect(await shareDialog.getLabels().get(0).getText()).toEqual('Link to share'); + expect(await shareDialog.labels.get(0).getText()).toEqual('Link to share'); expect(await shareDialog.getLinkUrl()).toContain(shareLinkPreUrl); expect(await shareDialog.isUrlReadOnly()).toBe(true, 'url is not readonly'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - expect(await shareDialog.getLabels().get(1).getText()).toEqual('Expires on'); + expect(await shareDialog.labels.get(1).getText()).toEqual('Expires on'); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expire toggle is checked'); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); }); it('[C286667] Close dialog', async () => { await dataTable.selectItem(file2); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isCloseEnabled()).toBe(true, 'Close button is not enabled'); @@ -877,7 +877,7 @@ describe('Share a file', () => { it('[C286668] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -889,12 +889,12 @@ describe('Share a file', () => { it('[C286669] Copy shared file URL', async () => { await dataTable.selectItem(file4); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); expect(url).toContain(shareLinkPreUrl); - await shareDialog.copyUrl(); + await shareDialog.urlAction.click(); expect(await page.getSnackBarMessage()).toBe('Link copied to the clipboard'); await browser.get(url); @@ -906,12 +906,12 @@ describe('Share a file', () => { it('[C286670] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.openDatetimePicker(); + await shareDialog.datetimePickerButton.click(); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -928,7 +928,7 @@ describe('Share a file', () => { it('[C286671] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -939,13 +939,13 @@ describe('Share a file', () => { it('[C286672] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -955,7 +955,7 @@ describe('Share a file', () => { it('[C286673] Shared file URL is not changed when Share dialog is closed and opened again', async () => { await dataTable.selectItem(file8); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url1 = await shareDialog.getLinkUrl(); await shareDialog.clickClose(); @@ -963,7 +963,7 @@ describe('Share a file', () => { await page.dataTable.clearSelection(); await dataTable.selectItem(file8); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url2 = await shareDialog.getLinkUrl(); @@ -973,7 +973,7 @@ describe('Share a file', () => { it('[C286674] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickShare(); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -1031,7 +1031,7 @@ describe('Share a file', () => { it('[C306975] Share a file', async () => { await dataTable.selectItem(file3); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); @@ -1043,12 +1043,12 @@ describe('Share a file', () => { it('[C306977] Share a file with expiration date', async () => { await dataTable.selectItem(file5); - await toolbar.clickShare(); + await toolbar.shareButton.click(); await shareDialog.waitForDialogToOpen(); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expire toggle not checked'); - await shareDialog.openDatetimePicker(); + await shareDialog.datetimePickerButton.click(); expect(await shareDialog.dateTimePicker.isCalendarOpen()).toBe(true, 'Calendar not opened'); const date = await shareDialog.dateTimePicker.setDefaultDay(); await shareDialog.dateTimePicker.waitForDateTimePickerToClose(); @@ -1065,7 +1065,7 @@ describe('Share a file', () => { it('[C306978] Expire date is displayed correctly', async () => { await dataTable.selectItem(file6); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const expireProperty = await apis.user.nodes.getSharedExpiryDate(file6Id); @@ -1076,13 +1076,13 @@ describe('Share a file', () => { it('[C306979] Disable the share link expiration', async () => { await dataTable.selectItem(file7); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isExpireToggleEnabled()).toBe(true, 'Expiration is not checked'); expect(await shareDialog.getExpireDate()).not.toBe('', 'Expire date input is empty'); - await shareDialog.clickExpirationToggle(); + await shareDialog.expireToggle.click(); expect(await shareDialog.isExpireToggleEnabled()).toBe(false, 'Expiration is checked'); expect(await shareDialog.getExpireDate()).toBe('', 'Expire date input is not empty'); @@ -1093,7 +1093,7 @@ describe('Share a file', () => { it('[C306981] Share a file from the context menu', async () => { await dataTable.rightClickOnItem(file9); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickShare(); + await contextMenu.shareAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); diff --git a/e2e/suites/actions/unshare-file-search-results.test.ts b/e2e/suites/actions/unshare-file-search-results.test.ts index 6fbdafb7b..0708e482b 100755 --- a/e2e/suites/actions/unshare-file-search-results.test.ts +++ b/e2e/suites/actions/unshare-file-search-results.test.ts @@ -112,11 +112,11 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -132,12 +132,12 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -157,13 +157,13 @@ describe('Unshare a file from Search Results', () => { await dataTable.waitForBody(); await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -180,12 +180,12 @@ describe('Unshare a file from Search Results', () => { await dataTable.rightClickOnItem(file4); await contextMenu.waitForMenuToOpen(); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -204,13 +204,13 @@ describe('Unshare a file from Search Results', () => { await searchInput.searchFor(fileSite1); await dataTable.waitForBody(); await dataTable.selectItem(fileSite1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`You don't have permission to unshare this file`); @@ -222,13 +222,13 @@ describe('Unshare a file from Search Results', () => { await searchInput.searchFor(fileSite2); await dataTable.waitForBody(); await dataTable.selectItem(fileSite2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); diff --git a/e2e/suites/actions/unshare-file.test.ts b/e2e/suites/actions/unshare-file.test.ts index 382c68db0..afab3aac0 100755 --- a/e2e/suites/actions/unshare-file.test.ts +++ b/e2e/suites/actions/unshare-file.test.ts @@ -106,11 +106,11 @@ describe('Unshare a file', () => { it('[C286339] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -121,12 +121,12 @@ describe('Unshare a file', () => { it('[C286340] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -141,13 +141,13 @@ describe('Unshare a file', () => { it('[C286341] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -158,12 +158,12 @@ describe('Unshare a file', () => { it('[C286359] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -227,11 +227,11 @@ describe('Unshare a file', () => { it('[C286679] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -242,12 +242,12 @@ describe('Unshare a file', () => { it('[C286680] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -262,13 +262,13 @@ describe('Unshare a file', () => { it('[C286681] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -279,12 +279,12 @@ describe('Unshare a file', () => { it('[C286683] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -340,11 +340,11 @@ describe('Unshare a file', () => { it('[C286689] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -355,12 +355,12 @@ describe('Unshare a file', () => { it('[C286690] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -375,13 +375,13 @@ describe('Unshare a file', () => { it('[C286691] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -392,12 +392,12 @@ describe('Unshare a file', () => { it('[C286693] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -453,11 +453,11 @@ describe('Unshare a file', () => { it('[C286684] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -468,12 +468,12 @@ describe('Unshare a file', () => { it('[C286685] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -488,13 +488,13 @@ describe('Unshare a file', () => { it('[C286686] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -505,12 +505,12 @@ describe('Unshare a file', () => { it('[C286688] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -573,11 +573,11 @@ describe('Unshare a file', () => { it('[C286694] Unshare dialog UI', async () => { await dataTable.selectItem(file1); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle not checked'); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); expect(await confirmDialog.isDialogOpen()).toBe(true, 'Unshare dialog is not open'); expect(await confirmDialog.getTitle()).toContain('Remove this shared link'); @@ -588,12 +588,12 @@ describe('Unshare a file', () => { it('[C286695] Unshare a file', async () => { await dataTable.selectItem(file2); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -608,13 +608,13 @@ describe('Unshare a file', () => { it('[C286696] Cancel the Unshare action', async () => { await dataTable.selectItem(file3); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); const urlBefore = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickCancel(); + await confirmDialog.cancelButton.click(); await confirmDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Share dialog not open'); expect(await shareDialog.isShareToggleChecked()).toBe(true, 'Share toggle is off'); @@ -625,12 +625,12 @@ describe('Unshare a file', () => { it('[C286698] Unshare a file from the context menu', async () => { await dataTable.rightClickOnItem(file4); - await contextMenu.clickSharedLinkSettings(); + await contextMenu.shareEditAction.click(); await shareDialog.waitForDialogToOpen(); const url = await shareDialog.getLinkUrl(); - await shareDialog.clickShareToggle(); + await shareDialog.shareToggle.click(); - await confirmDialog.clickRemove(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Share dialog open'); @@ -700,13 +700,13 @@ describe('Unshare a file', () => { await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.waitForHeader(); await dataTable.selectItem(file1FileLib); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`You don't have permission to unshare this file`); @@ -717,13 +717,13 @@ describe('Unshare a file', () => { await dataTable.doubleClickOnRowByName(sitePrivate); await dataTable.waitForHeader(); await dataTable.selectItem(file2FileLib); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); @@ -734,13 +734,13 @@ describe('Unshare a file', () => { it('[C286687] on Shared Files - file shared by other user', async () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(file1Shared); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`You don't have permission to unshare this file`); @@ -749,13 +749,13 @@ describe('Unshare a file', () => { it('[C286702] on Shared Files - file shared by the user', async () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(file2Shared); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); @@ -766,13 +766,13 @@ describe('Unshare a file', () => { it('[C286697] on Favorites - file shared by other user', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file1Fav); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); const msg = await page.getSnackBarMessage(); expect(msg).toContain(`You don't have permission to unshare this file`); @@ -781,13 +781,13 @@ describe('Unshare a file', () => { it('[C286703] on Favorites - file shared by the user', async () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(file2Fav); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); await shareDialog.waitForDialogToOpen(); expect(await shareDialog.isShareToggleDisabled()).toBe(false, 'Share toggle disabled for consumer'); - await shareDialog.clickShareToggle(); - await confirmDialog.clickRemove(); + await shareDialog.shareToggle.click(); + await confirmDialog.removeButton.click(); await confirmDialog.waitForDialogToClose(); await shareDialog.waitForDialogToClose(); diff --git a/e2e/suites/actions/upload-file.test.ts b/e2e/suites/actions/upload-file.test.ts index b9eb37dfb..f4a40cc44 100755 --- a/e2e/suites/actions/upload-file.test.ts +++ b/e2e/suites/actions/upload-file.test.ts @@ -62,7 +62,7 @@ describe('Upload files', () => { it('Upload a file', async () => { await dataTable.doubleClickOnRowByName(folder1); await page.sidenav.openNewMenu(); - await page.sidenav.menu.uploadFile().sendKeys(`${__dirname}/create-folder.test.ts`); + await page.sidenav.menu.uploadFilesInput.sendKeys(`${__dirname}/create-folder.test.ts`); expect(await dataTable.isItemPresent('create-folder.test.ts')).toBe(true, 'file not uploaded'); }); diff --git a/e2e/suites/actions/upload-new-version.test.ts b/e2e/suites/actions/upload-new-version.test.ts index c5ff72bd7..e7508442c 100755 --- a/e2e/suites/actions/upload-new-version.test.ts +++ b/e2e/suites/actions/upload-new-version.test.ts @@ -132,9 +132,9 @@ describe('Upload new version', () => { expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); - expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); - expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); - expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); + expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); + expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); + expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); }); @@ -146,9 +146,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); @@ -163,9 +163,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new minor version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); @@ -180,7 +180,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload3); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -196,9 +196,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(file); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); const message = await page.getSnackBarMessage(); expect(message).toContain(nameConflictMessage); @@ -215,9 +215,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload4); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); @@ -233,7 +233,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload5); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -283,9 +283,9 @@ describe('Upload new version', () => { expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); - expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); - expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); - expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); + expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); + expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); + expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); }); @@ -297,9 +297,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); @@ -314,9 +314,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new minor version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); @@ -331,7 +331,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload3); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -347,9 +347,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(file); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); const message = await page.getSnackBarMessage(); expect(message).toContain(nameConflictMessage); @@ -366,9 +366,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload4); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); @@ -384,7 +384,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload5); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -433,9 +433,9 @@ describe('Upload new version', () => { expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); - expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); - expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); - expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); + expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); + expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); + expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); }); @@ -447,9 +447,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload1, parentRF)).toBe(true, 'File not updated'); @@ -464,9 +464,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new minor version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload2, parentRF)).toBe(true, 'File not updated'); @@ -481,7 +481,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload3); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -497,9 +497,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(file); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); const message = await page.getSnackBarMessage(); expect(message).toContain(nameConflictMessage); @@ -516,9 +516,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload4); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload4, parentRF)).toBe(true, 'File name was not changed'); @@ -534,7 +534,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload5); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -584,9 +584,9 @@ describe('Upload new version', () => { expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); - expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); - expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); - expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); + expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); + expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); + expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); }); @@ -598,9 +598,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload1)).toBe(true, 'File not updated'); @@ -615,9 +615,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new minor version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload2)).toBe(true, 'File not updated'); @@ -632,7 +632,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload3); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -648,9 +648,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(file); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); const message = await page.getSnackBarMessage(); expect(message).toContain(nameConflictMessage); @@ -667,9 +667,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload4); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); expect(await dataTable.isItemPresent(fileToUpload4)).toBe(true, 'File name was not changed'); @@ -685,7 +685,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload5); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -735,9 +735,9 @@ describe('Upload new version', () => { expect(await uploadNewVersionDialog.getTitle()).toEqual('Upload New Version'); expect(await uploadNewVersionDialog.getText()).toContain('What level of changes were made to this version?'); - expect(await uploadNewVersionDialog.isDescriptionDisplayed()).toBe(true, 'Description not displayed'); - expect(await uploadNewVersionDialog.isMinorOptionDisplayed()).toBe(true, 'Minor option not displayed'); - expect(await uploadNewVersionDialog.isMajorOptionDisplayed()).toBe(true, 'Major option not displayed'); + expect(await uploadNewVersionDialog.description.isDisplayed()).toBe(true, 'Description not displayed'); + expect(await uploadNewVersionDialog.minorOption.isDisplayed()).toBe(true, 'Minor option not displayed'); + expect(await uploadNewVersionDialog.majorOption.isDisplayed()).toBe(true, 'Major option not displayed'); expect(await uploadNewVersionDialog.isCancelButtonEnabled()).toBe(true, 'Cancel button not enabled'); expect(await uploadNewVersionDialog.isUploadButtonEnabled()).toBe(true, 'Update button not enabled'); }); @@ -753,9 +753,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload1); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); // TODO: enable when ACA-2329 is fixed @@ -775,9 +775,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new minor version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); // TODO: enable when ACA-2329 is fixed @@ -797,7 +797,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload3); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); @@ -817,9 +817,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(file); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); const message = await page.getSnackBarMessage(); expect(message).toContain(nameConflictMessage); @@ -840,9 +840,9 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload4); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await uploadNewVersionDialog.waitForDialogToClose(); // TODO: enable when ACA-2329 is fixed @@ -863,7 +863,7 @@ describe('Upload new version', () => { await Utils.uploadFileNewVersion(fileToUpload5); await page.waitForDialog(); - await uploadNewVersionDialog.clickMinor(); + await uploadNewVersionDialog.minorOption.click(); await uploadNewVersionDialog.enterDescription('new version description'); await uploadNewVersionDialog.clickCancel(); diff --git a/e2e/suites/application/general.test.ts b/e2e/suites/application/general.test.ts index 1ac9dd228..4acf7cef0 100644 --- a/e2e/suites/application/general.test.ts +++ b/e2e/suites/application/general.test.ts @@ -59,7 +59,7 @@ describe('General', () => { await authApi.logout(); - await createDialog.clickCreate(); + await createDialog.createButton.click(); expect(await page.getSnackBarMessage()).toEqual('The action was unsuccessful. Try again or contact your IT Team.'); diff --git a/e2e/suites/authentication/login.test.ts b/e2e/suites/authentication/login.test.ts index 2e3c99801..2a2b28d17 100755 --- a/e2e/suites/authentication/login.test.ts +++ b/e2e/suites/authentication/login.test.ts @@ -81,16 +81,16 @@ describe('Login', () => { }); it('[C213089] login page layout', async () => { - expect(await login.isUsernameEnabled()).toBe(true, 'username input is not enabled'); - expect(await login.isPasswordEnabled()).toBe(true, 'password input is not enabled'); - expect(await login.isSubmitEnabled()).toBe(false, 'SIGN IN button is enabled'); + expect(await login.usernameInput.isEnabled()).toBe(true, 'username input is not enabled'); + expect(await login.passwordInput.isEnabled()).toBe(true, 'password input is not enabled'); + expect(await login.submitButton.isEnabled()).toBe(false, 'SIGN IN button is enabled'); expect(await login.isPasswordHidden()).toBe(true, 'Password is not hidden by default'); }); it('[C213091] change password visibility', async () => { await login.enterPassword('some password'); expect(await login.isPasswordDisplayed()).toBe(false, 'password is visible'); - await login.clickPasswordVisibility(); + await login.passwordVisibility.click(); expect(await login.isPasswordHidden()).toBe(false, 'Password visibility not changed'); expect(await login.isPasswordDisplayed()).toBe(true, 'password is not visible'); }); @@ -109,7 +109,7 @@ describe('Login', () => { const { username, firstName, lastName } = johnDoe; await loginPage.loginWith(username); - expect(await userInfo.getName()).toEqual(`${firstName} ${lastName}`); + expect(await userInfo.fullName.getText()).toEqual(`${firstName} ${lastName}`); }); it(`[C213096] logs in with user having username containing "@"`, async () => { diff --git a/e2e/suites/extensions/ext-info-drawer.test.ts b/e2e/suites/extensions/ext-info-drawer.test.ts index 4455510da..babba0e8d 100755 --- a/e2e/suites/extensions/ext-info-drawer.test.ts +++ b/e2e/suites/extensions/ext-info-drawer.test.ts @@ -94,7 +94,7 @@ describe('Extensions - Info Drawer', () => { it('[C284646] Add a new tab with icon and title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); const val = await infoDrawer.getTabTitle(custom_tab.order); @@ -104,7 +104,7 @@ describe('Extensions - Info Drawer', () => { it('[C284647] Remove existing tab', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`); @@ -112,7 +112,7 @@ describe('Extensions - Info Drawer', () => { it('[C284648] Change tab title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`); @@ -121,7 +121,7 @@ describe('Extensions - Info Drawer', () => { it('[C284649] Tab with icon and no title', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`); @@ -130,7 +130,7 @@ describe('Extensions - Info Drawer', () => { it('[C284651] Insert new component in tab', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`); @@ -150,7 +150,7 @@ describe('Extensions - Info Drawer', () => { it('[C284650] Remove all tabs', async () => { await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty'); diff --git a/e2e/suites/extensions/ext-metadata.test.ts b/e2e/suites/extensions/ext-metadata.test.ts index d51990544..0d25ee56e 100644 --- a/e2e/suites/extensions/ext-metadata.test.ts +++ b/e2e/suites/extensions/ext-metadata.test.ts @@ -83,11 +83,11 @@ describe('Extensions - Metadata presets', () => { await page.refresh(); await page.dataTable.selectItem(file); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickTab(properties_tab.title); - await metadataCard.clickExpandButton(); + await metadataCard.expandButton.click(); await metadataCard.waitForFirstExpansionPanel(); done(); diff --git a/e2e/suites/extensions/ext-viewer.test.ts b/e2e/suites/extensions/ext-viewer.test.ts index fe8a439eb..733166564 100755 --- a/e2e/suites/extensions/ext-viewer.test.ts +++ b/e2e/suites/extensions/ext-viewer.test.ts @@ -109,7 +109,7 @@ describe('Extensions - Viewer', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present'); expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.dataTable.doubleClickOnRowByName(docxFile.file_name); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); @@ -167,7 +167,7 @@ describe('Extensions - Viewer', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); await toolbar.openMoreMenu(); - expect(await toolbar.menu.isManagePermissionsPresent()).toBe(false, 'Action is still displayed'); + expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed'); }); }); }); diff --git a/e2e/suites/info-drawer/comments.test.ts b/e2e/suites/info-drawer/comments.test.ts index 9d4c45b82..0277d5de2 100755 --- a/e2e/suites/info-drawer/comments.test.ts +++ b/e2e/suites/info-drawer/comments.test.ts @@ -108,7 +108,7 @@ describe('Comments', () => { it('[C299173] Comments tab default fields', async () => { await dataTable.selectItem(file1); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -120,7 +120,7 @@ describe('Comments', () => { it('[C280583] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -130,7 +130,7 @@ describe('Comments', () => { it('[C280585] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -139,7 +139,7 @@ describe('Comments', () => { it('[C280589] Add button is enabled when typing in the comment field', async () => { await dataTable.selectItem(file1); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -153,7 +153,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Personal); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -168,7 +168,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(folder1); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -181,7 +181,7 @@ describe('Comments', () => { it('[C280591] Escape key clears the text when focus is on the textarea', async () => { await dataTable.selectItem(file2Personal); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment('myComment'); @@ -207,7 +207,7 @@ describe('Comments', () => { it('[C299197] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -217,7 +217,7 @@ describe('Comments', () => { it('[C299198] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -228,7 +228,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Favorites); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -243,7 +243,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(folder2); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -268,7 +268,7 @@ describe('Comments', () => { it('[C299189] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -278,7 +278,7 @@ describe('Comments', () => { it('[C299190] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -289,7 +289,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Shared); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -314,7 +314,7 @@ describe('Comments', () => { it('[C299193] Comments are displayed ordered by created date in descending order', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -324,7 +324,7 @@ describe('Comments', () => { it('[C299194] Total number of comments is displayed', async () => { await dataTable.selectItem(fileWith2Comments); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -335,7 +335,7 @@ describe('Comments', () => { const myComment = 'my comment'; await dataTable.selectItem(file2Recent); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); await commentsTab.typeComment(myComment); @@ -363,7 +363,7 @@ describe('Comments', () => { await dataTable.doubleClickOnRowByName(parent); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -382,7 +382,7 @@ describe('Comments', () => { await page.clickFavoritesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -401,7 +401,7 @@ describe('Comments', () => { await page.clickSharedFilesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); @@ -420,7 +420,7 @@ describe('Comments', () => { await page.clickRecentFilesAndWait(); await dataTable.selectItem(fileWith1Comment); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await infoDrawer.clickCommentsTab(); diff --git a/e2e/suites/info-drawer/file-folder-properties.test.ts b/e2e/suites/info-drawer/file-folder-properties.test.ts index 823c3d705..494ad73db 100755 --- a/e2e/suites/info-drawer/file-folder-properties.test.ts +++ b/e2e/suites/info-drawer/file-folder-properties.test.ts @@ -96,7 +96,7 @@ describe('File / Folder properties', () => { describe('View properties', () => { it('[C299162] Default tabs', async () => { await dataTable.selectItem(file1.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); @@ -134,7 +134,7 @@ describe('File / Folder properties', () => { ]; await dataTable.selectItem(file1.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); @@ -168,7 +168,7 @@ describe('File / Folder properties', () => { ]; await dataTable.selectItem(folder1.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed'); @@ -179,19 +179,19 @@ describe('File / Folder properties', () => { it('[C269004] Less / More information buttons', async () => { await dataTable.selectItem(file1.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded'); - await propertiesTab.clickMoreInformationButton(); + await propertiesTab.moreInfoButton.click(); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled'); expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded'); - await propertiesTab.clickLessInformationButton(); + await propertiesTab.lessInfoButton.click(); expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(true, 'More information button not displayed'); expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(false, 'Less information button enabled'); @@ -200,6 +200,7 @@ describe('File / Folder properties', () => { it('[C269007] Image properties', async () => { const apiProps = await apis.user.nodes.getNodeById(image1Id); + const properties = apiProps.entry.properties; const expectedPropLabels = [ 'Image Width', @@ -216,26 +217,26 @@ describe('File / Folder properties', () => { 'Camera Software' ]; const expectedPropValues = [ - apiProps.entry.properties['exif:pixelXDimension'].toString(), - apiProps.entry.properties['exif:pixelYDimension'].toString(), - moment(apiProps.entry.properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT), - apiProps.entry.properties['exif:exposureTime'].toString(), - apiProps.entry.properties['exif:fNumber'].toString(), - apiProps.entry.properties['exif:flash'], - apiProps.entry.properties['exif:focalLength'].toString(), - apiProps.entry.properties['exif:isoSpeedRatings'], - (apiProps.entry.properties['exif:orientation']).toString(), - apiProps.entry.properties['exif:manufacturer'], - apiProps.entry.properties['exif:model'], - apiProps.entry.properties['exif:software'] + properties['exif:pixelXDimension'].toString(), + properties['exif:pixelYDimension'].toString(), + moment(properties['exif:dateTimeOriginal']).format(DATE_TIME_FORMAT), + properties['exif:exposureTime'].toString(), + properties['exif:fNumber'].toString(), + properties['exif:flash'], + properties['exif:focalLength'].toString(), + properties['exif:isoSpeedRatings'], + (properties['exif:orientation']).toString(), + properties['exif:manufacturer'], + properties['exif:model'], + properties['exif:software'] ]; await dataTable.selectItem(image1.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); - await propertiesTab.clickMoreInformationButton(); - await propertiesTab.clickImagePropertiesPanel(); + await propertiesTab.moreInfoButton.click(); + await propertiesTab.imagePropertiesPanel.click(); await propertiesTab.waitForImagePropertiesPanelToExpand(); expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed'); diff --git a/e2e/suites/info-drawer/general.test.ts b/e2e/suites/info-drawer/general.test.ts index edf28afd1..da5108ccb 100755 --- a/e2e/suites/info-drawer/general.test.ts +++ b/e2e/suites/info-drawer/general.test.ts @@ -71,14 +71,14 @@ describe('General', () => { afterEach(async (done) => { if (await infoDrawer.isOpen()) { - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); } done(); }); it('[C268999] Info drawer closes on page refresh', async () => { await dataTable.selectItem(file1); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open'); await page.refresh(); diff --git a/e2e/suites/info-drawer/library-properties.test.ts b/e2e/suites/info-drawer/library-properties.test.ts index 5e81f843e..ccbf4ba65 100755 --- a/e2e/suites/info-drawer/library-properties.test.ts +++ b/e2e/suites/info-drawer/library-properties.test.ts @@ -97,14 +97,14 @@ describe('Library properties', () => { afterEach(async done => { if (await infoDrawer.isOpen()) { - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); } done(); }); it('[C289336] Info drawer opens for a library', async () => { await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await infoDrawer.getHeaderTitle()).toEqual('Details'); @@ -124,7 +124,7 @@ describe('Library properties', () => { it('[C289338] Editable properties', async () => { await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -143,7 +143,7 @@ describe('Library properties', () => { it('[C289339] Edit site details', async () => { await dataTable.selectItem(siteForUpdate.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -170,7 +170,7 @@ describe('Library properties', () => { const newDesc = `new desc ${Utils.random}`; await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled'); @@ -191,7 +191,7 @@ describe('Library properties', () => { await apis.user.queries.waitForSites(site.name, { expect: 1 }); await dataTable.selectItem(siteDup); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -202,7 +202,7 @@ describe('Library properties', () => { it('[C289342] Site name too long', async () => { await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -215,7 +215,7 @@ describe('Library properties', () => { it('[C289343] Site description too long', async () => { await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); @@ -237,7 +237,7 @@ describe('Library properties', () => { await page.clickFileLibrariesAndWait(); await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed'); }); @@ -247,7 +247,7 @@ describe('Library properties', () => { await page.clickFileLibrariesAndWait(); await dataTable.selectItem(site.name); - await page.toolbar.clickViewDetails(); + await page.toolbar.viewDetailsButton.click(); await infoDrawer.waitForInfoDrawerToOpen(); await aboutTab.clickEditLibraryProperties(); diff --git a/e2e/suites/list-views/empty-list.test.ts b/e2e/suites/list-views/empty-list.test.ts index fdf466d69..d90b503a6 100755 --- a/e2e/suites/list-views/empty-list.test.ts +++ b/e2e/suites/list-views/empty-list.test.ts @@ -198,7 +198,7 @@ describe('Empty list views', () => { await dataTable.waitForBody(); expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); - expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); + expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results'); }); it('[C290031] Empty Search results - Files / Folders', async () => { @@ -209,6 +209,6 @@ describe('Empty list views', () => { await dataTable.waitForBody(); expect(await dataTable.isEmpty()).toBe(true, 'list is not empty'); - expect(await dataTable.getEmptySearchResultsText()).toContain('Your search returned 0 results'); + expect(await dataTable.emptySearchText.getText()).toContain('Your search returned 0 results'); }); }); diff --git a/e2e/suites/list-views/favorites.test.ts b/e2e/suites/list-views/favorites.test.ts index 74dfbf0a2..bb8631219 100755 --- a/e2e/suites/list-views/favorites.test.ts +++ b/e2e/suites/list-views/favorites.test.ts @@ -139,6 +139,6 @@ describe('Favorites', () => { it('[C213230] Navigate into folder from Favorites', async () => { await dataTable.doubleClickOnRowByName(favFolderName); await dataTable.waitForEmptyState(); - expect(await breadcrumb.getCurrentItemName()).toBe(favFolderName); + expect(await breadcrumb.currentItem.getText()).toBe(favFolderName); }); }); diff --git a/e2e/suites/list-views/generic-errors.test.ts b/e2e/suites/list-views/generic-errors.test.ts index 881d5c28e..4b0d0386f 100755 --- a/e2e/suites/list-views/generic-errors.test.ts +++ b/e2e/suites/list-views/generic-errors.test.ts @@ -71,15 +71,15 @@ describe('Generic errors', () => { await apis.user.nodes.deleteNodeById(file1Id, false); await browser.get(URL); - expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); + expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed'); + expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`); }); it('[C217315] Invalid URL', async () => { await page.load('/invalid page'); - expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); + expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed'); + expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`); }); @@ -91,8 +91,8 @@ describe('Generic errors', () => { await loginPage.loginWith(username2); await browser.get(URL); - expect(await page.isGenericErrorDisplayed()).toBe(true, 'Generic error page not displayed'); - expect(await page.getGenericErrorTitle()).toContain(`This item no longer exists or you don't have permission to view it.`); + expect(await page.genericError.isDisplayed()).toBe(true, 'Generic error page not displayed'); + expect(await page.genericErrorTitle.getText()).toContain(`This item no longer exists or you don't have permission to view it.`); await loginPage.loginWith(username); }); diff --git a/e2e/suites/navigation/breadcrumb.test.ts b/e2e/suites/navigation/breadcrumb.test.ts index cdd115391..de3e629fe 100755 --- a/e2e/suites/navigation/breadcrumb.test.ts +++ b/e2e/suites/navigation/breadcrumb.test.ts @@ -85,44 +85,44 @@ describe('Breadcrumb', () => { it('[C260964] Personal Files breadcrumb main node', async () => { await page.clickPersonalFiles(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Personal Files'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Personal Files'); }); it('[C260966] My Libraries breadcrumb main node', async () => { await page.goToMyLibrariesAndWait(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('My Libraries'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('My Libraries'); }); it('[C289891] Favorite Libraries breadcrumb main node', async () => { await page.goToFavoriteLibrariesAndWait(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Favorite Libraries'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Favorite Libraries'); }); it('[C260971] Recent Files breadcrumb main node', async () => { await page.clickRecentFiles(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Recent Files'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Recent Files'); }); it('[C260972] Shared Files breadcrumb main node', async () => { await page.clickSharedFiles(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Shared Files'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Shared Files'); }); it('[C260973] Favorites breadcrumb main node', async () => { await page.clickFavorites(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Favorites'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Favorites'); }); it('[C260974] Trash breadcrumb main node', async () => { await page.clickTrash(); - expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items'); - expect(await breadcrumb.getCurrentItemName()).toBe('Trash'); + expect(await breadcrumb.items.count()).toEqual(1, 'Breadcrumb has incorrect number of items'); + expect(await breadcrumb.currentItem.getText()).toBe('Trash'); }); it('[C260965] Personal Files breadcrumb for a folder hierarchy', async () => { @@ -159,7 +159,11 @@ describe('Breadcrumb', () => { await page.dataTable.doubleClickOnRowByName(parent); await page.dataTable.doubleClickOnRowByName(subFolder1); await page.dataTable.doubleClickOnRowByName(subFolder2); - expect(await breadcrumb.getNthItemTooltip(3)).toEqual(subFolder1); + + const item = breadcrumb.items.get(2); + const title = await item.getAttribute('title'); + + expect(title).toEqual(subFolder1); }); it('[C213238] Breadcrumb updates correctly when folder is renamed', async () => { @@ -170,7 +174,7 @@ describe('Breadcrumb', () => { await apis.user.nodes.renameNode(folder1Id, folder1Renamed) await page.refresh(); await page.dataTable.wait(); - expect(await breadcrumb.getCurrentItemName()).toEqual(folder1Renamed); + expect(await breadcrumb.currentItem.getText()).toEqual(folder1Renamed); }); it('[C213240] Browser back navigates to previous location regardless of breadcrumb steps', async () => { diff --git a/e2e/suites/navigation/single-click.test.ts b/e2e/suites/navigation/single-click.test.ts index 81cb47b9e..e2423a9b2 100755 --- a/e2e/suites/navigation/single-click.test.ts +++ b/e2e/suites/navigation/single-click.test.ts @@ -112,7 +112,7 @@ describe('Single click on item name', () => { it('[C280034] Navigate inside the folder when clicking the hyperlink', async () => { await dataTable.clickNameLink(folder1); - expect(await breadcrumb.getCurrentItemName()).toBe(folder1); + expect(await breadcrumb.currentItem.getText()).toBe(folder1); }); }); @@ -129,7 +129,7 @@ describe('Single click on item name', () => { it('[C284902] Navigate inside the library when clicking the hyperlink', async () => { await dataTable.clickNameLink(siteName); - expect(await breadcrumb.getCurrentItemName()).toBe(siteName); + expect(await breadcrumb.currentItem.getText()).toBe(siteName); expect(await dataTable.isItemPresent(fileSite)).toBe(true, `${fileSite} not displayed`); }); }); @@ -193,7 +193,7 @@ describe('Single click on item name', () => { it('[C284911] Navigate inside the folder when clicking the hyperlink', async () => { await dataTable.clickNameLink(folder1); - expect(await breadcrumb.getCurrentItemName()).toBe(folder1); + expect(await breadcrumb.currentItem.getText()).toBe(folder1); }); }); @@ -232,7 +232,7 @@ describe('Single click on item name', () => { await dataTable.waitForBody(); await dataTable.clickSearchResultNameLink(folder1); - expect(await breadcrumb.getCurrentItemName()).toBe(folder1); + expect(await breadcrumb.currentItem.getText()).toBe(folder1); }); }); diff --git a/e2e/suites/search/search-filters.test.ts b/e2e/suites/search/search-filters.test.ts index d44d19051..9c937e0e5 100644 --- a/e2e/suites/search/search-filters.test.ts +++ b/e2e/suites/search/search-filters.test.ts @@ -287,7 +287,7 @@ describe('Search filters', () => { describe('Filter by File type', () => { afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); done(); }); @@ -341,7 +341,7 @@ describe('Search filters', () => { describe('Filter by Creator', () => { afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); done(); }); @@ -396,7 +396,7 @@ describe('Search filters', () => { describe('Filter by Modifier', () => { afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); done(); }); @@ -451,7 +451,7 @@ describe('Search filters', () => { describe('Filter by Location', () => { afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); done(); }); @@ -508,7 +508,7 @@ describe('Search filters', () => { const expectedDateFilters = ['Today (2)', 'This week (2)', 'This month (2)', 'In the last 6 months (2)', 'This year (2)']; afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); done(); }); @@ -562,7 +562,7 @@ describe('Search filters', () => { describe('Multiple filters', () => { afterEach(async (done) => { - await filters.clickResetAllButton(); + await filters.resetAllButton.click(); await sizeFilter.resetPanel(); await createdDateFilter.resetPanel(); done(); diff --git a/e2e/suites/search/search-results-files-folders.test.ts b/e2e/suites/search/search-results-files-folders.test.ts index 949f19bab..3b16a756f 100644 --- a/e2e/suites/search/search-results-files-folders.test.ts +++ b/e2e/suites/search/search-results-files-folders.test.ts @@ -94,7 +94,7 @@ describe('Search results - files and folders', () => { await searchInput.searchFor('test-'); await dataTable.waitForBody(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual('Search Results'); + expect(await page.breadcrumb.currentItem.getText()).toEqual('Search Results'); }); it('[C279183] File information', async () => { diff --git a/e2e/suites/search/search-results-libraries.test.ts b/e2e/suites/search/search-results-libraries.test.ts index 787e0fb54..e671a2cc1 100644 --- a/e2e/suites/search/search-results-libraries.test.ts +++ b/e2e/suites/search/search-results-libraries.test.ts @@ -163,7 +163,7 @@ describe('Search results - libraries', () => { await searchInput.searchFor('lib'); await dataTable.waitForBody(); - expect(await page.breadcrumb.getCurrentItemName()).toEqual('Libraries found...'); + expect(await page.breadcrumb.currentItem.getText()).toEqual('Libraries found...'); }); it('[C290016] Results page columns', async () => { diff --git a/e2e/suites/search/search-sorting.test.ts b/e2e/suites/search/search-sorting.test.ts index 3fdc08685..538d24726 100644 --- a/e2e/suites/search/search-sorting.test.ts +++ b/e2e/suites/search/search-sorting.test.ts @@ -103,13 +103,13 @@ describe('Search sorting', () => { }); it('[C277728] Sort by Name', async () => { - await page.sortingPicker.sortByName(); + await page.sortingPicker.sortBy('Filename'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); - await page.sortingPicker.sortByName(); + await page.sortingPicker.sortBy('Filename'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); @@ -117,13 +117,13 @@ describe('Search sorting', () => { }); it('[C277740] Sort by Type', async () => { - await page.sortingPicker.sortByType(); + await page.sortingPicker.sortBy('Type'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); - await page.sortingPicker.sortByType(); + await page.sortingPicker.sortBy('Type'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); @@ -131,13 +131,13 @@ describe('Search sorting', () => { }); it('[C277738] Sort by Size', async () => { - await page.sortingPicker.sortBySize(); + await page.sortingPicker.sortBy('Size'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(fileJpg.name); - await page.sortingPicker.sortBySize(); + await page.sortingPicker.sortBy('Size'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); @@ -145,13 +145,13 @@ describe('Search sorting', () => { }); it('[C277734] Sort by Created date', async () => { - await page.sortingPicker.sortByCreatedDate(); + await page.sortingPicker.sortBy('Created date'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); - await page.sortingPicker.sortByCreatedDate(); + await page.sortingPicker.sortBy('Created date'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); @@ -159,13 +159,13 @@ describe('Search sorting', () => { }); it('[C277736] Sort by Modified date', async () => { - await page.sortingPicker.sortByModifiedDate(); + await page.sortingPicker.sortBy('Modified date'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); - await page.sortingPicker.sortByModifiedDate(); + await page.sortingPicker.sortBy('Modified date'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); @@ -173,13 +173,13 @@ describe('Search sorting', () => { }); it('[C277727] Sort by Relevance', async () => { - await page.sortingPicker.sortByRelevance(); + await page.sortingPicker.sortBy('Relevance'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); - await page.sortingPicker.sortByRelevance(); + await page.sortingPicker.sortBy('Relevance'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); @@ -187,13 +187,13 @@ describe('Search sorting', () => { }); it('[C277732] Sort by Modifier', async () => { - await page.sortingPicker.sortByModifier(); + await page.sortingPicker.sortBy('Modifier'); await page.sortingPicker.setSortOrderASC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(fileJpg.name); expect(await dataTable.getNthSearchResultsRow(2).getText()).toContain(filePdf.name); - await page.sortingPicker.sortByModifier(); + await page.sortingPicker.sortBy('Modifier'); await page.sortingPicker.setSortOrderDESC(); expect(await dataTable.getNthSearchResultsRow(1).getText()).toContain(filePdf.name); diff --git a/e2e/suites/viewer/viewer-actions.test.ts b/e2e/suites/viewer/viewer-actions.test.ts index 9e917dcb0..08bb877bd 100755 --- a/e2e/suites/viewer/viewer-actions.test.ts +++ b/e2e/suites/viewer/viewer-actions.test.ts @@ -123,7 +123,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxPersonalFiles); await viewer.waitForViewerToOpen(); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location'); }); @@ -136,9 +136,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickCopy(); + await copyMoveDialog.copyButton.click(); expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not in the list'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -155,9 +155,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickMove(); + await copyMoveDialog.moveButton.click(); expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(xlsxPersonalFiles)).toBe(false, 'Item was not moved'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -169,7 +169,7 @@ describe('Viewer actions', () => { await viewer.waitForViewerToOpen(); await toolbar.clickMoreActionsFavorite(); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.clickFavoritesAndWait(); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not present in Favorites list'); @@ -214,9 +214,9 @@ describe('Viewer actions', () => { await Utils.uploadFileNewVersion(docxFile2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.getFileTitle()).toContain(docxFile2); @@ -229,18 +229,18 @@ describe('Viewer actions', () => { await viewer.waitForViewerToOpen(); await toolbar.openMoreMenu(); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(true, `'Cancel Editing' button should be shown`); - expect(await toolbar.menu.isEditOfflinePresent()).toBe(false, `'Edit Offline' shouldn't be shown`); + expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(true, `'Cancel Editing' button should be shown`); + expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(false, `'Edit Offline' shouldn't be shown`); await toolbar.menu.clickMenuItem('Upload New Version'); await Utils.uploadFileNewVersion(docxFile); await page.waitForDialog(); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); await toolbar.openMoreMenu(); - expect(await toolbar.menu.isCancelEditingPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); - expect(await toolbar.menu.isEditOfflinePresent()).toBe(true, `'Edit Offline' should be shown`); + expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`); + expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`); }); it('[C279282] Full screen action', async () => { @@ -248,7 +248,7 @@ describe('Viewer actions', () => { await viewer.waitForViewerToOpen(); await Utils.getBrowserLog(); - await toolbar.clickFullScreen(); + await toolbar.fullScreenButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen'); const browserLogAfter = await Utils.getBrowserLog(); @@ -259,7 +259,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxPersonalFiles); await viewer.waitForViewerToOpen(); - await toolbar.clickShare(); + await toolbar.shareButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); @@ -278,7 +278,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxPersonalFiles); await viewer.waitForViewerToOpen(); - await toolbar.clickShare(); + await toolbar.shareButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await Utils.pressEscape(); expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open'); @@ -345,7 +345,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxLibraries); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(docxLibraries)).toBe(true, 'File not found in download location'); }); @@ -357,9 +357,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickCopy(); + await copyMoveDialog.copyButton.click(); expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, 'Item is not in the list'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -377,9 +377,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickMove(); + await copyMoveDialog.moveButton.click(); expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(false, 'Item was not moved'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -391,7 +391,7 @@ describe('Viewer actions', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); await toolbar.clickMoreActionsFavorite(); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.clickFavoritesAndWait(); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, `${docxLibraries} is not favorite`); expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, `${docxLibraries} is not present in Favorites list`); @@ -436,9 +436,9 @@ describe('Viewer actions', () => { await Utils.uploadFileNewVersion(docxFile2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.getFileTitle()).toContain(docxFile2); @@ -450,7 +450,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxLibraries); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickShare(); + await toolbar.shareButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); @@ -526,7 +526,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxRecentFiles); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(docxRecentFiles)).toBe(true, 'File not found in download location'); }); @@ -538,9 +538,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickCopy(); + await copyMoveDialog.copyButton.click(); expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not in the list'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -558,9 +558,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickMove(); + await copyMoveDialog.moveButton.click(); expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(xlsxRecentFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.getItemLocationTooltip(xlsxRecentFiles)).toContain(destination, 'Item was not moved'); await page.clickPersonalFilesAndWait(); @@ -573,7 +573,7 @@ describe('Viewer actions', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); await toolbar.clickMoreActionsFavorite(); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.clickFavoritesAndWait(); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not present in Favorites list'); @@ -618,9 +618,9 @@ describe('Viewer actions', () => { await Utils.uploadFileNewVersion(docxFile2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.getFileTitle()).toContain(docxFile2); @@ -632,7 +632,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxRecentFiles); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickShare(); + await toolbar.shareButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); @@ -706,7 +706,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxSharedFiles); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(docxSharedFiles)).toBe(true, 'File not found in download location'); }); @@ -718,9 +718,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickCopy(); + await copyMoveDialog.copyButton.click(); expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not in the list'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -737,9 +737,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickMove(); + await copyMoveDialog.moveButton.click(); expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(xlsxSharedFiles)).toBe(true, 'Item is not in the list'); expect(await dataTable.getItemLocationTooltip(xlsxSharedFiles)).toContain(destination, 'Item was not moved'); await page.clickPersonalFilesAndWait(); @@ -752,7 +752,7 @@ describe('Viewer actions', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); await toolbar.clickMoreActionsFavorite(); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.clickFavoritesAndWait(); expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite'); expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not present in Favorites list'); @@ -797,9 +797,9 @@ describe('Viewer actions', () => { await Utils.uploadFileNewVersion(docxFile2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.getFileTitle()).toContain(docxFile2); @@ -811,7 +811,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxSharedFiles); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickSharedLinkSettings(); + await toolbar.shareEditButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); @@ -887,7 +887,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxFavorites); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickDownload(); + await toolbar.downloadButton.click(); expect(await Utils.fileExistsOnOS(docxFavorites)).toBe(true, 'File not found in download location'); }); @@ -899,9 +899,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickCopy(); + await copyMoveDialog.copyButton.click(); expect(await page.getSnackBarMessage()).toContain('Copied 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(docxFavorites)).toBe(true, 'Item is not in the list'); await page.clickPersonalFilesAndWait(); await dataTable.doubleClickOnRowByName(destination); @@ -919,9 +919,9 @@ describe('Viewer actions', () => { expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await copyMoveDialog.selectLocation('Personal Files'); await copyMoveDialog.selectDestination(destination); - await copyMoveDialog.clickMove(); + await copyMoveDialog.moveButton.click(); expect(await page.getSnackBarMessage()).toContain('Moved 1 item'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(true, 'Item is not in the list'); expect(await dataTable.getItemLocationTooltip(xlsxFavorites)).toContain(destination, 'Item was not moved'); await page.clickPersonalFilesAndWait(); @@ -934,7 +934,7 @@ describe('Viewer actions', () => { expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); await toolbar.clickMoreActionsRemoveFavorite(); - await viewer.clickClose(); + await viewer.closeButton.click(); await page.clickFavoritesAndWait(); expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite'); expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(false, 'Item is still present in Favorites list'); @@ -979,9 +979,9 @@ describe('Viewer actions', () => { await Utils.uploadFileNewVersion(docxFile2); await page.waitForDialog(); - await uploadNewVersionDialog.clickMajor(); + await uploadNewVersionDialog.majorOption.click(); await uploadNewVersionDialog.enterDescription('new major version description'); - await uploadNewVersionDialog.clickUpload(); + await uploadNewVersionDialog.uploadButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open'); expect(await viewer.getFileTitle()).toContain(docxFile2); @@ -993,7 +993,7 @@ describe('Viewer actions', () => { await dataTable.doubleClickOnRowByName(docxFavorites); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await toolbar.clickShare(); + await toolbar.shareButton.click(); expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open'); await shareDialog.clickClose(); }); diff --git a/e2e/suites/viewer/viewer-general.test.ts b/e2e/suites/viewer/viewer-general.test.ts index e1ceb5913..180fb483a 100755 --- a/e2e/suites/viewer/viewer-general.test.ts +++ b/e2e/suites/viewer/viewer-general.test.ts @@ -103,7 +103,7 @@ describe('Viewer general', () => { it('[C279270] Viewer opens when clicking the View action for a file', async () => { await dataTable.selectItem(xlsxFile); - await page.toolbar.clickView(); + await page.toolbar.viewButton.click(); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); }); @@ -118,7 +118,7 @@ describe('Viewer general', () => { it('[C279271] Close the viewer', async () => { await dataTable.doubleClickOnRowByName(xlsxFile); expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened'); - await viewer.clickClose(); + await viewer.closeButton.click(); expect(await viewer.isViewerOpened()).toBe(false, 'Viewer did not close'); }); diff --git a/e2e/suites/viewer/viewer-protected-file.test.ts b/e2e/suites/viewer/viewer-protected-file.test.ts index b8a62f81c..1fdbc4d93 100755 --- a/e2e/suites/viewer/viewer-protected-file.test.ts +++ b/e2e/suites/viewer/viewer-protected-file.test.ts @@ -87,7 +87,7 @@ describe('Viewer - password protected file', () => { await passwordDialog.enterPassword(protectedFile.password); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); - await passwordDialog.clickSubmit(); + await passwordDialog.submitButton.click(); await passwordDialog.waitForDialogToClose(); expect(await viewer.isPdfViewerContentDisplayed()).toBe(true, 'file content not displayed'); @@ -96,7 +96,7 @@ describe('Viewer - password protected file', () => { it('[C268960] Error appears when entering an incorrect password', async () => { await passwordDialog.enterPassword('incorrect'); expect(await passwordDialog.isSubmitEnabled()).toBe(true, 'Submit button not enabled'); - await passwordDialog.clickSubmit(); + await passwordDialog.submitButton.click(); expect(await passwordDialog.getErrorMessage()).toBe('Password is wrong'); expect(await viewer.isPdfViewerContentDisplayed()).toBe(false, 'file content is displayed'); diff --git a/e2e/utilities/utils.ts b/e2e/utilities/utils.ts index 5d37b35e8..c68f5cfa5 100755 --- a/e2e/utilities/utils.ts +++ b/e2e/utilities/utils.ts @@ -23,14 +23,87 @@ * along with Alfresco. If not, see . */ -import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging } from 'protractor'; +import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging, until } from 'protractor'; import { Logger } from '@alfresco/adf-testing'; -import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs'; +import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH } from '../configs'; const path = require('path'); const fs = require('fs'); const StreamZip = require('node-stream-zip'); +export async function typeText(element: ElementFinder, text: string) { + await element.clear(); + await element.sendKeys(text); +} + +export async function clearTextWithBackspace(element: ElementFinder) { + await element.clear(); + await element.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE); +} + +export async function waitElement(css: string, errorMessage?: string): Promise { + return browser.wait( + until.elementLocated(by.css(css)), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting for element' + ); +} + +export async function waitForClickable( + element: ElementFinder, + errorMessage?: string +): Promise { + return browser.wait( + EC.elementToBeClickable(element), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting for element to be clickable' + ); +} + +export async function waitForVisibility( + element: ElementFinder, + errorMessage?: string +): Promise { + return browser.wait( + EC.visibilityOf(element), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting for element visibility' + ); +} + +export async function waitForInvisibility( + element: ElementFinder, + errorMessage?: string +): Promise { + return browser.wait( + EC.invisibilityOf(element), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting for element visibility' + ); +} + +export async function waitForPresence( + element: ElementFinder, + errorMessage?: string +): Promise { + return browser.wait( + EC.presenceOf(element), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting for element presence' + ); +} + +export async function waitForStaleness( + element: ElementFinder, + errorMessage?: string +): Promise { + return browser.wait( + EC.stalenessOf(element), + BROWSER_WAIT_TIMEOUT, + errorMessage || 'Timeout waiting element staleness' + ); +} + export const isPresentAndEnabled = async (element: ElementFinder): Promise => { const isPresent = await element.isPresent(); @@ -60,25 +133,14 @@ export class Utils { extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \ lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative live'; - // generate a random value static random(): string { return Math.random().toString(36).substring(5, 10).toLowerCase(); } - // local storage static async clearLocalStorage(): Promise { await browser.executeScript('window.localStorage.clear();'); } - // session storage - static async clearSessionStorage(): Promise { - await browser.executeScript('window.sessionStorage.clear();'); - } - - static async getSessionStorage(): Promise { - return browser.executeScript('return window.sessionStorage.getItem("app.extension.config");'); - } - static async setSessionStorageFromConfig(configFileName: string): Promise { const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`; const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' })); @@ -86,12 +148,6 @@ export class Utils { await browser.executeScript(`window.sessionStorage.setItem('app.extension.config', ${fileContent});`); } - static async resetExtensionConfig(): Promise { - const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`; - - await this.setSessionStorageFromConfig(defConfig); - } - static retryCall(fn: () => Promise, retry: number = 30, delay: number = 1000): Promise { const pause = duration => new Promise(res => setTimeout(res, duration)); @@ -102,18 +158,6 @@ export class Utils { return run(retry); } - static async waitUntilElementClickable(element: ElementFinder): Promise { - await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error); - } - - static async typeInField(elem: ElementFinder, value: string): Promise { - for (let i = 0; i < value.length; i++) { - const c = value.charAt(i); - await elem.sendKeys(c); - await browser.sleep(100); - } - } - static async clearFieldWithBackspace(elem: ElementFinder): Promise { const text = await elem.getAttribute('value'); for (let i = 0; i < text.length; i++) {