mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
* remove demo shell test and make cloud a bit more stable * fix lint * Update restore-content-directive.e2e.ts * Update restore-content-directive.e2e.ts * Update restore-content-directive.e2e.ts * try fix attach * Update .travis.yml * sleep... * remove about e2e demo shell.... * fix * lint fix * configure * refactor buuild * names and remove demo shell build from libs * fix new build approach * fix * fix * . * uncomment * . * . * fix * fix * . * fix * lock update * fix demo shell errors * use replay subject * fix some console log error * suffix problem * split process e2e * not need to check everywhere the pagination e2e * split content * fix * fix * fix * fix * reorg # Conflicts: # .travis.yml
205 lines
8.6 KiB
TypeScript
205 lines
8.6 KiB
TypeScript
/*!
|
|
* @license
|
|
* Copyright 2019 Alfresco Software, Ltd.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import {
|
|
ApiService,
|
|
LikePage,
|
|
LoginPage,
|
|
RatePage,
|
|
UploadActions,
|
|
UserModel,
|
|
UsersActions
|
|
} from '@alfresco/adf-testing';
|
|
import { FileModel } from '../../models/ACS/file.model';
|
|
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
|
|
import { SocialPage } from '../../content-services/pages/social.page';
|
|
import { browser } from 'protractor';
|
|
|
|
describe('Social component', () => {
|
|
|
|
const loginPage = new LoginPage();
|
|
const likePage = new LikePage();
|
|
const ratePage = new RatePage();
|
|
const socialPage = new SocialPage();
|
|
const navigationBarPage = new NavigationBarPage();
|
|
const componentOwner = new UserModel();
|
|
const componentVisitor = new UserModel();
|
|
const secondComponentVisitor = new UserModel();
|
|
|
|
const apiService = new ApiService();
|
|
const usersActions = new UsersActions(apiService);
|
|
const uploadActions = new UploadActions(apiService);
|
|
|
|
const blueLikeColor = ('rgba(33, 150, 243, 1)');
|
|
const greyLikeColor = ('rgba(128, 128, 128, 1)');
|
|
const yellowRatedStarColor = ('rgba(255, 233, 68, 1)');
|
|
const averageStarColor = ('rgba(128, 128, 128, 1)');
|
|
|
|
let emptyFile;
|
|
|
|
const emptyFileModel = new FileModel({
|
|
'name': browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
|
|
'location': browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
|
|
});
|
|
|
|
beforeAll(async () => {
|
|
await apiService.loginWithProfile('admin');
|
|
|
|
await usersActions.createUser(componentOwner);
|
|
await usersActions.createUser(componentVisitor);
|
|
await usersActions.createUser(secondComponentVisitor);
|
|
|
|
await apiService.login(componentOwner.username, componentOwner.password);
|
|
|
|
emptyFile = await uploadActions.uploadFile(emptyFileModel.location, emptyFileModel.name, '-my-');
|
|
|
|
await apiService.getInstance().core.nodesApi.updateNode(emptyFile.entry.id,
|
|
|
|
{
|
|
permissions: {
|
|
locallySet: [{
|
|
authorityId: componentVisitor.username,
|
|
name: 'Consumer',
|
|
accessStatus: 'ALLOWED'
|
|
}, {
|
|
authorityId: secondComponentVisitor.username,
|
|
name: 'Consumer',
|
|
accessStatus: 'ALLOWED'
|
|
}]
|
|
}
|
|
});
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await apiService.loginWithProfile('admin');
|
|
await uploadActions.deleteFileOrFolder(emptyFile.entry.email);
|
|
});
|
|
|
|
describe('User interaction on their own components', () => {
|
|
beforeEach(async () => {
|
|
await loginPage.login(componentOwner.username, componentOwner.password);
|
|
await navigationBarPage.clickSocialButton();
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await navigationBarPage.clickLogoutButton();
|
|
});
|
|
|
|
it('[C203006] Should be able to like and unlike their components but not rate them,', async () => {
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
|
|
await likePage.clickLike();
|
|
await likePage.checkLikeCounter(1);
|
|
await likePage.removeHoverFromLikeButton();
|
|
await expect(await likePage.getLikedIconColor()).toBe(blueLikeColor);
|
|
await ratePage.rateComponent(4);
|
|
await ratePage.checkRatingCounter(0);
|
|
await expect(await ratePage.isNotStarRated(4));
|
|
await expect(await ratePage.getUnratedStarColor(4)).toBe(averageStarColor);
|
|
await likePage.clickUnlike();
|
|
await likePage.checkLikeCounter(0);
|
|
await likePage.removeHoverFromLikeButton();
|
|
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
|
|
});
|
|
});
|
|
|
|
describe('User interaction on components that belong to other users', () => {
|
|
|
|
beforeEach(async () => {
|
|
await loginPage.login(componentVisitor.username, componentVisitor.password);
|
|
await navigationBarPage.clickSocialButton();
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await navigationBarPage.clickLogoutButton();
|
|
});
|
|
|
|
it('[C310198] Should be able to rate and unRate a component', async () => {
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
|
|
|
|
await ratePage.checkRatingCounter(0);
|
|
await ratePage.rateComponent(4);
|
|
await ratePage.checkRatingCounter(1);
|
|
await expect(await ratePage.isStarRated(4));
|
|
await expect(await ratePage.getRatedStarColor(4)).toBe(yellowRatedStarColor);
|
|
await ratePage.removeRating(4);
|
|
await ratePage.checkRatingCounter(0);
|
|
await expect(await ratePage.isNotStarRated(4));
|
|
});
|
|
});
|
|
|
|
describe('Multiple Users interaction', () => {
|
|
|
|
beforeEach(async () => {
|
|
await loginPage.login(componentVisitor.username, componentVisitor.password);
|
|
await navigationBarPage.clickSocialButton();
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await navigationBarPage.clickLogoutButton();
|
|
});
|
|
|
|
it('[C310197] Should be able to like, unLike, display total likes', async () => {
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
|
|
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
|
|
await likePage.clickLike();
|
|
await likePage.checkLikeCounter(1);
|
|
await likePage.removeHoverFromLikeButton();
|
|
await expect(await likePage.getLikedIconColor()).toBe(blueLikeColor);
|
|
|
|
await navigationBarPage.clickLogoutButton();
|
|
await loginPage.login(secondComponentVisitor.username, secondComponentVisitor.password);
|
|
await navigationBarPage.clickSocialButton();
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
|
|
await likePage.clickLike();
|
|
await likePage.checkLikeCounter(2);
|
|
await likePage.removeHoverFromLikeButton();
|
|
await expect(await likePage.getLikedIconColor()).toBe(blueLikeColor);
|
|
await likePage.clickUnlike();
|
|
await likePage.checkLikeCounter(1);
|
|
await likePage.removeHoverFromLikeButton();
|
|
await expect(await likePage.getUnLikedIconColor()).toBe(greyLikeColor);
|
|
});
|
|
|
|
it('[C260327] Should be able to rate, unRate, display total ratings, display average rating', async () => {
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
|
|
await ratePage.rateComponent(4);
|
|
await ratePage.checkRatingCounter(1);
|
|
await expect(await ratePage.isStarRated(4));
|
|
await expect(await ratePage.getRatedStarColor(4)).toBe(yellowRatedStarColor);
|
|
|
|
await navigationBarPage.clickLogoutButton();
|
|
await loginPage.login(secondComponentVisitor.username, secondComponentVisitor.password);
|
|
await navigationBarPage.clickSocialButton();
|
|
await socialPage.writeCustomNodeId(emptyFile.entry.id);
|
|
await expect(await socialPage.getNodeIdFieldValue()).toEqual(emptyFile.entry.id);
|
|
await ratePage.checkRatingCounter(1);
|
|
await expect(await ratePage.getAverageStarColor(4)).toBe(averageStarColor);
|
|
await ratePage.rateComponent(0);
|
|
await ratePage.checkRatingCounter(2);
|
|
await expect(await ratePage.isStarRated(2));
|
|
await ratePage.removeRating(0);
|
|
await ratePage.checkRatingCounter(1);
|
|
await expect(await ratePage.getAverageStarColor(4)).toBe(averageStarColor);
|
|
});
|
|
});
|
|
});
|