Unexclude due the timeout (#1805)

* change base method to wait

* fix import

* reduce log

* fix

* data placeholder

* fix

* fix

* fix

* fix style

* change visibility with common method

* fix

* use common get value method

* remove unused import

* fix a few incorrect api calls

* - use separate variables

* correctly wait for items after they have been created

* use browseraction click

* Exclude failing tests

* increase timeout and some fix

* check env before execute test

* simplify conf

* exclude

* rerun

* logs

* refactor pagination tests to use only 51 items
take out pagination tests into a separate stage

* fix check

* remove hardcoded total items. other shared files might already exist

Co-authored-by: Adina Parpalita <Adina.Parpalita@ness.com>
Co-authored-by: iuliaib <iulia.burca@ness.com>
This commit is contained in:
Eugenio Romano
2020-11-19 16:07:57 +00:00
committed by GitHub
parent 509c6b6f75
commit 8308573f3c
82 changed files with 815 additions and 750 deletions

View File

@@ -24,7 +24,7 @@
*/
import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging, until, WebElement } from 'protractor';
import { Logger } from '@alfresco/adf-testing';
import { BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { BROWSER_WAIT_TIMEOUT } from '../configs';
import * as path from 'path';
import * as fs from 'fs';
@@ -45,26 +45,6 @@ export async function waitElement(css: string, errorMessage?: string): Promise<W
return browser.wait(until.elementLocated(by.css(css)), BROWSER_WAIT_TIMEOUT, errorMessage || `Timeout waiting for element: ${css}`);
}
export async function waitForClickable(element: ElementFinder, errorMessage?: string): Promise<void> {
await browser.wait(
EC.elementToBeClickable(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || `Timeout waiting for element to be clickable: ${element.locator()}`
);
}
export async function waitForVisibility(element: ElementFinder, errorMessage?: string): Promise<void> {
await browser.wait(EC.visibilityOf(element), BROWSER_WAIT_TIMEOUT, errorMessage || `Timeout waiting for element visibility: ${element.locator()}`);
}
export async function waitForInvisibility(element: ElementFinder, errorMessage?: string): Promise<void> {
await browser.wait(
EC.invisibilityOf(element),
BROWSER_WAIT_TIMEOUT,
errorMessage || `Timeout waiting for element visibility: ${element.locator()}`
);
}
export async function waitForPresence(element: ElementFinder, errorMessage?: string): Promise<void> {
await browser.wait(EC.presenceOf(element), BROWSER_WAIT_TIMEOUT, errorMessage || `Timeout waiting for element presence: ${element.locator()}`);
}
@@ -74,23 +54,21 @@ export async function waitForStaleness(element: ElementFinder, errorMessage?: st
}
export const isPresentAndEnabled = async (element: ElementFinder): Promise<boolean> => {
const isPresent = await element.isPresent();
if (isPresent) {
try {
await BrowserVisibility.waitUntilElementIsPresent(element);
return element.isEnabled();
} catch (error) {
return false;
}
return false;
};
export const isPresentAndDisplayed = async (element: ElementFinder): Promise<boolean> => {
const isPresent = await element.isPresent();
if (isPresent) {
return element.isDisplayed();
try {
await BrowserVisibility.waitUntilElementIsVisible(element);
return true;
} catch (error) {
return false;
}
return false;
};
export class Utils {
@@ -129,13 +107,6 @@ export class Utils {
return run(retry);
}
static async clearFieldWithBackspace(elem: ElementFinder): Promise<void> {
const text = await elem.getAttribute('value');
for (let i = 0; i < text.length; i++) {
await elem.sendKeys(protractor.Key.BACK_SPACE);
}
}
static async fileExistsOnOS(fileName: string, folderName: string = '', subFolderName: string = ''): Promise<any> {
const config = await browser.getProcessedConfig();
const filePath = path.join(config.params.downloadFolder, folderName, subFolderName, fileName);