mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
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:
@@ -77,15 +77,19 @@ export class FavoritesApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) {
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise<FavoriteEntry[]> {
|
||||
const favorites: FavoriteEntry[] = [];
|
||||
try {
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
await this.addFavoriteById(nodeType, current);
|
||||
}, Promise.resolve());
|
||||
if (ids && ids.length > 0) {
|
||||
for (const id of ids) {
|
||||
const favorite = await this.addFavoriteById(nodeType, id);
|
||||
favorites.push(favorite);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError(`FavoritesApi addFavoritesByIds : catch : `, error);
|
||||
}
|
||||
return favorites;
|
||||
}
|
||||
|
||||
async getFavorites() {
|
||||
|
@@ -49,15 +49,19 @@ export class SharedLinksApi extends RepoApi {
|
||||
}
|
||||
}
|
||||
|
||||
async shareFilesByIds(ids: string[]) {
|
||||
async shareFilesByIds(ids: string[]): Promise<SharedLinkEntry[]> {
|
||||
const sharedLinks: SharedLinkEntry[] = [];
|
||||
try {
|
||||
return await ids.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return this.shareFileById(current);
|
||||
}, Promise.resolve());
|
||||
if (ids && ids.length > 0) {
|
||||
for (const id of ids) {
|
||||
const sharedLink = await this.shareFileById(id);
|
||||
sharedLinks.push(sharedLink);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError(`SharedLinksApi shareFilesByIds : catch : `, error);
|
||||
}
|
||||
return sharedLinks;
|
||||
}
|
||||
|
||||
async getSharedIdOfNode(name: string): Promise<string> {
|
||||
|
@@ -139,15 +139,19 @@ export class SitesApi extends RepoApi {
|
||||
return this.createSite(title, SITE_VISIBILITY.MODERATED, description, siteId);
|
||||
}
|
||||
|
||||
async createSites(titles: string[], visibility?: string): Promise<any> {
|
||||
async createSites(siteNames: string[], visibility?: string): Promise<SiteEntry[]> {
|
||||
const sites: SiteEntry[] = [];
|
||||
try {
|
||||
return titles.reduce(async (previous: any, current: any) => {
|
||||
await previous;
|
||||
return this.createSite(current, visibility);
|
||||
}, Promise.resolve());
|
||||
if (siteNames && siteNames.length > 0) {
|
||||
for (const siteName of siteNames) {
|
||||
const site = await this.createSite(siteName, visibility);
|
||||
sites.push(site);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
this.handleError(`SitesApi createSites : catch : `, error);
|
||||
}
|
||||
return sites;
|
||||
}
|
||||
|
||||
async createSitesPrivate(siteNames: string[]): Promise<any> {
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user