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
@@ -30,11 +30,8 @@ const fs = require('fs');
|
||||
|
||||
export class Utils {
|
||||
// generate a random value
|
||||
static random(): string {
|
||||
return Math.random()
|
||||
.toString(36)
|
||||
.substring(5, 10)
|
||||
.toLowerCase();
|
||||
static random() {
|
||||
return Math.random().toString(36).substring(5, 10).toLowerCase();
|
||||
}
|
||||
|
||||
// local storage
|
||||
@@ -51,17 +48,17 @@ export class Utils {
|
||||
return browser.executeScript('return window.sessionStorage.getItem("aca.extension.config");');
|
||||
}
|
||||
|
||||
static async setSessionStorageFromConfig(key: string, configFileName: string) {
|
||||
static setSessionStorageFromConfig(key: string, configFileName: string) {
|
||||
const configFile = `${E2E_ROOT_PATH}/resources/extensibility-configs/${configFileName}`;
|
||||
const fileContent = JSON.stringify(fs.readFileSync(configFile, { encoding: 'utf8' }));
|
||||
|
||||
return await browser.executeScript(`window.sessionStorage.setItem(${key}, ${fileContent});`);
|
||||
return browser.executeScript(`window.sessionStorage.setItem(${key}, ${fileContent});`);
|
||||
}
|
||||
|
||||
static async resetExtensionConfig() {
|
||||
static resetExtensionConfig() {
|
||||
const defConfig = `${E2E_ROOT_PATH}/resources/extensibility-configs/${EXTENSIBILITY_CONFIGS.DEFAULT_EXTENSIONS_CONFIG}`;
|
||||
|
||||
return await this.setSessionStorageFromConfig('"aca.extension.config"', defConfig);
|
||||
return this.setSessionStorageFromConfig('"aca.extension.config"', defConfig);
|
||||
}
|
||||
|
||||
static retryCall(fn: () => Promise<any>, retry: number = 30, delay: number = 1000): Promise<any> {
|
||||
@@ -72,20 +69,23 @@ export class Utils {
|
||||
return run(retry);
|
||||
}
|
||||
|
||||
static waitUntilElementClickable(element: ElementFinder) {
|
||||
return browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT);
|
||||
static async waitUntilElementClickable(element: ElementFinder) {
|
||||
return await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
|
||||
// static waitUntilElementClickable(element: ElementFinder) {
|
||||
// return browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT);
|
||||
}
|
||||
|
||||
static typeInField(elem: ElementFinder, value: string) {
|
||||
static async typeInField(elem: ElementFinder, value: string) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const c = value.charAt(i);
|
||||
elem.sendKeys(c);
|
||||
browser.sleep(100);
|
||||
await elem.sendKeys(c);
|
||||
await browser.sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
static async fileExistsOnOS(fileName: string) {
|
||||
const filePath = path.join((await browser.getProcessedConfig()).params.downloadFolder, fileName);
|
||||
const config = await browser.getProcessedConfig();
|
||||
const filePath = path.join(config.params.downloadFolder, fileName);
|
||||
|
||||
let tries = 5;
|
||||
|
||||
@@ -108,17 +108,11 @@ export class Utils {
|
||||
});
|
||||
}
|
||||
|
||||
static async pressEscape() {
|
||||
return await browser
|
||||
.actions()
|
||||
.sendKeys(protractor.Key.ESCAPE)
|
||||
.perform();
|
||||
static pressEscape() {
|
||||
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||
}
|
||||
|
||||
static async getBrowserLog() {
|
||||
return await browser
|
||||
.manage()
|
||||
.logs()
|
||||
.get('browser');
|
||||
static getBrowserLog() {
|
||||
return browser.manage().logs().get('browser');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user