mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6798] protractor to playwright e2e test suites search results libraries (#3690)
* [ACS-6798] seach results libraries migrated * [ACS-6798] added infoDrawer and search to PW tests in PRs * [ACS-6798] excluded tests + sonar fix * [ACS-6798] sonar fix 2 * [ACS-6798] sonar fix 3 * [ACS-6798] sonar fix 3 * [ACS-6798] login and delete methods added to Utils for sonar cloud duplication code * [ACS-6798] review fixes * Revert "[ci:force][auto-commit] Update dependencies ADF:6.8.0-8186121470 JS:7.7.0-8186121470 (#3693)" This reverts commit 29b1bf99d4ff8734342b94907d6bb2676a407e2e. * Revert "Release 4.4.1 (#3688)" This reverts commit 6dd3ad66d0d96054beb4f70fee5b2b550cc23efc. * [ACS-6798] review fixes pt2 * [ACS-6798] review fixes pt 3 * [ACS-6798] review fixes pt4 * [ACS-6798] review fixes pt4.1
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
const crypto = require('crypto');
|
||||
import { LoginPage } from '../';
|
||||
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
|
||||
|
||||
export class Utils {
|
||||
|
||||
@@ -46,4 +48,43 @@ export class Utils {
|
||||
static formatDate(date: string): string {
|
||||
return new Date(date).toLocaleDateString('en-US');
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to login user with navigation. Also waits for the page to load after login
|
||||
*
|
||||
* @param loginPage page context passed from the test
|
||||
* @param username username string
|
||||
* @param password password string
|
||||
* @param errorMessage error message string if the login fails
|
||||
*
|
||||
*/
|
||||
static async tryLoginUser(loginPage: LoginPage, username: string, password: string, errorMessage = 'Error '): Promise<void> {
|
||||
try {
|
||||
await loginPage.loginUser({ username, password }, { withNavigation: true, waitForLoading: true });
|
||||
} catch (error) {
|
||||
console.error(`${errorMessage}: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to delete nodes and sites from user's account
|
||||
*
|
||||
* @param nodesApi nodesApi initialized with user credentials passed from the test
|
||||
* @param trashcanApi trashcanApi initialized with user credentials passed from the test
|
||||
* @param errorMessage error message string if the deleting sites/nodes fails
|
||||
* @param sitesApi sitesApi initialized with user credentials passed from the test
|
||||
* @param sitesToDelete array of sites' ids
|
||||
*
|
||||
*/
|
||||
static async deleteNodesSitesEmptyTrashcan(nodesApi?: NodesApi, trashcanApi?: TrashcanApi, errorMessage = 'Error ', sitesApi?: SitesApi, sitesToDelete?: string[]): Promise<void> {
|
||||
try {
|
||||
await nodesApi?.deleteCurrentUserNodes();
|
||||
await trashcanApi?.emptyTrashcan();
|
||||
if (sitesToDelete?.length > 0) {
|
||||
await sitesApi?.deleteSites(sitesToDelete);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`${errorMessage}: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user