mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1628] async await (#693)
* async / await on login component and utils * more async / awaits * remove fdescribe * expect for exact totalItems in waitForApi methods other async / awaits * pagination tests * more tries * disable selenium promise manager * try to fix shared-links tests * re-enable selenium_promise_manager and some more fixes * add target es2017 to e2e * set target to es2017 on tsconfig.spec.json * other tries * forgotten console.log * disable pagination tests * some fixes for pagination * temporary fix viewer actions tests * fix some actions tests * fix some tests for actions * fix some tests for undo action * try to fix some more tests * fixes for toolbar actions * fix NoSuchElementError for openMoreMenu * fix NoSuchElementError for rightClickOnMultipleSelection * fixes for mark as favourite * more fixes * more fixes * change order of some expects * forgot describe
This commit is contained in:
committed by
Denys Vuika
parent
0d4795bfa8
commit
7d73ae309c
@@ -23,76 +23,76 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ElementFinder, promise, by } from 'protractor';
|
||||
import { ElementFinder, by } from 'protractor';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
|
||||
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',
|
||||
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]'
|
||||
};
|
||||
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: 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));
|
||||
|
||||
menu: Menu = new Menu();
|
||||
menu: Menu = new Menu();
|
||||
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Pagination.selectors.root, ancestor);
|
||||
}
|
||||
constructor(ancestor?: ElementFinder) {
|
||||
super(Pagination.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
openMaxItemsMenu(): promise.Promise<Menu> {
|
||||
const { menu, maxItemsButton } = this;
|
||||
async openMaxItemsMenu() {
|
||||
const { menu, maxItemsButton } = this;
|
||||
|
||||
return maxItemsButton.click()
|
||||
.then(() => menu.waitForMenuToOpen())
|
||||
.then(() => menu);
|
||||
}
|
||||
await maxItemsButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
// return menu;
|
||||
}
|
||||
|
||||
openCurrentPageMenu(): promise.Promise<Menu> {
|
||||
const { menu, pagesButton } = this;
|
||||
async openCurrentPageMenu() {
|
||||
const { menu, pagesButton } = this;
|
||||
|
||||
return pagesButton.click()
|
||||
.then(() => menu.waitForMenuToOpen())
|
||||
.then(() => menu);
|
||||
}
|
||||
await pagesButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
// return menu;
|
||||
}
|
||||
|
||||
getText(elem: ElementFinder) {
|
||||
return elem.getText();
|
||||
}
|
||||
async getText(elem: ElementFinder) {
|
||||
return await elem.getText();
|
||||
}
|
||||
|
||||
resetToDefaultPageSize(): promise.Promise<any> {
|
||||
return this.openMaxItemsMenu()
|
||||
.then(menu => menu.clickMenuItem('25'))
|
||||
.then(() => this.menu.waitForMenuToClose());
|
||||
}
|
||||
async resetToDefaultPageSize() {
|
||||
await this.openMaxItemsMenu();
|
||||
await this.menu.clickMenuItem('25');
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
resetToDefaultPageNumber(): promise.Promise<any> {
|
||||
return this.openCurrentPageMenu()
|
||||
.then(menu => menu.clickMenuItem('1'))
|
||||
.then(() => this.menu.waitForMenuToClose());
|
||||
}
|
||||
async resetToDefaultPageNumber() {
|
||||
await this.openCurrentPageMenu();
|
||||
await this.menu.clickMenuItem('1');
|
||||
await this.menu.waitForMenuToClose();
|
||||
}
|
||||
|
||||
clickNext(): promise.Promise<any> {
|
||||
return this.nextButton.click();
|
||||
}
|
||||
async clickNext() {
|
||||
await this.nextButton.click();
|
||||
}
|
||||
|
||||
clickPrevious(): promise.Promise<any> {
|
||||
return this.previousButton.click();
|
||||
}
|
||||
async clickPrevious() {
|
||||
await this.previousButton.click();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user