mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5343] refactor Playwright framework in ACA (#3261)
* [ACS-5343] refactor Playwright framework in ACA * Add the tests for Actions, from the Adam PR [ACS-5328] * Small fixes * Improve logs * [ACS-5343] adding-goThroughPages-and-delete * [ACS-5343] added git changes * [ACS-5343] added git changes for playwright * [ACS-5343] fix for e2e * [ACS-5343] e2e protractor path fix * remove import * [ACS-5343] e2e playwright user fix * [ACS-5343] e2e playwright user ids fix * [ACS-5343] e2e playwright users ids fix * changes for git * fix playwright test run * tsconfig path fix * playwright action yml added * retrigger checks * add test id from testrail * merge conflits * fix gha * fix credentials --------- Co-authored-by: adam.zakrzewski <adam.zakrzewski@hyland.com> Co-authored-by: akash.rathod@hyland.com <akash.rathod@hyland.com> Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
13
projects/aca-playwright-shared/package.json
Normal file
13
projects/aca-playwright-shared/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "aca-playwright-shared",
|
||||
"version": "3.0.0",
|
||||
"license": "LGPL-3.0",
|
||||
"main": "src/index.ts",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Alfresco/alfresco-content-app.git"
|
||||
}
|
||||
}
|
7
projects/aca-playwright-shared/project.json
Normal file
7
projects/aca-playwright-shared/project.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"name": "playwright-shared",
|
||||
"sourceRoot": "projects/aca-playwright-shared/src",
|
||||
"projectType": "library",
|
||||
"prefix": "lib"
|
||||
}
|
138
projects/aca-playwright-shared/src/api/api-client-factory.ts
Normal file
138
projects/aca-playwright-shared/src/api/api-client-factory.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {
|
||||
AdminTenantsApi,
|
||||
AdminUsersApi,
|
||||
AlfrescoApi,
|
||||
ContentClient,
|
||||
GroupsApi,
|
||||
NodesApi,
|
||||
PeopleApi,
|
||||
QueriesApi,
|
||||
SearchApi,
|
||||
SecurityGroupsApi,
|
||||
SecurityMarksApi,
|
||||
SitesApi,
|
||||
UploadApi
|
||||
} from '@alfresco/js-api';
|
||||
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
||||
import { ActionTypes, Rule } from './rules-api';
|
||||
import { users } from '../base-config';
|
||||
|
||||
export interface AcaBackend {
|
||||
sites: SitesApi;
|
||||
upload: UploadApi;
|
||||
nodes: NodesApi;
|
||||
|
||||
tearDown(): Promise<any>;
|
||||
}
|
||||
|
||||
const config = {
|
||||
authType: process.env.APP_CONFIG_AUTH_TYPE,
|
||||
hostBpm: process.env.APP_CONFIG_BPM_HOST,
|
||||
hostEcm: process.env.APP_CONFIG_ECM_HOST,
|
||||
provider: process.env.APP_CONFIG_PROVIDER,
|
||||
contextRoot: 'alfresco'
|
||||
};
|
||||
|
||||
export class ApiClientFactory {
|
||||
public alfrescoApi: AlfrescoApi;
|
||||
public sites: SitesApi;
|
||||
public upload: UploadApi;
|
||||
public nodes: NodesApi;
|
||||
public people: PeopleApi;
|
||||
public adminUsers: AdminUsersApi;
|
||||
public adminTenant: AdminTenantsApi;
|
||||
public groups: GroupsApi;
|
||||
public queries: QueriesApi;
|
||||
public search: SearchApi;
|
||||
public securityGroupsApi: SecurityGroupsApi;
|
||||
public securityMarksApi: SecurityMarksApi;
|
||||
public contentClient: ContentClient;
|
||||
|
||||
constructor() {
|
||||
this.alfrescoApi = new AlfrescoApi(config);
|
||||
}
|
||||
|
||||
public async setUpAcaBackend(userProfile: keyof typeof users): Promise<AcaBackend> {
|
||||
await this.login(userProfile);
|
||||
|
||||
this.sites = new SitesApi(this.alfrescoApi);
|
||||
this.upload = new UploadApi(this.alfrescoApi);
|
||||
this.nodes = new NodesApi(this.alfrescoApi);
|
||||
this.people = new PeopleApi(this.alfrescoApi);
|
||||
this.adminUsers = new AdminUsersApi(this.alfrescoApi);
|
||||
this.adminTenant = new AdminTenantsApi(this.alfrescoApi);
|
||||
this.groups = new GroupsApi(this.alfrescoApi);
|
||||
this.queries = new QueriesApi(this.alfrescoApi);
|
||||
this.search = new SearchApi(this.alfrescoApi);
|
||||
this.securityGroupsApi = new SecurityGroupsApi(this.alfrescoApi);
|
||||
this.securityMarksApi = new SecurityMarksApi(this.alfrescoApi);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
async tearDown(): Promise<ApiClientFactory> {
|
||||
await this.alfrescoApi.logout();
|
||||
return this;
|
||||
}
|
||||
|
||||
private callApi(path: string, httpMethod: string, body: object = {}): Promise<any> {
|
||||
// APIs used by this service are still private and not yet available for public use
|
||||
const params = [{}, {}, {}, {}, body, ['application/json'], ['application/json']];
|
||||
return this.alfrescoApi.contentPrivateClient.callApi(path, httpMethod, ...params);
|
||||
}
|
||||
|
||||
async createRule(nodeId: string, rule: Partial<Rule>, ruleSetId: string = '-default-'): Promise<Rule> {
|
||||
const response = await this.callApi(`/nodes/${nodeId}/rule-sets/${ruleSetId}/rules`, 'POST', { ...rule });
|
||||
return response.entry;
|
||||
}
|
||||
|
||||
async createRandomRule(folderId: string, ruleName: string): Promise<Rule> {
|
||||
const response = await this.createRule(folderId, {
|
||||
name: ruleName,
|
||||
isEnabled: true,
|
||||
actions: [ActionTypes.ADDFEATURES.value, ActionTypes.CHECKIN.value]
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
async login(userProfile: keyof typeof users) {
|
||||
const userToLog =
|
||||
users[
|
||||
Object.keys(users)
|
||||
.filter((user) => user.match(new RegExp(`^${userProfile.toString()}$`)))
|
||||
.toString()
|
||||
] || userProfile;
|
||||
let e: any;
|
||||
|
||||
try {
|
||||
e = await this.alfrescoApi.login(userToLog.username, userToLog.password);
|
||||
} catch (error) {
|
||||
logger.error(`[API Client Factory] Log in user ${userToLog.username} failed ${e}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
26
projects/aca-playwright-shared/src/api/index.ts
Normal file
26
projects/aca-playwright-shared/src/api/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './rules-api';
|
||||
export * from './api-client-factory';
|
72
projects/aca-playwright-shared/src/api/rules-api.ts
Normal file
72
projects/aca-playwright-shared/src/api/rules-api.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
type RuleTrigger = 'inbound' | 'update' | 'outbound';
|
||||
|
||||
export interface RuleCompositeCondition {
|
||||
inverted: boolean;
|
||||
booleanMode: 'and' | 'or';
|
||||
compositeConditions: RuleCompositeCondition[];
|
||||
simpleConditions: RuleSimpleCondition[];
|
||||
}
|
||||
|
||||
export interface RuleSimpleCondition {
|
||||
field: string;
|
||||
comparator: string;
|
||||
parameter: string;
|
||||
}
|
||||
|
||||
export interface Rule {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
isEnabled: boolean;
|
||||
isInheritable: boolean;
|
||||
isAsynchronous: boolean;
|
||||
errorScript: string;
|
||||
isShared: boolean;
|
||||
triggers: RuleTrigger[];
|
||||
conditions: RuleCompositeCondition;
|
||||
actions: RuleAction[];
|
||||
}
|
||||
|
||||
export interface RuleAction {
|
||||
actionDefinitionId: string;
|
||||
params?: { [key: string]: unknown };
|
||||
}
|
||||
|
||||
export class ActionTypes {
|
||||
static ADDFEATURES = new ActionTypes('ADDFEATURES', {
|
||||
actionDefinitionId: 'add-features',
|
||||
params: { 'aspect-name': 'cm:thumbnailed' }
|
||||
});
|
||||
static CHECKIN = new ActionTypes('CHECKIN', {
|
||||
actionDefinitionId: 'check-in',
|
||||
params: {
|
||||
description: 'test',
|
||||
minorChange: true
|
||||
}
|
||||
});
|
||||
constructor(public key: string, public value: RuleAction) {}
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const env = process.env;
|
||||
|
||||
export const testEmailDomain = env.E2E_EMAIL_DOMAIN;
|
||||
export const users = {
|
||||
superadmin: {
|
||||
username: env.SUPERADMIN_EMAIL,
|
||||
password: env.SUPERADMIN_PASSWORD
|
||||
},
|
||||
identity: {
|
||||
username: env.IDENTITY_USER_EMAIL,
|
||||
password: env.IDENTITY_USER_PASSWORD
|
||||
},
|
||||
hruser: {
|
||||
username: env.HR_USER,
|
||||
password: env.HR_USER_PASSWORD
|
||||
},
|
||||
salesuser: {
|
||||
username: env.SALES_USER,
|
||||
password: env.SALES_USER_PASSWORD
|
||||
},
|
||||
admin: {
|
||||
username: env.ADMIN_EMAIL,
|
||||
password: env.ADMIN_PASSWORD
|
||||
},
|
||||
contentIdentity: {
|
||||
username: env.CONTENT_IDENTITY_USERNAME,
|
||||
password: env.CONTENT_IDENTITY_PASSWORD
|
||||
}
|
||||
};
|
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { chromium, FullConfig } from '@playwright/test';
|
||||
import { LoginPage } from '../page-objects';
|
||||
import { CustomConfig } from '../models';
|
||||
import { users } from './global-variables';
|
||||
import fs from 'fs';
|
||||
import { paths } from '../utils/paths';
|
||||
|
||||
async function globalSetup(config: FullConfig<CustomConfig>) {
|
||||
const { use } = config.projects[0];
|
||||
|
||||
await removeOutputFolders();
|
||||
await createOutputFolders();
|
||||
|
||||
if (use.users) {
|
||||
for (const user of use.users) {
|
||||
if (users[user].username) {
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage();
|
||||
const loginPage = new LoginPage(page);
|
||||
await page.goto(use.baseURL);
|
||||
await loginPage.loginUser({ username: users[user].username, password: users[user].password }, {
|
||||
withNavigation: false,
|
||||
waitForLoading: true
|
||||
});
|
||||
await page.context().storageState({ path: `${paths.userStates}/${user}UserState.json` });
|
||||
await browser.close();
|
||||
} else {
|
||||
throw new Error(`Add credentials for ${user} to you .env file!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function createOutputFolders() {
|
||||
for (const path in paths) {
|
||||
if (!fs.existsSync(paths[path])) {
|
||||
fs.mkdirSync(paths[path], { recursive: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function removeOutputFolders() {
|
||||
if (fs.existsSync(paths.rootFolder)) {
|
||||
fs.rmdirSync(paths.rootFolder, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
export default globalSetup;
|
27
projects/aca-playwright-shared/src/base-config/index.ts
Normal file
27
projects/aca-playwright-shared/src/base-config/index.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './global.setup';
|
||||
export * from './playwright.config';
|
||||
export * from './global-variables';
|
@@ -0,0 +1,80 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { PlaywrightTestConfig, ReporterDescription, devices } from '@playwright/test';
|
||||
import { timeouts } from '../utils';
|
||||
|
||||
require('@alfresco/adf-cli/tooling').dotenvConfig();
|
||||
const { env } = process;
|
||||
|
||||
const report: ReporterDescription[] = (env.CI) ? [['github']] : [['html']];
|
||||
|
||||
export const getGlobalConfig: PlaywrightTestConfig = {
|
||||
timeout: timeouts.globalTest,
|
||||
globalTimeout: timeouts.globalSpec,
|
||||
expect: {
|
||||
/**
|
||||
* Maximum time expect() should wait for the condition to be met.
|
||||
* For example in `await expect(locator).toHaveText();`
|
||||
*/
|
||||
timeout: timeouts.medium
|
||||
},
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: !!env.CI,
|
||||
/* Retry on CI only */
|
||||
retries: env.CI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: 3,
|
||||
reporter: [['list'], ...report],
|
||||
globalSetup: require.resolve('./global.setup'),
|
||||
use: {
|
||||
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
||||
actionTimeout: 0,
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: env.PLAYWRIGHT_E2E_HOST,
|
||||
headless: !!env.PLAYWRIGHT_HEADLESS ? (env.PLAYWRIGHT_HEADLESS === 'true') : !!env.CI,
|
||||
ignoreHTTPSErrors: true,
|
||||
bypassCSP: true,
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: 'retain-on-failure',
|
||||
video: 'retain-on-failure',
|
||||
screenshot: 'only-on-failure',
|
||||
launchOptions: {
|
||||
devtools: false,
|
||||
args: ['--no-sandbox', '--disable-site-isolation-trials']
|
||||
}
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
use: {
|
||||
...devices['Desktop Chrome']
|
||||
}
|
||||
}
|
||||
],
|
||||
};
|
@@ -0,0 +1,51 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
import { test as base } from '@playwright/test';
|
||||
import { ApiClientFactory, NodesPage, PersonalFilesPage } from '../';
|
||||
|
||||
interface Pages {
|
||||
personalFiles: PersonalFilesPage;
|
||||
nodesPage: NodesPage;
|
||||
}
|
||||
|
||||
interface Api {
|
||||
superAdminApiClient: ApiClientFactory;
|
||||
}
|
||||
|
||||
export const test = base.extend<Pages & Api>({
|
||||
personalFiles: async ({ page }, use) => {
|
||||
await use(new PersonalFilesPage(page));
|
||||
},
|
||||
nodesPage: async ({ page }, use) => {
|
||||
await use(new NodesPage(page));
|
||||
},
|
||||
// eslint-disable-next-line no-empty-pattern
|
||||
superAdminApiClient: async ({ }, use) => {
|
||||
const apiClient = new ApiClientFactory();
|
||||
await apiClient.setUpAcaBackend('admin');
|
||||
await use(apiClient);
|
||||
}
|
||||
});
|
30
projects/aca-playwright-shared/src/index.ts
Normal file
30
projects/aca-playwright-shared/src/index.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './api';
|
||||
export * from './base-config';
|
||||
export * from './models';
|
||||
export * from './page-objects';
|
||||
export * from './fixtures/page-initialization';
|
||||
export * from './utils';
|
29
projects/aca-playwright-shared/src/models/custom-config.ts
Normal file
29
projects/aca-playwright-shared/src/models/custom-config.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { users } from '../base-config';
|
||||
|
||||
export interface CustomConfig {
|
||||
users: Array<keyof typeof users>;
|
||||
}
|
26
projects/aca-playwright-shared/src/models/index.ts
Normal file
26
projects/aca-playwright-shared/src/models/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './user-model';
|
||||
export * from './custom-config';
|
60
projects/aca-playwright-shared/src/models/user-model.ts
Normal file
60
projects/aca-playwright-shared/src/models/user-model.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { StringUtil } from '@alfresco/adf-testing';
|
||||
|
||||
const LOWER_CASE_ALPHA = 'helloworld';
|
||||
export class UserModel {
|
||||
firstName?: string = StringUtil.generateRandomCharset(length, LOWER_CASE_ALPHA)(7);
|
||||
lastName?: string = StringUtil.generateRandomCharset(length, LOWER_CASE_ALPHA)(7);
|
||||
password?: string = StringUtil.generateRandomCharset(length, LOWER_CASE_ALPHA)(7);
|
||||
email?: string;
|
||||
username?: string;
|
||||
idIdentityService?: string;
|
||||
type = 'enterprise';
|
||||
tenantId?: number;
|
||||
company?: string;
|
||||
id: number;
|
||||
|
||||
constructor(details: any = {}) {
|
||||
const EMAIL_DOMAIN = 'alfresco';
|
||||
this.firstName = details.firstName ?? this.firstName;
|
||||
this.lastName = details.lastName ?? this.lastName;
|
||||
|
||||
const USER_IDENTIFY = `${this.firstName}${this.lastName}.${StringUtil.generateRandomCharset(length, LOWER_CASE_ALPHA)(7)}`;
|
||||
|
||||
this.password = details.password ?? this.password;
|
||||
this.email = details.email ?? `${USER_IDENTIFY}@${EMAIL_DOMAIN}.com`;
|
||||
this.username = details.username ?? USER_IDENTIFY;
|
||||
this.idIdentityService = details.idIdentityService ?? this.idIdentityService;
|
||||
this.type = details.type ?? this.type;
|
||||
this.tenantId = details.tenantId ?? this.tenantId;
|
||||
this.company = details.company ?? this.company;
|
||||
this.id = details.id ?? this.id;
|
||||
}
|
||||
|
||||
get fullName(): string {
|
||||
return `${this.firstName ?? ''} ${this.lastName ?? ''}`;
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from './base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class AcaHeader extends BaseComponent {
|
||||
private static rootElement = 'adf-toolbar';
|
||||
public createButton = this.getChild('[id="app.toolbar.create"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AcaHeader.rootElement);
|
||||
}
|
||||
}
|
@@ -0,0 +1,108 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from './base.component';
|
||||
|
||||
export enum ActionType {
|
||||
AddAspect = 'Add aspect',
|
||||
SimpleWorkflow = 'Add simple workflow',
|
||||
IncrementCounter = 'Increment Counter',
|
||||
CheckIn = 'Check in',
|
||||
AutoDeclareOptions = 'Auto-Declare Options',
|
||||
CheckOut = 'Check out',
|
||||
Copy = 'Copy',
|
||||
ExecuteScript = 'Execute script',
|
||||
ExtractCommonMetadataFields = 'Extract common metadata fields',
|
||||
FileAsRecord = 'File as Record',
|
||||
FileVersionAsRecord = 'File Version as Record',
|
||||
HideRecord = 'Hide Record',
|
||||
Import = 'Import',
|
||||
Move = 'Move',
|
||||
RemoveAspect = 'Remove aspect',
|
||||
RequestAIRenditions = 'Request AI renditions',
|
||||
SendEmail = 'Send email',
|
||||
SetPropertyValue = 'Set property value',
|
||||
SpecialiseType = 'Specialise type',
|
||||
TransformAndCopyContent = 'Transform and copy content',
|
||||
TransformAndCopyImage = 'Transform and copy image'
|
||||
}
|
||||
|
||||
export class ActionsDropdownComponent extends BaseComponent {
|
||||
private static rootElement = 'aca-rule-action-list';
|
||||
|
||||
private getOptionLocator = (optionName: string): Locator => this.page.locator('.mat-select-panel .mat-option-text', { hasText: optionName });
|
||||
private ruleActionLocator = this.getChild('aca-rule-action [data-automation-id="rule-action-card-view"]');
|
||||
private addActionButtonLocator = this.getChild('[data-automation-id="rule-action-list-add-action-button"]');
|
||||
private actionDropdownLocator = this.getChild('[data-automation-id="rule-action-select"]');
|
||||
private actionAspectNameLocator = '[data-automation-id="header-aspect-name"] mat-select';
|
||||
private actionCheckInInputLocator = '[data-automation-id="header-description"] input';
|
||||
private actionAutoDeclareLocator = '[data-automation-id="header-version"] mat-select';
|
||||
private actionSimpleWorkflowStepInputLocator = '[data-automation-id="header-approve-step"] input';
|
||||
private actionSimpleWorkflowApproveFolderLocator = `[data-automation-id="header-approve-folder"] input`;
|
||||
private actionSimpleWorkflowActionChoiceLocator = '[data-automation-id="content-node-selector-actions-choose"]';
|
||||
private actionSimpleWorkflowLabelApproveLocator = `[data-automation-id="card-boolean-label-approve-move"]`;
|
||||
private actionSimpleWorkflowSRejectStepLocator = '[data-automation-id="header-reject-step"] input';
|
||||
private actionSimpleWorkflowRejectFolderLocator = `[data-automation-id="header-reject-folder"] input`;
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ActionsDropdownComponent.rootElement);
|
||||
}
|
||||
|
||||
async selectAction(action: Partial<ActionType>, index: number): Promise<void> {
|
||||
if (index > 0) {
|
||||
await this.addActionButtonLocator.click();
|
||||
}
|
||||
await this.actionDropdownLocator.nth(index).click();
|
||||
const option = this.getOptionLocator(action);
|
||||
await option.click();
|
||||
}
|
||||
|
||||
async dropdownSelection(selectValue: string, locator: string, index: number): Promise<void> {
|
||||
await this.ruleActionLocator.nth(index).locator(locator).click();
|
||||
await this.getOptionLocator(selectValue).nth(0).click();
|
||||
}
|
||||
|
||||
async insertCheckInActionValues(checkInValue: string, index: number): Promise<void> {
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionCheckInInputLocator).type(checkInValue, { delay: 50 });
|
||||
}
|
||||
|
||||
async insertAddAspectActionValues(AspectValue: string, index: number): Promise<void> {
|
||||
await this.dropdownSelection(AspectValue, this.actionAspectNameLocator, index);
|
||||
}
|
||||
|
||||
async insertAutoDeclareOptionsActionValues(autoDeclareOptionsValue: string, index: number): Promise<void> {
|
||||
await this.dropdownSelection(autoDeclareOptionsValue, this.actionAutoDeclareLocator, index);
|
||||
}
|
||||
|
||||
async insertSimpleWorkflowActionValues(stepValue: string, index: number): Promise<void> {
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowStepInputLocator).type(stepValue, { delay: 50 });
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowApproveFolderLocator).click();
|
||||
await this.page.locator(this.actionSimpleWorkflowActionChoiceLocator).click();
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowLabelApproveLocator).click();
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowSRejectStepLocator).type(stepValue, { delay: 50 });
|
||||
await this.ruleActionLocator.nth(index).locator(this.actionSimpleWorkflowRejectFolderLocator).click();
|
||||
await this.page.locator(this.actionSimpleWorkflowActionChoiceLocator).click();
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { PlaywrightBase } from '../playwright-base';
|
||||
|
||||
export abstract class BaseComponent extends PlaywrightBase {
|
||||
private readonly rootElement: string;
|
||||
private overlayElement = this.page.locator('.cdk-overlay-backdrop-showing');
|
||||
|
||||
protected constructor(page: Page, rootElement: string) {
|
||||
super(page);
|
||||
this.rootElement = rootElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method which should be used across the repository, while creating
|
||||
* reference to elements, which are in root element of component.
|
||||
*
|
||||
* @param cssLocator css selector as String. Need to be in the tree under the root element
|
||||
* @param options if you want to localize it by text, then provide an optional hasText
|
||||
* @returns Locator object
|
||||
*/
|
||||
getChild(cssLocator: string, options?: { hasText?: string | RegExp; has?: Locator }): Locator {
|
||||
return this.page.locator(`${this.rootElement} ${cssLocator}`, options);
|
||||
}
|
||||
|
||||
async closeAdditionalOverlayElementIfVisible(): Promise<void> {
|
||||
if (await this.overlayElement.isVisible()) {
|
||||
await this.page.keyboard.press('Escape');
|
||||
await this.overlayElement.waitFor({ state: 'detached', timeout: 5000 });
|
||||
}
|
||||
}
|
||||
|
||||
async spinnerWaitForReload(): Promise<void> {
|
||||
try {
|
||||
await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: 2000 });
|
||||
await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: 2000 });
|
||||
} catch (e) {
|
||||
this.logger.info('Spinner was not present');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { ManageRulesDialogComponent } from './manageRules/manage-rules-dialog.component';
|
||||
|
||||
export enum Field {
|
||||
Name = 'Name',
|
||||
Size = 'Size',
|
||||
Mimetype = 'Mimetype'
|
||||
}
|
||||
|
||||
export enum Comparator {
|
||||
Equals = '(=) Equals',
|
||||
Contains = 'Contains',
|
||||
StartsWith = 'Starts with',
|
||||
EndsWith = 'Ends with'
|
||||
}
|
||||
|
||||
export class ConditionComponent extends ManageRulesDialogComponent {
|
||||
private getOptionLocator = (optionName: string): Locator => this.page.locator(`.cdk-overlay-pane .mat-option span`, { hasText: optionName });
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
}
|
||||
|
||||
private async selectField(fields: Partial<Field>, index: number): Promise<void> {
|
||||
await this.fieldDropDown.nth(index).click();
|
||||
const option = this.getOptionLocator(fields);
|
||||
await option.click();
|
||||
}
|
||||
|
||||
private async selectComparator(comparators: Partial<Comparator>, index: number): Promise<void> {
|
||||
await this.comparatorDropDown.nth(index).click();
|
||||
const option = this.getOptionLocator(comparators);
|
||||
await option.click();
|
||||
}
|
||||
|
||||
async addCondition(fields: Partial<Field>, comparators: Partial<Comparator>, value: string, index: number): Promise<void> {
|
||||
await this.addConditionButton.click();
|
||||
await this.selectField(fields, index);
|
||||
await this.selectComparator(comparators, index);
|
||||
await this.valueField.nth(index).type(value);
|
||||
}
|
||||
|
||||
async addConditionGroup(fields: Partial<Field>, comparators: Partial<Comparator>, value: string, index: number): Promise<void> {
|
||||
await this.addConditionButton.nth(0).click();
|
||||
await this.selectField(fields, index);
|
||||
await this.selectComparator(comparators, index);
|
||||
await this.valueField.nth(index).type(value);
|
||||
}
|
||||
}
|
@@ -0,0 +1,183 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { MatMenuComponent } from './mat-menu.component';
|
||||
import { PaginationActionsType, PaginationComponent } from '../pagination.component';
|
||||
|
||||
export class DataTableComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-datatable';
|
||||
contextMenuActions = new MatMenuComponent(this.page);
|
||||
|
||||
constructor(page: Page, rootElement = DataTableComponent.rootElement) {
|
||||
super(page, rootElement);
|
||||
}
|
||||
|
||||
public pagination = new PaginationComponent(this.page);
|
||||
getEmptyFolderLocator = this.getChild('.adf-empty-folder');
|
||||
getEmptyContentTitleLocator = this.getChild('adf-empty-content .adf-empty-content__title');
|
||||
getEmptyContentSubTitleLocator = this.getChild('adf-empty-content .adf-empty-content__subtitle');
|
||||
|
||||
/** Locator for row (or rows) */
|
||||
getRowLocator = this.getChild(`adf-datatable-row`);
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to check that some record is visible in the datatable. It will consider whole row
|
||||
*
|
||||
* @returns reference to cell element which contains text.
|
||||
*/
|
||||
getRowByName = (name: string | number): Locator => this.getChild(`adf-datatable-row`, { hasText: name.toString() });
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to check that some record is visible in the datatable.
|
||||
* But we want to check it by column header title and value of this column.
|
||||
*
|
||||
* @returns reference to cell element which contains text.
|
||||
*/
|
||||
getRowByColumnTitleAndItsCellValue = (columnTitle: string, cellValue: string | number): Locator =>
|
||||
this.page.locator(`//div[contains(@title, '${columnTitle}')]//span[contains(text(), '${cellValue}')]/ancestor::adf-datatable-row`);
|
||||
|
||||
/**
|
||||
* Method used in cases where user have possibility to navigate "inside" the element (it's clickable and has link attribute).
|
||||
* Perform action .click() to navigate inside it
|
||||
*
|
||||
* @returns reference to cell element which contains link.
|
||||
*/
|
||||
getCellLinkByName = (name: string): Locator => this.getChild('.adf-datatable-cell-value[role="link"]', { hasText: name });
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to localize the element by [aria-label]
|
||||
*
|
||||
* @returns reference to cell element.
|
||||
*/
|
||||
getByAriaLabelTitle = (title: string): Locator => this.getChild(`[aria-label="${title}"]`);
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the button (hamburger menu) for row element
|
||||
*
|
||||
* @returns reference to menu placed in row localized by the name
|
||||
*/
|
||||
getActionsButtonByName = (name: string): Locator =>
|
||||
this.getRowByName(name).locator('mat-icon', { hasText: new RegExp(`^\\s*more_vert\\s*$`, 'g') });
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the edit button and there is no hamburger menu
|
||||
*
|
||||
* @returns reference to edit button placed in row localized by the name
|
||||
*/
|
||||
getEditButtonByName = (name: string): Locator => this.getRowByName(name).locator('button#editButton');
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the button and there is no hamburger menu
|
||||
*
|
||||
* @returns reference to button placed in row localized by the name
|
||||
*/
|
||||
getButtonByNameForSpecificRow = (elementTitleInRow: string, buttonTitle: string): Locator =>
|
||||
this.getRowByName(elementTitleInRow).locator('button', { hasText: buttonTitle });
|
||||
|
||||
/**
|
||||
* Method used in cases where you want to get some specific cell (by column name) for row which contains some name/title/etc.
|
||||
*
|
||||
* @returns reference to cell element
|
||||
*/
|
||||
getCellByColumnNameAndRowItem = (item: string | number, columnName: string): Locator => this.getRowByName(item).locator(`[title="${columnName}"]`);
|
||||
|
||||
/**
|
||||
* Method used in cases where we want to get the checkbox for row element
|
||||
*
|
||||
* @returns reference to checkbox placed in row localized by the name
|
||||
*/
|
||||
getCheckboxForElement = (item: string): Locator => this.getRowByName(item).locator('mat-checkbox');
|
||||
|
||||
getColumnHeaderByTitleLocator = (headerTitle: string): Locator => this.getChild('[role="columnheader"]', { hasText: headerTitle });
|
||||
|
||||
async sortBy(columnTitle: string, order: 'Ascending' | 'Descending'): Promise<void> {
|
||||
const columnHeaderLocator = this.getColumnHeaderByTitleLocator(columnTitle);
|
||||
await this.spinnerWaitForReload();
|
||||
await columnHeaderLocator.click();
|
||||
|
||||
const sortAttribute = await columnHeaderLocator.getAttribute('aria-sort');
|
||||
if (sortAttribute !== order) {
|
||||
await columnHeaderLocator.click();
|
||||
}
|
||||
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used when we want to perform right mouse click on the dataTable row and perform some action
|
||||
*
|
||||
* @param name of the data table element with which we want to click
|
||||
* @param action provide which action you want to perform
|
||||
*/
|
||||
async performActionFromExpandableMenu(name: string | number, action: string): Promise<void> {
|
||||
await this.goThroughPagesLookingForRowWithName(name);
|
||||
const actionButtonLocator = await this.getActionLocatorFromExpandableMenu(name, action);
|
||||
await actionButtonLocator.click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
/**
|
||||
* Click action from the expandable kebab menu for the element in datatable
|
||||
*
|
||||
* @param name title of the record you would like to proceed
|
||||
* @param action provide button title for the action
|
||||
* @param subAction if the action is in sub menu, then provide it here
|
||||
*/
|
||||
async performActionForElement(name: string, action: string, subAction?: string): Promise<void> {
|
||||
await this.getActionsButtonByName(name).click();
|
||||
await this.contextMenuActions.getButtonByText(action).click();
|
||||
|
||||
if (subAction) {
|
||||
await this.contextMenuActions.getButtonByText(subAction).click();
|
||||
}
|
||||
}
|
||||
|
||||
async getActionLocatorFromExpandableMenu(name: string | number, action: string): Promise<Locator> {
|
||||
await this.getRowByName(name).click({ button: 'right' });
|
||||
return this.contextMenuActions.getButtonByText(action);
|
||||
}
|
||||
|
||||
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
|
||||
await this.spinnerWaitForReload();
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((await this.pagination.currentPageLocator.textContent()) !== ' Page 1 ') {
|
||||
await this.pagination.navigateToPage(1);
|
||||
}
|
||||
|
||||
const maxPages = (await this.pagination.totalPageLocator.textContent()).match(/\d/)[0];
|
||||
for (let page = 1; page <= Number(maxPages); page++) {
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
break;
|
||||
}
|
||||
await this.pagination.getArrowLocatorFor(PaginationActionsType.NextPageSelector).isEnabled();
|
||||
await this.pagination.getArrowLocatorFor(PaginationActionsType.NextPageSelector).click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './data-table.component';
|
||||
export * from './mat-menu.component';
|
||||
export * from './toolbar.component';
|
@@ -0,0 +1,39 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class MatMenuComponent extends BaseComponent {
|
||||
private static rootElement = '.mat-menu-content';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, MatMenuComponent.rootElement);
|
||||
}
|
||||
|
||||
public getMenuItemsLocator = this.getChild('button');
|
||||
public getMenuItemTextLocator = this.getChild('[data-automation-id="menu-item-title"]');
|
||||
public createFolder = this.getChild('[id="app.create.folder"]');
|
||||
public getButtonByText = (text: string) => this.getChild('button', { hasText: text });
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class ToolbarComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-toolbar';
|
||||
private createRuleButton = this.getChild('[data-automation-id="manage-rules-create-button"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ToolbarComponent.rootElement);
|
||||
}
|
||||
|
||||
async clickCreateRuleButton(): Promise<void> {
|
||||
await this.createRuleButton.click();
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class AdfFolderDialogComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-folder-dialog';
|
||||
|
||||
public folderNameInputLocator = this.getChild('[id="adf-folder-name-input"]');
|
||||
public createButton = this.getChild('[id="adf-folder-create-button"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AdfFolderDialogComponent.rootElement);
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './adf-folder-dialog.component';
|
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './snackBar/snack-bar.component';
|
||||
export * from './dataTable';
|
||||
export * from './dialogs';
|
||||
export * from './manageRules';
|
||||
export * from './base.component';
|
||||
export * from './spinner.component';
|
||||
export * from './actions-dropdown.component';
|
||||
export * from './conditions.component';
|
||||
export * from './pagination.component';
|
||||
|
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './manage-rules-dialog.component';
|
||||
export * from './manage-rules.component';
|
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class ManageRulesDialogComponent extends BaseComponent {
|
||||
private static rootElement = 'aca-edit-rule-dialog';
|
||||
|
||||
public createRuleButton = this.getChild('[data-automation-id="edit-rule-dialog-submit"]');
|
||||
public ruleNameInputLocator = this.getChild('[id="rule-details-name-input"]');
|
||||
public addConditionButton = this.getChild('[data-automation-id="add-condition-button"]');
|
||||
public addConditionGroupButton = this.getChild('[data-automation-id="add-group-button"]');
|
||||
public fieldDropDown = this.getChild('[data-automation-id="field-select"]');
|
||||
public comparatorDropDown = this.getChild('[data-automation-id="comparator-select"]');
|
||||
public valueField = this.getChild('[data-automation-id="value-input"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ManageRulesDialogComponent.rootElement);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class ManageRules extends BaseComponent {
|
||||
private static rootElement = '.aca-manage-rules';
|
||||
|
||||
public getGroupsList = (optionName: string): Locator => this.getChild('.aca-rule-list-item__header', { hasText: optionName });
|
||||
public disableRuleToggle = this.getChild('.aca-manage-rules__container .mat-slide-toggle-bar').first();
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, ManageRules.rootElement);
|
||||
}
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseComponent } from './base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
import { MatMenuComponent } from './dataTable/mat-menu.component';
|
||||
|
||||
export enum PaginationActionsType {
|
||||
PageSizeSelector = 'Page size selector',
|
||||
CurrentPageSelector = 'Current page selector',
|
||||
NextPageSelector = 'Next page button'
|
||||
}
|
||||
|
||||
export class PaginationComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-pagination';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, PaginationComponent.rootElement);
|
||||
}
|
||||
|
||||
private itemsPerPageMenu = new MatMenuComponent(this.page);
|
||||
|
||||
public currentPageLocator = this.getChild('.adf-pagination__current-page');
|
||||
public totalPageLocator = this.getChild('.adf-pagination__total-pages');
|
||||
public getArrowLocatorFor = (action: PaginationActionsType) => this.getChild(`[aria-label="${action}"]`);
|
||||
|
||||
async setItemsPerPage(amount: number): Promise<void> {
|
||||
await this.getArrowLocatorFor(PaginationActionsType.PageSizeSelector).click();
|
||||
await this.itemsPerPageMenu.getButtonByText(amount.toString()).click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
async navigateToPage(pageNumber: number): Promise<void> {
|
||||
await this.getArrowLocatorFor(PaginationActionsType.CurrentPageSelector).click();
|
||||
await this.itemsPerPageMenu.getButtonByText(pageNumber.toString()).click();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
||||
async spinnerWaitForReload(): Promise<void> {
|
||||
try {
|
||||
await this.page.locator('mat-progress-spinner').waitFor({ state: 'attached', timeout: 2000 });
|
||||
await this.page.locator('mat-progress-spinner').waitFor({ state: 'detached', timeout: 2000 });
|
||||
} catch (e) {
|
||||
this.logger.info('Spinner was not present');
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class SnackBarComponent extends BaseComponent {
|
||||
private static rootElement = 'simple-snack-bar';
|
||||
|
||||
public message = this.getChild(' > span');
|
||||
public getByMessageLocator = (message: string) => this.getChild('span', { hasText: message });
|
||||
|
||||
constructor(page: Page, rootElement = SnackBarComponent.rootElement) {
|
||||
super(page, rootElement);
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from './base.component';
|
||||
|
||||
export class SpinnerComponent extends BaseComponent {
|
||||
private static rootElement = 'mat-progress-spinner';
|
||||
|
||||
constructor(page: Page, rootElement = SpinnerComponent.rootElement) {
|
||||
super(page, rootElement);
|
||||
}
|
||||
|
||||
async waitForReload(): Promise<void> {
|
||||
try {
|
||||
await this.getChild('').waitFor({ state: 'attached', timeout: 2000 });
|
||||
await this.getChild('').waitFor({ state: 'detached', timeout: 2000 });
|
||||
} catch (e) {
|
||||
this.logger.info('Spinner was not present');
|
||||
}
|
||||
}
|
||||
}
|
26
projects/aca-playwright-shared/src/page-objects/index.ts
Normal file
26
projects/aca-playwright-shared/src/page-objects/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './components';
|
||||
export * from './pages';
|
@@ -0,0 +1,96 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { PlaywrightBase } from '../playwright-base';
|
||||
import { SnackBarComponent, SpinnerComponent } from '../components';
|
||||
|
||||
export interface NavigateOptions {
|
||||
query?: string;
|
||||
waitForRequest?: boolean;
|
||||
waitUntil?: 'networkidle' | 'commit' | 'load' | 'domcontentloaded';
|
||||
remoteUrl?: string;
|
||||
}
|
||||
export abstract class BasePage extends PlaywrightBase {
|
||||
private readonly pageUrl: string;
|
||||
private readonly urlRequest: RegExp;
|
||||
public snackBar: SnackBarComponent;
|
||||
public spinner: SpinnerComponent;
|
||||
|
||||
protected constructor(page: Page, pageUrl: string, urlRequest?: RegExp) {
|
||||
super(page);
|
||||
this.pageUrl = pageUrl;
|
||||
this.urlRequest = urlRequest;
|
||||
this.snackBar = new SnackBarComponent(this.page);
|
||||
this.spinner = new SpinnerComponent(this.page);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method which navigate to appropriate page or remoteURL
|
||||
*
|
||||
* @param options object with configurable options
|
||||
* @property {string} query if you would like to navigate to page which support query,
|
||||
* then pass it in this option - e.g. '?appName=content'
|
||||
* @property {boolean} waitForRequest if you would like to NOT wait for request (which need to be passed
|
||||
* in the constructor of the page), then pass false. By default it'll wait for request to be fulfilled.
|
||||
* @property {'networkidle' | 'commit' | 'load' | 'domcontentloaded'} waitUntil by default will wait until 'networkidle' but you can change it if needed
|
||||
* @property {string} remoteUrl if you need to navigate to third part site, then you need to pass all of the URL in this option
|
||||
*/
|
||||
async navigate(options?: Partial<NavigateOptions>): Promise<void> {
|
||||
const actualOptions: NavigateOptions = {
|
||||
query: '',
|
||||
waitForRequest: true,
|
||||
remoteUrl: '',
|
||||
...options
|
||||
};
|
||||
|
||||
if (actualOptions.remoteUrl) {
|
||||
await this.page.goto(actualOptions.remoteUrl, {
|
||||
waitUntil: actualOptions.waitUntil
|
||||
});
|
||||
} else {
|
||||
if (this.urlRequest && actualOptions.waitForRequest) {
|
||||
await Promise.all([
|
||||
this.page.goto(`./#/${this.pageUrl}${actualOptions.query}`, { waitUntil: 'load' }),
|
||||
this.page.waitForResponse(this.urlRequest)
|
||||
]);
|
||||
} else {
|
||||
await this.page.goto(`./#/${this.pageUrl}${actualOptions.query}`, {
|
||||
waitUntil: actualOptions.waitUntil,
|
||||
timeout: 60000
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await this.spinner.waitForReload();
|
||||
}
|
||||
|
||||
async reload(options?: Pick<NavigateOptions, 'waitUntil'>): Promise<void> {
|
||||
const actualOptions: Pick<NavigateOptions, 'waitUntil'> = {
|
||||
waitUntil: 'networkidle',
|
||||
...options
|
||||
};
|
||||
await this.page.reload(actualOptions);
|
||||
}
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './base.page';
|
||||
export * from './login.page';
|
||||
export * from './nodes.page';
|
||||
export * from './personal-files.page';
|
@@ -0,0 +1,54 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { UserModel } from '../../models';
|
||||
|
||||
interface LoginOptions {
|
||||
waitForLoading?: boolean;
|
||||
withNavigation?: boolean;
|
||||
}
|
||||
export class LoginPage extends BasePage {
|
||||
constructor(page: Page) {
|
||||
super(page, '');
|
||||
}
|
||||
|
||||
private username = this.page.locator('#username');
|
||||
private password = this.page.locator('#password');
|
||||
private submitButton = this.page.locator('#login-button');
|
||||
|
||||
async loginUser(userData: { username: string; password: string } | UserModel, options?: LoginOptions): Promise<void> {
|
||||
if (options?.withNavigation) {
|
||||
await this.navigate();
|
||||
}
|
||||
await this.username.fill(userData.username);
|
||||
await this.password.fill(userData.password);
|
||||
await this.submitButton.click();
|
||||
|
||||
if (options?.waitForLoading) {
|
||||
await Promise.all([this.page.waitForLoadState('domcontentloaded'), this.spinner.waitForReload()]);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { ConditionComponent, ManageRules, ManageRulesDialogComponent, ToolbarComponent, ActionsDropdownComponent } from '../components';
|
||||
import { BasePage } from './base.page';
|
||||
|
||||
|
||||
export class NodesPage extends BasePage {
|
||||
private static pageUrl = 'nodes';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, NodesPage.pageUrl);
|
||||
}
|
||||
|
||||
public toolbar = new ToolbarComponent(this.page);
|
||||
public manageRulesDialog = new ManageRulesDialogComponent(this.page);
|
||||
public actionsDropdown = new ActionsDropdownComponent(this.page);
|
||||
public conditionsDropdown = new ConditionComponent(this.page);
|
||||
public manageRules = new ManageRules(this.page);
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent } from '../components/dialogs';
|
||||
|
||||
export class PersonalFilesPage extends BasePage {
|
||||
private static pageUrl = 'personal-files';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, PersonalFilesPage.pageUrl);
|
||||
}
|
||||
|
||||
public acaHeader = new AcaHeader(this.page);
|
||||
public matMenu = new MatMenuComponent(this.page);
|
||||
public folderDialog = new AdfFolderDialogComponent(this.page);
|
||||
public dataTable = new DataTableComponent(this.page);
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { GenericLogger, LoggerLike } from '@alfresco/adf-testing';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export abstract class PlaywrightBase {
|
||||
public page: Page;
|
||||
public logger: LoggerLike;
|
||||
|
||||
protected constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.logger = new GenericLogger(process.env.PLAYWRIGHT_CUSTOM_LOG_LEVEL);
|
||||
}
|
||||
}
|
22
projects/aca-playwright-shared/src/utils/exclude-tests.ts
Normal file
22
projects/aca-playwright-shared/src/utils/exclude-tests.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright © 2005 - 2021 Alfresco Software, Ltd. All rights reserved.
|
||||
*
|
||||
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||
* pursuant to a written agreement and any use of this program without such an
|
||||
* agreement is prohibited.
|
||||
*/
|
||||
|
||||
import { logger } from '@alfresco/adf-cli/scripts/logger';
|
||||
|
||||
export const getExcludedTestsRegExpArray = (excludedJson: any, projectName: string) => {
|
||||
const prefix = `[ 🎭 Playwright Excludes - ${projectName} ]`;
|
||||
const objectKeys = Object.keys(excludedJson);
|
||||
|
||||
if (!objectKeys.length) {
|
||||
logger.info(`${prefix} ✅ No excluded tests 🎉 `);
|
||||
} else {
|
||||
logger.warn(`${prefix} ❌ Tests excluded because of 🐛 : ${objectKeys}`);
|
||||
}
|
||||
|
||||
return objectKeys.map((key) => new RegExp(key));
|
||||
};
|
28
projects/aca-playwright-shared/src/utils/index.ts
Normal file
28
projects/aca-playwright-shared/src/utils/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export * from './paths';
|
||||
export * from './timeouts';
|
||||
export * from './exclude-tests';
|
||||
export * from './state-helper';
|
33
projects/aca-playwright-shared/src/utils/paths.ts
Normal file
33
projects/aca-playwright-shared/src/utils/paths.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const rootFolder = 'e2e-output';
|
||||
|
||||
export const paths = {
|
||||
rootFolder,
|
||||
allData: `${rootFolder}/playwright-data`,
|
||||
files: `${rootFolder}/playwright-data/downloads`,
|
||||
report: `${rootFolder}/playwright-data/report`,
|
||||
userStates: `${rootFolder}/playwright-data/user-states`,
|
||||
};
|
34
projects/aca-playwright-shared/src/utils/state-helper.ts
Normal file
34
projects/aca-playwright-shared/src/utils/state-helper.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
import { resolve } from 'path';
|
||||
import { paths } from '.';
|
||||
import { users } from '../base-config';
|
||||
|
||||
export function getUserState(user: UserType) {
|
||||
return resolve(process.cwd(), `${paths.userStates}/${user}UserState.json`);
|
||||
}
|
||||
|
||||
type UserType = keyof typeof users;
|
37
projects/aca-playwright-shared/src/utils/timeouts.ts
Normal file
37
projects/aca-playwright-shared/src/utils/timeouts.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export const timeouts = {
|
||||
typingDelay: 50,
|
||||
tiny: 500,
|
||||
short: 1000,
|
||||
normal: 2000,
|
||||
medium: 5000,
|
||||
large: 10000,
|
||||
extraLarge: 20 * 1000,
|
||||
globalTest: 45 * 1000,
|
||||
extendedTest: 120 * 1000,
|
||||
webServer: 240 * 1000,
|
||||
globalSpec: 60 * 10 * 1000
|
||||
};
|
25
projects/aca-playwright-shared/tsconfig.lib.json
Normal file
25
projects/aca-playwright-shared/tsconfig.lib.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/aca-playwright-testing",
|
||||
"target": "es2015",
|
||||
"module": "es2015",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"inlineSources": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"types": [],
|
||||
"lib": ["dom", "es2018"]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"fullTemplateTypeCheck": true,
|
||||
"strictInjectionParameters": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": ["node_modules", "src/test.ts", "**/*.spec.ts"]
|
||||
}
|
Reference in New Issue
Block a user