mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-16 18:12:50 +00:00
[ACS-12817] copilot review fixes 1
This commit is contained in:
committed by
Adam Świderski
parent
86e1b33dec
commit
340550904d
@@ -38,6 +38,7 @@ test.describe('Copy actions', () => {
|
||||
let sourceFileId: string;
|
||||
let sourceFileInsideFolderId: string;
|
||||
let destinationFolderId: string;
|
||||
let sourceFileWorkingCopy: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
@@ -52,7 +53,9 @@ test.describe('Copy actions', () => {
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ personalFiles, page }) => {
|
||||
sourceFile = `source-file-${Utils.random()}.txt`;
|
||||
const sourceFileRandom = `${Utils.random()}`;
|
||||
sourceFile = `source-file-${sourceFileRandom}`;
|
||||
sourceFileWorkingCopy = `source-file-${sourceFileRandom} (Working Copy)`;
|
||||
sourceFileInsideFolder = `source-file-inside-folder-${Utils.random()}.txt`;
|
||||
sourceFolder = `source-folder-${Utils.random()}`;
|
||||
destinationFolder = `destination-folder-${Utils.random()}`;
|
||||
@@ -69,6 +72,7 @@ test.describe('Copy actions', () => {
|
||||
});
|
||||
|
||||
test.afterAll(async () => {
|
||||
await nodesApi.cancelCheckout([sourceFileId]);
|
||||
await Utils.deleteNodesSitesEmptyTrashcan(nodesApi, trashcanApi, 'afterAll failed');
|
||||
});
|
||||
|
||||
@@ -121,13 +125,12 @@ test.describe('Copy actions', () => {
|
||||
|
||||
test('[XAT-4944] Copy a file with a name that already exists on the destination', async ({ personalFiles }) => {
|
||||
await nodesApi.createFile(sourceFile, destinationFolderId);
|
||||
const expectedNameForCopiedFile = sourceFile.replace('.', '-1.');
|
||||
const expectedNameForCopiedFile = `${sourceFile + '-1'}`;
|
||||
await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFile);
|
||||
await copyContentInPersonalFiles(personalFiles, [sourceFile], destinationFolder);
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(destinationFolder);
|
||||
await personalFiles.spinnerWaitForReload();
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
expect(await personalFiles.dataTable.isItemPresent(expectedNameForCopiedFile)).toBe(true);
|
||||
});
|
||||
|
||||
@@ -149,9 +152,9 @@ test.describe('Copy actions', () => {
|
||||
|
||||
test('[XAT-4947] Copy locked file', async ({ personalFiles }) => {
|
||||
await nodesApi.checkoutNodes([sourceFileId]);
|
||||
await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFile);
|
||||
await copyContentInPersonalFiles(personalFiles, [sourceFile], destinationFolder);
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFileWorkingCopy);
|
||||
await copyContentInPersonalFiles(personalFiles, [sourceFileWorkingCopy], destinationFolder);
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFileWorkingCopy)).toBe(true);
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(destinationFolder);
|
||||
await personalFiles.spinnerWaitForReload();
|
||||
expect(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
@@ -184,15 +187,13 @@ test.describe('Copy actions', () => {
|
||||
|
||||
test('[XAT-4951] Undo copy of a file when a file with same name already exists on the destination', async ({ personalFiles }) => {
|
||||
await nodesApi.createFile(sourceFile, destinationFolderId);
|
||||
const expectedNameForCopiedFile = sourceFile.replace('.', '-1.');
|
||||
await Utils.reloadPageIfRowNotVisible(personalFiles, sourceFile);
|
||||
await copyContentInPersonalFiles(personalFiles, [sourceFile], destinationFolder);
|
||||
await personalFiles.snackBar.actionButton.click();
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
await personalFiles.dataTable.performClickFolderOrFileToOpen(destinationFolder);
|
||||
await personalFiles.spinnerWaitForReload();
|
||||
expect.soft(await personalFiles.dataTable.isItemPresent(sourceFile)).toBe(true);
|
||||
expect(await personalFiles.dataTable.isItemPresent(expectedNameForCopiedFile)).toBe(false);
|
||||
expect(await personalFiles.dataTable.getRowsCount()).toBe(1);
|
||||
});
|
||||
|
||||
test('[XAT-4952] Undo copy of a folder when a folder with same name already exists on the destination', async ({ personalFiles }) => {
|
||||
|
||||
@@ -45,12 +45,12 @@ test.describe('Edit offline - on Personal Files', () => {
|
||||
});
|
||||
|
||||
test.describe('[XAT-5304] File is locked and downloaded when clicking Edit offline', () => {
|
||||
const file5304 = `file-5304-${Utils.random()}.docx`;
|
||||
const file5304 = `file-5304-${Utils.random()}`;
|
||||
let file5304Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
file5304Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, file5304)).entry.id;
|
||||
file5304Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.PNG_FILE.path, file5304)).entry.id;
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
@@ -77,12 +77,12 @@ test.describe('Edit offline - on Personal Files', () => {
|
||||
});
|
||||
|
||||
test.describe('[XAT-5305] Lock information is displayed', () => {
|
||||
const fileLocked5305 = `file-locked-5305-${Utils.random()}.docx`;
|
||||
const fileLocked5305 = `file-locked-5305-${Utils.random()}`;
|
||||
let fileLocked5305Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
fileLocked5305Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked5305)).entry.id;
|
||||
fileLocked5305Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.PNG_FILE.path, fileLocked5305)).entry.id;
|
||||
await nodesApi.checkoutNodes([fileLocked5305Id]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
@@ -105,12 +105,12 @@ test.describe('Edit offline - on Personal Files', () => {
|
||||
});
|
||||
|
||||
test.describe('[XAT-5306] Cancel Editing unlocks the file', () => {
|
||||
const fileLocked5306 = `file-locked-5306-${Utils.random()}.docx`;
|
||||
const fileLocked5306 = `file-locked-5306-${Utils.random()}`;
|
||||
let fileLocked5306Id: string;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
fileLocked5306Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.DOCX.path, fileLocked5306)).entry.id;
|
||||
fileLocked5306Id = (await fileActionsApi.uploadFileWithRename(TEST_FILES.PNG_FILE.path, fileLocked5306)).entry.id;
|
||||
await nodesApi.checkoutNodes([fileLocked5306Id]);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
@@ -127,16 +127,16 @@ test.describe('Edit offline - on Personal Files', () => {
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
await personalFiles.matMenu.clickMenuItemFromHeaderMenu('Cancel Editing');
|
||||
|
||||
expect(await nodesApi.isFileLockedWrite(fileLocked5306Id), `${fileLocked5306} is still locked`).not.toEqual('WRITE_LOCK');
|
||||
expect(await nodesApi.isFileLockedWrite(fileLocked5306Id), `${fileLocked5306} is still locked`).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('[XAT-20171] Cancel Editing option should not persists after uploading a new file version', () => {
|
||||
const file20171 = `file-20171-${Utils.random()}.docx`;
|
||||
const file20171 = `file-20171-${Utils.random()}`;
|
||||
|
||||
test.beforeAll(async () => {
|
||||
try {
|
||||
await fileActionsApi.uploadFileWithRename(TEST_FILES.JPG_FILE.path, file20171);
|
||||
await fileActionsApi.uploadFileWithRename(TEST_FILES.PNG_FILE.path, file20171);
|
||||
} catch (error) {
|
||||
console.error(`beforeAll failed : ${error}`);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ test.describe('Edit offline - on Personal Files', () => {
|
||||
await personalFiles.navigate();
|
||||
});
|
||||
|
||||
test('[XAT-20171] Cancel Editing option should not persists after uploading a new file version', async ({ personalFiles }) => {
|
||||
test('[XAT-20171] Cancel Editing option should not persist after uploading a new file version', async ({ personalFiles }) => {
|
||||
await personalFiles.dataTable.selectItems(file20171);
|
||||
await personalFiles.acaHeader.clickMoreActions();
|
||||
const [fileChooser] = await Promise.all([
|
||||
|
||||
@@ -236,7 +236,7 @@ test.describe('viewer action file', () => {
|
||||
|
||||
test.describe('Personal Files - Cancel Editing action', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const fileForCancelEditing = `playwright-file2-${Utils.random()}.docx`;
|
||||
const fileForCancelEditing = `playwright-file2-${Utils.random()}`;
|
||||
let folderIdCancelEdit: string;
|
||||
let nodesApi: NodesApi;
|
||||
let trashcanApi: TrashcanApi;
|
||||
@@ -249,7 +249,7 @@ test.describe('viewer action file', () => {
|
||||
|
||||
const { fileActionsApi } = apis;
|
||||
folderIdCancelEdit = (await nodesApi.createFolder(`viewer-action-5424-${Utils.random()}`)).entry.id;
|
||||
const fileForCancelEditingId = (await fileActionsApi.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderIdCancelEdit)).entry.id;
|
||||
const fileForCancelEditingId = (await fileActionsApi.uploadFile(TEST_FILES.PNG_FILE.path, fileForCancelEditing, folderIdCancelEdit)).entry.id;
|
||||
await nodesApi.checkoutNodes([fileForCancelEditingId]);
|
||||
await fileActionsApi.isFileCheckedOutWithRetry(fileForCancelEditingId, true);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user