[ACA-1766] disable selenium_promise_manager (#1061)

* disable selenium_promise_manager and fix some methods

* some more changes
This commit is contained in:
Adina Parpalita
2019-04-09 22:06:59 +03:00
committed by Denys Vuika
parent f051f01279
commit 7df8d8a4ae
11 changed files with 82 additions and 71 deletions

View File

@@ -278,12 +278,14 @@ export class DataTable extends Component {
async rightClickOnItem(itemName: string) {
const item = this.getRowFirstCell(itemName);
await browser.actions().click(item, protractor.Button.RIGHT).perform();
await browser.actions().mouseMove(item).perform();
await browser.actions().click(protractor.Button.RIGHT).perform();
}
async rightClickOnMultipleSelection() {
const itemFromSelection = this.getSelectedRows().get(0);
await browser.actions().click(itemFromSelection, protractor.Button.RIGHT).perform();
await browser.actions().mouseMove(itemFromSelection).perform();
await browser.actions().click(protractor.Button.RIGHT).perform();
}
getItemLocationEl(name: string) {

View File

@@ -82,16 +82,17 @@ export class Menu extends Component {
}
async waitForMenuToOpen() {
await browser.wait(EC.presenceOf(browser.element(by.css('.mat-menu-panel'))), BROWSER_WAIT_TIMEOUT);
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);
}
async waitForMenuToClose() {
await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.not(EC.presenceOf(browser.element(by.css('.cdk-overlay-container .mat-menu-panel')))), BROWSER_WAIT_TIMEOUT);
}
async closeMenu() {
return Utils.pressEscape();
await Utils.pressEscape();
await this.waitForMenuToClose();
}
getNthItem(nth: number) {
@@ -127,16 +128,21 @@ export class Menu extends Component {
}
async clickNthItem(nth: number) {
const elem = this.getNthItem(nth);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await browser.actions().mouseMove(elem).click().perform();
await this.waitForMenuToClose();
try {
const elem = this.getNthItem(nth);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable');
await browser.actions().mouseMove(elem).perform();
await browser.actions().click().perform();
await this.waitForMenuToClose();
} catch (e) {
console.log('____ click nth menu item catch ___', e);
}
}
async clickMenuItem(menuItem: string) {
try {
const elem = this.getItemByLabel(menuItem);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT, 'timeout waiting for menu item to be clickable');
await elem.click();
} catch (e) {
console.log('___click menu item catch___', e);

View File

@@ -23,10 +23,11 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { ElementFinder, by } from 'protractor';
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Menu } from '../menu/menu';
import { Component } from '../component';
import { browser } from 'protractor';
export class Pagination extends Component {
private static selectors = {
root: 'adf-pagination',
@@ -59,27 +60,45 @@ export class Pagination extends Component {
async openMaxItemsMenu() {
const { menu, maxItemsButton } = this;
await maxItemsButton.click();
await menu.waitForMenuToOpen();
try {
await browser.wait(EC.elementToBeClickable(maxItemsButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for maxItemsButton to be clickable');
await maxItemsButton.click();
await menu.waitForMenuToOpen();
} catch (error) {
console.log('____ open max items catch ___', error);
}
}
async openCurrentPageMenu() {
const { menu, pagesButton } = this;
await pagesButton.click();
await menu.waitForMenuToOpen();
try {
await browser.wait(EC.elementToBeClickable(pagesButton), BROWSER_WAIT_TIMEOUT, 'timeout waiting for pagesButton to be clickable');
await pagesButton.click();
await menu.waitForMenuToOpen();
} catch (error) {
console.log('____ open current page menu ___', error);
}
}
async resetToDefaultPageSize() {
await this.openMaxItemsMenu();
await this.menu.clickMenuItem('25');
await this.menu.waitForMenuToClose();
try {
await this.openMaxItemsMenu();
await this.menu.clickNthItem(1);
await this.menu.waitForMenuToClose();
} catch (error) {
console.log('___ reset to default page size catch ___', error);
}
}
async resetToDefaultPageNumber() {
await this.openCurrentPageMenu();
await this.menu.clickMenuItem('1');
await this.menu.waitForMenuToClose();
try {
await this.openCurrentPageMenu();
await this.menu.clickNthItem(1);
await this.menu.waitForMenuToClose();
} catch (error) {
console.log('____ reset to default page number catch ___', error);
}
}
async clickNext() {

View File

@@ -83,11 +83,9 @@ describe('Pagination on multiple pages on Favorites', () => {
it('Items per page values - [C280114]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});

View File

@@ -78,11 +78,9 @@ describe('Pagination on multiple pages', () => {
it('Items per page values - [C280087]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});
@@ -181,11 +179,9 @@ describe('Pagination on multiple pages', () => {
it('Items per page values - [C291876]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});

View File

@@ -55,6 +55,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
await dataTable.waitForHeader();
done();
});
@@ -79,11 +80,9 @@ describe('Pagination on multiple pages on Personal Files', () => {
it('Items per page values - [C280078]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});
@@ -93,7 +92,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
expect(await pagination.getMaxItems()).toContain('25');
expect(await pagination.getTotalPages()).toContain('of 5');
await pagination.openCurrentPageMenu();
expect(pagination.menu.getItemsCount()).toBe(5);
expect(await pagination.menu.getItemsCount()).toBe(5);
await pagination.menu.closeMenu();
await pagination.openMaxItemsMenu();
@@ -101,7 +100,7 @@ describe('Pagination on multiple pages on Personal Files', () => {
expect(await pagination.getMaxItems()).toContain('50');
expect(await pagination.getTotalPages()).toContain('of 3');
await pagination.openCurrentPageMenu();
expect(pagination.menu.getItemsCount()).toBe(3);
expect(await pagination.menu.getItemsCount()).toBe(3);
await pagination.menu.closeMenu();
await pagination.openMaxItemsMenu();

View File

@@ -79,11 +79,9 @@ describe('Pagination on multiple pages on Recent Files', () => {
it('Items per page values - [C280105]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});
@@ -140,8 +138,8 @@ describe('Pagination on multiple pages on Recent Files', () => {
await dataTable.waitForHeader();
await pagination.clickPrevious();
await dataTable.waitForHeader();
expect(pagination.getRange()).toContain('1-25 of 101');
expect(dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page');
expect(await pagination.getRange()).toContain('1-25 of 101');
expect(await dataTable.isItemPresent('file-88')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber();
});

View File

@@ -81,11 +81,9 @@ describe('Pagination on multiple pages on Search Results', () => {
it('Items per page values - [C290126]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});
@@ -140,7 +138,7 @@ describe('Pagination on multiple pages on Search Results', () => {
await dataTable.waitForBody();
await pagination.clickPrevious();
await dataTable.waitForBody();
expect(pagination.getRange()).toContain('1-25 of 101');
expect(await pagination.getRange()).toContain('1-25 of 101');
await pagination.resetToDefaultPageNumber();
});

View File

@@ -82,12 +82,9 @@ describe('Pagination on multiple pages on Shared Files', () => {
it('Items per page values - [C280096]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});

View File

@@ -78,11 +78,9 @@ describe('Pagination on multiple pages on Trash', () => {
it('Items per page values - [C280123]', async () => {
await pagination.openMaxItemsMenu();
const [ first, second, third ] = [1, 2, 3]
.map(async nth => await pagination.menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
expect(await pagination.menu.getNthItem(1).getText()).toBe('25');
expect(await pagination.menu.getNthItem(2).getText()).toBe('50');
expect(await pagination.menu.getNthItem(3).getText()).toBe('100');
await pagination.menu.closeMenu();
});
@@ -130,8 +128,8 @@ describe('Pagination on multiple pages on Trash', () => {
it('navigate to next and previous pages - [C280128]', async () => {
await pagination.clickNext();
await dataTable.waitForHeader();
expect(pagination.getRange()).toContain('26-50 of 101');
expect(dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page');
expect(await pagination.getRange()).toContain('26-50 of 101');
expect(await dataTable.isItemPresent('file-70')).toBe(true, 'File not found on page');
await pagination.resetToDefaultPageNumber();
await pagination.openCurrentPageMenu();

View File

@@ -49,7 +49,7 @@ exports.config = {
'./e2e/suites/extensions/*.test.ts'
],
SELENIUM_PROMISE_MANAGER: true,
SELENIUM_PROMISE_MANAGER: false,
capabilities: {
browserName: 'chrome',