mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests (#3628)
*[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests --------- Co-authored-by: datguycheb <adam.swiderski@hyland.com>
This commit is contained in:
@@ -85,6 +85,7 @@ export class ApiClientFactory {
|
||||
public favorites: FavoritesApi;
|
||||
public trashCan: TrashcanApi;
|
||||
public commentsApi: CommentsApi;
|
||||
public queriesApi: QueriesApi;
|
||||
|
||||
constructor() {
|
||||
this.alfrescoApi = new AlfrescoApi(config);
|
||||
@@ -108,6 +109,7 @@ export class ApiClientFactory {
|
||||
this.favorites = new FavoritesApi(this.alfrescoApi);
|
||||
this.trashCan = new TrashcanApi(this.alfrescoApi);
|
||||
this.commentsApi = new CommentsApi(this.alfrescoApi);
|
||||
this.queriesApi = new QueriesApi(this.alfrescoApi);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@@ -33,3 +33,4 @@ export * from './sites-api';
|
||||
export * from './node-content-tree';
|
||||
export * from './search-api';
|
||||
export * from './trashcan-api';
|
||||
export * from './queries-api';
|
||||
|
75
projects/aca-playwright-shared/src/api/queries-api.ts
Executable file
75
projects/aca-playwright-shared/src/api/queries-api.ts
Executable file
@@ -0,0 +1,75 @@
|
||||
/*!
|
||||
* 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
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { FindQuery } from '@alfresco/js-api';
|
||||
import { Utils } from '../utils';
|
||||
import { ApiClientFactory } from './api-client-factory';
|
||||
|
||||
export class QueriesApi {
|
||||
private apiService: ApiClientFactory;
|
||||
|
||||
constructor() {
|
||||
this.apiService = new ApiClientFactory();
|
||||
}
|
||||
|
||||
static async initialize(userName: string, password?: string): Promise<QueriesApi> {
|
||||
const classObj = new QueriesApi();
|
||||
await classObj.apiService.setUpAcaBackend(userName, password);
|
||||
return classObj;
|
||||
}
|
||||
|
||||
async waitForSites(searchTerm: string, data: { expect: number }): Promise<number> {
|
||||
try {
|
||||
const sites = async () => {
|
||||
const totalItems = await this.findSitesTotalItems(searchTerm);
|
||||
if (totalItems !== data.expect) {
|
||||
return Promise.reject(totalItems);
|
||||
} else {
|
||||
return Promise.resolve(totalItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sites);
|
||||
} catch (error) {
|
||||
console.error(`QueriesApi waitForSites : catch : `);
|
||||
console.error(`\tExpected: ${data.expect} items, but found ${error}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private async findSitesTotalItems(searchTerm: string): Promise<number> {
|
||||
try {
|
||||
const opts: FindQuery = {
|
||||
term: searchTerm,
|
||||
fields: ['title']
|
||||
};
|
||||
|
||||
const sites = await this.apiService.queries.findSites(searchTerm, opts);
|
||||
return sites.list.pagination.totalItems;
|
||||
} catch (error) {
|
||||
console.error(`QueriesApi findSitesTotalItems : catch :`, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@@ -158,4 +158,13 @@ export class SitesApi {
|
||||
console.error(`SitesApi deleteSiteMember : catch : `, error);
|
||||
}
|
||||
}
|
||||
|
||||
async getSite(siteId: string): Promise<SiteEntry> {
|
||||
try {
|
||||
return await this.apiService.sites.getSite(siteId);
|
||||
} catch (error) {
|
||||
console.error(`SitesApi getSite : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,26 +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/>.
|
||||
*/
|
||||
* 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, expect } from '@playwright/test';
|
||||
@@ -34,11 +34,12 @@ export class AdfInfoDrawerComponent extends BaseComponent {
|
||||
|
||||
public getNameField = (labelText: string) => this.getChild('[data-automation-id="library-name-properties-wrapper"]', { hasText: labelText });
|
||||
public getIdField = (labelText: string) => this.getChild('[data-automation-id="library-id-properties-wrapper"]', { hasText: labelText });
|
||||
public getVisibilityField = (labelText: string) => this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText });
|
||||
public getVisibilityField = (labelText: string) =>
|
||||
this.getChild('[data-automation-id="library-visibility-properties-wrapper"]', { hasText: labelText });
|
||||
public getDescriptionField = this.getChild('[data-automation-id="library-description-properties-wrapper"] textarea');
|
||||
public propertiesTab = this.page.getByRole('tab', { name: 'Properties' });
|
||||
public commentsTab = this.page.getByRole('tab', { name: 'Comments' });
|
||||
public infoDrawerTabs = this.getChild('.adf-info-drawer-tab');
|
||||
public propertiesTab = this.infoDrawerTabs.nth(0);
|
||||
public commentsTab = this.infoDrawerTabs.nth(1);
|
||||
public commentInputField = this.getChild('mat-form-field');
|
||||
public commentsHeader = this.getChild('#comment-header');
|
||||
public addCommentButton = this.getChild('[data-automation-id="comments-input-add"]');
|
||||
@@ -46,11 +47,21 @@ export class AdfInfoDrawerComponent extends BaseComponent {
|
||||
public commentUsername = this.getChild('.adf-comment-user-name');
|
||||
public commentTextContent = this.getChild('.adf-comment-message');
|
||||
public commentTimestamp = this.getChild('.adf-comment-message-time');
|
||||
public headerTitle = this.getChild('.adf-info-drawer-layout-header-title div');
|
||||
public infoDrawerPanel = this.page.locator('.adf-info-drawer');
|
||||
public headerTitle = this.page.locator('.adf-info-drawer-layout-header-title').getByRole('heading');
|
||||
public editButton = this.page.getByRole('button', { name: 'Edit' });
|
||||
public cancelButton = this.page.getByRole('button', { name: 'Cancel' });
|
||||
public updateButton = this.page.getByRole('button', { name: 'Update' });
|
||||
public hintMessage = this.page.locator('.mat-hint');
|
||||
public errorMessage = this.page.locator('.mat-error');
|
||||
public expandDetailsButton = this.getChild(`button[title='Expand panel']`);
|
||||
public expandedDetailsTabs = this.page.locator('.aca-details-container .mat-tab-label-content');
|
||||
public expandedDetailsPermissionsTab = this.expandedDetailsTabs.getByText("Permissions");
|
||||
|
||||
public expandedDetailsPermissionsTab = this.expandedDetailsTabs.getByText('Permissions');
|
||||
public nameField = this.page.locator('label', { hasText: 'Name' });
|
||||
public idField = this.page.locator('label', { hasText: 'Library ID' });
|
||||
public descriptionField = this.page.locator('label', { hasText: 'Description' });
|
||||
public visibilityField = this.infoDrawerPanel.getByRole('combobox');
|
||||
public selectVisibility = (visibilityOption: string) => this.page.getByRole('listbox').getByRole('option', { name: visibilityOption }).click();
|
||||
|
||||
async checkCommentsHeaderCount(): Promise<number> {
|
||||
const commentsCountTextContent = await this.commentsHeader.textContent();
|
||||
|
@@ -43,3 +43,31 @@ export const SIDEBAR_LABELS = {
|
||||
FAVORITES: 'Favorites',
|
||||
TRASH: 'Trash'
|
||||
};
|
||||
|
||||
export const SITE_ROLES = {
|
||||
SITE_MANAGER: {
|
||||
ROLE: 'SiteManager',
|
||||
LABEL: 'Manager'
|
||||
},
|
||||
SITE_CONSUMER: {
|
||||
ROLE: 'SiteConsumer',
|
||||
LABEL: 'Consumer'
|
||||
},
|
||||
SITE_CONTRIBUTOR: {
|
||||
ROLE: 'SiteContributor',
|
||||
LABEL: 'Contributor'
|
||||
},
|
||||
SITE_COLLABORATOR: {
|
||||
ROLE: 'SiteCollaborator',
|
||||
LABEL: 'Collaborator'
|
||||
},
|
||||
NONE: {
|
||||
LABEL: 'Not a member'
|
||||
}
|
||||
};
|
||||
|
||||
export const SITE_VISIBILITY = {
|
||||
PUBLIC: 'PUBLIC',
|
||||
MODERATED: 'MODERATED',
|
||||
PRIVATE: 'PRIVATE'
|
||||
};
|
||||
|
Reference in New Issue
Block a user