Files
alfresco-ng2-components/e2e/search/search_multiselect.e2e.ts
Denys Vuika 058d23d57f [ADF-3442] create library dialog (#4018)
* library dialog

* integrate with demo shell

* update resources

* fix license

* auto focus for the first input

* update e2e tests

* try close the dialog between tests

* fix afterEach

* Revert "try close the dialog between tests"

This reverts commit 63464f2b03c226c606d09b18c7d2782e3bb52c0a.

* update code due to css lint issues

* csslint settings for vs code

* missing import
lint fix
remove not used import
convert errorPage js to ts
convert tasklistpage js to ts
fix redirection creation folder in root
fix lint issue
fix e2e

* e2e fix

* fix PS tests

* navigation import

* fix tests tooltip
convert paginapage to ts

* fix lint

* fix lock files e2e
filterspage to ts

* fix lint

* fix cs cre
git dept 3 and not 50 as default in travis

* quiet log git download

* add some delay and change the delete lock

* fix node entry

* convert searchDialog to typescript
parallel protractor

* disable browser execute

* restote test

* change search tests

* move search in a separate e2e folder

* experiment fix e2e

* change util presence
change protractor conf

* fix unshare test

* improve query viewerPage using css over xpath

* waitForAngularEnabled before browser redirect

* convert util to ts and more

* convert other files to ts

* convert to ts other files

* trigger build

* function fixes use arrow function

* process service fixes

* lint fix
review timeout default

* fix failing tests

* restore timeout

* share dialog fix

* remove

* use configuration admin

* fix APS 2 login sso
2018-12-05 13:05:39 +00:00

251 lines
10 KiB
TypeScript

/*!
* @license
* Copyright 2016 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 TestConfig = require('../test.config');
import AlfrescoApi = require('alfresco-js-api-node');
import { Util } from '../util/util';
import resources = require('../util/resources');
import CONSTANTS = require('../util/constants');
import { UploadActions } from '../actions/ACS/upload.actions';
import { browser } from 'protractor';
import { LoginPage } from '../pages/adf/loginPage';
import { SearchDialog } from '../pages/adf/dialog/searchDialog';
import { SearchResultsPage } from '../pages/adf/searchResultsPage';
import { SearchFiltersPage } from '../pages/adf/searchFiltersPage';
import { AcsUserModel } from '../models/ACS/acsUserModel';
import { FileModel } from '../models/ACS/fileModel';
describe('Search Component - Multi-Select Facet', () => {
let loginPage = new LoginPage();
let searchDialog = new SearchDialog();
let searchResultsPage = new SearchResultsPage();
let uploadActions = new UploadActions();
let searchFiltersPage = new SearchFiltersPage();
let site, userOption;
beforeAll(() => {
this.alfrescoJsApi = new AlfrescoApi({
provider: 'ECM',
hostEcm: TestConfig.adf.url
});
});
describe('', () => {
let jpgFile, jpgFileSite, txtFile, txtFileSite;
let acsUser = new AcsUserModel();
let randomName = Util.generateRandomString();
let jpgFileInfo = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.JPG.file_location,
'name': `${randomName}.jpg`
});
let txtFileInfo = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
'name': `${randomName}.txt`
});
beforeAll(async (done) => {
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);
site = await this.alfrescoJsApi.core.sitesApi.createSite({
title: Util.generateRandomString(8),
visibility: 'PUBLIC'
});
jpgFile = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, '-my-');
jpgFileSite = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
txtFile = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, '-my-');
txtFileSite = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, site.entry.guid);
await browser.driver.sleep(30000);
loginPage.loginToContentServicesUsingUserModel(acsUser);
searchDialog.checkSearchIconIsVisible();
searchDialog.clickOnSearchIcon();
searchDialog.enterTextAndPressEnter(`${randomName}`);
userOption = `${acsUser.firstName} ${acsUser.lastName}`;
searchFiltersPage.checkSearchFiltersIsDisplayed();
searchFiltersPage.creatorCheckListFiltersPage().filterBy(userOption);
done();
});
afterAll(async (done) => {
Promise.all([
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, jpgFile.entry.id),
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, jpgFileSite.entry.id),
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, txtFile.entry.id),
uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, txtFileSite.entry.id)
]);
await this.alfrescoJsApi.core.sitesApi.deleteSite(site.entry.id);
done();
});
it('[C280054] Should be able to select multiple items from a search facet filter', () => {
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(2);
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
searchResultsPage.checkContentIsDisplayed(txtFileSite.entry.name);
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(4);
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
searchResultsPage.checkContentIsDisplayed(txtFileSite.entry.name);
searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
searchResultsPage.checkContentIsDisplayed(jpgFileSite.entry.name);
});
});
describe('', () => {
let jpgFile, txtFile;
let userUploadingTxt = new AcsUserModel();
let userUploadingImg = new AcsUserModel();
let randomName = Util.generateRandomString();
let jpgFileInfo = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.JPG.file_location,
'name': `${randomName}.jpg`
});
let txtFileInfo = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
'name': `${randomName}.txt`
});
beforeAll(async (done) => {
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
await this.alfrescoJsApi.core.peopleApi.addPerson(userUploadingTxt);
await this.alfrescoJsApi.core.peopleApi.addPerson(userUploadingImg);
await this.alfrescoJsApi.login(userUploadingTxt.id, userUploadingTxt.password);
site = await this.alfrescoJsApi.core.sitesApi.createSite({
title: Util.generateRandomString(8),
visibility: 'PUBLIC'
});
await this.alfrescoJsApi.core.sitesApi.addSiteMember(site.entry.id, {
id: userUploadingImg.id,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
txtFile = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, site.entry.guid);
await this.alfrescoJsApi.login(userUploadingImg.id, userUploadingImg.password);
jpgFile = await uploadActions.uploadFile(this.alfrescoJsApi, jpgFileInfo.location, jpgFileInfo.name, site.entry.guid);
await browser.driver.sleep(30000);
loginPage.loginToContentServicesUsingUserModel(userUploadingImg);
searchDialog.checkSearchIconIsVisible();
searchDialog.clickOnSearchIcon();
searchDialog.enterTextAndPressEnter(`*${randomName}*`);
done();
});
it('[C280056] Should be able to select multiple items from multiple search facet filters', () => {
searchFiltersPage.checkSearchFiltersIsDisplayed();
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${userUploadingTxt.firstName} ${userUploadingTxt.lastName}`);
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${userUploadingImg.firstName} ${userUploadingImg.lastName}`);
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('JPEG Image');
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(2);
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
searchResultsPage.checkContentIsDisplayed(jpgFile.entry.name);
});
});
describe('', () => {
let txtFile;
let acsUser = new AcsUserModel();
let randomName = Util.generateRandomString();
let txtFileInfo = new FileModel({
'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location,
'name': `${randomName}.txt`
});
beforeAll(async (done) => {
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);
site = await this.alfrescoJsApi.core.sitesApi.createSite({
title: Util.generateRandomString(8),
visibility: 'PUBLIC'
});
txtFile = await uploadActions.uploadFile(this.alfrescoJsApi, txtFileInfo.location, txtFileInfo.name, '-my-');
await browser.driver.sleep(30000);
loginPage.loginToContentServicesUsingUserModel(acsUser);
searchDialog.checkSearchIconIsVisible();
searchDialog.clickOnSearchIcon();
searchDialog.enterTextAndPressEnter(`*${randomName}*`);
searchFiltersPage.checkSearchFiltersIsDisplayed();
done();
});
afterAll(async (done) => {
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, txtFile.entry.id);
await this.alfrescoJsApi.core.sitesApi;
done();
});
it('[C280058] Should update filter facets items number when another filter facet item is selected', () => {
searchFiltersPage.fileTypeCheckListFiltersPage().filterBy('Plain Text');
searchFiltersPage.creatorCheckListFiltersPage().filterBy(`${acsUser.firstName} ${acsUser.lastName}`);
expect(searchResultsPage.numberOfResultsDisplayed()).toBe(1);
searchResultsPage.checkContentIsDisplayed(txtFile.entry.name);
});
});
});