mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-5016] [E2E] delete actions migrated to playwright (#3868)
* [ACS-5016] [E2E] delete actions migrated to playwright * [ACS-5016] sonar fix 1 * [ACS-5016] sonar fix 2 * [ACS-5016] upload.effects.spec.ts reverted * [ACS-5016] upload-file.test.ts reverted * [ACS-5016] review fix 1
This commit is contained in:
26
e2e/playwright/delete-actions/.eslintrc.json
Normal file
26
e2e/playwright/delete-actions/.eslintrc.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"extends": "../../../.eslintrc.json",
|
||||
"ignorePatterns": [
|
||||
"!**/*"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.ts"
|
||||
],
|
||||
"parserOptions": {
|
||||
"project": [
|
||||
"e2e/playwright/delete-actions/tsconfig.e2e.json"
|
||||
],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"plugins": [
|
||||
"rxjs",
|
||||
"unicorn"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-floating-promises": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
1
e2e/playwright/delete-actions/exclude.tests.json
Normal file
1
e2e/playwright/delete-actions/exclude.tests.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
42
e2e/playwright/delete-actions/playwright.config.ts
Normal file
42
e2e/playwright/delete-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, 'Delete Actions'),
|
||||
projects: [
|
||||
{
|
||||
name: 'Delete Actions',
|
||||
testDir: './src/tests',
|
||||
use: {}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default config;
|
22
e2e/playwright/delete-actions/project.json
Normal file
22
e2e/playwright/delete-actions/project.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "delete-actions-e2e",
|
||||
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "e2e/playwright/delete-actions",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"e2e": {
|
||||
"executor": "nx:run-commands",
|
||||
"options": {
|
||||
"commands": ["npx playwright test --config=e2e/playwright/delete-actions/playwright.config.ts"]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"devServerTarget": "content-ce:serve:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@angular-eslint/builder:lint"
|
||||
}
|
||||
}
|
||||
}
|
238
e2e/playwright/delete-actions/src/tests/delete-undo-delete.e2e.ts
Executable file
238
e2e/playwright/delete-actions/src/tests/delete-undo-delete.e2e.ts
Executable file
@@ -0,0 +1,238 @@
|
||||
/*!
|
||||
* 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('Delete and undo delete', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
|
||||
const username = `user-${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);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test.describe('on Personal Files', () => {
|
||||
const file1 = `file1-${Utils.random()}.txt`;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
const file4 = `file4-${Utils.random()}.txt`;
|
||||
const file5 = `file5-${Utils.random()}.txt`;
|
||||
const file6 = `file6-${Utils.random()}.txt`;
|
||||
const file7 = `file7-${Utils.random()}.txt`;
|
||||
|
||||
const folder1 = `folder1-${Utils.random()}`;
|
||||
const folder2 = `folder2-${Utils.random()}`;
|
||||
const folder3 = `folder3-${Utils.random()}`;
|
||||
const folder4 = `folder4-${Utils.random()}`;
|
||||
const folder5 = `folder5-${Utils.random()}`;
|
||||
const folder6 = `folder6-${Utils.random()}`;
|
||||
|
||||
const file1InFolder = `file1InFolder-${Utils.random()}.txt`;
|
||||
const file2InFolder = `file2InFolder-${Utils.random()}.txt`;
|
||||
const fileLocked1 = `fileLocked1-${Utils.random()}.txt`;
|
||||
let fileLocked1Id: string;
|
||||
const fileLocked2 = `fileLocked2-${Utils.random()}.txt`;
|
||||
let fileLocked2Id: string;
|
||||
const fileLocked3 = `fileLocked3-${Utils.random()}.txt`;
|
||||
let fileLocked3Id: string;
|
||||
const fileLocked4 = `fileLocked4-${Utils.random()}.txt`;
|
||||
let fileLocked4Id: string;
|
||||
|
||||
const parent = `parentPF-${Utils.random()}`;
|
||||
let parentId: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
parentId = (await nodesApi.createFolder(parent)).entry.id;
|
||||
|
||||
await nodesApi.createFile(file1, parentId);
|
||||
await nodesApi.createFile(file2, parentId);
|
||||
await nodesApi.createFile(file3, parentId);
|
||||
await nodesApi.createFile(file4, parentId);
|
||||
await nodesApi.createFile(file5, parentId);
|
||||
await nodesApi.createFile(file6, parentId);
|
||||
await nodesApi.createFile(file7, parentId);
|
||||
|
||||
const folder1Id = (await nodesApi.createFolder(folder1, parentId)).entry.id;
|
||||
const folder2Id = (await nodesApi.createFolder(folder2, parentId)).entry.id;
|
||||
const folder3Id = (await nodesApi.createFolder(folder3, parentId)).entry.id;
|
||||
const folder4Id = (await nodesApi.createFolder(folder4, parentId)).entry.id;
|
||||
const folder5Id = (await nodesApi.createFolder(folder5, parentId)).entry.id;
|
||||
const folder6Id = (await nodesApi.createFolder(folder6, parentId)).entry.id;
|
||||
|
||||
await nodesApi.createFile(file1InFolder, folder1Id);
|
||||
fileLocked1Id = (await nodesApi.createFile(fileLocked1, folder2Id)).entry.id;
|
||||
fileLocked2Id = (await nodesApi.createFile(fileLocked2, folder3Id)).entry.id;
|
||||
fileLocked3Id = (await nodesApi.createFile(fileLocked3, folder4Id)).entry.id;
|
||||
fileLocked4Id = (await nodesApi.createFile(fileLocked4, folder5Id)).entry.id;
|
||||
await nodesApi.createFile(file2InFolder, folder6Id);
|
||||
|
||||
await nodesApi.lockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id], 'FULL');
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, personalFiles }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await personalFiles.navigate();
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(parent);
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await nodesApi.unlockNodes([fileLocked1Id, fileLocked2Id, fileLocked3Id, fileLocked4Id]);
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[C217125] delete a file and check notification', async ({ personalFiles, trashPage }) => {
|
||||
let items = await personalFiles.dataTable.getRowsCount();
|
||||
await personalFiles.dataTable.selectItem(file1);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
const message = await personalFiles.snackBar.getSnackBarMessage();
|
||||
expect(message).toContain(`${file1} deleted`);
|
||||
const action = await personalFiles.snackBar.getSnackBarActionText();
|
||||
expect(action).toContain('Undo');
|
||||
await personalFiles.snackBar.closeIcon.click();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file1)).toBeFalsy();
|
||||
items--;
|
||||
expect(await personalFiles.pagination.getMaxRange()).toEqual(` Showing 1-${items} of ${items} `);
|
||||
await trashPage.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file1)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C280502] delete multiple files and check notification', async ({ personalFiles, trashPage }) => {
|
||||
let items = await personalFiles.dataTable.getRowsCount();
|
||||
await personalFiles.dataTable.selectItem(file2);
|
||||
await personalFiles.page.waitForTimeout(1500);
|
||||
await personalFiles.dataTable.selectItem(file3);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.verifySnackBarActionText(`Deleted 2 items`);
|
||||
await personalFiles.snackBar.closeIcon.click();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file2)).toBeFalsy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file3)).toBeFalsy();
|
||||
items = items - 2;
|
||||
expect(await personalFiles.pagination.getMaxRange()).toEqual(` Showing 1-${items} of ${items} `);
|
||||
await trashPage.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file2)).toBeTruthy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file3)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C217126] delete a folder with content', async ({ personalFiles, trashPage }) => {
|
||||
let items = await personalFiles.dataTable.getRowsCount();
|
||||
await personalFiles.dataTable.selectItem(folder1);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.closeIcon.click();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder1)).toBeFalsy();
|
||||
items--;
|
||||
expect(await personalFiles.pagination.getMaxRange()).toEqual(` Showing 1-${items} of ${items} `);
|
||||
await trashPage.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder1)).toBeTruthy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file1InFolder)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C217127] delete a folder containing locked files', async ({ personalFiles, trashPage }) => {
|
||||
await personalFiles.dataTable.selectItem(folder2);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.verifySnackBarActionText(`${folder2} couldn't be deleted`);
|
||||
await expect(personalFiles.snackBar.actionButton).toBeHidden();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder2)).toBeTruthy();
|
||||
await trashPage.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder2)).toBeFalsy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(fileLocked1)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C217129] notification on multiple items deletion - some items fail to delete', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(file4);
|
||||
await personalFiles.page.waitForTimeout(1500);
|
||||
await personalFiles.dataTable.selectItem(folder3);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.verifySnackBarActionText(`Deleted 1 item, 1 couldn't be deleted`);
|
||||
const action = await personalFiles.snackBar.getSnackBarActionText();
|
||||
expect(action).toContain('Undo');
|
||||
});
|
||||
|
||||
test('[C217130] notification on multiple items deletion - all items fail to delete', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folder4);
|
||||
await personalFiles.page.waitForTimeout(1500);
|
||||
await personalFiles.dataTable.selectItem(folder5);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.verifySnackBarActionText(`2 items couldn't be deleted`);
|
||||
await expect(personalFiles.snackBar.actionButton).toBeHidden();
|
||||
});
|
||||
|
||||
test('[C217132] undo delete of file', async ({ personalFiles }) => {
|
||||
const items = await personalFiles.dataTable.getRowsCount();
|
||||
|
||||
await personalFiles.dataTable.selectItem(file5);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
|
||||
await personalFiles.snackBar.clickSnackBarAction();
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file5)).toBeTruthy();
|
||||
expect(await personalFiles.pagination.getRange()).toContain(`1-${items} of ${items}`);
|
||||
});
|
||||
|
||||
test('[C280503] undo delete of folder with content', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(folder6);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.clickSnackBarAction();
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder6)).toBeTruthy();
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(folder6);
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file2InFolder)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C280504] undo delete of multiple files', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItem(file6);
|
||||
await personalFiles.page.waitForTimeout(1500);
|
||||
await personalFiles.dataTable.selectItem(file7);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItem('Delete');
|
||||
await personalFiles.snackBar.clickSnackBarAction();
|
||||
await personalFiles.dataTable.spinnerWaitForReload();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file6)).toBeTruthy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file7)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
143
e2e/playwright/delete-actions/src/tests/permanently-delete.e2e.ts
Executable file
143
e2e/playwright/delete-actions/src/tests/permanently-delete.e2e.ts
Executable file
@@ -0,0 +1,143 @@
|
||||
/*!
|
||||
* 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, SitesApi } from '@alfresco/playwright-shared';
|
||||
|
||||
test.describe('Delete and undo delete', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let sitesApi: SitesApi;
|
||||
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
|
||||
sitesApi = await SitesApi.initialize(username, username);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test.describe('Permanently delete from Trash', () => {
|
||||
const file1 = `file1-${Utils.random()}.txt`;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
let filesIds;
|
||||
|
||||
const folder1 = `folder1-${Utils.random()}`;
|
||||
const folder2 = `folder2-${Utils.random()}`;
|
||||
let foldersIds;
|
||||
|
||||
const site = `site-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
filesIds = (await nodesApi.createFiles([file1, file2, file3])).list.entries.map((entries) => entries.entry.id);
|
||||
foldersIds = (await nodesApi.createFolders([folder1, folder2])).list.entries.map((entries) => entries.entry.id);
|
||||
await sitesApi.createSite(site);
|
||||
await nodesApi.deleteNodes([...filesIds, ...foldersIds], false);
|
||||
await sitesApi.deleteSites([site], false);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, trashPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await trashPage.navigate();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[C217091] delete a file', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file1);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.deleteButton.click();
|
||||
|
||||
await trashPage.snackBar.verifySnackBarActionText(`${file1} deleted`);
|
||||
expect(await trashPage.dataTable.isItemPresent(file1)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C280416] delete a folder', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(folder1);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.deleteButton.click();
|
||||
|
||||
await trashPage.snackBar.verifySnackBarActionText(`${folder1} deleted`);
|
||||
expect(await trashPage.dataTable.isItemPresent(folder1)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C290103] delete a library', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(site);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.deleteButton.click();
|
||||
|
||||
await trashPage.snackBar.verifySnackBarActionText(`${site} deleted`);
|
||||
expect(await trashPage.dataTable.isItemPresent(site)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C280417] delete multiple items', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file2);
|
||||
await trashPage.page.waitForTimeout(1500);
|
||||
await trashPage.dataTable.selectItem(folder2);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.deleteButton.click();
|
||||
|
||||
await trashPage.snackBar.verifySnackBarActionText(`2 items deleted`);
|
||||
expect(await trashPage.dataTable.isItemPresent(file2)).toBeFalsy();
|
||||
expect(await trashPage.dataTable.isItemPresent(folder2)).toBeFalsy();
|
||||
});
|
||||
|
||||
test('[C269113] Confirmation dialog UI', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file3);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.waitForDialog();
|
||||
|
||||
expect(await trashPage.deleteDialog.isDialogOpen()).toBeTruthy();
|
||||
expect(await trashPage.deleteDialog.getDialogTitle()).toContain('Delete from trash');
|
||||
expect(await trashPage.deleteDialog.getDialogDescription()).toContain('This will permanently remove the selected item(s)');
|
||||
expect(await trashPage.deleteDialog.isDeleteEnabled()).toBeTruthy();
|
||||
expect(await trashPage.deleteDialog.isKeepEnabled()).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C269115] Keep action cancels the deletion', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file3);
|
||||
await trashPage.acaHeader.permanentlyDeleteButton.click();
|
||||
await trashPage.deleteDialog.waitForDialog();
|
||||
|
||||
expect(await trashPage.deleteDialog.isKeepEnabled()).toBeTruthy();
|
||||
await trashPage.deleteDialog.keepButton.click();
|
||||
expect(await trashPage.dataTable.isItemPresent(file3)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
245
e2e/playwright/delete-actions/src/tests/restore.e2e.ts
Executable file
245
e2e/playwright/delete-actions/src/tests/restore.e2e.ts
Executable file
@@ -0,0 +1,245 @@
|
||||
/*!
|
||||
* 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, SitesApi, APP_ROUTES, TrashPage } from '@alfresco/playwright-shared';
|
||||
|
||||
test.describe('Restore from Trash', () => {
|
||||
const apiClientFactory = new ApiClientFactory();
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
let sitesApi: SitesApi;
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
await apiClientFactory.setUpAcaBackend('admin');
|
||||
await apiClientFactory.createUser({ username });
|
||||
sitesApi = await SitesApi.initialize(username, username);
|
||||
|
||||
nodesApi = await NodesApi.initialize(username, username);
|
||||
trashcanApi = await TrashcanApi.initialize(username, username);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test.describe('successful restore', () => {
|
||||
let fileId1: string;
|
||||
const file1 = `file1-${Utils.random()}.txt`;
|
||||
let folderId1: string;
|
||||
const folder1 = `folder1-${Utils.random()}`;
|
||||
let fileId2: string;
|
||||
const file2 = `file2-${Utils.random()}.txt`;
|
||||
let folderId2: string;
|
||||
const folder2 = `folder2-${Utils.random()}`;
|
||||
let fileId3: string;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
const site1 = `site1-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
fileId1 = (await nodesApi.createFile(file1)).entry.id;
|
||||
folderId1 = (await nodesApi.createFolder(folder1)).entry.id;
|
||||
fileId2 = (await nodesApi.createFile(file2)).entry.id;
|
||||
folderId2 = (await nodesApi.createFolder(folder2)).entry.id;
|
||||
fileId3 = (await nodesApi.createFile(file3)).entry.id;
|
||||
await sitesApi.createSite(site1);
|
||||
await nodesApi.deleteNodes([fileId1, folderId1, fileId2, folderId2, fileId3], false);
|
||||
await sitesApi.deleteSites([site1], false);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ trashPage, loginPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await trashPage.navigate();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
async function restoreNode(trashPage: TrashPage, nodeName: string) {
|
||||
await trashPage.dataTable.selectItem(nodeName);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText(`${nodeName} restored`);
|
||||
const action = await trashPage.snackBar.getSnackBarActionText();
|
||||
expect(action).toContain('View');
|
||||
expect(await trashPage.dataTable.isItemPresent(nodeName)).toBeFalsy();
|
||||
}
|
||||
|
||||
test('[C217177] restore file', async ({ trashPage, personalFiles }) => {
|
||||
await restoreNode(trashPage, file1);
|
||||
await personalFiles.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file1)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C280438] restore folder', async ({ trashPage, personalFiles }) => {
|
||||
await restoreNode(trashPage, folder1);
|
||||
await personalFiles.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder1)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C290104] restore library', async ({ trashPage, myLibrariesPage }) => {
|
||||
await restoreNode(trashPage, site1);
|
||||
await myLibrariesPage.navigate();
|
||||
expect(await myLibrariesPage.dataTable.isItemPresent(site1)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C217182] restore multiple items', async ({ trashPage, personalFiles }) => {
|
||||
await trashPage.dataTable.selectItem(file2);
|
||||
await trashPage.page.waitForTimeout(1500);
|
||||
await trashPage.dataTable.selectItem(folder2);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText(`Restore successful`);
|
||||
const action = await trashPage.snackBar.getSnackBarActionText();
|
||||
expect(action).not.toContain('View');
|
||||
expect(await trashPage.dataTable.isItemPresent(file2)).toBeFalsy();
|
||||
expect(await trashPage.dataTable.isItemPresent(folder2)).toBeFalsy();
|
||||
await personalFiles.navigate();
|
||||
expect(await personalFiles.dataTable.isItemPresent(file2)).toBeTruthy();
|
||||
expect(await personalFiles.dataTable.isItemPresent(folder2)).toBeTruthy();
|
||||
});
|
||||
|
||||
test('[C217181] View from notification', async ({ trashPage, personalFiles }) => {
|
||||
await trashPage.dataTable.selectItem(file3);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.clickSnackBarAction();
|
||||
await trashPage.dataTable.spinnerWaitForReload();
|
||||
expect(await trashPage.sidenav.isActive('Personal Files')).toBeTruthy();
|
||||
expect(personalFiles.page.url()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('failure to restore', () => {
|
||||
const randomText = Utils.random();
|
||||
let file1Id1: string;
|
||||
const file1 = `file1-${randomText}.txt`;
|
||||
const file1copy = `file1-${randomText}.txt`;
|
||||
let file2Id: string;
|
||||
const file2 = `file2-${randomText}.txt`;
|
||||
let folder1Id: string;
|
||||
const folder1 = `folder1-${randomText}`;
|
||||
let folder2Id: string;
|
||||
const folder2 = `folder2-${randomText}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
folder1Id = (await nodesApi.createFolder(folder1)).entry.id;
|
||||
folder2Id = (await nodesApi.createFolder(folder2)).entry.id;
|
||||
file1Id1 = (await nodesApi.createFile(file1, folder1Id)).entry.id;
|
||||
file2Id = (await nodesApi.createFile(file2, folder2Id)).entry.id;
|
||||
await nodesApi.deleteNodes([file2Id, folder2Id, file1Id1], false);
|
||||
await nodesApi.createFile(file1copy, folder1Id);
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, trashPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await trashPage.navigate();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[C217178] Restore a file when another file with same name exists on the restore location', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file1);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText(`Can't restore, ${file1} already exists`);
|
||||
});
|
||||
|
||||
test('[C217179] Restore a file when original location no longer exists', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file2);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText(`Can't restore ${file2}, the original location no longer exists`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Notification on partial success', () => {
|
||||
const folder1 = `folder1-${Utils.random()}.txt`;
|
||||
let folder1Id: string;
|
||||
const folder2 = `folder2-${Utils.random()}.txt`;
|
||||
let folder2Id: string;
|
||||
const file1 = `file-${Utils.random()}.txt`;
|
||||
let file1Id: string;
|
||||
const file2 = `file-${Utils.random()}.txt`;
|
||||
let file2Id: string;
|
||||
|
||||
const folder3 = `folder3-${Utils.random()}.txt`;
|
||||
let folder3Id: string;
|
||||
const folder4 = `folder4-${Utils.random()}.txt`;
|
||||
let folder4Id: string;
|
||||
const file3 = `file3-${Utils.random()}.txt`;
|
||||
let file3Id: string;
|
||||
const file4 = `file4-${Utils.random()}.txt`;
|
||||
let file4Id: string;
|
||||
const file5 = `file5-${Utils.random()}.txt`;
|
||||
let file5Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
folder1Id = (await nodesApi.createFolder(folder1)).entry.id;
|
||||
file1Id = (await nodesApi.createFile(file1, folder1Id)).entry.id;
|
||||
folder2Id = (await nodesApi.createFolder(folder2)).entry.id;
|
||||
file2Id = (await nodesApi.createFile(file2, folder2Id)).entry.id;
|
||||
await nodesApi.deleteNodes([file1Id, folder1Id, file2Id], false);
|
||||
|
||||
folder3Id = (await nodesApi.createFolder(folder3)).entry.id;
|
||||
file3Id = (await nodesApi.createFile(file3, folder3Id)).entry.id;
|
||||
file4Id = (await nodesApi.createFile(file4, folder3Id)).entry.id;
|
||||
folder4Id = (await nodesApi.createFolder(folder4)).entry.id;
|
||||
file5Id = (await nodesApi.createFile(file5, folder4Id)).entry.id;
|
||||
await nodesApi.deleteNodes([file3Id, file4Id, folder3Id, file5Id], false);
|
||||
} catch {}
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ loginPage, trashPage }) => {
|
||||
await Utils.tryLoginUser(loginPage, username, username, 'beforeEach failed');
|
||||
await trashPage.navigate();
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
test('[C217183] one failure', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file1);
|
||||
await trashPage.page.waitForTimeout(1500);
|
||||
await trashPage.dataTable.selectItem(file2);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText(`Can't restore ${file1}, the original location no longer exists`);
|
||||
});
|
||||
|
||||
test('[C217184] multiple failures', async ({ trashPage }) => {
|
||||
await trashPage.dataTable.selectItem(file3);
|
||||
await trashPage.page.waitForTimeout(1500);
|
||||
await trashPage.dataTable.selectItem(file4);
|
||||
await trashPage.page.waitForTimeout(1500);
|
||||
await trashPage.dataTable.selectItem(file5);
|
||||
await trashPage.acaHeader.restoreButton.click();
|
||||
await trashPage.snackBar.verifySnackBarActionText('2 items not restored because of issues with the restore location');
|
||||
});
|
||||
});
|
||||
});
|
15
e2e/playwright/delete-actions/tsconfig.e2e.adf.json
Normal file
15
e2e/playwright/delete-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/delete-actions/tsconfig.e2e.json
Executable file
15
e2e/playwright/delete-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"]
|
||||
}
|
Reference in New Issue
Block a user