[ACS-259] refactor login page (#5733)

* refator login page

* refator login page

* remove obsolete classes and move what is needed in the test pck

* fix const

* revert modify

* remove duplicate browser property

* fix build

* fix

* fix

* fix lint

* move drop action in testing
remove not necessary space
js-api centralize content

* first refactor use js-api

* fix protractor

* refactor test config

* simplify properties
fix namings

* ps cloud simplify
remove unused js files

* id fix

* fix search test
simplify environment var step 1

* fix lint

* first user iteration fix

* fix model

* unify use of apiService

* first step automatic user creation Identity

* refactor creation user content-services

* refactor creation user search

* refactor creation user core

* process service refactoring 1

* process service refactoring 1

* process service refactoring 2

* fix process

* appconfig

* fix process util

* fix gallery

* fix "this" reference issues

* fix incorrect import paths

* fix core

* some fixes

* allign

* fix some test
remove structure folder and move in actions

* fixes

* move folders in the right place

* fix

* fix rebase

* solve build issue

* fix e2e

* change init aae

* order api and some fixes

* fix possible not valid password

* fix some ps test

* replace host port also in objects

* Update app-config.service.ts

* fix process

* fix process test

* process service cloud fix

* fiexs

* modify init script

* fix two test

* remove unused property

* host issue

* not use npx

* fix ps cloud test

Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
Eugenio Romano
2020-06-04 14:41:30 +01:00
committed by GitHub
parent f0df6b3a5f
commit a78f24ada1
297 changed files with 5130 additions and 9622 deletions

View File

@@ -15,29 +15,27 @@
* limitations under the License.
*/
import { LoginPage, UploadActions, StringUtil } from '@alfresco/adf-testing';
import { LoginSSOPage, UploadActions, StringUtil, ApiService, UserModel } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../pages/adf/navigation-bar.page';
import { ContentServicesPage } from '../pages/adf/content-services.page';
import { LockFilePage } from '../pages/adf/lock-file.page';
import { AcsUserModel } from '../models/ACS/acs-user.model';
import { FileModel } from '../models/ACS/file.model';
import CONSTANTS = require('../util/constants');
import { browser } from 'protractor';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UsersActions } from '../actions/users.actions';
describe('Lock File', () => {
const loginPage = new LoginPage();
const loginPage = new LoginSSOPage();
const navigationBarPage = new NavigationBarPage();
const lockFilePage = new LockFilePage();
const contentServices = new ContentServicesPage();
const adminUser = new AcsUserModel();
const managerUser = new AcsUserModel();
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: browser.params.testConfig.adf_acs.host
});
const uploadActions = new UploadActions(this.alfrescoJsApi);
const adminUser = new UserModel();
const managerUser = new UserModel();
const apiService = new ApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
@@ -52,34 +50,33 @@ describe('Lock File', () => {
let nodeId, site, documentLibrary, lockedFileNodeId;
beforeAll(async () => {
await this.alfrescoJsApi.login(browser.params.testConfig.adf.adminEmail, browser.params.testConfig.adf.adminPassword);
await apiService.getInstance().login(browser.params.testConfig.admin.email, browser.params.testConfig.admin.password);
await this.alfrescoJsApi.core.peopleApi.addPerson(adminUser);
await this.alfrescoJsApi.core.peopleApi.addPerson(managerUser);
await usersActions.createUser(adminUser);
await usersActions.createUser(managerUser);
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await apiService.getInstance().login(adminUser.email, adminUser.password);
site = await this.alfrescoJsApi.core.sitesApi.createSite({
site = await apiService.getInstance().core.sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PRIVATE'
});
const resultNode = await this.alfrescoJsApi.core.nodesApi.getNodeChildren(site.entry.guid);
const resultNode = await apiService.getInstance().core.nodesApi.getNodeChildren(site.entry.guid);
documentLibrary = resultNode.list.entries[0].entry.id;
await this.alfrescoJsApi.core.sitesApi.addSiteMember(site.entry.id, {
id: managerUser.id,
await apiService.getInstance().core.sitesApi.addSiteMember(site.entry.id, {
id: managerUser.email,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
});
afterAll(async () => {
await this.alfrescoJsApi.core.sitesApi.deleteSite(site.entry.id, { permanent: true });
await apiService.getInstance().core.sitesApi.deleteSite(site.entry.id, { permanent: true });
});
describe('Lock file interaction with the UI', () => {
beforeAll(async () => {
const pngLockedUploadedFile = await uploadActions.uploadFile(pngFileToLock.location, pngFileToLock.name, documentLibrary);
@@ -90,41 +87,35 @@ describe('Lock File', () => {
try {
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.loginToContentServicesUsingUserModel(adminUser);
await loginPage.login(adminUser.email, adminUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
await contentServices.waitForTableBody();
} catch (error) {
}
});
}
});
afterEach(async () => {
try {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await apiService.getInstance().login(adminUser.email, adminUser.password);
await uploadActions.deleteFileOrFolder(nodeId);
} catch (error) {
}
});
}
});
afterAll(async () => {
try {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await apiService.getInstance().login(adminUser.email, adminUser.password);
await this.alfrescoJsApi.core.nodesApi.unlockNode(lockedFileNodeId);
await apiService.getInstance().core.nodesApi.unlockNode(lockedFileNodeId);
await uploadActions.deleteFileOrFolder(lockedFileNodeId);
} catch (error) {
}
});
}
});
it('[C286604] Should be able to open Lock file option by clicking the lock image', async () => {
await contentServices.lockContent(pngFileModel.name);
@@ -171,27 +162,25 @@ describe('Lock File', () => {
});
describe('Locked file without owner permissions', () => {
beforeEach(async () => {
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.loginToContentServicesUsingUserModel(managerUser);
await loginPage.login(managerUser.email, managerUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
});
afterEach(async () => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await apiService.getInstance().login(adminUser.email, adminUser.password);
try {
await this.alfrescoJsApi.core.nodesApi.unlockNode(nodeId);
await apiService.getInstance().core.nodesApi.unlockNode(nodeId);
await uploadActions.deleteFileOrFolder(nodeId);
} catch (error) {
}
});
});
it('[C286610] Should not be able to delete a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
@@ -201,12 +190,11 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.deleteNode(nodeId);
await apiService.getInstance().core.nodesApi.deleteNode(nodeId);
} catch (error) {
await expect(error.status).toEqual(409);
}
});
});
it('[C286611] Should not be able to rename a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
@@ -216,13 +204,12 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: 'My new name' });
await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
} catch (error) {
await expect(error.status).toEqual(409);
}
});
});
it('[C286612] Should not be able to move a locked file', async () => {
await contentServices.lockContent(pngFileModel.name);
@@ -232,7 +219,7 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
} catch (error) {
await expect(error.status).toEqual(409);
@@ -247,7 +234,7 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
} catch (error) {
await expect(error.status).toEqual(409);
@@ -256,7 +243,6 @@ describe('Lock File', () => {
});
describe('Locked file with owner permissions', () => {
let pngFileToBeLocked;
beforeAll(async () => {
@@ -265,29 +251,26 @@ describe('Lock File', () => {
lockedFileNodeId = pngFileToBeLocked.entry.id;
} catch (error) {
}
});
});
beforeEach(async () => {
try {
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, documentLibrary);
nodeId = pngUploadedFile.entry.id;
await loginPage.loginToContentServicesUsingUserModel(adminUser);
await loginPage.login(adminUser.email, adminUser.password);
await navigationBarPage.openContentServicesFolder(documentLibrary);
} catch (error) {
}
});
});
afterEach(async () => {
await this.alfrescoJsApi.login(adminUser.id, adminUser.password);
await apiService.getInstance().login(adminUser.email, adminUser.password);
try {
await uploadActions.deleteFileOrFolder(nodeId);
} catch (error) {
}
});
});
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);
@@ -298,12 +281,11 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
const response = await this.alfrescoJsApi.core.nodesApi.updateNode(nodeId, { name: 'My new name' });
const response = await apiService.getInstance().core.nodesApi.updateNode(nodeId, { name: 'My new name' });
await expect(response.entry.name).toEqual('My new name');
} catch (error) {
}
});
});
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);
@@ -314,12 +296,11 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
const response = await this.alfrescoJsApi.core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
await expect(response.entry.modifiedAt).toBeGreaterThan(response.entry.createdAt);
const response = await apiService.getInstance().core.nodesApi.updateNodeContent(nodeId, 'NEW FILE CONTENT');
await expect(response.entry.modifiedAt.getTime()).toBeGreaterThan(response.entry.createdAt.getTime());
} catch (error) {
}
});
});
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);
@@ -330,15 +311,14 @@ describe('Lock File', () => {
await lockFilePage.clickSaveButton();
try {
await this.alfrescoJsApi.core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
await apiService.getInstance().core.nodesApi.moveNode(nodeId, { targetParentId: '-my-' });
const movedFile = await this.alfrescoJsApi.core.nodesApi.getNode(nodeId);
const movedFile = await apiService.getInstance().core.nodesApi.getNode(nodeId);
await expect(movedFile.entry.parentId).not.toEqual(documentLibrary);
} catch (error) {
}
});
});
it('[C286617] Owner of the locked file should be able to delete if Allow owner to modify is checked', async () => {
await contentServices.lockContent(pngFileToLock.name);