Remove useless duplicated flaky e2es (#2531)

This commit is contained in:
Michał Fidor
2022-06-06 14:09:08 +02:00
committed by GitHub
parent a92b3e8c0f
commit 8d27b7773a

View File

@@ -34,11 +34,10 @@ import {
Viewer,
ContentNodeSelectorDialog,
ShareDialog,
ManageVersionsDialog,
UploadNewVersionDialog,
UploadFilesDialog
} from '@alfresco/aca-testing-shared';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
import { Logger } from '@alfresco/adf-testing';
describe('Viewer actions', () => {
const username = `user-${Utils.random()}`;
@@ -59,7 +58,6 @@ describe('Viewer actions', () => {
const { toolbar } = viewer;
const copyMoveDialog = new ContentNodeSelectorDialog();
const shareDialog = new ShareDialog();
const manageVersionsDialog = new ManageVersionsDialog();
const uploadNewVersionDialog = new UploadNewVersionDialog();
const adminApiActions = new AdminActions();
const userActions = new UserActions();
@@ -76,7 +74,6 @@ describe('Viewer actions', () => {
let destinationId: string;
const docxPersonalFiles = `docxPF-${Utils.random()}.docx`;
let docxFileId: string;
const xlsxPersonalFiles = `xlsxPF-${Utils.random()}.xlsx`;
const pdfPersonalFiles = `pdfPF-${Utils.random()}.pdf`;
@@ -97,7 +94,7 @@ describe('Viewer actions', () => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles)).entry.id;
await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxPersonalFiles);
filePersonalFilesId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
@@ -152,53 +149,6 @@ describe('Viewer actions', () => {
expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location');
});
it('[C268130] Copy action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCopy();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not present in destination');
await apis.user.nodes.deleteNodeChildren(destinationId);
});
it('[C268131] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxPersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsMove();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxPersonalFiles)).toBe(false, 'Item was not moved');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxPersonalFiles)).toBe(true, 'Item is not present in destination');
});
it('[C268132] Favorite action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsFavorite();
await viewer.closeButton.click();
await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxPersonalFiles)).toBe(true, 'Item is not present in Favorites list');
});
it('[C268133] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfPersonalFiles);
await viewer.waitForViewerToOpen();
@@ -233,7 +183,6 @@ describe('Viewer actions', () => {
it('[C297586] Upload new version action', async () => {
await dataTable.doubleClickOnRowByName(filePersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog();
@@ -252,11 +201,6 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(fileForUploadNewVersion2);
await viewer.waitForViewerToOpen();
await toolbar.openMoreMenu();
expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(true, `'Cancel Editing' button should be shown`);
expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(false, `'Edit Offline' shouldn't be shown`);
await toolbar.menu.clickMenuItem('Upload New Version');
await Utils.uploadFileNewVersion(docxFile);
await page.waitForDialog();
@@ -283,24 +227,6 @@ describe('Viewer actions', () => {
expect(browserLogAfter.length).toBe(0, browserLogAfter.entries);
});
it('[C286313] Share action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
it('[C286316] Manage Versions action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsManageVersions();
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
it('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();
@@ -318,16 +244,10 @@ describe('Viewer actions', () => {
const destination = `destFL-${Utils.random()}`;
let destinationId: string;
const docxLibraries = `docxFL-${Utils.random()}.docx`;
let docxFileId: string;
const xlsxLibraries = `xlsxFL-${Utils.random()}.xlsx`;
const pdfLibraries = `pdfFL-${Utils.random()}.pdf`;
const fileLibraries = docxFile2;
let fileLibrariesId: string;
const fileForEditOffline = `file1-${Utils.random()}.docx`;
let fileForEditOfflineId: string;
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
let fileForCancelEditingId: string;
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
@@ -338,14 +258,13 @@ describe('Viewer actions', () => {
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, docxLibraries)).entry.id;
fileLibrariesId = (await apis.user.upload.uploadFile(docxFile2, docLibId)).entry.id;
await apis.user.upload.uploadFile(docxFile2, docLibId);
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline)).entry.id;
await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline);
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForUploadNewVersion)).entry.id;
@@ -384,33 +303,6 @@ describe('Viewer actions', () => {
}
});
it('[C286369] Download action', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxLibraries)).toBe(true, 'File not found in download location');
});
it('[C286370] Copy action', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsCopy();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, 'Item is not present in destination');
await apis.user.nodes.deleteNodeChildren(destinationId);
});
it('[C286371] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -427,84 +319,6 @@ describe('Viewer actions', () => {
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(true, 'Item is not present in destination');
});
it('[C286372] Favorite action', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsFavorite();
await viewer.closeButton.click();
await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, `${docxLibraries} is not favorite`);
expect(await dataTable.isItemPresent(docxLibraries)).toBe(true, `${docxLibraries} is not present in Favorites list`);
});
it('[C286373] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toContain(`${pdfLibraries} deleted`);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(pdfLibraries)).toBe(true, 'Item is not present in Trash');
});
it('[C297589] Edit Offline action', async () => {
await dataTable.doubleClickOnRowByName(fileForEditOffline);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsEditOffline();
expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297590] Cancel Editing action', async () => {
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297591] Upload new version action', async () => {
await dataTable.doubleClickOnRowByName(fileLibraries);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2);
expect(await apis.user.nodes.getFileVersionType(fileLibrariesId)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileLibrariesId)).toEqual('2.0', 'File has incorrect version label');
});
it('[C286374] Share action', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
it('[C286375] Manage Versions action', async () => {
await dataTable.doubleClickOnRowByName(docxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsManageVersions();
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
});
describe('from Recent Files', () => {
@@ -514,15 +328,10 @@ describe('Viewer actions', () => {
let destinationId: string;
const docxRecentFiles = `docxRF-${Utils.random()}.docx`;
let docxFileId: string;
const xlsxRecentFiles = `xlsxRF-${Utils.random()}.xlsx`;
const pdfRecentFiles = `pdfRF-${Utils.random()}.pdf`;
const fileRecent = docxFile2;
let fileRecentId: string;
const fileForEditOffline = `file1-${Utils.random()}.docx`;
let fileForEditOfflineId: string;
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
let fileForCancelEditingId: string;
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
@@ -534,11 +343,10 @@ describe('Viewer actions', () => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
destinationId = (await apis.user.nodes.createFolder(destination)).entry.id;
docxFileId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles)).entry.id;
await apis.user.upload.uploadFileWithRename(docxFile, parentId, docxRecentFiles);
await apis.user.upload.uploadFile(docxFile2, parentId);
fileRecentId = (await apis.user.upload.uploadFile(docxFile2, parentId)).entry.id;
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline);
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
@@ -575,14 +383,6 @@ describe('Viewer actions', () => {
}
});
it('[C286383] Download action', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxRecentFiles)).toBe(true, 'File not found in download location');
});
it('[C286384] Copy action', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -601,102 +401,6 @@ describe('Viewer actions', () => {
await apis.user.nodes.deleteNodeChildren(destinationId);
});
it('[C286385] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsMove();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxRecentFiles)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxRecentFiles)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxRecentFiles)).toBe(true, 'Item is not present in destination');
});
it('[C286386] Favorite action', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsFavorite();
await viewer.closeButton.click();
await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxRecentFiles)).toBe(true, 'Item is not present in Favorites list');
});
it('[C286387] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toContain(`${pdfRecentFiles} deleted`);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(pdfRecentFiles)).toBe(true, 'Item is not present in Trash');
});
it('[C297594] Edit Offline action', async () => {
await dataTable.doubleClickOnRowByName(fileForEditOffline);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsEditOffline();
expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297595] Cancel Editing action', async () => {
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297596] Upload new version action', async () => {
await dataTable.doubleClickOnRowByName(fileRecent);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2);
expect(await apis.user.nodes.getFileVersionType(fileRecentId)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileRecentId)).toEqual('2.0', 'File has incorrect version label');
});
it('[C286388] Share action', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.shareButton.click();
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
it('[C286389] Manage Versions action', async () => {
await dataTable.doubleClickOnRowByName(docxRecentFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsManageVersions();
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
});
describe('from Shared Files', () => {
@@ -712,7 +416,6 @@ describe('Viewer actions', () => {
let xlsxFileId: string;
const pdfSharedFiles = `pdfSF-${Utils.random()}.pdf`;
let pdfFileId: string;
const fileShared = docxFile2;
let fileSharedId: string;
const fileForEditOffline = `file1-${Utils.random()}.docx`;
@@ -788,51 +491,6 @@ describe('Viewer actions', () => {
}
});
it('[C286376] Download action', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxSharedFiles)).toBe(true, 'File not found in download location');
});
it('[C286377] Copy action', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsCopy();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not present in destination');
await apis.user.nodes.deleteNodeChildren(destinationId);
});
it('[C286378] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsMove();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxSharedFiles)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxSharedFiles)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxSharedFiles)).toBe(true, 'Item is not present in destination');
});
it('[C286379] Favorite action', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -843,73 +501,6 @@ describe('Viewer actions', () => {
expect(await apis.user.favorites.isFavorite(docxFileId)).toBe(true, 'Item is not favorite');
expect(await dataTable.isItemPresent(docxSharedFiles)).toBe(true, 'Item is not present in Favorites list');
});
it('[C286380] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toContain(`${pdfSharedFiles} deleted`);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(pdfSharedFiles)).toBe(true, 'Item is not present in Trash');
});
it('[C297601] Edit Offline action', async () => {
await dataTable.doubleClickOnRowByName(fileForEditOffline);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsEditOffline();
expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297602] Cancel Editing action', async () => {
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297603] Upload new version action', async () => {
await dataTable.doubleClickOnRowByName(fileShared);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2);
expect(await apis.user.nodes.getFileVersionType(fileSharedId)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileSharedId)).toEqual('2.0', 'File has incorrect version label');
});
it('[C286381] Share action', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await BrowserActions.click(toolbar.shareEditButton);
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
it('[C286382] Manage Versions action', async () => {
await dataTable.doubleClickOnRowByName(docxSharedFiles);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsManageVersions();
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
});
describe('from Favorites', () => {
@@ -925,7 +516,6 @@ describe('Viewer actions', () => {
let xlsxFileId: string;
const pdfFavorites = `pdfFav-${Utils.random()}.pdf`;
let pdfFileId: string;
const fileFav = docxFile2;
let fileFavId: string;
const fileForEditOffline = `file1-${Utils.random()}.docx`;
@@ -988,111 +578,6 @@ describe('Viewer actions', () => {
}
});
it('[C286390] Download action', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.downloadButton.click();
expect(await Utils.fileExistsOnOS(docxFavorites)).toBe(true, 'File not found in download location');
});
it('[C286391] Copy action', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsCopy();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.copyButton.click();
expect(await page.getSnackBarMessage()).toContain('Copied 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(docxFavorites)).toBe(true, 'Item is not in the list');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(docxFavorites)).toBe(true, 'Item is not present in destination');
await apis.user.nodes.deleteNodeChildren(destinationId);
});
it('[C286392] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsMove();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(true, 'Item is not in the list');
expect(await dataTable.getItemLocationTooltip(xlsxFavorites)).toContain(destination, 'Item was not moved');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(true, 'Item is not present in destination');
});
it('[C286393] Favorite action', async () => {
await dataTable.doubleClickOnRowByName(xlsxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsRemoveFavorite();
await viewer.closeButton.click();
await page.clickFavoritesAndWait();
expect(await apis.user.favorites.isFavorite(xlsxFileId)).toBe(false, 'Item is still favorite');
expect(await dataTable.isItemPresent(xlsxFavorites)).toBe(false, 'Item is still present in Favorites list');
});
it('[C286394] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toContain(`${pdfFavorites} deleted`);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(pdfFavorites)).toBe(true, 'Item is not present in Trash');
});
it('[C297604] Edit Offline action', async () => {
await dataTable.doubleClickOnRowByName(fileForEditOffline);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsEditOffline();
expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297605] Cancel Editing action', async () => {
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});
it('[C297606] Upload new version action', async () => {
await dataTable.doubleClickOnRowByName(fileFav);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsUploadNewVersion();
await Utils.uploadFileNewVersion(docxFile2);
await page.waitForDialog();
await uploadNewVersionDialog.majorOption.click();
await uploadNewVersionDialog.enterDescription('new major version description');
await uploadNewVersionDialog.uploadButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
expect(await viewer.getFileTitle()).toContain(docxFile2);
expect(await apis.user.nodes.getFileVersionType(fileFavId)).toEqual('MAJOR', 'File has incorrect version type');
expect(await apis.user.nodes.getFileVersionLabel(fileFavId)).toEqual('2.0', 'File has incorrect version label');
});
it('[C286395] Share action', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
@@ -1101,14 +586,5 @@ describe('Viewer actions', () => {
expect(await shareDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await shareDialog.clickClose();
});
it('[C286396] Manage Versions action', async () => {
await dataTable.doubleClickOnRowByName(docxFavorites);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.clickMoreActionsManageVersions();
expect(await manageVersionsDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await manageVersionsDialog.clickClose();
});
});
});