mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6435] playwright e2e for list views personal files (#3551)
* [ACS-6435] playwright e2e for list views personal files * e2e test for trash page * e2e test for trash page * e2e test for file-libraries page * e2e test for file-libraries page fix * e2e test for file-libraries page fix * e2e test shared recent page * e2e test shared recent page fix * e2e test review comment fix * e2e test review fix flaky test fix * e2e test fail test fix * e2e test fail fix * test code fix * protractor list-view test enable
This commit is contained in:
@@ -73,7 +73,7 @@ export class SharedLinksApi {
|
||||
return await this.apiService.share.listSharedLinks(opts);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi getSharedLinks : catch : `, error);
|
||||
return new SharedLinkPaging;
|
||||
return new SharedLinkPaging();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,4 +95,47 @@ export class SharedLinksApi {
|
||||
console.error(`\tWait timeout reached waiting for files to be shared`);
|
||||
}
|
||||
}
|
||||
|
||||
private async getSharedIdOfNode(fileId: string): Promise<string> {
|
||||
try {
|
||||
const sharedLinksEntries = (await this.getSharedLinks())?.list.entries;
|
||||
const found = sharedLinksEntries.find((sharedLink) => sharedLink.entry.nodeId === fileId);
|
||||
return found?.entry.id;
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi getSharedIdOfNode : catch : `, error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async unshareFileById(fileId: string): Promise<void> {
|
||||
try {
|
||||
const sharedId = await this.getSharedIdOfNode(fileId);
|
||||
return await this.apiService.share.deleteSharedLink(sharedId);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi unshareFileById : catch : `, error);
|
||||
}
|
||||
}
|
||||
|
||||
async waitForFilesToNotBeShared(filesIds: string[]): Promise<any> {
|
||||
try {
|
||||
const sharedFile = async () => {
|
||||
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
|
||||
|
||||
const foundItems = filesIds.some((id) => {
|
||||
return sharedFiles.includes(id);
|
||||
});
|
||||
|
||||
if (foundItems) {
|
||||
return Promise.reject(foundItems);
|
||||
} else {
|
||||
return Promise.resolve(foundItems);
|
||||
}
|
||||
};
|
||||
|
||||
return await Utils.retryCall(sharedFile);
|
||||
} catch (error) {
|
||||
console.error(`SharedLinksApi waitForFilesToNotBeShared : catch : ${error}`);
|
||||
console.error(`\tWait timeout reached waiting for files to no longer be shared`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -50,6 +50,7 @@ interface Pages {
|
||||
sharedPage: SharedPage;
|
||||
searchPage: SearchPage;
|
||||
favoritePage: FavoritesPage;
|
||||
favoritesLibrariesPage: FavoritesLibrariesPage;
|
||||
trashPage: TrashPage;
|
||||
loginPage: LoginPage;
|
||||
favoriteLibrariesPage: FavoritesLibrariesPage;
|
||||
@@ -82,6 +83,9 @@ export const test = base.extend<Pages & Api>({
|
||||
favoritePage: async ({ page }, use) => {
|
||||
await use(new FavoritesPage(page));
|
||||
},
|
||||
favoritesLibrariesPage: async ({ page }, use) => {
|
||||
await use(new FavoritesLibrariesPage(page));
|
||||
},
|
||||
trashPage: async ({ page }, use) => {
|
||||
await use(new TrashPage(page));
|
||||
},
|
||||
|
@@ -26,6 +26,7 @@ import { Locator, Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { MatMenuComponent } from './mat-menu.component';
|
||||
import { PaginationActionsType, PaginationComponent } from '../pagination.component';
|
||||
import { timeouts } from '../../../utils';
|
||||
|
||||
export class DataTableComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-datatable';
|
||||
@@ -40,6 +41,9 @@ export class DataTableComponent extends BaseComponent {
|
||||
getEmptyContentTitleLocator = this.getChild('adf-empty-content .adf-empty-content__title');
|
||||
getEmptyContentSubTitleLocator = this.getChild('adf-empty-content .adf-empty-content__subtitle');
|
||||
getSelectedRow = this.getChild('.adf-datatable-row.adf-is-selected');
|
||||
sortedColumnHeader = this.getChild(`.adf-datatable__header--sorted-asc .adf-datatable-cell-header-content .adf-datatable-cell-value,
|
||||
.adf-datatable__header--sorted-desc .adf-datatable-cell-header-content .adf-datatable-cell-value`);
|
||||
columnHeaders = this.getChild('.adf-datatable-row .adf-datatable-cell-header .adf-datatable-cell-value');
|
||||
|
||||
/** Locator for row (or rows) */
|
||||
getRowLocator = this.getChild(`adf-datatable-row`);
|
||||
@@ -188,7 +192,7 @@ export class DataTableComponent extends BaseComponent {
|
||||
|
||||
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
|
||||
await this.spinnerWaitForReload();
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
if ((await this.getRowByName(name).isVisible()) || (await this.pagination.totalPageLocator.textContent()) === ' of 1 ') {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -234,4 +238,47 @@ export class DataTableComponent extends BaseComponent {
|
||||
const row = this.getRowByName(itemName);
|
||||
return await row.locator('.adf-datatable-selected').isVisible();
|
||||
}
|
||||
|
||||
async getColumnHeaders(): Promise<Array<string>> {
|
||||
const columnNameLocator = this.columnHeaders;
|
||||
await this.columnHeaders.nth(0).waitFor({ state: 'attached' });
|
||||
return columnNameLocator.allTextContents();
|
||||
}
|
||||
|
||||
async getSortedColumnHeaderText(): Promise<string> {
|
||||
return this.sortedColumnHeader.innerText();
|
||||
}
|
||||
|
||||
private getItemLocationEl(name: string): Locator {
|
||||
return this.getRowByName(name).locator('.aca-location-link');
|
||||
}
|
||||
|
||||
async getItemLocationText(name: string): Promise<string> {
|
||||
await this.getItemLocationEl(name).locator('a').waitFor({ state: 'attached' });
|
||||
return this.getItemLocationEl(name).innerText();
|
||||
}
|
||||
|
||||
async getItemLocationTooltip(name: string): Promise<string> {
|
||||
const location = this.getItemLocationEl(name);
|
||||
await location.hover();
|
||||
return location.locator('a').getAttribute('title', { timeout: timeouts.normal });
|
||||
}
|
||||
|
||||
async clickItemLocation(name: string): Promise<void> {
|
||||
await this.getItemLocationEl(name).click();
|
||||
}
|
||||
|
||||
async getSortingOrder(): Promise<string> {
|
||||
const str = await this.sortedColumnHeader.locator('../..').getAttribute('class');
|
||||
if (str.includes('asc')) {
|
||||
return 'asc';
|
||||
} else if (str.includes('desc')) {
|
||||
return 'desc';
|
||||
}
|
||||
return 'none';
|
||||
}
|
||||
|
||||
async getRowAllInnerTexts(name: string): Promise<string> {
|
||||
return (await this.getRowByName(name).locator('span').allInnerTexts()).toString();
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent } from '../components';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, PaginationComponent, Breadcrumb } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
|
||||
|
||||
@@ -43,6 +43,7 @@ export class FavoritesPage extends BasePage {
|
||||
public viewerDialog = new ViewerOverlayDialogComponent(this.page);
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public pagination = new PaginationComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
|
||||
async waitForPageLoad() {
|
||||
await this.page.waitForURL(`**/${FavoritesPage.pageUrl}`);
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent } from '../components/dialogs';
|
||||
|
||||
@@ -41,4 +41,5 @@ export class RecentFilesPage extends BasePage {
|
||||
public dataTable = new DataTableComponent(this.page);
|
||||
public viewer = new ViewerComponent(this.page);
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
|
||||
|
||||
@@ -42,4 +42,5 @@ export class SharedPage extends BasePage {
|
||||
public viewer = new ViewerComponent(this.page);
|
||||
public viewerDialog = new ViewerOverlayDialogComponent(this.page);
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent } from '../components';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent, ViewerOverlayDialogComponent } from '../components/dialogs';
|
||||
|
||||
@@ -42,4 +42,5 @@ export class TrashPage extends BasePage {
|
||||
public viewer = new ViewerComponent(this.page);
|
||||
public viewerDialog = new ViewerOverlayDialogComponent(this.page);
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
}
|
||||
|
Reference in New Issue
Block a user