mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8063] Migrate editActions e2e from Protractor to Playwright (#3900)
* ACS-8063 Migrate editActions * Removed protractor edit folder tests and protractor e2e run from github
This commit is contained in:
26
e2e/playwright/edit-actions/.eslintrc.json
Normal file
26
e2e/playwright/edit-actions/.eslintrc.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "../../../.eslintrc.json",
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"e2e/playwright/edit-actions/tsconfig.e2e.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"plugins": [
|
||||
"rxjs",
|
||||
"unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-floating-promises": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
1
e2e/playwright/edit-actions/exclude.tests.json
Normal file
1
e2e/playwright/edit-actions/exclude.tests.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
42
e2e/playwright/edit-actions/playwright.config.ts
Normal file
42
e2e/playwright/edit-actions/playwright.config.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* Copyright © 2005-2024 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 { PlaywrightTestConfig } from '@playwright/test';
|
||||
import { CustomConfig, getGlobalConfig, getExcludedTestsRegExpArray } from '@alfresco/playwright-shared';
|
||||
import EXCLUDED_JSON from './exclude.tests.json';
|
||||
|
||||
const config: PlaywrightTestConfig<CustomConfig> = {
|
||||
...getGlobalConfig,
|
||||
|
||||
grepInvert: getExcludedTestsRegExpArray(EXCLUDED_JSON, 'Edit Actions'),
|
||||
projects: [
|
||||
{
|
||||
name: 'Edit Actions',
|
||||
testDir: './src/tests',
|
||||
use: {}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
22
e2e/playwright/edit-actions/project.json
Normal file
22
e2e/playwright/edit-actions/project.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "edit-actions-e2e",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "e2e/playwright/edit-actions",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"e2e": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"commands": ["npx playwright test --config=e2e/playwright/edit-actions/playwright.config.ts"]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "content-ce:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@angular-eslint/builder:lint"
|
||||
}
|
||||
}
|
||||
}
|
165
e2e/playwright/edit-actions/src/tests/edit-folder.e2e.ts
Executable file
165
e2e/playwright/edit-actions/src/tests/edit-folder.e2e.ts
Executable file
@@ -0,0 +1,165 @@
|
||||
/*!
|
||||
* Copyright © 2005-2024 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 { expect } from '@playwright/test';
|
||||
import { ApiClientFactory, NodesApi, Utils, test, TrashcanApi } from '@alfresco/playwright-shared';
|
||||
|
||||
test.describe('Edit folder', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
let parentId: string;
|
||||
let folderNameToEditId: string;
|
||||
|
||||
const username = `user-${Utils.random()}`;
|
||||
const parent = `parent-${Utils.random()}`;
|
||||
const folderName = `folder-${Utils.random()}`;
|
||||
const folderDescription = 'my folder description';
|
||||
|
||||
const folderNameToEdit = `folder-${Utils.random()}`;
|
||||
const duplicateFolderName = `folder-${Utils.random()}`;
|
||||
|
||||
const folderNameEdited = `folder-renamed-${Utils.random()}`;
|
||||
const folderDescriptionEdited = 'description edited';
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
|
||||
parentId = (await nodesApi.createFolder(parent)).entry.id;
|
||||
await nodesApi.createFolder(folderName, parentId, '', folderDescription);
|
||||
folderNameToEditId = (await nodesApi.createFolder(folderNameToEdit, parentId)).entry.id;
|
||||
await nodesApi.createFolder(duplicateFolderName, parentId);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, personalFiles }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(parent);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test.describe('on Personal Files', () => {
|
||||
test('[XAT-5089] "Edit folder" dialog UI', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
|
||||
await expect(personalFiles.editDialog.editDialog).toBeVisible();
|
||||
await expect(personalFiles.editDialog.titleInput).toHaveText('Edit folder');
|
||||
await expect(personalFiles.editDialog.nameInput).toHaveValue(folderName);
|
||||
await expect(personalFiles.editDialog.descriptionInput).toHaveValue(folderDescription);
|
||||
await expect(personalFiles.editDialog.cancelButton).toBeEnabled();
|
||||
await expect(personalFiles.editDialog.updateButton).toBeEnabled();
|
||||
});
|
||||
|
||||
test('[XAT-5093] Properties are modified when clicking Update button', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderNameToEdit);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.descriptionInput.fill(folderDescriptionEdited);
|
||||
await personalFiles.editDialog.nameInput.fill(folderNameEdited);
|
||||
await personalFiles.editDialog.updateButton.click();
|
||||
|
||||
await expect(personalFiles.editDialog.editDialog).toBeHidden();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folderNameEdited)).toBeTruthy();
|
||||
const description = await nodesApi.getNodeProperty(folderNameToEditId, 'cm:description');
|
||||
expect(description).toEqual(folderDescriptionEdited);
|
||||
});
|
||||
|
||||
test('[XAT-5090] Empty folder name', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.nameInput.fill('');
|
||||
|
||||
await expect(personalFiles.editDialog.updateButton).toBeDisabled();
|
||||
await expect(personalFiles.editDialog.fieldHint).toHaveText('Folder name is required');
|
||||
});
|
||||
|
||||
test('[XAT-5091] Folder name with special characters', async ({ personalFiles }) => {
|
||||
const namesWithSpecialChars = ['a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a'];
|
||||
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
|
||||
for (const name of namesWithSpecialChars) {
|
||||
await personalFiles.editDialog.nameInput.fill(name);
|
||||
await expect(personalFiles.editDialog.updateButton).toBeDisabled();
|
||||
expect(await personalFiles.editDialog.fieldHint.innerText()).toContain(`Folder name can't contain these characters`);
|
||||
}
|
||||
});
|
||||
|
||||
test('[XAT-5092] Folder name ending with a dot', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.nameInput.fill(`${folderName}.`);
|
||||
|
||||
await expect(personalFiles.editDialog.updateButton).toBeDisabled();
|
||||
expect(await personalFiles.editDialog.fieldHint.innerText()).toContain(`Folder name can't end with a period`);
|
||||
});
|
||||
|
||||
test('[XAT-5094] Cancel editing properties', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.cancelButton.click();
|
||||
|
||||
await expect(personalFiles.editDialog.editDialog).toBeHidden();
|
||||
});
|
||||
|
||||
test('[XAT-5095] Duplicated folder name', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.nameInput.fill(duplicateFolderName);
|
||||
await personalFiles.editDialog.updateButton.click();
|
||||
|
||||
await expect(personalFiles.editDialog.editDialog).toBeVisible();
|
||||
expect(await personalFiles.snackBar.getSnackBarMessage()).toEqual(`There's already a folder with this name. Try a different name.`);
|
||||
});
|
||||
|
||||
test('[XAT-5096] Trim ending spaces', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folderName);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Edit');
|
||||
await personalFiles.editDialog.nameInput.fill(`${folderName} `);
|
||||
await personalFiles.editDialog.updateButton.click();
|
||||
|
||||
await expect(personalFiles.editDialog.editDialog).toBeHidden();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folderName)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
94
e2e/playwright/edit-actions/src/tests/edit-offline.e2e.ts
Normal file
94
e2e/playwright/edit-actions/src/tests/edit-offline.e2e.ts
Normal file
@@ -0,0 +1,94 @@
|
||||
/*!
|
||||
* Copyright © 2005-2024 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 { expect } from '@playwright/test';
|
||||
import { ApiClientFactory, NodesApi, Utils, test, TrashcanApi, FileActionsApi, TEST_FILES } from '@alfresco/playwright-shared';
|
||||
|
||||
test.describe('Edit offline - on Personal Files', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let fileActionsApi: FileActionsApi;
|
||||
|
||||
let parentPFId: string;
|
||||
let fileLockedId: string;
|
||||
let fileLocked2Id: string;
|
||||
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const file1 = `file1-${Utils.random()}.docx`;
|
||||
const fileLocked = `file-locked-${Utils.random()}.docx`;
|
||||
const fileLocked2 = `file-locked2-${Utils.random()}.docx`;
|
||||
const parentPF = `parentPersonal-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
fileActionsApi = await FileActionsApi.initialize(username, username);
|
||||
|
||||
parentPFId = (await nodesApi.createFolder(parentPF)).entry.id;
|
||||
fileLockedId = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked, parentPFId)).entry.id;
|
||||
fileLocked2Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked2, parentPFId)).entry.id;
|
||||
await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, file1, parentPFId);
|
||||
|
||||
await nodesApi.lockNodes([fileLockedId, fileLocked2Id]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, personalFiles }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(parentPF);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[XAT-5304] File is locked and downloaded when clicking Edit offline', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(file1);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Edit Offline');
|
||||
const [download] = await Promise.all([personalFiles.page.waitForEvent('download')]);
|
||||
expect(download.suggestedFilename()).toBe(file1);
|
||||
});
|
||||
|
||||
test('XAT-5305] Lock information is displayed', async ({ personalFiles }) => {
|
||||
expect(await personalFiles.dataTable.isItemPresent(fileLocked2)).toBe(true);
|
||||
expect(await personalFiles.dataTable.getLockOwner(fileLocked2)).toContain(username);
|
||||
});
|
||||
|
||||
test('[XAT-5306] Cancel Editing unlocks the file', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(fileLocked);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Cancel Editing');
|
||||
await personalFiles.dataTable.selectItem(fileLocked);
|
||||
|
||||
expect(await nodesApi.isFileLockedWrite(fileLockedId), `${fileLocked} is still locked`).not.toEqual('WRITE_LOCK');
|
||||
});
|
||||
});
|
15
e2e/playwright/edit-actions/tsconfig.e2e.adf.json
Normal file
15
e2e/playwright/edit-actions/tsconfig.e2e.adf.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.adf.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/e2e",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"target": "es2017",
|
||||
"types": ["jasmine", "jasminewd2", "node"],
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
15
e2e/playwright/edit-actions/tsconfig.e2e.json
Executable file
15
e2e/playwright/edit-actions/tsconfig.e2e.json
Executable file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/e2e",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"target": "es2017",
|
||||
"types": ["jasmine", "jasminewd2", "node", "@playwright/test"],
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"@alfresco/playwright-shared": ["../../../projects/aca-playwright-shared/src/index.ts"]
|
||||
}
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
@@ -188,6 +188,7 @@ test.describe('viewer action file', () => {
|
||||
await personalFiles.uploadNewVersionDialog.majorOption.click();
|
||||
await personalFiles.uploadNewVersionDialog.description.fill('new major version description');
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.click();
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.waitFor({ state: 'detached' });
|
||||
await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
|
||||
expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is not open').toBe(true);
|
||||
expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toContain(docxFile2);
|
||||
@@ -202,14 +203,15 @@ test.describe('viewer action file', () => {
|
||||
await Utils.uploadFileNewVersion(personalFiles, docxFile);
|
||||
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.click();
|
||||
await personalFiles.uploadNewVersionDialog.uploadButton.waitFor({ state: 'detached' });
|
||||
await expect(personalFiles.uploadNewVersionDialog.cancelButton).toHaveCount(0);
|
||||
|
||||
await personalFiles.viewer.waitForViewerToOpen();
|
||||
expect(await personalFiles.viewer.fileTitleButtonLocator.innerText()).toContain(docxFile);
|
||||
|
||||
await personalFiles.acaHeader.clickViewerMoreActions();
|
||||
await expect(personalFiles.matMenu.cancelEditingAction, `'Cancel Editing' button shouldn't be shown`).toBeHidden();
|
||||
await expect(personalFiles.matMenu.editOfflineAction, `'Edit Offline' should be shown`).toBeVisible();
|
||||
await expect(personalFiles.matMenu.getMenuItemFromHeaderMenu('Cancel Editing'), `'Cancel Editing' button shouldn't be shown`).toBeHidden();
|
||||
await expect(personalFiles.matMenu.getMenuItemFromHeaderMenu('Edit Offline'), `'Edit Offline' should be shown`).toBeVisible();
|
||||
});
|
||||
|
||||
test('[C286384] Copy action from Recent Files', async ({ recentFilesPage, personalFiles }) => {
|
||||
|
Reference in New Issue
Block a user