[ACA-1258] automate tests for viewing file/image properties (#1101)

* split InfoDrawer test component and add tests for viewing properties

* add “date item” to spell ignore and remove commented code

* try to increase timeout
This commit is contained in:
Adina Parpalita
2019-05-09 14:57:31 +03:00
committed by Suzana Dirla
parent 996975fdb5
commit d5f8699976
14 changed files with 990 additions and 492 deletions
+118 -86
View File
@@ -35,6 +35,8 @@ describe('Comments', () => {
const parent = `parent-${Utils.random()}`; let parentId;
const file1 = `file1-${Utils.random()}.txt`;
const folder1 = `folder1-${Utils.random()}`;
const folder2 = `folder2-${Utils.random()}`; let folder2Id;
const fileWith1Comment = `file1Comment-${Utils.random()}.txt`; let fileWith1CommentId;
const fileWith2Comments = `file2Comments-${Utils.random()}.txt`; let fileWith2CommentsId;
@@ -53,6 +55,7 @@ describe('Comments', () => {
};
const infoDrawer = new InfoDrawer();
const { commentsTab } = infoDrawer;
const loginPage = new LoginPage();
const page = new BrowsingPage();
@@ -80,6 +83,10 @@ describe('Comments', () => {
await apis.user.shared.shareFilesByIds([file2SharedId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.favorites.addFavoritesByIds('file', [file2FavoritesId, fileWith1CommentId, fileWith2CommentsId]);
await apis.user.nodes.createFolder(folder1, parentId);
folder2Id = (await apis.user.nodes.createFolder(folder2, parentId)).entry.id;
await apis.user.favorites.addFavoriteById('folder', folder2Id);
await loginPage.loginWith(username);
done();
});
@@ -96,11 +103,6 @@ describe('Comments', () => {
done();
});
afterEach(async (done) => {
await dataTable.clearSelection();
done();
});
it('Comments tab default fields - [C299173]', async () => {
await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails();
@@ -108,9 +110,9 @@ describe('Comments', () => {
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getActiveTabTitle()).toBe('COMMENTS');
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (0)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (0)');
expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
});
it('Comment info display - [C280582]', async () => {
@@ -119,15 +121,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
});
it('Comments are displayed ordered by created date in descending order - [C280583]', async () => {
@@ -136,8 +138,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id);
expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
});
it('Total number of comments is displayed - [C280585]', async () => {
@@ -146,7 +148,7 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
});
it('Add button is enabled when typing in the comment field - [C280589]', async () => {
@@ -155,25 +157,40 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
await infoDrawer.typeComment('my comment');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled');
await commentsTab.typeComment('my comment');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(true, 'Add comment button not enabled');
});
it('Add a comment - [C280590]', async () => {
it('Add a comment on a file - [C280590]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(file2Personal);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment);
await infoDrawer.clickAddButton();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
it('Add a comment on a folder - [C299208]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(folder1);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
it('Escape key clears the text when focus is on the textarea - [C280591]', async () => {
@@ -181,19 +198,19 @@ describe('Comments', () => {
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment('myComment');
await commentsTab.typeComment('myComment');
expect(await infoDrawer.getCommentTextFromTextArea()).toBe('myComment');
expect(await commentsTab.getCommentTextFromTextArea()).toBe('myComment');
await Utils.pressEscape();
expect(await infoDrawer.getCommentTextFromTextArea()).toBe('');
expect(await commentsTab.getCommentTextFromTextArea()).toBe('');
});
});
describe('from Favorites', () => {
beforeAll(async (done) => {
await apis.user.favorites.waitForApi({ expect: 3 });
await apis.user.favorites.waitForApi({ expect: 4 });
done();
});
@@ -203,7 +220,7 @@ describe('Comments', () => {
});
afterEach(async (done) => {
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
@@ -213,16 +230,16 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
// ACA-2348 expect broken because of parallel test suites
// expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
// expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
});
it('Comments are displayed ordered by created date in descending order - [C299197]', async () => {
@@ -231,8 +248,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id);
expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
});
it('Total number of comments is displayed - [C299198]', async () => {
@@ -241,22 +258,37 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
});
it('Add a comment - [C299199]', async () => {
it('Add a comment on a file - [C299199]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(file2Favorites);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment);
await infoDrawer.clickAddButton();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
it('Add a comment on a folder - [C299209]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(folder2);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
});
@@ -272,7 +304,7 @@ describe('Comments', () => {
});
afterEach(async (done) => {
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
@@ -282,15 +314,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
});
it('Comments are displayed ordered by created date in descending order - [C299189]', async () => {
@@ -299,8 +331,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id);
expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
});
it('Total number of comments is displayed - [C299190]', async () => {
@@ -309,22 +341,22 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
});
it('Add a comment - [C299191]', async () => {
it('Add a comment on a file - [C299191]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(file2Shared);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment);
await infoDrawer.clickAddButton();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
});
@@ -340,7 +372,7 @@ describe('Comments', () => {
});
afterEach(async (done) => {
await dataTable.clearSelection();
await page.clickPersonalFiles();
done();
});
@@ -350,15 +382,15 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await infoDrawer.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentTextAreaDisplayed()).toBe(true, 'Comment field not present');
expect(await commentsTab.isAddCommentButtonEnabled()).toBe(false, 'Add comment button not disabled');
expect(await infoDrawer.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await infoDrawer.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await infoDrawer.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await infoDrawer.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await infoDrawer.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
expect(await commentsTab.isCommentDisplayed(commentFile1Entry.id)).toBe(true, `Comment with id: ${commentFile1Entry.id} not displayed`);
expect(await commentsTab.getCommentText(commentFile1Entry.id)).toBe(commentFile1Entry.content, 'Incorrect comment text');
expect(await commentsTab.getCommentUserName(commentFile1Entry.id)).toBe(`${username} ${username}`, 'Incorrect comment user');
expect(await commentsTab.getCommentTime(commentFile1Entry.id)).toBe(moment(commentFile1Entry.createdAt).fromNow(), 'Incorrect comment created time');
expect(await commentsTab.isCommentUserAvatarDisplayed(commentFile1Entry.id)).toBe(true, 'User avatar not displayed');
});
it('Comments are displayed ordered by created date in descending order - [C299193]', async () => {
@@ -367,8 +399,8 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await infoDrawer.getNthCommentId(2)).toContain(comment1File2Entry.id);
expect(await commentsTab.getNthCommentId(1)).toContain(comment2File2Entry.id);
expect(await commentsTab.getNthCommentId(2)).toContain(comment1File2Entry.id);
});
it('Total number of comments is displayed - [C299194]', async () => {
@@ -377,22 +409,22 @@ describe('Comments', () => {
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (2)');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (2)');
});
it('Add a comment - [C299195]', async () => {
it('Add a comment on a file - [C299195]', async () => {
const myComment = 'my comment';
await dataTable.selectItem(file2Recent);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickCommentsTab();
await infoDrawer.typeComment(myComment);
await infoDrawer.clickAddButton();
await commentsTab.typeComment(myComment);
await commentsTab.clickAddButton();
expect(await infoDrawer.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await infoDrawer.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await infoDrawer.getCommentText()).toBe(myComment, 'Incorrect comment text');
expect(await commentsTab.getCommentsTabHeaderText()).toBe('Comments (1)');
expect(await commentsTab.isCommentDisplayed()).toBe(true, `Comment not displayed`);
expect(await commentsTab.getCommentText()).toBe(myComment, 'Incorrect comment text');
});
});
+249
View File
@@ -0,0 +1,249 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2019 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { InfoDrawer } from './../../components/info-drawer/info-drawer';
import { Utils } from '../../utilities/utils';
import { FILES } from '../../configs';
import * as moment from 'moment';
describe('File / Folder properties', () => {
const username = `user1-${Utils.random()}`;
const parent = `parent-${Utils.random()}`; let parentId;
const file1 = {
name: `file1-${Utils.random()}.txt`,
title: 'file title',
description: 'file description',
author: 'file author'
};
let file1Id;
const image1 = {
name: FILES.jpgFile,
title: 'image title',
description: 'image description',
author: 'image author'
}
let image1Id;
const folder1 = {
name: `folder1-${Utils.random()}`,
title: 'folder title',
description: 'folder description',
author: 'folder author'
};
let folder1Id;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const { propertiesTab } = infoDrawer;
const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable } = page;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
file1Id = (await apis.user.nodes.createFile(file1.name, parentId, file1.title, file1.description, file1.author)).entry.id;
folder1Id = (await apis.user.nodes.createFolder(folder1.name, parentId, folder1.title, folder1.description, folder1.author)).entry.id;
image1Id = (await apis.user.upload.uploadFile(image1.name, parentId)).entry.id;
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(parentId);
done();
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(parent);
done();
});
describe('View properties', () => {
it('Default tabs - [C299162]', async () => {
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed');
expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed');
expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs');
});
it('File properties - [C269003]', async () => {
const apiProps = await apis.user.nodes.getNodeById(file1Id);
const expectedPropLabels = [
'Name',
'Title',
'Creator',
'Created Date',
'Size',
'Modifier',
'Modified Date',
'Mimetype',
'Author',
'Description'
];
const expectedPropValues = [
file1.name,
file1.title,
apiProps.entry.createdByUser.displayName,
moment(apiProps.entry.createdAt).format('MMM DD YYYY'),
`${apiProps.entry.content.sizeInBytes} Bytes`,
apiProps.entry.modifiedByUser.displayName,
moment(apiProps.entry.modifiedAt).format('MMM DD YYYY'),
apiProps.entry.content.mimeTypeName,
file1.author,
file1.description
];
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
});
it('Folder properties - [C307106]', async () => {
const apiProps = await apis.user.nodes.getNodeById(folder1Id);
const expectedPropLabels = [
'Name',
'Title',
'Creator',
'Created Date',
'Modifier',
'Modified Date',
'Author',
'Description'
];
const expectedPropValues = [
folder1.name,
folder1.title,
apiProps.entry.createdByUser.displayName,
moment(apiProps.entry.createdAt).format('MMM DD YYYY'),
apiProps.entry.modifiedByUser.displayName,
moment(apiProps.entry.modifiedAt).format('MMM DD YYYY'),
folder1.author,
folder1.description
];
await dataTable.selectItem(folder1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
});
it('Less / More information buttons - [C269004]', async () => {
await dataTable.selectItem(file1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
await propertiesTab.clickLessInformationButton();
expect(await propertiesTab.isLessInfoButtonDisplayed()).toBe(false, 'Less information button displayed');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(false, 'Properties list expanded');
await propertiesTab.clickMoreInformationButton();
expect(await propertiesTab.isMoreInfoButtonDisplayed()).toBe(false, 'More information button displayed');
expect(await propertiesTab.isLessInfoButtonEnabled()).toBe(true, 'Less information button not enabled');
expect(await propertiesTab.isPropertiesListExpanded()).toBe(true, 'Properties list not expanded');
});
it('Image properties - [C269007]', async () => {
const apiProps = await apis.user.nodes.getNodeById(image1Id);
const expectedPropLabels = [
'Image Width',
'Image Height',
'Date and Time',
'Exposure Time',
'F Number',
'Flash Activated',
'Focal Length',
'ISO Speed',
'Orientation',
'Camera Manufacturer',
'Camera Model',
'Camera Software'
];
const expectedPropValues = [
apiProps.entry.properties['exif:pixelXDimension'].toString(),
apiProps.entry.properties['exif:pixelYDimension'].toString(),
moment(apiProps.entry.properties['exif:dateTimeOriginal']).format('MMM DD YYYY H:mm'),
apiProps.entry.properties['exif:exposureTime'].toString(),
apiProps.entry.properties['exif:fNumber'].toString(),
apiProps.entry.properties['exif:flash'],
apiProps.entry.properties['exif:focalLength'].toString(),
apiProps.entry.properties['exif:isoSpeedRatings'],
(apiProps.entry.properties['exif:orientation']).toString(),
apiProps.entry.properties['exif:manufacturer'],
apiProps.entry.properties['exif:model'],
apiProps.entry.properties['exif:software']
];
await dataTable.selectItem(image1.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await propertiesTab.clickLessInformationButton();
await propertiesTab.clickImagePropertiesPanel();
await propertiesTab.waitForImagePropertiesPanelToExpand();
expect(await propertiesTab.isImagePropertiesPanelDisplayed()).toBe(true, 'Image properties panel not displayed');
expect(await propertiesTab.getVisiblePropertiesLabels()).toEqual(expectedPropLabels, 'Incorrect properties displayed');
expect(await propertiesTab.getVisiblePropertiesValues()).toEqual(expectedPropValues, 'Incorrect properties values');
expect(await propertiesTab.isEditPropertiesButtonEnabled()).toBe(true, 'Edit button not enabled');
expect(await propertiesTab.isMoreInfoButtonEnabled()).toBe(true, 'More information button not enabled');
});
});
});
+6 -6
View File
@@ -76,15 +76,15 @@ describe('General', () => {
done();
});
it('Info drawer for a file - default tabs - [C299162]', async () => {
it('Info drawer closes on page refresh - [C268999]', async () => {
await dataTable.selectItem(file1);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open');
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed');
expect(await infoDrawer.isCommentsTabDisplayed()).toBe(true, 'Comments tab is not displayed');
expect(await infoDrawer.getTabsCount()).toBe(2, 'Incorrect number of tabs');
await page.refresh();
await dataTable.waitForBody();
expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer open');
});
});
@@ -62,6 +62,7 @@ describe('Library properties', () => {
};
const infoDrawer = new InfoDrawer();
const { aboutTab } = infoDrawer;
const loginPage = new LoginPage();
const page = new BrowsingPage();
@@ -108,17 +109,17 @@ describe('Library properties', () => {
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
expect(await infoDrawer.isAboutTabDisplayed()).toBe(true, 'About tab is not displayed');
expect(await infoDrawer.isNameDisplayed()).toBe(true, 'Name field not displayed');
expect(await infoDrawer.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
expect(await infoDrawer.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
expect(await infoDrawer.isDescriptionDisplayed()).toBe(true, 'Description field not displayed');
expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed');
expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
expect(await aboutTab.isDescriptionDisplayed()).toBe(true, 'Description field not displayed');
expect(await infoDrawer.getName()).toEqual(site.name);
expect(await infoDrawer.getLibraryId()).toEqual(site.id);
expect((await infoDrawer.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase());
expect(await infoDrawer.getDescription()).toEqual(site.description);
expect(await aboutTab.getName()).toEqual(site.name);
expect(await aboutTab.getLibraryId()).toEqual(site.id);
expect((await aboutTab.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase());
expect(await aboutTab.getDescription()).toEqual(site.description);
expect(await infoDrawer.isEditDisplayed()).toBe(true, 'Edit action is not displayed');
expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(true, 'Edit action is not displayed');
});
it('Editable properties - [C289338]', async () => {
@@ -126,18 +127,18 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await aboutTab.clickEditLibraryProperties();
expect(await infoDrawer.isNameEnabled()).toBe(true, 'Name field not enabled');
expect(await infoDrawer.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled');
expect(await infoDrawer.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled');
expect(await infoDrawer.isDescriptionEnabled()).toBe(true, 'Description field not enabled');
expect(await aboutTab.isNameEnabled()).toBe(true, 'Name field not enabled');
expect(await aboutTab.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled');
expect(await aboutTab.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled');
expect(await aboutTab.isDescriptionEnabled()).toBe(true, 'Description field not enabled');
expect(await infoDrawer.isCancelDisplayed()).toBe(true, 'Cancel button not displayed');
expect(await infoDrawer.isUpdateDisplayed()).toBe(true, 'Update button not displayed');
expect(await infoDrawer.isCancelEnabled()).toBe(true, 'Cancel button not enabled');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled');
expect(await aboutTab.isCancelDisplayed()).toBe(true, 'Cancel button not displayed');
expect(await aboutTab.isUpdateDisplayed()).toBe(true, 'Update button not displayed');
expect(await aboutTab.isCancelEnabled()).toBe(true, 'Cancel button not enabled');
expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
});
it('Edit site details - [C289339]', async () => {
@@ -145,15 +146,15 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(siteUpdated.name);
await infoDrawer.enterDescription(siteUpdated.description);
await infoDrawer.setVisibility(siteUpdated.visibility);
expect(await infoDrawer.isUpdateEnabled()).toBe(true, 'Update button not enabled');
await aboutTab.enterName(siteUpdated.name);
await aboutTab.enterDescription(siteUpdated.description);
await aboutTab.setVisibility(siteUpdated.visibility);
expect(await aboutTab.isUpdateEnabled()).toBe(true, 'Update button not enabled');
await infoDrawer.clickUpdate();
await aboutTab.clickUpdate();
expect(await page.getSnackBarMessage()).toEqual('Library properties updated');
expect(await dataTable.isItemPresent(siteUpdated.name)).toBe(true, 'New site name not displayed in the list');
@@ -172,14 +173,14 @@ describe('Library properties', () => {
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditEnabled()).toBe(true, 'Edit action is not enabled');
await infoDrawer.clickEdit();
expect(await aboutTab.isEditLibraryPropertiesEnabled()).toBe(true, 'Edit action is not enabled');
await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(newName);
await infoDrawer.enterDescription(newDesc);
await infoDrawer.setVisibility(SITE_VISIBILITY.MODERATED);
await aboutTab.enterName(newName);
await aboutTab.enterDescription(newDesc);
await aboutTab.setVisibility(SITE_VISIBILITY.MODERATED);
await infoDrawer.clickCancel();
await aboutTab.clickCancel();
expect(await dataTable.isItemPresent(newName)).toBe(false, 'New site name is displayed in the list');
expect(await dataTable.isItemPresent(site.name)).toBe(true, 'Original site name not displayed in the list');
@@ -192,37 +193,37 @@ describe('Library properties', () => {
await dataTable.selectItem(siteDup);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit();
await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(site.name);
expect(await infoDrawer.isMessageDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getMessage()).toEqual('Library name already in use');
await aboutTab.enterName(site.name);
expect(await aboutTab.isMessageDisplayed()).toBe(true, 'Message not displayed');
expect(await aboutTab.getMessage()).toEqual('Library name already in use');
});
it('Site name too long - [C289342]', async () => {
await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit();
await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterName(Utils.string257);
await aboutTab.enterName(Utils.string257);
await Utils.pressTab();
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getError()).toEqual('Use 256 characters or less for title');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled');
expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await aboutTab.getError()).toEqual('Use 256 characters or less for title');
expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
});
it('Site description too long - [C289343]', async () => {
await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit();
await aboutTab.clickEditLibraryProperties();
await infoDrawer.enterDescription(Utils.string513);
await aboutTab.enterDescription(Utils.string513);
await Utils.pressTab();
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await infoDrawer.getError()).toEqual('Use 512 characters or less for description');
expect(await infoDrawer.isUpdateEnabled()).toBe(false, 'Update button not disabled');
expect(await aboutTab.isErrorDisplayed()).toBe(true, 'Message not displayed');
expect(await aboutTab.getError()).toEqual('Use 512 characters or less for description');
expect(await aboutTab.isUpdateEnabled()).toBe(false, 'Update button not disabled');
});
describe('Non manager', () => {
@@ -238,7 +239,7 @@ describe('Library properties', () => {
await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEditDisplayed()).toBe(false, 'Edit action is displayed');
expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed');
});
it('Error notification - [C289344]', async () => {
@@ -248,12 +249,12 @@ describe('Library properties', () => {
await dataTable.selectItem(site.name);
await page.toolbar.clickViewDetails();
await infoDrawer.waitForInfoDrawerToOpen();
await infoDrawer.clickEdit();
await aboutTab.clickEditLibraryProperties();
await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE);
await infoDrawer.enterDescription('new description');
await infoDrawer.clickUpdate();
await aboutTab.enterDescription('new description');
await aboutTab.clickUpdate();
expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties');
});