mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6437] viewer e2e test migrate to playwright (#3704)
* rebase * [ACS-6437] view protractor migrate to playwright * [ACS-6437] review changes * [ACS-6437] review changes
This commit is contained in:
@@ -418,29 +418,9 @@ export class NodesApi {
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedId(nodeId: string): Promise<string> {
|
||||
try {
|
||||
const sharedId = await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
||||
return sharedId || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getSharedId.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedExpiryDate(nodeId: string): Promise<string> {
|
||||
try {
|
||||
const expiryDate = await this.getNodeProperty(nodeId, 'qshare:expiryDate');
|
||||
return expiryDate || '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.getSharedExpiryDate.name}`, error);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async isFileShared(nodeId: string): Promise<boolean> {
|
||||
try {
|
||||
const sharedId = await this.getSharedId(nodeId);
|
||||
const sharedId = await this.getNodeProperty(nodeId, 'qshare:sharedId');
|
||||
return sharedId !== '';
|
||||
} catch (error) {
|
||||
console.error(`${this.constructor.name} ${this.isFileShared.name}`, error);
|
||||
|
@@ -39,6 +39,8 @@ export class MatMenuComponent extends BaseComponent {
|
||||
public createFileFromTemplate = this.getChild('[id="app.create.fileFromTemplate"]');
|
||||
public createLibrary = this.getChild('[id="app.create.library"]');
|
||||
public getButtonByText = (text: string) => this.getChild('button', { hasText: text });
|
||||
public cancelEditingAction = this.getChild(`.mat-menu-item[title='Cancel Editing']`);
|
||||
public editOfflineAction = this.getChild(`.mat-menu-item[title='Edit Offline']`);
|
||||
|
||||
async clickMenuItem(menuItem: string): Promise<void> {
|
||||
const menuElement = this.getButtonByText(menuItem);
|
||||
|
@@ -30,3 +30,4 @@ export * from './content-node-selector-dialog';
|
||||
export * from './create-from-template-dialog-component';
|
||||
export * from './adf-confirm-dialog.component';
|
||||
export * from './share-dialog.component';
|
||||
export * from './upload-new-version-dialog.component';
|
||||
|
@@ -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
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Page } from '@playwright/test';
|
||||
import { BaseComponent } from '../base.component';
|
||||
|
||||
export class UploadNewVersionDialog extends BaseComponent {
|
||||
private static rootElement = 'adf-new-version-uploader-dialog';
|
||||
|
||||
public cancelButton = this.getChild('#adf-new-version-cancel');
|
||||
public uploadButton = this.getChild('[data-automation-id="adf-new-version-file-upload"]');
|
||||
public majorOption = this.getChild('#adf-new-version-major');
|
||||
public description = this.getChild('#adf-new-version-text-area');
|
||||
|
||||
constructor(page: Page) {
|
||||
super(page, UploadNewVersionDialog.rootElement);
|
||||
}
|
||||
}
|
@@ -40,7 +40,8 @@ import {
|
||||
ErrorComponent,
|
||||
ShareDialogComponent,
|
||||
AdfConfirmDialogComponent,
|
||||
AdfInfoDrawerComponent
|
||||
AdfInfoDrawerComponent,
|
||||
UploadNewVersionDialog
|
||||
} from '../components';
|
||||
|
||||
export class PersonalFilesPage extends BasePage {
|
||||
@@ -63,9 +64,10 @@ export class PersonalFilesPage extends BasePage {
|
||||
public createFromTemplateDialogComponent = new CreateFromTemplateDialogComponent(this.page);
|
||||
public pagination = new PaginationComponent(this.page);
|
||||
public errorDialog = new ErrorComponent(this.page);
|
||||
public shareDialog= new ShareDialogComponent(this.page);
|
||||
public shareDialog = new ShareDialogComponent(this.page);
|
||||
public confirmDialog = new AdfConfirmDialogComponent(this.page);
|
||||
public infoDrawer = new AdfInfoDrawerComponent(this.page);
|
||||
public uploadNewVersionDialog = new UploadNewVersionDialog(this.page);
|
||||
|
||||
async selectCreateFolder(): Promise<void> {
|
||||
await this.acaHeader.createButton.click();
|
||||
|
@@ -26,7 +26,7 @@ import { Page } from '@playwright/test';
|
||||
import { BasePage } from './base.page';
|
||||
import { DataTableComponent, MatMenuComponent, ViewerComponent, SidenavComponent, Breadcrumb, AdfInfoDrawerComponent } from '../components';
|
||||
import { AcaHeader } from '../components/aca-header.component';
|
||||
import { AdfFolderDialogComponent } from '../components/dialogs';
|
||||
import { AdfFolderDialogComponent, ContentNodeSelectorDialog } from '../components/dialogs';
|
||||
|
||||
export class RecentFilesPage extends BasePage {
|
||||
private static pageUrl = 'recent-files';
|
||||
@@ -43,4 +43,5 @@ export class RecentFilesPage extends BasePage {
|
||||
public sidenav = new SidenavComponent(this.page);
|
||||
public breadcrumb = new Breadcrumb(this.page);
|
||||
public infoDrawer = new AdfInfoDrawerComponent(this.page);
|
||||
public contentNodeSelector = new ContentNodeSelectorDialog(this.page);
|
||||
}
|
||||
|
@@ -23,11 +23,11 @@
|
||||
*/
|
||||
|
||||
const crypto = require('crypto');
|
||||
import { LoginPage } from '../';
|
||||
import * as path from 'path';
|
||||
import { LoginPage, PersonalFilesPage } from '../';
|
||||
import { NodesApi, TrashcanApi, SitesApi } from '@alfresco/playwright-shared';
|
||||
|
||||
export class Utils {
|
||||
|
||||
static string257Long = 'x'.repeat(257);
|
||||
static string513Long = 'x'.repeat(513);
|
||||
|
||||
@@ -49,15 +49,15 @@ export class Utils {
|
||||
return new Date(date).toLocaleDateString('en-US');
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Method used to login user with navigation. Also waits for the page to load after login
|
||||
*
|
||||
*
|
||||
* @param loginPage page context passed from the test
|
||||
* @param username username string
|
||||
* @param password password string
|
||||
* @param errorMessage error message string if the login fails
|
||||
*
|
||||
*/
|
||||
*
|
||||
*/
|
||||
static async tryLoginUser(loginPage: LoginPage, username: string, password: string, errorMessage = 'Error '): Promise<void> {
|
||||
try {
|
||||
await loginPage.loginUser({ username, password }, { withNavigation: true, waitForLoading: true });
|
||||
@@ -66,17 +66,23 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Method used to delete nodes and sites from user's account
|
||||
*
|
||||
*
|
||||
* @param nodesApi nodesApi initialized with user credentials passed from the test
|
||||
* @param trashcanApi trashcanApi initialized with user credentials passed from the test
|
||||
* @param errorMessage error message string if the deleting sites/nodes fails
|
||||
* @param sitesApi sitesApi initialized with user credentials passed from the test
|
||||
* @param sitesToDelete array of sites' ids
|
||||
*
|
||||
*/
|
||||
static async deleteNodesSitesEmptyTrashcan(nodesApi?: NodesApi, trashcanApi?: TrashcanApi, errorMessage = 'Error ', sitesApi?: SitesApi, sitesToDelete?: string[]): Promise<void> {
|
||||
*
|
||||
*/
|
||||
static async deleteNodesSitesEmptyTrashcan(
|
||||
nodesApi?: NodesApi,
|
||||
trashcanApi?: TrashcanApi,
|
||||
errorMessage = 'Error ',
|
||||
sitesApi?: SitesApi,
|
||||
sitesToDelete?: string[]
|
||||
): Promise<void> {
|
||||
try {
|
||||
await nodesApi?.deleteCurrentUserNodes();
|
||||
await trashcanApi?.emptyTrashcan();
|
||||
@@ -87,4 +93,9 @@ export class Utils {
|
||||
console.error(`${errorMessage}: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
static async uploadFileNewVersion(personalFilesPage: PersonalFilesPage, fileFromOS: string): Promise<void> {
|
||||
const fileInput = await personalFilesPage.page.$('#app-upload-file-version');
|
||||
await fileInput.setInputFiles(path.join(__dirname, `../resources/test-files/${fileFromOS}.docx`));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user