[no-issue] Parallel run e2e and e2e common action refactoring (#4702)

This commit is contained in:
Eugenio Romano
2019-05-13 04:44:35 +02:00
committed by GitHub
parent a48bfc3714
commit 898e3b5a80
288 changed files with 8704 additions and 5130 deletions

View File

@@ -98,34 +98,42 @@ describe('Lock File', () => {
});
beforeEach(async (done) => {
const pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, documentLibrary);
try {
const pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.loginToContentServicesUsingUserModel(adminUser);
await navigationBarPage.openContentServicesFolder(documentLibrary);
nodeId = pngUploadedFile.entry.id;
loginPage.loginToContentServicesUsingUserModel(adminUser);
await navigationBarPage.openContentServicesFolder(documentLibrary);
contentServices.waitForTableBody();
contentServices.waitForTableBody();
} catch (error) {
}
done();
});
afterEach(async (done) => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
try {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
} catch (error) {
}
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
try {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await this.alfrescoJsApi.core.nodesApi.unlockNode(lockedFileNodeId);
await this.alfrescoJsApi.core.nodesApi.unlockNode(lockedFileNodeId);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, lockedFileNodeId);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, lockedFileNodeId);
} catch (error) {
}
done();
});
@@ -181,9 +189,9 @@ describe('Lock File', () => {
nodeId = pngUploadedFile.entry.id;
loginPage.loginToContentServicesUsingUserModel(managerUser);
await loginPage.loginToContentServicesUsingUserModel(managerUser);
navigationBarPage.openContentServicesFolder(documentLibrary);
await navigationBarPage.openContentServicesFolder(documentLibrary);
done();
});
@@ -191,23 +199,24 @@ describe('Lock File', () => {
afterEach(async (done) => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await this.alfrescoJsApi.core.nodesApi.unlockNode(nodeId);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
try {
await this.alfrescoJsApi.core.nodesApi.unlockNode(nodeId);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
} catch (error) {
}
done();
});
it('[C286610] Should not be able to delete a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.deleteNode(nodeId);
} catch (error) {
expect(error.status).toEqual(409);
}
@@ -215,11 +224,11 @@ describe('Lock File', () => {
});
it('[C286611] Should not be able to rename a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: 'My new name' });
@@ -231,11 +240,11 @@ describe('Lock File', () => {
});
it('[C286612] Should not be able to move a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
@@ -246,11 +255,11 @@ describe('Lock File', () => {
});
it('[C286613] Should not be able to update a new version on a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
@@ -267,73 +276,85 @@ describe('Lock File', () => {
let pngFileToBeLocked;
beforeAll(async (done) => {
pngFileToBeLocked = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileToLock.location, pngFileToLock.name, documentLibrary);
lockedFileNodeId = pngFileToBeLocked.entry.id;
try {
pngFileToBeLocked = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileToLock.location, pngFileToLock.name, documentLibrary);
lockedFileNodeId = pngFileToBeLocked.entry.id;
} catch (error) {
}
done();
});
beforeEach(async (done) => {
const pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
loginPage.loginToContentServicesUsingUserModel(adminUser);
navigationBarPage.openContentServicesFolder(documentLibrary);
try {
const pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.loginToContentServicesUsingUserModel(adminUser);
navigationBarPage.openContentServicesFolder(documentLibrary);
} catch (error) {
}
done();
});
afterEach(async (done) => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
try {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
} catch (error) {
}
done();
});
it('[C286614] Owner of the locked file should be able to rename if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickAllowOwnerCheckbox();
lockFilePage.clickSaveButton();
const response = await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: 'My new name' });
try {
const response = await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: 'My new name' });
expect(response.entry.name).toEqual('My new name');
} catch (error) {
}
expect(response.entry.name).toEqual('My new name');
});
it('[C286615] Owner of the locked file should be able to update a new version if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickAllowOwnerCheckbox();
lockFilePage.clickSaveButton();
const response = await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
try {
const response = await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
expect(response.entry.modifiedAt).toBeGreaterThan(response.entry.createdAt);
} catch (error) {
}
expect(response.entry.modifiedAt).toBeGreaterThan(response.entry.createdAt);
});
it('[C286616] Owner of the locked file should be able to move if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileModel.name);
contentServices.lockContent(pngFileModel.name);
await lockFilePage.checkLockFileCheckboxIsDisplayed();
await lockFilePage.clickLockFileCheckbox();
await lockFilePage.clickAllowOwnerCheckbox();
await lockFilePage.clickSaveButton();
lockFilePage.checkLockFileCheckboxIsDisplayed();
lockFilePage.clickLockFileCheckbox();
lockFilePage.clickAllowOwnerCheckbox();
lockFilePage.clickSaveButton();
await this.alfrescoJsApi.core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
try {
await this.alfrescoJsApi.core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
const movedFile = await this.alfrescoJsApi.core.nodesApi.getNode(nodeId);
const movedFile = await this.alfrescoJsApi.core.nodesApi.getNode(nodeId);
expect(movedFile.entry.parentId).not.toEqual(documentLibrary);
expect(movedFile.entry.parentId).not.toEqual(documentLibrary);
} catch (error) {
}
});