mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3560] Create an automated test to cover 'Add group' on permissions (#3798)
* [ADF-3560] Create an automated test to cover 'Add group' on permissions * fix test * fix tslint issues
This commit is contained in:
@@ -25,6 +25,7 @@ import ContentListPage = require('../pages/adf/dialog/contentList');
|
|||||||
import AlfrescoApi = require('alfresco-js-api-node');
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
import FileModel = require('../models/ACS/fileModel');
|
import FileModel = require('../models/ACS/fileModel');
|
||||||
import { UploadActions } from '../actions/ACS/upload.actions';
|
import { UploadActions } from '../actions/ACS/upload.actions';
|
||||||
|
import Util = require('../util/util.js');
|
||||||
|
|
||||||
describe('Permissions Component', function () {
|
describe('Permissions Component', function () {
|
||||||
|
|
||||||
@@ -40,19 +41,33 @@ describe('Permissions Component', function () {
|
|||||||
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
|
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeAll(() => {
|
let groupBody = {
|
||||||
|
id: Util.generateRandomString(),
|
||||||
|
displayName: Util.generateRandomString()
|
||||||
|
};
|
||||||
|
|
||||||
|
let groupId;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
this.alfrescoJsApi = new AlfrescoApi({
|
this.alfrescoJsApi = new AlfrescoApi({
|
||||||
provider: 'ECM',
|
provider: 'ECM',
|
||||||
hostEcm: TestConfig.adf.url
|
hostEcm: TestConfig.adf.url
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(async (done) => {
|
|
||||||
acsUser = new AcsUserModel();
|
acsUser = new AcsUserModel();
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||||
|
|
||||||
|
let group = await this.alfrescoJsApi.core.groupsApi.createGroup(groupBody);
|
||||||
|
|
||||||
|
groupId = group.entry.id;
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async (done) => {
|
||||||
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||||
|
|
||||||
file = await uploadActions.uploadFile(this.alfrescoJsApi, fileModel.location, fileModel.name, '-my-');
|
file = await uploadActions.uploadFile(this.alfrescoJsApi, fileModel.location, fileModel.name, '-my-');
|
||||||
@@ -69,6 +84,14 @@ describe('Permissions Component', function () {
|
|||||||
|
|
||||||
afterEach(async (done) => {
|
afterEach(async (done) => {
|
||||||
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, file.entry.id);
|
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, file.entry.id);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async (done) => {
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.core.groupsApi.deleteGroup(groupId);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -81,4 +104,14 @@ describe('Permissions Component', function () {
|
|||||||
permissionsPage.checkResultListIsDisplayed();
|
permissionsPage.checkResultListIsDisplayed();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('[C276979] Should be able to give permissions to a group of people', () => {
|
||||||
|
permissionsPage.checkAddPermissionButtonIsDisplayed();
|
||||||
|
permissionsPage.clickAddPermissionButton();
|
||||||
|
permissionsPage.checkAddPermissionDialogIsDisplayed();
|
||||||
|
permissionsPage.checkSearchUserInputIsDisplayed();
|
||||||
|
permissionsPage.searchUserOrGroup('GROUP_' + groupBody.id);
|
||||||
|
permissionsPage.clickUserOrGroup('GROUP_' + groupBody.id);
|
||||||
|
permissionsPage.checkUserOrGroupIsAdded('GROUP_' + groupBody.id);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -29,7 +29,7 @@ import resources = require('../util/resources');
|
|||||||
|
|
||||||
import AlfrescoApi = require('alfresco-js-api-node');
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
import { UploadActions } from '../actions/ACS/upload.actions';
|
import { UploadActions } from '../actions/ACS/upload.actions';
|
||||||
import { browser } from "protractor";
|
import { browser } from 'protractor';
|
||||||
|
|
||||||
describe('Unshare file', () => {
|
describe('Unshare file', () => {
|
||||||
|
|
||||||
|
@@ -130,4 +130,3 @@ export class HeaderPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ export class ShareDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getShareLink() {
|
getShareLink() {
|
||||||
Util.waitUntilElementIsVisible(this.shareLink)
|
Util.waitUntilElementIsVisible(this.shareLink);
|
||||||
return this.shareLink.getAttribute('value');
|
return this.shareLink.getAttribute('value');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ export class PermissionsPage {
|
|||||||
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
|
addPermissionDialog = element(by.css('adf-add-permission-dialog'));
|
||||||
searchUserInput = element(by.id('searchInput'));
|
searchUserInput = element(by.id('searchInput'));
|
||||||
searchResults = element.all(by.id('adf-search-results-content')).first();
|
searchResults = element.all(by.id('adf-search-results-content')).first();
|
||||||
|
addButton = element(by.id('add-permission-dialog-confirm-button'));
|
||||||
|
|
||||||
checkAddPermissionButtonIsDisplayed() {
|
checkAddPermissionButtonIsDisplayed() {
|
||||||
Util.waitUntilElementIsVisible(this.addPermissionButton);
|
Util.waitUntilElementIsVisible(this.addPermissionButton);
|
||||||
@@ -52,4 +53,17 @@ export class PermissionsPage {
|
|||||||
Util.waitUntilElementIsVisible(this.searchResults);
|
Util.waitUntilElementIsVisible(this.searchResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clickUserOrGroup(name) {
|
||||||
|
let userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
|
||||||
|
Util.waitUntilElementIsVisible(userOrGroupName);
|
||||||
|
userOrGroupName.click();
|
||||||
|
Util.waitUntilElementIsVisible(this.addButton);
|
||||||
|
return this.addButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkUserOrGroupIsAdded(name) {
|
||||||
|
let userOrGroupName = element(by.css('div[data-automation-id="text_' + name + '"]'));
|
||||||
|
Util.waitUntilElementIsVisible(userOrGroupName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
"build-lib": "./scripts/ng-packagr.sh",
|
"build-lib": "./scripts/ng-packagr.sh",
|
||||||
"bundlesize-check": "bundlesize",
|
"bundlesize-check": "bundlesize",
|
||||||
"lint-lib": "./node_modules/.bin/tslint -p ./lib/tsconfig.json -c ./lib/tslint.json",
|
"lint-lib": "./node_modules/.bin/tslint -p ./lib/tsconfig.json -c ./lib/tslint.json",
|
||||||
"lint-e2e": "./node_modules/.bin/tslint --fix -p ./e2e/tsconfig.e2e.json -c ./tslint.json",
|
"lint-e2e": "./node_modules/.bin/tslint -p ./e2e/tsconfig.e2e.json -c ./tslint.json",
|
||||||
"test-export": "ts-node ./tools/export-check/exportCheck.ts ./lib/core/public-api.ts ./lib/process-services/public-api.ts ./lib/content-services/public-api.ts ./lib/insights/public-api.ts",
|
"test-export": "ts-node ./tools/export-check/exportCheck.ts ./lib/core/public-api.ts ./lib/process-services/public-api.ts ./lib/content-services/public-api.ts ./lib/insights/public-api.ts",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"validate-config": "ajv validate -s ./lib/core/app-config/schema.json -d ./demo-shell/src/app.config.json --errors=text --verbose",
|
"validate-config": "ajv validate -s ./lib/core/app-config/schema.json -d ./demo-shell/src/app.config.json --errors=text --verbose",
|
||||||
|
@@ -9,8 +9,8 @@ npm run lint-lib || exit 1
|
|||||||
|
|
||||||
echo "====== lint E2E ====="
|
echo "====== lint E2E ====="
|
||||||
|
|
||||||
npm run lint-e2e
|
npm run lint-e2e || exit 1
|
||||||
|
|
||||||
echo "====== lint Demo shell ====="
|
echo "====== lint Demo shell ====="
|
||||||
|
|
||||||
ng lint dev --fix
|
ng lint dev || exit 1
|
||||||
|
Reference in New Issue
Block a user