mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6066] viewer special permissions playwright (#3453)
* [ACS-5923] sidenav and singleclick test * [ACS-5923] remove protractor test and fix flaky test * [ACS-5923] test fix * [ACS-5639] fix exclude test in viewer * [ACS-5923] remove exclude test and fix test * [ACS-6066] viewer special permissions playwright test * [ACS-6066] viewer protractor test remove * [ACS-6066] viewer failed test fix * [ACS-5923] review changes added * [ACS-5923] fix error in script
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
export class MatMenuComponent extends BaseComponent {
|
||||
private static rootElement = '.mat-menu-content';
|
||||
@@ -51,4 +52,18 @@ export class MatMenuComponent extends BaseComponent {
|
||||
await menuElement.waitFor({ state: 'attached' });
|
||||
return await menuElement.isVisible();
|
||||
}
|
||||
|
||||
async verifyActualMoreActions(expectedToolbarMore: string[]): Promise<void> {
|
||||
await this.page.locator('.mat-menu-content').waitFor({ state: 'attached' });
|
||||
let menus = await this.page.$$('.mat-menu-content .mat-menu-item');
|
||||
let actualMoreActions: string[] = await Promise.all(
|
||||
menus.map(async (button) => {
|
||||
const title = await (await button.$('span')).innerText();
|
||||
return title || '';
|
||||
})
|
||||
);
|
||||
for (const action of expectedToolbarMore) {
|
||||
expect(actualMoreActions.includes(action), `Expected to contain ${action} ${actualMoreActions}`).toBe(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ export class SearchInputComponent extends BaseComponent {
|
||||
}
|
||||
|
||||
async performDoubleClickFolderOrFileToOpen(name: string): Promise<void> {
|
||||
await this.getCellLinkByName(name).waitFor({ state: 'visible', timeout: timeouts.normal });
|
||||
await this.getCellLinkByName(name).waitFor({ state: 'visible', timeout: timeouts.medium });
|
||||
await this.getCellLinkByName(name).dblclick();
|
||||
await this.spinnerWaitForReload();
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from './base.component';
|
||||
import { AcaHeader } from './aca-header.component';
|
||||
import { timeouts } from '../../utils';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
export class ViewerComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-viewer';
|
||||
@@ -35,6 +36,7 @@ export class ViewerComponent extends BaseComponent {
|
||||
public fileTitleButtonLocator = this.getChild('.adf-viewer__file-title');
|
||||
public pdfViewerContentPages = this.getChild('.adf-pdf-viewer__content .page');
|
||||
public shareButton = this.getChild('button[id="share-action-button"]');
|
||||
public allButtons = this.getChild('button');
|
||||
|
||||
toolbar = new AcaHeader(this.page);
|
||||
|
||||
@@ -70,4 +72,23 @@ export class ViewerComponent extends BaseComponent {
|
||||
await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
|
||||
return await this.closeButtonLocator.getAttribute('title');
|
||||
}
|
||||
|
||||
async verifyViewerPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
|
||||
const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
|
||||
const removeClosePreviousNextOldInfo = (actions: string[]): string[] => actions.filter((elem) => !toRemove.includes(elem));
|
||||
|
||||
let buttons = await this.page.$$('adf-viewer button');
|
||||
let actualPrimaryActions: string[] = await Promise.all(
|
||||
buttons.map(async (button) => {
|
||||
const title = await button.getAttribute('title');
|
||||
return title || '';
|
||||
})
|
||||
);
|
||||
|
||||
actualPrimaryActions = removeClosePreviousNextOldInfo(actualPrimaryActions);
|
||||
|
||||
for (const action of expectedToolbarPrimary) {
|
||||
expect(actualPrimaryActions.includes(action), `Expected to contain ${action}`).toBe(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user