[ACA-2850][ACA-2849] Viewer - document properties not refreshed after changes or uploading new version (#1286)

* update viewer on upload complete

* prevent multiple same actions triggers

* Display node again after upload was complete

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Add e2e test for showing 'Editing Offline' when a new version was uploaded and the node was locked before

* Update src/app/components/page.component.ts

return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

* return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

* return type

Co-Authored-By: Denys Vuika <denys.vuika@alfresco.com>

Co-authored-by: Martin Muller <damadden88@googlemail.com>
Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
Cilibiu Bogdan
2020-01-02 20:17:59 +02:00
committed by GitHub
parent 0d0ddfcf37
commit 55547ed163
5 changed files with 89 additions and 4 deletions

View File

@@ -351,6 +351,14 @@ export class Menu extends Component {
return this.uploadFolderAction.isEnabled();
}
async isCancelEditingActionPresent(): Promise<boolean> {
return this.cancelEditingAction.isPresent();
}
async isEditOfflineActionPresent(): Promise<boolean> {
return this.editOfflineAction.isPresent();
}
async clickCreateFolder() {
const action = this.createFolderAction;

View File

@@ -74,6 +74,7 @@ describe('Viewer actions', () => {
const fileForEditOffline = `file1-${Utils.random()}.docx`; let fileForEditOfflineId;
const fileForCancelEditing = `file2-${Utils.random()}.docx`; let fileForCancelEditingId;
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`; let fileForUploadNewVersionId;
const fileForUploadNewVersion2 = `file4-${Utils.random()}.docx`; let fileForUploadNewVersionId2;
beforeAll(async (done) => {
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
@@ -88,9 +89,11 @@ describe('Viewer actions', () => {
fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
await apis.user.nodes.lockFile(fileForCancelEditingId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId);
await apis.user.nodes.lockFile(fileForUploadNewVersionId2);
await loginPage.loginWith(username);
@@ -221,6 +224,26 @@ describe('Viewer actions', () => {
expect(await apis.user.nodes.getFileVersionLabel(filePersonalFilesId)).toEqual('2.0', 'File has incorrect version label');
});
it('Upload new version action when node is locked - [MNT-21058]', async () => {
await dataTable.doubleClickOnRowByName(fileForUploadNewVersion2);
await viewer.waitForViewerToOpen();
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCancelEditingActionPresent()).toBe(true, `'Cancel Editing' button should be shown`);
expect(await toolbar.menu.isEditOfflineActionPresent()).toBe(false, `'Edit Offline' shouldn't be shown`);
await toolbar.menu.clickMenuItem('Upload New Version');
await Utils.uploadFileNewVersion(docxFile);
await page.waitForDialog();
await uploadNewVersionDialog.clickUpload();
await toolbar.openMoreMenu();
expect(await toolbar.menu.isCancelEditingActionPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`);
expect(await toolbar.menu.isEditOfflineActionPresent()).toBe(true, `'Edit Offline' should be shown`);
});
it('Full screen action - [C279282]', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();