mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5511] create library playwright tests (#3318)
* [ACS-511]-adding-library-tests * updating tests and adding before and after all * spinner timeouts update * updating import statement * update error locator * adding random method in general utils * [ACA-4715] break dependency on envsubst (#3325) * remove BPM host * break dependency on envsubst * remove prebuild script * cleanup package.json * [ACS-511]-adding-library-tests * adding lost MyLibrariesPage import * rebase page initialization merge * [ACS-511]-adding-library-tests * comma deleted * fix readability and indentation * adding id to info drawer * adding index and updating import * updating after wrong rebase * after rebase * updating tests and adding before and after all * updating import statement * update error locator * adding random method in general utils * [ACS-511]-adding-library-tests * comma deleted * fix readability and indentation * adding id to info drawer * adding index and updating import * next after rebase * update delete in folder tests * providing string as parameter * after rebase * updating tests and adding before and after all * adding random method in general utils * [ACS-511]-adding-library-tests * comma deleted * [ACS-511]-adding-library-tests * adding index and updating import * providing string as parameter * delete protractor create-library tests * update for calls in expect method * bump to 4.2.0 (#3334) * adding random method in general utils * adding index and updating import * providing string as parameter * after rebase * providing string as parameter * update for tests C280026 and C280027 * raising time for visibility check * quotes change in error strings * adding waitFor method * raising timeout in isErrorMessageDisplayed method * updating mat-error locator * adding press tab after fill * update general-utils to utils for random * updating label typo --------- Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
import { test as base } from '@playwright/test';
|
||||
import {
|
||||
MyLibrariesPage,
|
||||
FileActionsApi,
|
||||
NodesPage,
|
||||
PersonalFilesPage,
|
||||
@@ -38,6 +39,7 @@ import {
|
||||
interface Pages {
|
||||
personalFiles: PersonalFilesPage;
|
||||
nodesPage: NodesPage;
|
||||
myLibrariesPage: MyLibrariesPage;
|
||||
recentFilesPage: RecentFilesPage;
|
||||
sharedPage: SharedPage;
|
||||
searchPage: SearchPage;
|
||||
@@ -80,5 +82,8 @@ export const test = base.extend<Pages & Api>({
|
||||
// eslint-disable-next-line no-empty-pattern
|
||||
favoritesPageAction: async ({}, use) => {
|
||||
await use(await FavoritesPageApi.initialize('admin'));
|
||||
},
|
||||
myLibrariesPage: async ({ page }, use) => {
|
||||
await use(new MyLibrariesPage(page));
|
||||
}
|
||||
});
|
||||
|
@@ -24,10 +24,10 @@
|
||||
|
||||
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"]');
|
||||
public viewDetails = this.getChild('[title="View Details"]');
|
||||
public viewButton = this.getChild('button[title="View"]');
|
||||
public searchButton = this.getChild('button[title="Search"]');
|
||||
|
||||
|
@@ -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 AdfInfoDrawerComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-info-drawer';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AdfInfoDrawerComponent.rootElement);
|
||||
}
|
||||
|
||||
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 getDescriptionField = (labelText: string) => this.getChild('[data-automation-id="library-description-properties-wrapper"]', { hasText: labelText });
|
||||
}
|
@@ -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 { BaseComponent } from '../base.component';
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class AdfBreadcrumbComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-breadcrumb';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AdfBreadcrumbComponent.rootElement);
|
||||
}
|
||||
|
||||
public getBreadcrumbItem = (text: string) => this.getChild('.adf-breadcrumb-item-current', { hasText: text });
|
||||
}
|
@@ -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 './breadcrumb.component';
|
@@ -171,6 +171,11 @@ export class DataTableComponent extends BaseComponent {
|
||||
return this.contextMenuActions.getButtonByText(action);
|
||||
}
|
||||
|
||||
async performActionInExpandableMenu(name: string | number, action: string): Promise<void> {
|
||||
await this.getRowByName(name).click({ button: 'right' });
|
||||
await this.contextMenuActions.getButtonByText(action).click();
|
||||
}
|
||||
|
||||
async goThroughPagesLookingForRowWithName(name: string | number): Promise<void> {
|
||||
await this.spinnerWaitForReload();
|
||||
if (await this.getRowByName(name).isVisible()) {
|
||||
|
@@ -35,5 +35,6 @@ export class MatMenuComponent extends BaseComponent {
|
||||
public getMenuItemsLocator = this.getChild('button');
|
||||
public getMenuItemTextLocator = this.getChild('[data-automation-id="menu-item-title"]');
|
||||
public createFolder = this.getChild('[id="app.create.folder"]');
|
||||
public createLibrary = this.getChild('[id="app.create.library"]');
|
||||
public getButtonByText = (text: string) => this.getChild('button', { hasText: text });
|
||||
}
|
||||
|
@@ -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 { timeouts } from '../../../utils';
|
||||
import { BaseComponent } from '../base.component';
|
||||
import { Locator, Page } from '@playwright/test';
|
||||
|
||||
export class AdfLibraryDialogComponent extends BaseComponent {
|
||||
private static rootElement = 'adf-library-dialog';
|
||||
|
||||
public createButton = this.getChild('[data-automation-id="create-library-id"]');
|
||||
public cancelButton = this.getChild('[data-automation-id="cancel-library-id"]');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, AdfLibraryDialogComponent.rootElement);
|
||||
}
|
||||
|
||||
public getLabelText = (text: string) => this.getChild('label', { hasText: text });
|
||||
public getDialogTitle = (text: string) => this.getChild('.mat-dialog-title', { hasText: text });
|
||||
public getErrorByText = (text: string): Locator => this.page.locator('mat-error', {hasText: text});
|
||||
|
||||
/**
|
||||
* This method is used when we want to fill in Create Library Dialog and choose Create button
|
||||
*
|
||||
* @param nameInput input for the Name field
|
||||
* @param libraryIdInput input for Library ID field
|
||||
* @param descriptionInput input for Description field
|
||||
* @param visibility visibility of the library
|
||||
*/
|
||||
async createLibraryWithNameAndId(nameInput: string, libraryIdInput: string, descriptionInput?: string, visibility?: string): Promise<void> {
|
||||
await this.getLabelText('Name *').fill(nameInput);
|
||||
await this.getLabelText('Library ID *').clear();
|
||||
await this.getLabelText('Library ID *').fill(libraryIdInput);
|
||||
if (descriptionInput) { await this.getLabelText('Description').fill(descriptionInput); }
|
||||
if (visibility) { await this.getLabelText(visibility).click(); }
|
||||
await this.createButton.click();
|
||||
}
|
||||
|
||||
async isErrorMessageDisplayed(errorText: string): Promise<boolean> {
|
||||
await this.getErrorByText(errorText).waitFor({ state: 'visible', timeout: timeouts.large });
|
||||
return await this.getErrorByText(errorText).isVisible();
|
||||
}
|
||||
}
|
@@ -23,3 +23,5 @@
|
||||
*/
|
||||
|
||||
export * from './adf-folder-dialog.component';
|
||||
export * from './adf-library-dialog.component';
|
||||
|
||||
|
@@ -31,6 +31,9 @@ export * from './spinner.component';
|
||||
export * from './actions-dropdown.component';
|
||||
export * from './conditions.component';
|
||||
export * from './pagination.component';
|
||||
export * from './breadcrumb';
|
||||
export * from './adf-info-drawer.component';
|
||||
export * from './viewer.component';
|
||||
export * from './search/search-input.component';
|
||||
export * from './search/search-overlay.components';
|
||||
|
||||
|
@@ -26,6 +26,7 @@ export * from './base.page';
|
||||
export * from './login.page';
|
||||
export * from './nodes.page';
|
||||
export * from './personal-files.page';
|
||||
export * from './my-libraries.page';
|
||||
export * from './recent-files.page';
|
||||
export * from './shared.page';
|
||||
export * from './search.page';
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* 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 { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfBreadcrumbComponent, AdfInfoDrawerComponent, AdfLibraryDialogComponent, DataTableComponent, MatMenuComponent } from '../components';
|
||||
|
||||
export class MyLibrariesPage extends BasePage {
|
||||
private static pageUrl = 'libraries';
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, MyLibrariesPage.pageUrl);
|
||||
}
|
||||
public acaHeader = new AcaHeader(this.page);
|
||||
public matMenu = new MatMenuComponent(this.page);
|
||||
public libraryDialog = new AdfLibraryDialogComponent(this.page);
|
||||
public dataTable = new DataTableComponent(this.page);
|
||||
public breadcrumb = new AdfBreadcrumbComponent(this.page);
|
||||
public libraryDetails = new AdfInfoDrawerComponent (this.page);
|
||||
|
||||
async selectCreateLibrary(): Promise<void> {
|
||||
await this.acaHeader.createButton.click();
|
||||
await this.matMenu.createLibrary.click();
|
||||
}
|
||||
|
||||
}
|
@@ -27,3 +27,5 @@ export * from './timeouts';
|
||||
export * from './exclude-tests';
|
||||
export * from './state-helper';
|
||||
export * from './folder-errors';
|
||||
export * from './utils';
|
||||
export * from './library-errors';
|
||||
|
29
projects/aca-playwright-shared/src/utils/library-errors.ts
Normal file
29
projects/aca-playwright-shared/src/utils/library-errors.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/>.
|
||||
*/
|
||||
|
||||
export const libraryErrors = {
|
||||
libraryIdIsNotAvailable: "This Library ID isn't available. Try a different Library ID.",
|
||||
libraryIdIsAlreadyUsed: "This Library ID is already used. Check the trashcan.",
|
||||
useNumbersAndLettersOnly: "Use numbers and letters only"
|
||||
}
|
@@ -28,6 +28,7 @@ export const timeouts = {
|
||||
short: 1000,
|
||||
normal: 2000,
|
||||
medium: 5000,
|
||||
big: 7500,
|
||||
large: 10000,
|
||||
extraLarge: 20 * 1000,
|
||||
globalTest: 45 * 1000,
|
||||
|
33
projects/aca-playwright-shared/src/utils/utils.ts
Normal file
33
projects/aca-playwright-shared/src/utils/utils.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 crypto = require('crypto');
|
||||
|
||||
export class Utils {
|
||||
|
||||
static random(): string {
|
||||
return crypto.getRandomValues(new Uint32Array(1))[0].toString(36).substring(0, 5).toLowerCase();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user