[ACS-6066 ] playwright e2e other permissions (#3510)

* ACS-6066 other permissions test

* ACS-6066 other permissions test remove protractor

* ACS-6066 other permissions test remove protracto

* ACS-6066 other permissions remove code Duplicate

* ACS-6066 other permissions rebase

* ACS-6066 other permissions code cleanup

* code fix and remove protractor test

* review code fix

* review code fix

* fail test code fix
This commit is contained in:
Akash Rathod
2023-11-14 12:32:24 +01:00
committed by GitHub
parent 57ac20a8c5
commit 4877a0549b
14 changed files with 440 additions and 418 deletions

View File

@@ -22,12 +22,14 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Page } from '@playwright/test';
import { Page, expect } from '@playwright/test';
import { MatMenuComponent } from './dataTable';
import { BaseComponent } from './base.component';
export class AcaHeader extends BaseComponent {
private static rootElement = 'aca-toolbar';
private moreActionsButton = this.getChild('button[id="app.viewer.toolbar.more"]');
private toolbarMoreActions = this.getChild('button[id="app.toolbar.more"]');
public createButton = this.getChild('[id="app.toolbar.create"]');
public viewDetails = this.getChild('[title="View Details"]');
public viewButton = this.getChild('button[title="View"]');
@@ -46,11 +48,30 @@ export class AcaHeader extends BaseComponent {
await this.moreActionsButton.click();
}
async clickMoreActions(): Promise<void> {
await this.toolbarMoreActions.waitFor({ state: 'attached' });
await this.toolbarMoreActions.click();
}
async clickCreateFolderFromTemplate(): Promise<void> {
await this.createButton.click();
await this.matMenu.createFolderFromTemplate.click();
}
async verifyToolbarPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
let buttons = await this.page.$$('aca-toolbar button');
let actualPrimaryActions: string[] = await Promise.all(
buttons.map(async (button) => {
const title = await button.getAttribute('title');
return title || '';
})
);
for (const action of expectedToolbarPrimary) {
expect(actualPrimaryActions.includes(action), `Expected to contain ${action}`).toBe(true);
}
}
async clickCreateFileFromTemplate(): Promise<void> {
await this.createButton.click();
await this.matMenu.createFileFromTemplate.click();

View File

@@ -45,7 +45,7 @@ export class DataTableComponent extends BaseComponent {
getRowLocator = this.getChild(`adf-datatable-row`);
/** Locator to get "No results found" message */
getNoResultsFoundMessage = this.getChild('adf-custom-empty-content-template', { hasText: "No results found" });
getNoResultsFoundMessage = this.getChild('adf-custom-empty-content-template', { hasText: 'No results found' });
/**
* Method used in cases where we want to check that some record is visible in the datatable. It will consider whole row
@@ -210,13 +210,14 @@ export class DataTableComponent extends BaseComponent {
async selectItem(name: string): Promise<void> {
const isSelected = await this.hasCheckMarkIcon(name);
if (!isSelected) {
const row = this.getRowByName(name);
await row.locator('.mat-checkbox[id*="mat-checkbox"]').check();
let row = this.getRowByName(name);
await row.locator('[title="Size"]').click();
await row.locator('.adf-datatable-selected').waitFor({ state: 'attached' });
}
}
async hasCheckMarkIcon(itemName: string): Promise<boolean> {
const row = this.getRowByName(itemName);
return await row.locator('.mat-checkbox[class*="checked"]').isVisible();
return await row.locator('.adf-datatable-selected').isVisible();
}
}

View File

@@ -42,6 +42,39 @@ const searchConsumerSharedToolbarPrimary = ['Shared Link Settings', 'Download',
const consumerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
const consumerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
export const collaboratorToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
export const collaboratorEditRowToolbarMore = [
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
export const favoritesCollaboratorToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
export const collaboratorSharedToolbarPrimary = [
'Activate full-screen mode',
'Shared Link Settings',
'Download',
'Print',
'View Details',
'More Actions'
];
export const collaboratorDocToolbarMore = [
'Edit in Microsoft Office™',
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
export const collaboratorLockCurrentUserToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
export const collaboratorLockOtherUserToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
export const collaboratorLockOtherUserSearchToolbarMore = ['Cancel Editing', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
// ---- VIEWER ----
const consumerViewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];