[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

@@ -15,8 +15,8 @@
* limitations under the License.
*/
import { browser, by, element } from 'protractor';
import { LoginPage, PaginationPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { LoginPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
@@ -28,10 +28,6 @@ import { FileModel } from '../../models/ACS/fileModel';
import { StringUtil } from '@alfresco/adf-testing';
import { Util } from '../../util/util';
import { ContentNodeSelectorDialogPage } from '@alfresco/adf-testing';
import { BreadCrumbDropdownPage } from '../../pages/adf/content-services/breadcrumb/breadCrumbDropdownPage';
import { FolderModel } from '../../models/ACS/folderModel';
import { BreadCrumbPage } from '../../pages/adf/content-services/breadcrumb/breadCrumbPage';
import { InfinitePaginationPage } from '../../pages/adf/core/infinitePaginationPage';
describe('Document List Component - Actions', () => {
@@ -40,11 +36,7 @@ describe('Document List Component - Actions', () => {
const navigationBarPage = new NavigationBarPage();
const contentListPage = contentServicesPage.getDocumentList();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const paginationPage = new PaginationPage();
const breadCrumbDropdownPage = new BreadCrumbDropdownPage();
const breadCrumbPage = new BreadCrumbPage();
const uploadActions = new UploadActions();
const infinitePaginationPage = new InfinitePaginationPage(element(by.css('adf-content-node-selector')));
const alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
@@ -75,7 +67,6 @@ describe('Document List Component - Actions', () => {
};
beforeAll(async (done) => {
acsUser = new AcsUserModel();
folderName = `TATSUMAKY_${StringUtil.generateRandomString(5)}_SENPOUKYAKU`;
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
@@ -89,13 +80,13 @@ describe('Document List Component - Actions', () => {
fileNames = Util.generateSequenceFiles(1, nrOfFiles, files.base, files.extension);
await uploadActions.createEmptyFiles(alfrescoJsApi, fileNames, uploadedFolder.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
browser.driver.sleep(10000);
await browser.driver.sleep(15000);
done();
});
beforeEach(async (done) => {
beforeEach((done) => {
navigationBarPage.clickContentServicesButton();
done();
});
@@ -215,147 +206,4 @@ describe('Document List Component - Actions', () => {
});
});
describe('Folder Actions - Copy and Move', () => {
const folderModel1 = new FolderModel({'name': StringUtil.generateRandomString()});
const folderModel2 = new FolderModel({'name': StringUtil.generateRandomString()});
const folderModel3 = new FolderModel({'name': StringUtil.generateRandomString()});
const folderModel4 = new FolderModel({'name': StringUtil.generateRandomString()});
const folderModel5 = new FolderModel({'name': StringUtil.generateRandomString()});
const folderModel6 = new FolderModel({'name': StringUtil.generateRandomString()});
let folder1, folder2, folder3, folder4, folder5, folder6;
let folders;
const contentServicesUser = new AcsUserModel();
beforeAll(async (done) => {
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await alfrescoJsApi.core.peopleApi.addPerson(contentServicesUser);
await alfrescoJsApi.login(contentServicesUser.id, contentServicesUser.password);
folder1 = await uploadActions.createFolder(alfrescoJsApi, 'A' + folderModel1.name, '-my-');
folder2 = await uploadActions.createFolder(alfrescoJsApi, 'B' + folderModel2.name, '-my-');
folder3 = await uploadActions.createFolder(alfrescoJsApi, 'C' + folderModel3.name, '-my-');
folder4 = await uploadActions.createFolder(alfrescoJsApi, 'D' + folderModel4.name, '-my-');
folder5 = await uploadActions.createFolder(alfrescoJsApi, 'E' + folderModel5.name, '-my-');
folder6 = await uploadActions.createFolder(alfrescoJsApi, 'F' + folderModel6.name, '-my-');
folders = [folder1, folder2, folder3, folder4, folder5, folder6];
done();
});
beforeEach(async (done) => {
loginPage.loginToContentServicesUsingUserModel(contentServicesUser);
contentServicesPage.goToDocumentList();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage('5');
contentServicesPage.checkAcsContainer();
contentListPage.waitForTableBody();
done();
});
afterAll(async (done) => {
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await folders.forEach(function (folder) {
uploadActions.deleteFilesOrFolder(alfrescoJsApi, folder.entry.id);
});
done();
});
it('[C260132] Move action on folder with - Load more', () => {
expect(paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
expect(contentNodeSelector.getDialogHeaderText()).toBe('Move \'' + 'A' + folderModel1.name + '\' to...');
contentNodeSelector.checkSearchInputIsDisplayed();
expect(contentNodeSelector.getSearchLabel()).toBe('Search');
contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
contentNodeSelector.checkCancelButtonIsDisplayed();
contentNodeSelector.checkMoveCopyButtonIsDisplayed();
expect(contentNodeSelector.getMoveCopyButtonText()).toBe('MOVE');
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
infinitePaginationPage.clickLoadMoreButton();
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickCancelButton();
contentNodeSelector.checkDialogIsNotDisplayed();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
infinitePaginationPage.clickLoadMoreButton();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
contentServicesPage.doubleClickRow('F' + folderModel6.name);
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
breadCrumbDropdownPage.clickParentFolder();
breadCrumbDropdownPage.checkBreadCrumbDropdownIsDisplayed();
breadCrumbDropdownPage.choosePath(contentServicesUser.id);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
breadCrumbPage.chooseBreadCrumb(contentServicesUser.id);
contentServicesPage.waitForTableBody();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
it('[C305051] Copy action on folder with - Load more', () => {
expect(paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Copy');
contentServicesPage.pressContextMenuActionNamed('Copy');
contentNodeSelector.checkDialogIsDisplayed();
expect(contentNodeSelector.getDialogHeaderText()).toBe('Copy \'' + 'A' + folderModel1.name + '\' to...');
contentNodeSelector.checkSearchInputIsDisplayed();
expect(contentNodeSelector.getSearchLabel()).toBe('Search');
contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
contentNodeSelector.checkCancelButtonIsDisplayed();
contentNodeSelector.checkMoveCopyButtonIsDisplayed();
expect(contentNodeSelector.getMoveCopyButtonText()).toBe('COPY');
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
infinitePaginationPage.clickLoadMoreButton();
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickCancelButton();
contentNodeSelector.checkDialogIsNotDisplayed();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Copy');
contentServicesPage.pressContextMenuActionNamed('Copy');
contentNodeSelector.checkDialogIsDisplayed();
infinitePaginationPage.clickLoadMoreButton();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
paginationPage.clickOnNextPage();
contentListPage.waitForTableBody();
contentServicesPage.doubleClickRow('F' + folderModel6.name);
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
});
});

View File

@@ -15,14 +15,12 @@
* limitations under the License.
*/
import { browser } from 'protractor';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import { ViewerPage } from '../../pages/adf/viewerPage';
import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import { LoginPage, ErrorPage, StringUtil } from '@alfresco/adf-testing';
import { LoginPage, StringUtil } from '@alfresco/adf-testing';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UploadActions } from '../../actions/ACS/upload.actions';
import { FileModel } from '../../models/ACS/fileModel';
@@ -32,9 +30,6 @@ describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navBar = new NavigationBarPage();
const errorPage = new ErrorPage();
let privateSite;
let uploadedFolder, uploadedFolderExtra;
const uploadActions = new UploadActions();
let acsUser = null;
@@ -68,58 +63,6 @@ describe('Document List Component', () => {
done();
});
describe('Permission Message', async () => {
beforeAll(async (done) => {
acsUser = new AcsUserModel();
const siteName = `PRIVATE_TEST_SITE_${StringUtil.generateRandomString(5)}`;
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}`;
const privateSiteBody = { visibility: 'PRIVATE', title: siteName };
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
privateSite = await this.alfrescoJsApi.core.sitesApi.createSite(privateSiteBody);
uploadedFolder = await uploadActions.createFolder(this.alfrescoJsApi, folderName, privateSite.entry.guid);
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.core.sitesApi.deleteSite(privateSite.entry.id);
navBar.openLanguageMenu();
navBar.chooseLanguage('English');
done();
});
it('[C217334] Should display a message when accessing file without permissions', () => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
browser.get(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorCode()).toBe('403');
expect(errorPage.getErrorDescription()).toBe('You\'re not allowed access to this resource on the server.');
});
it('[C279924] Should display custom message when accessing a file without permissions', () => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.enableCustomPermissionMessage();
browser.get(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorCode()).toBe('403');
});
it('[C279925] Should display translated message when accessing a file without permissions if language is changed', () => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
navBar.openLanguageMenu();
navBar.chooseLanguage('Italiano');
browser.sleep(2000);
browser.get(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorDescription()).toBe('Accesso alla risorsa sul server non consentito.');
});
});
describe('Custom Column', () => {
let folderName;
@@ -252,7 +195,7 @@ describe('Document List Component', () => {
fileBNode = await uploadActions.uploadFile(this.alfrescoJsApi, fakeFileB.location, fakeFileB.name, '-my-');
fileCNode = await uploadActions.uploadFile(this.alfrescoJsApi, fakeFileC.location, fakeFileC.name, '-my-');
loginPage.loginToContentServicesUsingUserModel(user);
await loginPage.loginToContentServicesUsingUserModel(user);
contentServicesPage.goToDocumentList();
done();
@@ -313,7 +256,7 @@ describe('Document List Component', () => {
const folderName = 'BANANA';
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.createNewFolder(folderName);
contentServicesPage.doubleClickRow(folderName);
@@ -334,7 +277,7 @@ describe('Document List Component', () => {
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
uploadedFolder = await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkContentIsDisplayed(uploadedFolder.entry.name);
contentServicesPage.doubleClickRow(uploadedFolder.entry.name);
@@ -347,7 +290,7 @@ describe('Document List Component', () => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.clickOnContentServices();
contentServicesPage.checkRecentFileToBeShowed();
const icon = await contentServicesPage.getRecentFileIcon();
@@ -367,7 +310,7 @@ describe('Document List Component', () => {
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
uploadedFolder = await uploadActions.createFolder(this.alfrescoJsApi, folderNameA, '-my-');
uploadedFolderExtra = await uploadActions.createFolder(this.alfrescoJsApi, folderNameB, '-my-');
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkContentIsDisplayed(folderNameA);
contentServicesPage.checkContentIsDisplayed(folderNameB);
@@ -391,7 +334,7 @@ describe('Document List Component', () => {
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
testFileNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFileA.location, testFileA.name, '-my-');
pdfBFileNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFileB.location, testFileB.name, '-my-');
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkContentIsDisplayed(testFileA.name);
contentServicesPage.checkContentIsDisplayed(testFileB.name);
@@ -429,7 +372,7 @@ describe('Document List Component', () => {
});
it('[C277093] Should sort files with Items per page set to default', async (done) => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.checkListIsSortedByNameColumn('asc');
done();
@@ -437,252 +380,6 @@ describe('Document List Component', () => {
});
describe('Thumbnails and tooltips', () => {
const pdfFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const testFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
const docxFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode, fileTestNode, fileDocxNode, folderNode;
beforeAll(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
filePdfNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(this.alfrescoJsApi, docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
if (filePdfNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileDocxNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, folderNode.entry.id);
}
done();
});
beforeEach(() => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
});
it('[C260108] Should display tooltip for file\'s name', () => {
expect(contentServicesPage.getContentList().getTooltip(pdfFile.name)).toEqual(pdfFile.name);
});
it('[C260109] Should display tooltip for folder\'s name', () => {
expect(contentServicesPage.getContentList().getTooltip(folderName)).toEqual(folderName);
});
it('[C260119] Should have a specific thumbnail for folders', async (done) => {
const folderIconUrl = await contentServicesPage.getRowIconImageUrl(folderName);
expect(folderIconUrl).toContain('/assets/images/ft_ic_folder.svg');
done();
});
it('[C280066] Should have a specific thumbnail PDF files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_pdf.svg');
done();
});
it('[C280067] Should have a specific thumbnail DOCX files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(docxFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_ms_word.svg');
done();
});
it('[C280068] Should have a specific thumbnail files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(testFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_document.svg');
done();
});
it('[C274701] Should be able to enable thumbnails', async (done) => {
contentServicesPage.enableThumbnails();
contentServicesPage.checkAcsContainer();
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
expect(fileIconUrl).toContain(`/versions/1/nodes/${filePdfNode.entry.id}/renditions`);
done();
});
});
describe('Gallery View', () => {
const cardProperties = {
DISPLAY_NAME: 'Display name',
SIZE: 'Size',
LOCK: 'Lock',
CREATED_BY: 'Created by',
CREATED: 'Created'
};
let funnyUser;
const pdfFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const testFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
const docxFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode, fileTestNode, fileDocxNode, folderNode, filePDFSubNode;
beforeAll(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
funnyUser = await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
filePdfNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(this.alfrescoJsApi, docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
filePDFSubNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, folderNode.entry.id);
done();
});
beforeEach(() => {
loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
contentServicesPage.clickGridViewButton();
contentServicesPage.checkCardViewContainerIsDisplayed();
});
it('[C280016] Should be able to choose Gallery View', () => {
expect(contentServicesPage.getCardElementShowedInPage()).toBe(4);
});
it('[C280023] Gallery Card should show details', () => {
expect(contentServicesPage.getDocumentCardIconForElement(folderName)).toContain('/assets/images/ft_ic_folder.svg');
expect(contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
expect(contentServicesPage.getDocumentCardIconForElement(docxFile.name)).toContain('/assets/images/ft_ic_ms_word.svg');
expect(contentServicesPage.getDocumentCardIconForElement(testFile.name)).toContain('/assets/images/ft_ic_document.svg');
contentServicesPage.checkMenuIsShowedForElementIndex(0);
contentServicesPage.checkMenuIsShowedForElementIndex(1);
contentServicesPage.checkMenuIsShowedForElementIndex(2);
contentServicesPage.checkMenuIsShowedForElementIndex(3);
});
it('[C280069] Gallery Card should show attributes', () => {
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.DISPLAY_NAME);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.SIZE);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED_BY);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.DISPLAY_NAME)).toBe(folderName);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.DISPLAY_NAME)).toBe(pdfFile.name);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.SIZE)).toBe(`702.76 KB`);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.DISPLAY_NAME)).toBe(docxFile.name);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.SIZE)).toBe(`81.05 KB`);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.DISPLAY_NAME)).toBe(testFile.name);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.SIZE)).toBe(`14 Bytes`);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
});
it('[C280129] Should keep Gallery View when accessing a folder', () => {
contentServicesPage.navigateToCardFolder(folderName);
expect(contentServicesPage.getCardElementShowedInPage()).toBe(1);
expect(contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
});
it('[C280130] Should be able to go back to List View', () => {
contentServicesPage.clickGridViewButton();
contentServicesPage.checkAcsContainer();
contentServicesPage.doubleClickRow(folderName);
contentServicesPage.checkRowIsDisplayed(pdfFile.name);
});
it('[C261993] Should be able to sort Gallery Cards by display name', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.DISPLAY_NAME);
contentServicesPage.checkListIsSortedByNameColumn('asc');
});
it('[C261994] Should be able to sort Gallery Cards by size', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.SIZE);
contentServicesPage.checkListIsSortedBySizeColumn('asc');
});
it('[C261995] Should be able to sort Gallery Cards by author', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED_BY);
contentServicesPage.checkListIsSortedByAuthorColumn('asc');
});
it('[C261996] Should be able to sort Gallery Cards by created date', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED);
contentServicesPage.checkListIsSortedByCreatedColumn('asc');
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
if (filePdfNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileDocxNode.entry.id);
}
if (filePDFSubNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePDFSubNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, folderNode.entry.id);
}
done();
});
});
describe('Column Template', () => {
const file0BytesModel = new FileModel({
@@ -700,7 +397,7 @@ describe('Document List Component', () => {
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
file = await uploadActions.uploadFile(this.alfrescoJsApi, file0BytesModel.location, file0BytesModel.name, '-my-');
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList()
.waitForTableBody();
done();

View File

@@ -0,0 +1,191 @@
/*!
* @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 { by, element } from 'protractor';
import { LoginPage, PaginationPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import TestConfig = require('../../test.config');
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UploadActions } from '../../actions/ACS/upload.actions';
import { StringUtil } from '@alfresco/adf-testing';
import { ContentNodeSelectorDialogPage } from '@alfresco/adf-testing';
import { BreadCrumbDropdownPage } from '../../pages/adf/content-services/breadcrumb/breadCrumbDropdownPage';
import { FolderModel } from '../../models/ACS/folderModel';
import { BreadCrumbPage } from '../../pages/adf/content-services/breadcrumb/breadCrumbPage';
import { InfinitePaginationPage } from '../../pages/adf/core/infinitePaginationPage';
describe('Document List Component - Actions', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const contentListPage = contentServicesPage.getDocumentList();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const paginationPage = new PaginationPage();
const breadCrumbDropdownPage = new BreadCrumbDropdownPage();
const breadCrumbPage = new BreadCrumbPage();
const uploadActions = new UploadActions();
const infinitePaginationPage = new InfinitePaginationPage(element(by.css('adf-content-node-selector')));
const alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
describe('Folder Actions - Copy and Move', () => {
const folderModel1 = new FolderModel({ 'name': StringUtil.generateRandomString() });
const folderModel2 = new FolderModel({ 'name': StringUtil.generateRandomString() });
const folderModel3 = new FolderModel({ 'name': StringUtil.generateRandomString() });
const folderModel4 = new FolderModel({ 'name': StringUtil.generateRandomString() });
const folderModel5 = new FolderModel({ 'name': StringUtil.generateRandomString() });
const folderModel6 = new FolderModel({ 'name': StringUtil.generateRandomString() });
let folder1, folder2, folder3, folder4, folder5, folder6;
let folders;
const contentServicesUser = new AcsUserModel();
beforeAll(async (done) => {
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await alfrescoJsApi.core.peopleApi.addPerson(contentServicesUser);
await alfrescoJsApi.login(contentServicesUser.id, contentServicesUser.password);
folder1 = await uploadActions.createFolder(alfrescoJsApi, 'A' + folderModel1.name, '-my-');
folder2 = await uploadActions.createFolder(alfrescoJsApi, 'B' + folderModel2.name, '-my-');
folder3 = await uploadActions.createFolder(alfrescoJsApi, 'C' + folderModel3.name, '-my-');
folder4 = await uploadActions.createFolder(alfrescoJsApi, 'D' + folderModel4.name, '-my-');
folder5 = await uploadActions.createFolder(alfrescoJsApi, 'E' + folderModel5.name, '-my-');
folder6 = await uploadActions.createFolder(alfrescoJsApi, 'F' + folderModel6.name, '-my-');
folders = [folder1, folder2, folder3, folder4, folder5, folder6];
done();
});
beforeEach(async (done) => {
await loginPage.loginToContentServicesUsingUserModel(contentServicesUser);
contentServicesPage.goToDocumentList();
contentServicesPage.waitForTableBody();
paginationPage.selectItemsPerPage('5');
contentServicesPage.checkAcsContainer();
contentListPage.waitForTableBody();
done();
});
afterAll(async (done) => {
await alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await folders.forEach(function (folder) {
uploadActions.deleteFilesOrFolder(alfrescoJsApi, folder.entry.id);
});
done();
});
it('[C260132] Move action on folder with - Load more', () => {
expect(paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
expect(contentNodeSelector.getDialogHeaderText()).toBe('Move \'' + 'A' + folderModel1.name + '\' to...');
contentNodeSelector.checkSearchInputIsDisplayed();
expect(contentNodeSelector.getSearchLabel()).toBe('Search');
contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
contentNodeSelector.checkCancelButtonIsDisplayed();
contentNodeSelector.checkMoveCopyButtonIsDisplayed();
expect(contentNodeSelector.getMoveCopyButtonText()).toBe('MOVE');
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
infinitePaginationPage.clickLoadMoreButton();
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickCancelButton();
contentNodeSelector.checkDialogIsNotDisplayed();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
infinitePaginationPage.clickLoadMoreButton();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
contentServicesPage.doubleClickRow('F' + folderModel6.name);
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Move');
contentServicesPage.pressContextMenuActionNamed('Move');
contentNodeSelector.checkDialogIsDisplayed();
breadCrumbDropdownPage.clickParentFolder();
breadCrumbDropdownPage.checkBreadCrumbDropdownIsDisplayed();
breadCrumbDropdownPage.choosePath(contentServicesUser.id);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsNotDisplayed('A' + folderModel1.name);
breadCrumbPage.chooseBreadCrumb(contentServicesUser.id);
contentServicesPage.waitForTableBody();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
it('[C305051] Copy action on folder with - Load more', () => {
expect(paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(paginationPage.getPaginationRange()).toEqual('Showing 1-' + 5 + ' of ' + 6);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Copy');
contentServicesPage.pressContextMenuActionNamed('Copy');
contentNodeSelector.checkDialogIsDisplayed();
expect(contentNodeSelector.getDialogHeaderText()).toBe('Copy \'' + 'A' + folderModel1.name + '\' to...');
contentNodeSelector.checkSearchInputIsDisplayed();
expect(contentNodeSelector.getSearchLabel()).toBe('Search');
contentNodeSelector.checkSelectedSiteIsDisplayed('My files');
contentNodeSelector.checkCancelButtonIsDisplayed();
contentNodeSelector.checkMoveCopyButtonIsDisplayed();
expect(contentNodeSelector.getMoveCopyButtonText()).toBe('COPY');
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(5);
infinitePaginationPage.clickLoadMoreButton();
expect(contentNodeSelector.numberOfResultsDisplayed()).toBe(6);
infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickCancelButton();
contentNodeSelector.checkDialogIsNotDisplayed();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
contentListPage.rightClickOnRow('A' + folderModel1.name);
contentServicesPage.checkContextActionIsVisible('Copy');
contentServicesPage.pressContextMenuActionNamed('Copy');
contentNodeSelector.checkDialogIsDisplayed();
infinitePaginationPage.clickLoadMoreButton();
contentNodeSelector.contentListPage().dataTablePage().selectRowByContent('F' + folderModel6.name);
contentNodeSelector.contentListPage().dataTablePage().checkRowByContentIsSelected('F' + folderModel6.name);
contentNodeSelector.clickMoveCopyButton();
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
paginationPage.clickOnNextPage();
contentListPage.waitForTableBody();
contentServicesPage.doubleClickRow('F' + folderModel6.name);
contentServicesPage.checkContentIsDisplayed('A' + folderModel1.name);
});
});
});

View File

@@ -0,0 +1,195 @@
/*!
* @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 { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import { LoginPage, StringUtil } from '@alfresco/adf-testing';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UploadActions } from '../../actions/ACS/upload.actions';
import { FileModel } from '../../models/ACS/fileModel';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const uploadActions = new UploadActions();
let acsUser = null;
const navBar = new NavigationBarPage();
beforeAll(() => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
describe('Gallery View', () => {
const cardProperties = {
DISPLAY_NAME: 'Display name',
SIZE: 'Size',
LOCK: 'Lock',
CREATED_BY: 'Created by',
CREATED: 'Created'
};
let funnyUser;
const pdfFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const testFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
const docxFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode, fileTestNode, fileDocxNode, folderNode, filePDFSubNode;
beforeAll(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
funnyUser = await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
filePdfNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(this.alfrescoJsApi, docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
filePDFSubNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, folderNode.entry.id);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
beforeEach(async () => {
navBar.clickHomeButton();
contentServicesPage.goToDocumentList();
contentServicesPage.clickGridViewButton();
contentServicesPage.checkCardViewContainerIsDisplayed();
});
it('[C280016] Should be able to choose Gallery View', () => {
expect(contentServicesPage.getCardElementShowedInPage()).toBe(4);
});
it('[C280023] Gallery Card should show details', () => {
expect(contentServicesPage.getDocumentCardIconForElement(folderName)).toContain('/assets/images/ft_ic_folder.svg');
expect(contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
expect(contentServicesPage.getDocumentCardIconForElement(docxFile.name)).toContain('/assets/images/ft_ic_ms_word.svg');
expect(contentServicesPage.getDocumentCardIconForElement(testFile.name)).toContain('/assets/images/ft_ic_document.svg');
contentServicesPage.checkMenuIsShowedForElementIndex(0);
contentServicesPage.checkMenuIsShowedForElementIndex(1);
contentServicesPage.checkMenuIsShowedForElementIndex(2);
contentServicesPage.checkMenuIsShowedForElementIndex(3);
});
it('[C280069] Gallery Card should show attributes', () => {
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.DISPLAY_NAME);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.SIZE);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED_BY);
contentServicesPage.checkDocumentCardPropertyIsShowed(folderName, cardProperties.CREATED);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.DISPLAY_NAME)).toBe(folderName);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(folderName, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.DISPLAY_NAME)).toBe(pdfFile.name);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.SIZE)).toBe(`105.02 KB`);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(pdfFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.DISPLAY_NAME)).toBe(docxFile.name);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.SIZE)).toBe(`81.05 KB`);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(docxFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.DISPLAY_NAME)).toBe(testFile.name);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.SIZE)).toBe(`14 Bytes`);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED_BY)).toBe(`${funnyUser.entry.firstName} ${funnyUser.entry.lastName}`);
expect(contentServicesPage.getAttributeValueForElement(testFile.name, cardProperties.CREATED)).toMatch(/(ago|few)/);
});
it('[C280129] Should keep Gallery View when accessing a folder', () => {
contentServicesPage.navigateToCardFolder(folderName);
expect(contentServicesPage.getCardElementShowedInPage()).toBe(1);
expect(contentServicesPage.getDocumentCardIconForElement(pdfFile.name)).toContain('/assets/images/ft_ic_pdf.svg');
});
it('[C280130] Should be able to go back to List View', () => {
contentServicesPage.clickGridViewButton();
contentServicesPage.checkAcsContainer();
contentServicesPage.doubleClickRow(folderName);
contentServicesPage.checkRowIsDisplayed(pdfFile.name);
});
it('[C261993] Should be able to sort Gallery Cards by display name', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.DISPLAY_NAME);
contentServicesPage.checkListIsSortedByNameColumn('asc');
});
it('[C261994] Should be able to sort Gallery Cards by size', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.SIZE);
contentServicesPage.checkListIsSortedBySizeColumn('asc');
});
it('[C261995] Should be able to sort Gallery Cards by author', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED_BY);
contentServicesPage.checkListIsSortedByAuthorColumn('asc');
});
it('[C261996] Should be able to sort Gallery Cards by created date', () => {
contentServicesPage.selectGridSortingFromDropdown(cardProperties.CREATED);
contentServicesPage.checkListIsSortedByCreatedColumn('asc');
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
if (filePdfNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileDocxNode.entry.id);
}
if (filePDFSubNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePDFSubNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, folderNode.entry.id);
}
done();
});
});
});

View File

@@ -86,16 +86,12 @@ describe('Document List - Pagination', function () {
await uploadActions.createEmptyFiles(this.alfrescoJsApi, secondSetOfFiles, folderThreeUploadedModel.entry.id);
done();
});
beforeEach(async (done) => {
await loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
it('[C260062] Should use default pagination settings', function () {
it('[C260062] Should use default pagination settings', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
contentServicesPage.checkAcsContainer();
@@ -110,7 +106,7 @@ describe('Document List - Pagination', function () {
paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C274713] Should be able to set Items per page to 20', function () {
it('[C274713] Should be able to set Items per page to 20', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
contentServicesPage.checkAcsContainer();
@@ -132,7 +128,7 @@ describe('Document List - Pagination', function () {
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.twenty);
});
it('[C260069] Should be able to set Items per page to 5', function () {
it('[C260069] Should be able to set Items per page to 5', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
contentServicesPage.checkAcsContainer();
@@ -183,7 +179,7 @@ describe('Document List - Pagination', function () {
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
});
it('[C260067] Should be able to set Items per page to 10', function () {
it('[C260067] Should be able to set Items per page to 10', () => {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
@@ -214,7 +210,7 @@ describe('Document List - Pagination', function () {
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.ten);
});
it('[C260065] Should be able to set Items per page to 15', function () {
it('[C260065] Should be able to set Items per page to 15', () => {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
@@ -246,7 +242,7 @@ describe('Document List - Pagination', function () {
expect(paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.fifteen);
});
it('[C91320] Pagination should preserve sorting', function () {
it('[C91320] Pagination should preserve sorting', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(newFolderModel.name);
contentServicesPage.checkAcsContainer();
@@ -286,7 +282,7 @@ describe('Document List - Pagination', function () {
});
});
it('[C260107] Should not display pagination bar when a folder is empty', function () {
it('[C260107] Should not display pagination bar when a folder is empty', () => {
contentServicesPage.goToDocumentList();
paginationPage.selectItemsPerPage(itemsPerPage.five);
contentServicesPage.checkAcsContainer();
@@ -302,7 +298,7 @@ describe('Document List - Pagination', function () {
contentServicesPage.checkPaginationIsNotDisplayed();
});
it('[C260071] Should be able to change pagination when having 25 files', function () {
it('[C260071] Should be able to change pagination when having 25 files', () => {
currentPage = 1;
contentServicesPage.goToDocumentList();
contentServicesPage.doubleClickRow(folderThreeModel.name);

View File

@@ -0,0 +1,90 @@
/*!
* @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 { browser } from 'protractor';
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { NavigationBarPage } from '../../pages/adf/navigationBarPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import TestConfig = require('../../test.config');
import { LoginPage, ErrorPage, StringUtil, BrowserActions } from '@alfresco/adf-testing';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navBar = new NavigationBarPage();
const errorPage = new ErrorPage();
let privateSite;
let acsUser = null;
beforeAll(() => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
describe('Permission Message', async () => {
beforeAll(async (done) => {
acsUser = new AcsUserModel();
const siteName = `PRIVATE_TEST_SITE_${StringUtil.generateRandomString(5)}`;
const privateSiteBody = { visibility: 'PRIVATE', title: siteName };
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
privateSite = await this.alfrescoJsApi.core.sitesApi.createSite(privateSiteBody);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.core.sitesApi.deleteSite(privateSite.entry.id);
navBar.openLanguageMenu();
navBar.chooseLanguage('English');
done();
});
it('[C217334] Should display a message when accessing file without permissions', () => {
BrowserActions.getUrl(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorCode()).toBe('403');
expect(errorPage.getErrorDescription()).toBe('You\'re not allowed access to this resource on the server.');
});
it('[C279924] Should display custom message when accessing a file without permissions', () => {
contentServicesPage.goToDocumentList();
contentServicesPage.enableCustomPermissionMessage();
BrowserActions.getUrl(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorCode()).toBe('403');
});
it('[C279925] Should display translated message when accessing a file without permissions if language is changed', () => {
navBar.openLanguageMenu();
navBar.chooseLanguage('Italiano');
browser.sleep(2000);
BrowserActions.getUrl(TestConfig.adf.url + '/files/' + privateSite.entry.guid);
expect(errorPage.getErrorDescription()).toBe('Accesso alla risorsa sul server non consentito.');
});
});
});

View File

@@ -65,7 +65,7 @@ describe('Document List Component - Properties', () => {
subFolder = await uploadActions.createFolder(this.alfrescoJsApi, 'subFolder', parentFolder.entry.id);
loginPage.loginToContentServicesUsingUserModel(acsUser);
await loginPage.loginToContentServicesUsingUserModel(acsUser);
done();
});

View File

@@ -0,0 +1,161 @@
/*!
* @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 { ContentServicesPage } from '../../pages/adf/contentServicesPage';
import { AcsUserModel } from '../../models/ACS/acsUserModel';
import TestConfig = require('../../test.config');
import resources = require('../../util/resources');
import { LoginPage, StringUtil } from '@alfresco/adf-testing';
import { AlfrescoApiCompatibility as AlfrescoApi } from '@alfresco/js-api';
import { UploadActions } from '../../actions/ACS/upload.actions';
import { FileModel } from '../../models/ACS/fileModel';
describe('Document List Component', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
let uploadedFolder, uploadedFolderExtra;
const uploadActions = new UploadActions();
let acsUser = null;
let testFileNode, pdfBFileNode;
beforeAll(() => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
afterEach(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
if (uploadedFolder) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, uploadedFolder.entry.id);
uploadedFolder = null;
}
if (uploadedFolderExtra) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, uploadedFolderExtra.entry.id);
uploadedFolderExtra = null;
}
if (testFileNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, testFileNode.entry.id);
testFileNode = null;
}
if (pdfBFileNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, pdfBFileNode.entry.id);
pdfBFileNode = null;
}
done();
});
describe('Thumbnails and tooltips', () => {
const pdfFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.PDF.file_name,
'location': resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const testFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.TEST.file_name,
'location': resources.Files.ADF_DOCUMENTS.TEST.file_location
});
const docxFile = new FileModel({
'name': resources.Files.ADF_DOCUMENTS.DOCX.file_name,
'location': resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
let filePdfNode, fileTestNode, fileDocxNode, folderNode;
beforeAll(async (done) => {
acsUser = new AcsUserModel();
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
filePdfNode = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFile.location, pdfFile.name, '-my-');
fileTestNode = await uploadActions.uploadFile(this.alfrescoJsApi, testFile.location, testFile.name, '-my-');
fileDocxNode = await uploadActions.uploadFile(this.alfrescoJsApi, docxFile.location, docxFile.name, '-my-');
folderNode = await uploadActions.createFolder(this.alfrescoJsApi, folderName, '-my-');
done();
});
afterAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
if (filePdfNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, filePdfNode.entry.id);
}
if (fileTestNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileTestNode.entry.id);
}
if (fileDocxNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, fileDocxNode.entry.id);
}
if (folderNode) {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, folderNode.entry.id);
}
done();
});
beforeEach(async () => {
await loginPage.loginToContentServicesUsingUserModel(acsUser);
contentServicesPage.goToDocumentList();
});
it('[C260108] Should display tooltip for file\'s name', () => {
expect(contentServicesPage.getContentList().getTooltip(pdfFile.name)).toEqual(pdfFile.name);
});
it('[C260109] Should display tooltip for folder\'s name', () => {
expect(contentServicesPage.getContentList().getTooltip(folderName)).toEqual(folderName);
});
it('[C260119] Should have a specific thumbnail for folders', async (done) => {
const folderIconUrl = await contentServicesPage.getRowIconImageUrl(folderName);
expect(folderIconUrl).toContain('/assets/images/ft_ic_folder.svg');
done();
});
it('[C280066] Should have a specific thumbnail PDF files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_pdf.svg');
done();
});
it('[C280067] Should have a specific thumbnail DOCX files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(docxFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_ms_word.svg');
done();
});
it('[C280068] Should have a specific thumbnail files', async (done) => {
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(testFile.name);
expect(fileIconUrl).toContain('/assets/images/ft_ic_document.svg');
done();
});
it('[C274701] Should be able to enable thumbnails', async (done) => {
contentServicesPage.enableThumbnails();
contentServicesPage.checkAcsContainer();
const fileIconUrl = await contentServicesPage.getRowIconImageUrl(pdfFile.name);
expect(fileIconUrl).toContain(`/versions/1/nodes/${filePdfNode.entry.id}/renditions`);
done();
});
});
});