mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
use Logger instead of console (#1417)
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC, protractor } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Menu } from '../menu/menu';
|
||||
@@ -247,7 +248,7 @@ export class DataTable extends Component {
|
||||
await browser.actions().mouseMove(item).perform();
|
||||
await browser.actions().doubleClick().perform();
|
||||
} catch (error) {
|
||||
console.log('--- catch: doubleClickOnRowByName', error);
|
||||
Logger.error('--- catch: doubleClickOnRowByName', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +260,7 @@ export class DataTable extends Component {
|
||||
await item.click();
|
||||
|
||||
} catch (e) {
|
||||
console.log('--- select item catch : ', e);
|
||||
Logger.error('--- select item catch : ', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +273,7 @@ export class DataTable extends Component {
|
||||
await item.click();
|
||||
|
||||
} catch (e) {
|
||||
console.log('--- unselect item catch : ', e);
|
||||
Logger.error('--- unselect item catch : ', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,7 +304,7 @@ export class DataTable extends Component {
|
||||
await this.wait();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('------ clearSelection catch : ', error);
|
||||
Logger.error('------ clearSelection catch : ', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
|
||||
@@ -192,7 +193,7 @@ export class LibraryMetadata extends Component {
|
||||
} else if (val === 'moderated') {
|
||||
await this.visibilityModerated.click();
|
||||
} else {
|
||||
console.log('----- invalid visibility', val);
|
||||
Logger.error('----- invalid visibility', val);
|
||||
}
|
||||
|
||||
await this.waitForVisibilityDropDownToClose();
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { CommentsTab } from './info-drawer-comments-tab';
|
||||
@@ -145,7 +146,7 @@ export class InfoDrawer extends Component {
|
||||
browser.wait(EC.invisibilityOf(this.propertiesTab.component), BROWSER_WAIT_TIMEOUT)
|
||||
]);
|
||||
} catch (error) {
|
||||
console.error('--- info-drawer clickCommentsTab catch error: ', error);
|
||||
Logger.error('--- info-drawer clickCommentsTab catch error: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Component } from '../component';
|
||||
import { Utils } from '../../utilities/utils'
|
||||
@@ -175,7 +176,7 @@ export class Menu extends Component {
|
||||
await browser.actions().click().perform();
|
||||
await this.waitForMenuToClose();
|
||||
} catch (e) {
|
||||
console.log('____ click nth menu item catch ___', e);
|
||||
Logger.error('____ click nth menu item catch ___', e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +186,7 @@ export class Menu extends Component {
|
||||
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);
|
||||
Logger.error('___click menu item catch___', e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +197,7 @@ export class Menu extends Component {
|
||||
await browser.actions().mouseMove(elem).perform();
|
||||
await browser.sleep(500);
|
||||
} catch (error) {
|
||||
console.log('----- mouse over error: ', error);
|
||||
Logger.error('----- mouse over error: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ export class Menu extends Component {
|
||||
const elemClass = await elem.getAttribute('class');
|
||||
return elemClass.includes('mat-menu-item-submenu-trigger');
|
||||
} catch (error) {
|
||||
console.log('---- has submenu error: ', error);
|
||||
Logger.error('---- has submenu error: ', error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -218,7 +219,7 @@ export class Menu extends Component {
|
||||
await browser.wait(EC.elementToBeClickable(elem), BROWSER_WAIT_TIMEOUT);
|
||||
await elem.click();
|
||||
} catch (e) {
|
||||
console.log('___click submenu item catch___', e);
|
||||
Logger.error('___click submenu item catch___', e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +241,7 @@ export class Menu extends Component {
|
||||
const disabled = await item.getAttribute('disabled');
|
||||
return disabled;
|
||||
} catch (error) {
|
||||
console.log('----- isMenuItemDisabled catch: ', error);
|
||||
Logger.error('----- isMenuItemDisabled catch: ', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
@@ -65,7 +66,7 @@ export class Pagination extends Component {
|
||||
await maxItemsButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
} catch (error) {
|
||||
console.log('____ open max items catch ___', error);
|
||||
Logger.error('____ open max items catch ___', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ export class Pagination extends Component {
|
||||
await pagesButton.click();
|
||||
await menu.waitForMenuToOpen();
|
||||
} catch (error) {
|
||||
console.log('____ open current page menu ___', error);
|
||||
Logger.error('____ open current page menu ___', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +88,7 @@ export class Pagination extends Component {
|
||||
await this.menu.clickNthItem(1);
|
||||
await this.menu.waitForMenuToClose();
|
||||
} catch (error) {
|
||||
console.log('___ reset to default page size catch ___', error);
|
||||
Logger.error('___ reset to default page size catch ___', error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +98,7 @@ export class Pagination extends Component {
|
||||
await this.menu.clickNthItem(1);
|
||||
await this.menu.waitForMenuToClose();
|
||||
} catch (error) {
|
||||
console.log('____ reset to default page number catch ___', error);
|
||||
Logger.error('____ reset to default page number catch ___', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, ElementArrayFinder, by, element, browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Menu } from '../menu/menu';
|
||||
import { Component } from '../component';
|
||||
@@ -86,7 +87,7 @@ export class Sidenav extends Component {
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log('---- sidebar navigation catch expandMenu: ', e);
|
||||
Logger.error('---- sidebar navigation catch expandMenu: ', e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +163,7 @@ export class Sidenav extends Component {
|
||||
await Utils.waitUntilElementClickable(link);
|
||||
await link.click();
|
||||
} catch (error) {
|
||||
console.log('---- sidebar navigation clickLink catch error: ', error);
|
||||
Logger.error('---- sidebar navigation clickLink catch error: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { ElementFinder, by, browser, ExpectedConditions as EC, ElementArrayFinder } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Component } from '../component';
|
||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||
import { Toolbar } from '../toolbar/toolbar';
|
||||
@@ -61,7 +62,7 @@ export class Viewer extends Component {
|
||||
await browser.wait(EC.presenceOf(this.viewerContainer), BROWSER_WAIT_TIMEOUT);
|
||||
await browser.wait(EC.presenceOf(this.viewerLayout), BROWSER_WAIT_TIMEOUT);
|
||||
} catch (error) {
|
||||
console.log('\n-----> catch waitForViewerToOpen <-----\n', error)
|
||||
Logger.error('\n-----> catch waitForViewerToOpen <-----\n', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { browser, by, ElementFinder, ExpectedConditions as EC, until } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT, USE_HASH_STRATEGY } from './../configs';
|
||||
import { Utils } from '../utilities/utils';
|
||||
|
||||
@@ -108,7 +109,7 @@ export abstract class Page {
|
||||
const action = await browser.wait(until.elementLocated(by.css('.mat-simple-snackbar-action button')), BROWSER_WAIT_TIMEOUT, '------- timeout waiting for snack action to appear');
|
||||
await action.click();
|
||||
} catch (e) {
|
||||
console.log(e, '.......failed on click snack bar action.........');
|
||||
Logger.error(e, '.......failed on click snack bar action.........');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +121,6 @@ export abstract class Page {
|
||||
return this.genericErrorTitle.getText();
|
||||
}
|
||||
|
||||
|
||||
async isUndoActionPresent() {
|
||||
const message = await this.snackBar.getAttribute('innerText');
|
||||
return message.includes('Undo');
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BrowsingPage, LoginPage } from '../../pages/pages';
|
||||
import { CreateOrEditFolderDialog } from '../../components/dialog/create-edit-folder-dialog';
|
||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
@@ -67,7 +68,7 @@ describe('General', () => {
|
||||
try {
|
||||
await createDialog.waitForDialogToClose();
|
||||
} catch (error) {
|
||||
console.log('err: ', error);
|
||||
Logger.error('err: ', error);
|
||||
}
|
||||
expect(await createDialog.isDialogOpen()).not.toBe(true, 'dialog is present');
|
||||
});
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { RepoClient } from './../../repo-client';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { FavoritesApi as AdfFavoritesApi, SitesApi as AdfSiteApi, FavoriteEntry } from '@alfresco/js-api';
|
||||
@@ -166,8 +167,8 @@ export class FavoritesApi extends RepoApi {
|
||||
};
|
||||
return await Utils.retryCall(favoriteFiles);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { QueriesApi as AdfQueriesApi } from '@alfresco/js-api';
|
||||
|
||||
@@ -77,8 +78,8 @@ export class QueriesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForSites.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForSites.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +96,8 @@ export class QueriesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForFilesAndFolders.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForFilesAndFolders.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,7 @@
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { AlfrescoApi } from '@alfresco/js-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
|
||||
export abstract class RepoApi {
|
||||
alfrescoJsApi = new AlfrescoApi();
|
||||
@@ -36,30 +37,28 @@ export abstract class RepoApi {
|
||||
this.alfrescoJsApi.setConfig(browser.params.config);
|
||||
}
|
||||
|
||||
apiAuth() {
|
||||
apiAuth(): Promise<any> {
|
||||
return this.alfrescoJsApi.login(this.username, this.password);
|
||||
}
|
||||
|
||||
getUsername() {
|
||||
getUsername(): string {
|
||||
return this.username;
|
||||
}
|
||||
|
||||
protected handleError(message: string, response: any) {
|
||||
console.log(`\n--- ${message} error :`);
|
||||
console.log('\t>>> username: ', this.username);
|
||||
console.log('\t>>> JSON: ', JSON.stringify(browser.params.config));
|
||||
Logger.error(`\n--- ${message} error :`);
|
||||
Logger.error('\t>>> username: ', this.username);
|
||||
Logger.error('\t>>> JSON: ', JSON.stringify(browser.params.config));
|
||||
if ( response.status && response.response ) {
|
||||
try {
|
||||
console.log('\t>>> Status: ', response.status);
|
||||
console.log('\t>>> Text: ', response.response.text);
|
||||
console.log('\t>>> Method: ', response.response.error.method);
|
||||
console.log('\t>>> Path: ', response.response.error.path);
|
||||
Logger.error('\t>>> Status: ', response.status);
|
||||
Logger.error('\t>>> Text: ', response.response.text);
|
||||
Logger.error('\t>>> Method: ', response.response.error.method);
|
||||
Logger.error('\t>>> Path: ', response.response.error.path);
|
||||
} catch {
|
||||
console.log('\t>>> ', response);
|
||||
Logger.error('\t>>> ', response);
|
||||
}
|
||||
}
|
||||
else console.log('\t>>> ', response);
|
||||
|
||||
else Logger.error('\t>>> ', response);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { SearchApi as AdfSearchApi } from '@alfresco/js-api';
|
||||
|
||||
@@ -109,8 +110,8 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(recentFiles);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,8 +128,8 @@ export class SearchApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(nodes);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForNodes.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForNodes.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { SharedlinksApi as AdfSharedlinksApi, SharedLinkEntry } from '@alfresco/js-api';
|
||||
|
||||
@@ -102,8 +103,8 @@ export class SharedLinksApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sharedFiles);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { SiteBody, SiteMemberRoleBody, SiteMemberBody, SiteEntry, SiteMembershipRequestEntry, SitesApi as AdfSiteApi, SiteMemberEntry } from '@alfresco/js-api';
|
||||
import { SITE_VISIBILITY, SITE_ROLES } from '../../../../configs';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
@@ -260,8 +261,8 @@ export class SitesApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,13 +24,14 @@
|
||||
*/
|
||||
|
||||
import { RepoApi } from '../repo-api';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { Utils } from '../../../../utilities/utils';
|
||||
import { TrashcanApi as AdfTrashcanApi} from '@alfresco/js-api';
|
||||
|
||||
export class TrashcanApi extends RepoApi {
|
||||
trashcanApi = new AdfTrashcanApi(this.alfrescoJsApi);
|
||||
|
||||
constructor(username?, password?) {
|
||||
constructor(username?: string, password?: string) {
|
||||
super(username, password);
|
||||
}
|
||||
|
||||
@@ -92,8 +93,8 @@ export class TrashcanApi extends RepoApi {
|
||||
|
||||
return await Utils.retryCall(deletedFiles);
|
||||
} catch (error) {
|
||||
console.log(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
console.log(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
Logger.error(`${this.constructor.name} ${this.waitForApi.name} catch: `);
|
||||
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,13 +24,13 @@
|
||||
*/
|
||||
|
||||
import { browser, protractor, ElementFinder, ExpectedConditions as EC, by, logging } from 'protractor';
|
||||
import { Logger } from '@alfresco/adf-testing';
|
||||
import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const StreamZip = require('node-stream-zip');
|
||||
|
||||
|
||||
export class Utils {
|
||||
static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \
|
||||
reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation';
|
||||
@@ -136,7 +136,7 @@ export class Utils {
|
||||
if (fileExists) {
|
||||
fs.rename(oldFilePath, newFilePath, function (err) {
|
||||
if (err) {
|
||||
console.log('==== rename err: ', err);
|
||||
Logger.error('==== rename err: ', err);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -152,7 +152,7 @@ export class Utils {
|
||||
storeEntries: true
|
||||
});
|
||||
|
||||
await zip.on('error', err => { console.log('=== unzip err: ', err) });
|
||||
await zip.on('error', err => { Logger.error('=== unzip err: ', err) });
|
||||
|
||||
await zip.on('ready', async () => {
|
||||
if (unzippedName) {
|
||||
|
Reference in New Issue
Block a user