ACS-8610: cleanup demo shell protractor tests (#10148)

This commit is contained in:
Denys Vuika
2024-09-10 08:36:42 -04:00
committed by GitHub
parent a754976ad9
commit f1208d45c3
402 changed files with 180 additions and 45538 deletions

View File

@@ -1,188 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { CommentsPage } from '../../core/pages/comments.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import CONSTANTS = require('../../util/constants');
import { SitesApi, SiteEntry, CommentsApi } from '@alfresco/js-api';
describe('Comment', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const viewerPage = new ViewerPage();
const commentsPage = new CommentsPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const commentsApi = new CommentsApi(apiService.getInstance());
let userFullName: string;
let nodeId: string;
let acsUser: UserModel;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const comments = {
first: 'This is a comment',
multiline: 'This is a comment\n' + 'with a new line',
second: 'This is another comment',
test: 'Test'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
});
describe('component', () => {
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
nodeId = pngUploadedFile.entry.id;
userFullName = pngUploadedFile.entry.createdByUser.displayName;
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(nodeId);
await navigationBarPage.clickLogoutButton();
});
it('[C276947] Should be able to add a comment on ACS and view on ADF', async () => {
await commentsApi.createComment(nodeId, { content: comments.test });
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await commentsPage.checkCommentsTabIsSelected();
await commentsPage.checkCommentInputIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
expect(await commentsPage.getMessage(0)).toEqual(comments.test);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
it('[C276948] Should be able to add a comment on a file', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.clickOnCommentsTab();
await commentsPage.addComment(comments.first);
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
expect(await commentsPage.getMessage(0)).toEqual(comments.first);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
it('[C280021] Should be able to add a multiline comment on a file', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.clickOnCommentsTab();
await commentsPage.addComment(comments.multiline);
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
expect(await commentsPage.getMessage(0)).toEqual(comments.multiline);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
await commentsPage.addComment(comments.second);
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (2)');
expect(await commentsPage.getMessage(0)).toEqual(comments.second);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
});
describe('Consumer Permissions', () => {
let site: SiteEntry;
let pngUploadedFile;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(8),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: acsUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, site.entry.guid);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(pngUploadedFile.entry.id);
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});
it('[C290147] Should NOT be able to add comments to a site file with Consumer permissions', async () => {
await navigationBarPage.goToSite(site);
await contentServicesPage.checkAcsContainer();
await viewerPage.viewFile(pngUploadedFile.entry.name);
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await commentsPage.checkCommentsTabIsSelected();
await commentsPage.checkCommentInputIsNotDisplayed();
await viewerPage.clickCloseButton();
});
});
});

View File

@@ -1,377 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element, protractor } from 'protractor';
import { createApiService, BrowserActions, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Content Services Viewer', () => {
const acsUser = new UserModel();
const viewerPage = new ViewerPage();
const contentServicesPage = new ContentServicesPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const pdfFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
firstPageText: browser.params.resources.Files.ADF_DOCUMENTS.PDF.first_page_text,
secondPageText: browser.params.resources.Files.ADF_DOCUMENTS.PDF.second_page_text,
lastPageNumber: browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_number
});
const protectedFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.file_name,
firstPageText: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.first_page_text,
secondPageText: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.second_page_text,
lastPageNumber: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.last_page_number,
password: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.password,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_PROTECTED.file_path
});
const docxFile = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path,
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
firstPageText: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.first_page_text
});
const jpgFile = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_path,
name: browser.params.resources.Files.ADF_DOCUMENTS.JPG.file_name
});
const mp4File = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.MP4.file_path,
name: browser.params.resources.Files.ADF_DOCUMENTS.MP4.file_name
});
const unsupportedFile = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_path,
name: browser.params.resources.Files.ADF_DOCUMENTS.UNSUPPORTED.file_name
});
const pptFile = new FileModel({
location: browser.params.resources.Files.ADF_DOCUMENTS.PPT.file_path,
name: browser.params.resources.Files.ADF_DOCUMENTS.PPT.file_name,
firstPageText: browser.params.resources.Files.ADF_DOCUMENTS.PPT.first_page_text
});
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
const pdfFileUploaded = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
Object.assign(pdfFile, pdfFileUploaded.entry);
const protectedFileUploaded = await uploadActions.uploadFile(protectedFile.location, protectedFile.name, '-my-');
Object.assign(protectedFile, protectedFileUploaded.entry);
const docxFileUploaded = await uploadActions.uploadFile(docxFile.location, docxFile.name, '-my-');
Object.assign(docxFile, docxFileUploaded.entry);
const jpgFileUploaded = await uploadActions.uploadFile(jpgFile.location, jpgFile.name, '-my-');
Object.assign(jpgFile, jpgFileUploaded.entry);
const mp4FileUploaded = await uploadActions.uploadFile(mp4File.location, mp4File.name, '-my-');
Object.assign(mp4File, mp4FileUploaded.entry);
const pptFileUploaded = await uploadActions.uploadFile(pptFile.location, pptFile.name, '-my-');
Object.assign(pptFile, pptFileUploaded.entry);
const unsupportedFileUploaded = await uploadActions.uploadFile(unsupportedFile.location, unsupportedFile.name, '-my-');
Object.assign(unsupportedFile, unsupportedFileUploaded.entry);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(pdfFile.getId());
await uploadActions.deleteFileOrFolder(protectedFile.getId());
await uploadActions.deleteFileOrFolder(docxFile.getId());
await uploadActions.deleteFileOrFolder(jpgFile.getId());
await uploadActions.deleteFileOrFolder(mp4File.getId());
await uploadActions.deleteFileOrFolder(pptFile.getId());
await uploadActions.deleteFileOrFolder(unsupportedFile.getId());
await navigationBarPage.clickLogoutButton();
});
describe('Usual type files', () => {
it('[C260038] Should display first page, toolbar and pagination when opening a .pdf file', async () => {
await contentServicesPage.doubleClickRow(pdfFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(pdfFile.name);
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkFullScreenButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkPreviousPageButtonIsDisplayed();
await viewerPage.checkNextPageButtonIsDisplayed();
await viewerPage.checkPageSelectorInputIsDisplayed('1');
await viewerPage.checkPercentageIsDisplayed();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkZoomOutButtonIsDisplayed();
await viewerPage.checkScalePageButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
it('[C260040] Should be able to change pages and zoom when .pdf file is open', async () => {
await contentServicesPage.doubleClickRow(pdfFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.clickNextPageButton();
await viewerPage.checkFileContent('2', pdfFile.secondPageText);
await viewerPage.checkPageSelectorInputIsDisplayed('2');
await viewerPage.clickPreviousPageButton();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkPageSelectorInputIsDisplayed('1');
await viewerPage.clearPageNumber();
await viewerPage.checkPageSelectorInputIsDisplayed('');
const initialWidth = await viewerPage.getCanvasWidth();
const initialHeight = await viewerPage.getCanvasHeight();
await viewerPage.clickZoomInButton();
expect(+(await viewerPage.getCanvasWidth())).toBeGreaterThan(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toBeGreaterThan(+initialHeight);
await viewerPage.clickActualSize();
expect(+(await viewerPage.getCanvasWidth())).toEqual(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toEqual(+initialHeight);
await viewerPage.clickZoomOutButton();
expect(+(await viewerPage.getCanvasWidth())).toBeLessThan(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toBeLessThan(+initialHeight);
await viewerPage.clickCloseButton();
});
it('[C260042] Should be able to download, open full-screen and Info container from the Viewer', async () => {
await contentServicesPage.doubleClickRow(jpgFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkImgContainerIsDisplayed();
await viewerPage.checkFullScreenButtonIsDisplayed();
await viewerPage.clickFullScreenButton();
await viewerPage.exitFullScreen();
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.clickDownloadButton();
await viewerPage.clickCloseButton();
});
it('[C260052] Should display image, toolbar and pagination when opening a .jpg file', async () => {
await contentServicesPage.doubleClickRow(jpgFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkImgContainerIsDisplayed();
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(jpgFile.name);
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkFullScreenButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkZoomOutButtonIsDisplayed();
await viewerPage.checkPercentageIsDisplayed();
await viewerPage.checkScaleImgButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
it('[C260483] Should be able to zoom and rotate image when .jpg file is open', async () => {
await contentServicesPage.doubleClickRow(jpgFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkPercentageIsDisplayed();
let zoom = await viewerPage.getZoom();
await viewerPage.clickZoomInButton();
await viewerPage.checkZoomedIn(zoom);
zoom = await viewerPage.getZoom();
await viewerPage.clickZoomOutButton();
await viewerPage.checkZoomedOut(zoom);
await viewerPage.clickCloseButton();
});
it('[C279922] Should display first page, toolbar and pagination when opening a .ppt file', async () => {
await contentServicesPage.doubleClickRow(pptFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', pptFile.firstPageText);
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(pptFile.name);
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkPreviousPageButtonIsDisplayed();
await viewerPage.checkNextPageButtonIsDisplayed();
await viewerPage.checkPageSelectorInputIsDisplayed('1');
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkZoomOutButtonIsDisplayed();
await viewerPage.checkScalePageButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
it('[C260053] Should display first page, toolbar and pagination when opening a .docx file', async () => {
await contentServicesPage.doubleClickRow(docxFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', docxFile.firstPageText);
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(docxFile.name);
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkPreviousPageButtonIsDisplayed();
await viewerPage.checkNextPageButtonIsDisplayed();
await viewerPage.checkPageSelectorInputIsDisplayed('1');
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkZoomOutButtonIsDisplayed();
await viewerPage.checkScalePageButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
it('[C260054] Should display Preview could not be loaded and viewer toolbar when opening an unsupported file', async () => {
await contentServicesPage.doubleClickRow(unsupportedFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(unsupportedFile.name);
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkZoomInButtonIsNotDisplayed();
await viewerPage.checkUnknownFormatIsDisplayed();
expect(await viewerPage.getUnknownFormatMessage()).toBe(
`Couldn't load preview. Unsupported file type or loading error. Please try refreshing the page.`
);
await viewerPage.clickCloseButton();
});
it('[C260056] Should display video and viewer toolbar when opening a media file', async () => {
await contentServicesPage.doubleClickRow(mp4File.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkMediaPlayerContainerIsDisplayed();
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.checkFileThumbnailIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(mp4File.name);
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.checkZoomInButtonIsNotDisplayed();
await viewerPage.clickCloseButton();
});
it('[C261123] Should be able to preview all pages and navigate to a page when using thumbnails', async () => {
await contentServicesPage.doubleClickRow(pdfFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkThumbnailsBtnIsDisplayed();
await viewerPage.clickThumbnailsBtn();
await viewerPage.checkThumbnailsContentIsDisplayed();
await viewerPage.checkThumbnailsCloseIsDisplayed();
await viewerPage.checkAllThumbnailsDisplayed(pdfFile.lastPageNumber);
await viewerPage.clickSecondThumbnail();
await viewerPage.checkFileContent('2', pdfFile.secondPageText);
await viewerPage.checkCurrentThumbnailIsSelected();
await viewerPage.checkPreviousPageButtonIsDisplayed();
await viewerPage.clickPreviousPageButton();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkCurrentThumbnailIsSelected();
await viewerPage.clickThumbnailsBtn();
await viewerPage.checkThumbnailsContentIsNotDisplayed();
await viewerPage.clickThumbnailsBtn();
await viewerPage.checkThumbnailsCloseIsDisplayed();
await viewerPage.clickThumbnailsClose();
await viewerPage.clickCloseButton();
});
it('[C268105] Should display current thumbnail when getting to the page following the last visible thumbnail', async () => {
await contentServicesPage.doubleClickRow(pdfFile.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkZoomInButtonIsDisplayed();
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkThumbnailsBtnIsDisplayed();
await viewerPage.clickThumbnailsBtn();
await viewerPage.clickLastThumbnailDisplayed();
await viewerPage.checkCurrentThumbnailIsSelected();
await viewerPage.checkNextPageButtonIsDisplayed();
await viewerPage.clickNextPageButton();
await viewerPage.checkCurrentThumbnailIsSelected();
await viewerPage.clickCloseButton();
});
it('[C269109] Should not be able to open thumbnail panel before the pdf is loaded', async () => {
const fileView = element.all(by.css(`#document-list-container div[data-automation-id="${pdfFile.name}"]`)).first();
await BrowserActions.click(fileView);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await viewerPage.checkThumbnailsBtnIsDisabled();
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.clickCloseButton();
});
});
});

View File

@@ -1,94 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, FileBrowserUtil, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { VersionManagePage } from '../pages/version-manager.page';
describe('Viewer', () => {
const navigationBarPage = new NavigationBarPage();
const viewerPage = new ViewerPage();
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const versionManagePage = new VersionManagePage();
const acsUser = new UserModel();
let txtFileUploaded;
const txtFileInfo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const fileModelVersionTwo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
txtFileUploaded = await uploadActions.uploadFile(txtFileInfo.location, txtFileInfo.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(txtFileUploaded.entry.id);
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.doubleClickRow(txtFileUploaded.entry.name);
await viewerPage.waitTillContentLoaded();
});
afterEach(async () => {
await viewerPage.clickCloseButton();
});
it('[C362242] Should the Viewer be able to view a previous version of a file', async () => {
await contentServicesPage.versionManagerContent(txtFileInfo.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.closeVersionDialog();
await contentServicesPage.doubleClickRow(txtFileUploaded.entry.name);
await viewerPage.waitTillContentLoaded();
await viewerPage.clickInfoButton();
await viewerPage.clickOnTab('Versions');
await versionManagePage.viewFileVersion('1.0');
await viewerPage.expectUrlToContain('1.0');
});
it('[C362265] Should the Viewer be able to download a previous version of a file', async () => {
await viewerPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(txtFileInfo.name);
});
});

View File

@@ -1,143 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import {
createApiService,
FileBrowserUtil,
IdentityService,
LoginPage,
SettingsPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NodeEntry } from '@alfresco/js-api';
describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList, implicitFlow true', () => {
const settingsPage = new SettingsPage();
const navigationBarPage = new NavigationBarPage();
const contentServicesPage = new ContentServicesPage();
const contentListPage = contentServicesPage.getDocumentList();
const loginSsoPage = new LoginPage();
const viewerPage = new ViewerPage();
const apiService = createApiService({ authType: 'OAUTH' });
const uploadActions = new UploadActions(apiService);
const identityService = new IdentityService(apiService);
const usersActions = new UsersActions(apiService);
const firstPdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_path
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
let folder: NodeEntry;
let acsUser: UserModel;
const folderName = StringUtil.generateRandomString(5);
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
folder = await uploadActions.createFolder(folderName, '-my-');
await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id);
await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id);
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false,
true,
browser.params.testConfig.appConfig.oauth2.clientId
);
await browser.refresh();
await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.checkAcsContainer();
await contentServicesPage.openFolder(folderName);
await contentListPage.waitForTableBody();
});
afterAll(async () => {
try {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(folder.entry.id);
await identityService.deleteIdentityUser(acsUser.email);
} catch (error) {}
await apiService.getInstance().logout();
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
describe('SSO in ADF using ACS and AIS, implicit flow set', () => {
afterEach(async () => {
await browser.refresh();
await contentListPage.waitForTableBody();
});
it('[C291936] Should be able to download a file', async () => {
await contentListPage.selectRow(pngFileModel.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(pngFileModel.name);
});
it('[C291938] Should be able to open a document', async () => {
await contentServicesPage.doubleClickRow(firstPdfFileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.checkFileNameIsDisplayed(firstPdfFileModel.name);
await viewerPage.clickCloseButton();
await contentListPage.waitForTableBody();
});
it('[C291942] Should be able to open an image', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.checkImgViewerIsDisplayed();
await viewerPage.checkFileNameIsDisplayed(pngFileModel.name);
await viewerPage.clickCloseButton();
await contentListPage.waitForTableBody();
});
it('[C291941] Should be able to download multiple files', async () => {
await contentServicesPage.clickMultiSelectToggle();
await contentServicesPage.checkAcsContainer();
await contentListPage.dataTablePage().checkAllRows();
await contentListPage.dataTablePage().checkRowIsChecked('Display name', pngFileModel.name);
await contentListPage.dataTablePage().checkRowIsChecked('Display name', firstPdfFileModel.name);
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded('archive.zip');
});
});
});

View File

@@ -1,321 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 '../../core/pages/content-services.page';
import { browser } from 'protractor';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Document List Component', () => {
let uploadedFolder: NodeEntry;
let uploadedFolderExtra: NodeEntry;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const contentServicesPage = new ContentServicesPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
let acsUser: UserModel = null;
let testFileNode: NodeEntry;
let pdfBFileNode: NodeEntry;
afterEach(async () => {
await apiService.loginWithProfile('admin');
if (uploadedFolder) {
await uploadActions.deleteFileOrFolder(uploadedFolder.entry.id);
uploadedFolder = null;
}
if (uploadedFolderExtra) {
await uploadActions.deleteFileOrFolder(uploadedFolderExtra.entry.id);
uploadedFolderExtra = null;
}
if (testFileNode) {
await uploadActions.deleteFileOrFolder(testFileNode.entry.id);
testFileNode = null;
}
if (pdfBFileNode) {
await uploadActions.deleteFileOrFolder(pdfBFileNode.entry.id);
pdfBFileNode = null;
}
});
describe('Custom Column', () => {
let folderName: string;
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const docxFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path
});
let pdfUploadedNode: NodeEntry;
let docxUploadedNode: NodeEntry;
let timeAgoUploadedNode: NodeEntry;
let mediumDateUploadedNode: NodeEntry;
beforeAll(async () => {
/* cspell:disable-next-line */
folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
pdfUploadedNode = await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, '-my-');
docxUploadedNode = await uploadActions.uploadFile(docxFileModel.location, docxFileModel.name, '-my-');
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
if (pdfUploadedNode) {
await uploadActions.deleteFileOrFolder(pdfUploadedNode.entry.id);
}
if (docxUploadedNode) {
await uploadActions.deleteFileOrFolder(docxUploadedNode.entry.id);
}
if (timeAgoUploadedNode) {
await uploadActions.deleteFileOrFolder(timeAgoUploadedNode.entry.id);
}
if (mediumDateUploadedNode) {
await uploadActions.deleteFileOrFolder(mediumDateUploadedNode.entry.id);
}
});
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C279926] Should only display the user files and folders', async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsDisplayed(folderName);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
expect(await contentServicesPage.getDocumentListRowNumber()).toBe(4);
});
it('[C279927] Should display default columns', async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkColumnNameHeader();
await contentServicesPage.checkColumnSizeHeader();
await contentServicesPage.checkColumnCreatedByHeader();
await contentServicesPage.checkColumnCreatedHeader();
});
});
describe('Column Sorting', () => {
const fakeFileA = new FileModel({
name: 'A',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const fakeFileB = new FileModel({
name: 'B',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const fakeFileC = new FileModel({
name: 'C',
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
let fileANode: NodeEntry;
let fileBNode: NodeEntry;
let fileCNode: NodeEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
const user = await usersActions.createUser();
await apiService.login(user.username, user.password);
fileANode = await uploadActions.uploadFile(fakeFileA.location, fakeFileA.name, '-my-');
fileBNode = await uploadActions.uploadFile(fakeFileB.location, fakeFileB.name, '-my-');
fileCNode = await uploadActions.uploadFile(fakeFileC.location, fakeFileC.name, '-my-');
await loginPage.login(user.username, user.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
await apiService.loginWithProfile('admin');
if (fileANode) {
await uploadActions.deleteFileOrFolder(fileANode.entry.id);
}
if (fileBNode) {
await uploadActions.deleteFileOrFolder(fileBNode.entry.id);
}
if (fileCNode) {
await uploadActions.deleteFileOrFolder(fileCNode.entry.id);
}
});
it('[C260112] Should be able to sort by name (Ascending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByName('asc')).toBe(true);
});
it('[C272770] Should be able to sort by name (Descending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByName('desc')).toBe(true);
});
it('[C272771] Should be able to sort by author (Ascending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByAuthor('asc')).toBe(true);
});
it('[C272772] Should be able to sort by author (Descending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByAuthor('desc')).toBe(true);
});
it('[C272773] Should be able to sort by date (Ascending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByCreated('asc')).toBe(true);
});
it('[C272774] Should be able to sort by date (Descending)', async () => {
expect(await contentServicesPage.sortAndCheckListIsOrderedByCreated('desc')).toBe(true);
});
});
describe('', () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C279959] Should display empty folder state for new folders', async () => {
const folderName = 'BANANA';
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.createNewFolder(folderName);
await contentServicesPage.openFolder(folderName);
await contentServicesPage.checkEmptyFolderTextToBe('This folder is empty');
await contentServicesPage.checkEmptyFolderImageUrlToContain('/assets/images/empty_doc_lib.svg');
});
it('[C272775] Should be able to upload a file in new folder', async () => {
const testFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_location
});
/* cspell:disable-next-line */
const folderName = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsDisplayed(uploadedFolder.entry.name);
await contentServicesPage.openFolder(uploadedFolder.entry.name);
await contentServicesPage.uploadFile(testFile.location);
await contentServicesPage.checkContentIsDisplayed(testFile.name);
});
it('[C279970] Should display Islocked field for folders', async () => {
const folderNameA = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
const folderNameB = `MEESEEKS_${StringUtil.generateRandomString(5)}_LOOK_AT_ME`;
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
uploadedFolder = await uploadActions.createFolder(folderNameA, '-my-');
uploadedFolderExtra = await uploadActions.createFolder(folderNameB, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsDisplayed(folderNameA);
await contentServicesPage.checkContentIsDisplayed(folderNameB);
await contentServicesPage.checkLockIsDisplayedForElement(folderNameA);
await contentServicesPage.checkLockIsDisplayedForElement(folderNameB);
});
it('[C269086] Should display IsLocked field for files', async () => {
const testFileA = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const testFileB = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_path
});
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
testFileNode = await uploadActions.uploadFile(testFileA.location, testFileA.name, '-my-');
pdfBFileNode = await uploadActions.uploadFile(testFileB.location, testFileB.name, '-my-');
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkContentIsDisplayed(testFileA.name);
await contentServicesPage.checkContentIsDisplayed(testFileB.name);
await contentServicesPage.checkLockIsDisplayedForElement(testFileA.name);
await contentServicesPage.checkLockIsDisplayedForElement(testFileB.name);
});
});
describe('Once uploaded 20 folders', () => {
let folderCreated: NodeEntry[];
beforeAll(async () => {
folderCreated = [];
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
let folderName = '';
let folder = null;
for (let i = 0; i < 20; i++) {
folderName = `MEESEEKS_000${i}`;
folder = await uploadActions.createFolder(folderName, '-my-');
folderCreated.push(folder);
}
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
for (const item of folderCreated) {
await uploadActions.deleteFileOrFolder(item.entry.id);
}
await navigationBarPage.clickLogoutButton();
});
it('[C277093] Should sort files with Items per page set to default', async () => {
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
await contentServicesPage.checkListIsSortedByNameColumn('asc');
});
});
});

View File

@@ -1,434 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
ArrayUtil,
FileBrowserUtil,
LocalStorageUtil,
LoginPage,
PaginationPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FolderModel } from '../../models/ACS/folder.model';
import { browser } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { UploadDialogPage } from '../pages/upload-dialog.page';
describe('Document List - Pagination', () => {
const pagination = {
base: 'newFile',
secondSetBase: 'secondSet',
extension: '.txt'
};
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const paginationPage = new PaginationPage();
const navigationBarPage = new NavigationBarPage();
const uploadDialog = new UploadDialogPage();
const newFolderModel = new FolderModel({ name: 'newFolder' });
let acsUser: UserModel;
let fileNames = [];
let secondSetOfFiles = [];
const nrOfFiles = 20;
const numberOfFilesAfterUpload = 21;
const secondSetNumber = 25;
const folderTwoModel = new FolderModel({ name: 'folderTwo' });
const folderThreeModel = new FolderModel({ name: 'folderThree' });
const numberOfSubFolders = 6;
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
const docxFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
beforeAll(async () => {
fileNames = StringUtil.generateFilesNames(10, nrOfFiles + 9, pagination.base, pagination.extension);
secondSetOfFiles = StringUtil.generateFilesNames(10, secondSetNumber + 9, pagination.secondSetBase, pagination.extension);
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const folderThreeUploadedModel = await uploadActions.createFolder(folderThreeModel.name, '-my-');
const newFolderUploadedModel = await uploadActions.createFolder(newFolderModel.name, '-my-');
await uploadActions.createEmptyFiles(fileNames, newFolderUploadedModel.entry.id);
await uploadActions.createEmptyFiles(secondSetOfFiles, folderThreeUploadedModel.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
});
it('[C260062] Should use default pagination settings', async () => {
await contentServicesPage.openFolder(newFolderModel.name);
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('20');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${nrOfFiles} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
const list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames)).toEqual(true);
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
});
it('[C274713] Should be able to set Items per page to 20', async () => {
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('20');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('20');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${nrOfFiles} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
const list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames)).toEqual(true);
await paginationPage.checkNextPageButtonIsDisabled();
await paginationPage.checkPreviousPageButtonIsDisabled();
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('20');
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C260069] Should be able to set Items per page to 5', async () => {
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${5 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(5);
let list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
await paginationPage.clickOnNextPage();
currentPage++;
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 6-${5 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(5);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(5, 10))).toEqual(true);
await paginationPage.clickOnNextPage();
currentPage++;
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 11-${5 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(5);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(10, 15))).toEqual(true);
await paginationPage.clickOnNextPage();
currentPage++;
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 16-${5 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(5);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
});
it('[C260067] Should be able to set Items per page to 10', async () => {
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('10');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('10');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${10 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(10);
let list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 10))).toEqual(true);
await paginationPage.clickOnNextPage();
currentPage++;
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('10');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 11-${10 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(10);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(10, 20))).toEqual(true);
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('10');
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
currentPage = 1;
});
it('[C260065] Should be able to set Items per page to 15', async () => {
let currentPage = 1;
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('15');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('15');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${15 * currentPage} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(15);
let list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 15))).toEqual(true);
currentPage++;
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('15');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 16-${nrOfFiles} of ${nrOfFiles}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles - 15);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(15, 20))).toEqual(true);
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('15');
});
it('[C91320] Pagination should preserve sorting', async () => {
await contentServicesPage.openFolder(newFolderModel.name);
await paginationPage.selectItemsPerPage('20');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await contentServicesPage.getDocumentList().dataTablePage().checkListIsSorted('ASC', 'Display name'));
await contentServicesPage.sortByName('DESC');
expect(await contentServicesPage.getDocumentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await contentServicesPage.getDocumentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await contentServicesPage.getDocumentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
await paginationPage.selectItemsPerPage('10');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await contentServicesPage.getDocumentList().dataTablePage().checkListIsSorted('DESC', 'Display name'));
});
it('[C260107] Should not display pagination bar when a folder is empty', async () => {
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await contentServicesPage.openFolder(newFolderModel.name);
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await contentServicesPage.createAndOpenNewFolder(folderTwoModel.name);
await contentServicesPage.checkPaginationIsNotDisplayed();
await contentServicesPage.deleteSubFolderUnderRoot(newFolderModel.name, folderTwoModel.name);
});
it('[C260071] Should be able to change pagination when having 25 files', async () => {
let currentPage = 1;
await contentServicesPage.openFolder(folderThreeModel.name);
await paginationPage.selectItemsPerPage('15');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('15');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${15 * currentPage} of ${secondSetNumber}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(15);
let list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(0, 15))).toEqual(true);
currentPage++;
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('15');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 16-${secondSetNumber} of ${secondSetNumber}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - 15);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(15, 25))).toEqual(true);
currentPage = 1;
await paginationPage.selectItemsPerPage('20');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('20');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-${20 * currentPage} of ${secondSetNumber}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(20);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(0, 20))).toEqual(true);
currentPage++;
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('20');
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 21-${secondSetNumber} of ${secondSetNumber}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(secondSetNumber - 20);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, secondSetOfFiles.slice(20, 25))).toEqual(true);
});
it('[C216321] Should be able to modify the supported page size value', async () => {
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getItemsPerPageDropdownOptions()).toEqual(['5', '10', '15', '20']);
await LocalStorageUtil.setUserPreference('supportedPageSizes', JSON.stringify([5, 10, 15, 21]));
await contentServicesPage.goToDocumentList();
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await contentServicesPage.openFolder(newFolderModel.name);
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getItemsPerPageDropdownOptions()).toEqual(['5', '10', '15', '21']);
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await paginationPage.selectItemsPerPage('21');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('21');
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-21 of ${numberOfFilesAfterUpload}`);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(21);
await LocalStorageUtil.setUserPreference('supportedPageSizes', JSON.stringify([5, 10, 15, 20]));
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await paginationPage.clickItemsPerPageDropdown();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getItemsPerPageDropdownOptions()).toEqual(['5', '10', '15', '20']);
});
it('[C272767] Should propagate the option chosen regarding displaying items per page to files/folders inside a folder', async () => {
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await contentServicesPage.openFolder(newFolderModel.name);
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await apiService.login(acsUser.username, acsUser.password);
await contentServicesPage.createNewFolder(folderTwoModel.name);
const nodeIdSubFolderTwo = await contentServicesPage.getAttributeValueForElement(folderTwoModel.name, 'Node id');
await contentServicesPage.openFolder(folderTwoModel.name);
for (let i = 0; i < numberOfSubFolders; i++) {
await uploadActions.createFolder('subfolder' + (i + 1), nodeIdSubFolderTwo);
}
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-5 of ${numberOfSubFolders}`);
await paginationPage.clickOnNextPage();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 6-${numberOfSubFolders} of ${numberOfSubFolders}`);
const nodeIdSubFolder6 = await contentServicesPage.getAttributeValueForElement('subfolder6', 'Node id');
for (let i = 0; i < numberOfSubFolders; i++) {
await uploadActions.createFolder('subfolder' + (i + 1), nodeIdSubFolder6);
}
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-5 of ${numberOfSubFolders}`);
expect(await paginationPage.getCurrentPage()).toEqual('Page 1');
expect(await paginationPage.getTotalPages()).toEqual('of 2');
await contentServicesPage.deleteSubFolderUnderRoot(newFolderModel.name, folderTwoModel.name);
});
it('[C260064] Should download only the last selection when changing pages in Single mode', async () => {
await paginationPage.selectItemsPerPage('5');
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await contentServicesPage.openFolder(newFolderModel.name);
expect(await paginationPage.getCurrentItemsPerPage()).toEqual('5');
await contentServicesPage.createNewFolder(folderTwoModel.name);
const nodeIdSubFolderTwo = await contentServicesPage.getAttributeValueForElement(folderTwoModel.name, 'Node id');
await contentServicesPage.openFolder(folderTwoModel.name);
await apiService.login(acsUser.username, acsUser.password);
for (let i = 0; i < numberOfSubFolders; i++) {
await uploadActions.createFolder('subfolder' + (i + 1), nodeIdSubFolderTwo);
}
await browser.refresh();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 1-5 of ${numberOfSubFolders}`);
await contentServicesPage.chooseSelectionMode('Single');
await contentServicesPage.selectFolder('subfolder1');
await paginationPage.clickOnNextPage();
expect(await paginationPage.getPaginationRange()).toEqual(`Showing 6-${numberOfSubFolders} of ${numberOfSubFolders}`);
await contentServicesPage.selectFolderWithCommandKey('subfolder6');
await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded('subfolder6.zip');
await contentServicesPage.deleteSubFolderUnderRoot(newFolderModel.name, folderTwoModel.name);
});
});

View File

@@ -1,195 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
LoginPage,
ModelActions,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage,
Logger
} from '@alfresco/adf-testing';
import { CustomModel, CustomType } from '@alfresco/js-api';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
describe('content type', () => {
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const modelActions = new ModelActions(apiService);
const uploadActions = new UploadActions(apiService);
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const navigationBarPage = new NavigationBarPage();
const contentServicesPage = new ContentServicesPage();
const loginPage = new LoginPage();
const randomString = StringUtil.generateRandomString();
const model: CustomModel = {
name: `test-${randomString}`,
namespaceUri: `http://www.customModel.com/model/${randomString}/1.0`,
namespacePrefix: `e2e-${randomString}`,
author: 'E2e Automation User',
description: 'Custom type e2e model',
status: 'DRAFT'
};
const type: CustomType = { name: `test-type-${randomString}`, parentName: 'cm:content', title: `Test type - ${randomString}` };
const property = {
name: `test-property-${randomString}`,
title: `Test property - ${randomString}`,
dataType: 'd:text',
defaultValue: randomString
};
const pdfFile = new FileModel({ name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name });
const docxFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
let acsUser: UserModel;
beforeAll(async () => {
try {
await apiService.loginWithProfile('admin');
await modelActions.createModel(model);
await modelActions.createType(model.name, type);
await modelActions.addPropertyToType(model.name, type.name, [property]);
await modelActions.activateCustomModel(model.name);
await modelActions.isCustomTypeSearchable(type.title);
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const filePdfNode = await uploadActions.uploadFile(pdfFile.location, pdfFile.name, '-my-');
pdfFile.id = filePdfNode.entry.id;
const docsNode = await uploadActions.uploadFile(docxFileModel.location, docxFileModel.name, '-my-');
docxFileModel.id = docsNode.entry.id;
} catch (e) {
fail('Failed to setup custom types :: ' + JSON.stringify(e, null, 2));
}
});
afterAll(async () => {
await apiService.login(acsUser.username, acsUser.password);
await uploadActions.deleteFileOrFolder(pdfFile.id);
await uploadActions.deleteFileOrFolder(docxFileModel.id);
try {
await apiService.loginWithProfile('admin');
await modelActions.deactivateCustomModel(model.name);
await modelActions.deleteCustomModel(model.name);
} catch (e) {
Logger.error('failed to delete the model {e}');
}
});
beforeEach(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C593560] Should the user be able to select a new content type and save it only after the confirmation dialog', async () => {
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pdfFile.id}/view)`);
await viewerPage.checkFileIsLoaded(pdfFile.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
const defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
expect(defaultType).toBe(true);
await metadataViewPage.clickEditIconGeneral();
expect(await metadataViewPage.changeContentType(type.title)).toBe(true, 'Failed to update node type.');
await metadataViewPage.clickSaveGeneralMetadata();
await metadataViewPage.checkConfirmDialogDisplayed();
await metadataViewPage.applyNodeProperties();
expect(await metadataViewPage.checkPropertyDisplayed(`properties.${model.namespacePrefix}:${property.name}`)).toContain(
property.defaultValue
);
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pdfFile.id}/view)`);
await viewerPage.checkFileIsLoaded(pdfFile.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
const customType =
(await metadataViewPage.hasContentType(type.title)) || (await metadataViewPage.hasContentType(`${model.namespacePrefix}:${type.name}`));
expect(customType).toBe(true);
expect(await metadataViewPage.getPropertyText(`properties.${model.namespacePrefix}:${property.name}`)).toContain(property.defaultValue);
await viewerPage.clickCloseButton();
});
it('[C593559] Should the user be able to select a new content type and not save it when press cancel in the confirmation dialog', async () => {
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${docxFileModel.id}/view)`);
await viewerPage.checkFileIsLoaded(docxFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
let defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
expect(defaultType).toBe(true);
await metadataViewPage.clickEditIconGeneral();
expect(await metadataViewPage.changeContentType(type.title)).toBe(true);
await metadataViewPage.clickSaveGeneralMetadata();
await metadataViewPage.checkConfirmDialogDisplayed();
await metadataViewPage.cancelNodeProperties();
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${docxFileModel.id}/view)`);
await viewerPage.checkFileIsLoaded(docxFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
defaultType = (await metadataViewPage.hasContentType('Content')) || (await metadataViewPage.hasContentType('cm:content'));
expect(defaultType).toBe(true);
await viewerPage.clickCloseButton();
});
});

View File

@@ -1,136 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import CONSTANTS = require('../../util/constants');
import { SitesApi } from '@alfresco/js-api';
describe('permissions', () => {
const loginPage = new LoginPage();
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const navigationBarPage = new NavigationBarPage();
const consumerUser = new UserModel();
const collaboratorUser = new UserModel();
const contributorUser = new UserModel();
let site;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(consumerUser);
await usersActions.createUser(collaboratorUser);
await usersActions.createUser(contributorUser);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: consumerUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
await sitesApi.createSiteMembership(site.entry.id, {
id: collaboratorUser.username,
role: CONSTANTS.CS_USER_ROLES.COLLABORATOR
});
await sitesApi.createSiteMembership(site.entry.id, {
id: contributorUser.username,
role: CONSTANTS.CS_USER_ROLES.CONTRIBUTOR
});
await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, site.entry.guid);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C274692] Should not be possible edit metadata properties when the user is a consumer user', async () => {
await loginPage.login(consumerUser.username, consumerUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.editIconIsNotDisplayed();
});
it('[C279971] Should be possible edit metadata properties when the user is a collaborator user', async () => {
await loginPage.login(collaboratorUser.username, collaboratorUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.editIconIsDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
await metadataViewPage.clickMetadataGroup('EXIF');
await metadataViewPage.editIconIsDisplayed();
});
it('[C279972] Should be possible edit metadata properties when the user is a contributor user', async () => {
await loginPage.login(collaboratorUser.username, collaboratorUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.editIconIsDisplayed();
expect(await viewerPage.getActiveTab()).toEqual('Properties');
await metadataViewPage.clickMetadataGroup('EXIF');
await metadataViewPage.editIconIsDisplayed();
});
});

View File

@@ -1,189 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService,
CheckboxPage,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage,
TogglePage
} from '@alfresco/adf-testing';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
describe('CardView Component - properties', () => {
const METADATA = {
DATA_FORMAT: 'mmm dd yyyy',
TITLE: 'Details',
COMMENTS_TAB: 'Comments',
PROPERTY_TAB: 'Properties',
DEFAULT_ASPECT: 'Properties',
EDIT_BUTTON_TOOLTIP: 'Edit'
};
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const contentServicesPage = new ContentServicesPage();
const togglePage = new TogglePage();
let acsUser: UserModel;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const pdfUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
Object.assign(pngFileModel, pdfUploadedFile.entry);
pngFileModel.update(pdfUploadedFile.entry);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
afterEach(async () => {
await viewerPage.clickCloseButton();
});
it('[C246516] Should show/hide the empty metadata when the property displayEmpty is true/false', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.editIconIsDisplayed();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
await metadataViewPage.clickMetadataGroup('EXIF');
await metadataViewPage.checkPropertyIsVisible('properties.exif:flash', 'boolean');
await metadataViewPage.checkPropertyIsNotVisible('properties.exif:model', 'textitem');
await CheckboxPage.check(metadataViewPage.displayEmptySwitch);
await metadataViewPage.checkPropertyIsVisible('properties.exif:flash', 'boolean');
await metadataViewPage.checkPropertyIsVisible('properties.exif:model', 'textitem');
});
it('[C260179] Should not be possible edit the basic property when readOnly is true', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
await CheckboxPage.check(metadataViewPage.readonlySwitch);
});
it('[C268965] Should multi property allow expand multi accordion at the same time when set', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.checkMetadataGroupIsExpand('properties');
await metadataViewPage.checkMetadataGroupIsNotExpand('EXIF');
await metadataViewPage.clickMetadataGroup('EXIF');
await metadataViewPage.checkMetadataGroupIsExpand('EXIF');
await metadataViewPage.checkMetadataGroupIsNotExpand('properties');
await CheckboxPage.check(metadataViewPage.multiSwitch);
await metadataViewPage.clickMetadataGroup('properties');
await metadataViewPage.checkMetadataGroupIsExpand('EXIF');
await metadataViewPage.checkMetadataGroupIsExpand('properties');
});
it('[C280559] Should show/hide the default metadata properties when displayDefaultProperties is true/false', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await togglePage.disableToggle(metadataViewPage.defaultPropertiesSwitch);
await metadataViewPage.checkMetadataGroupIsNotPresent('properties');
await metadataViewPage.checkMetadataGroupIsPresent('Versionable');
await metadataViewPage.checkMetadataGroupIsExpand('Versionable');
await togglePage.enableToggle(metadataViewPage.defaultPropertiesSwitch);
await metadataViewPage.checkMetadataGroupIsPresent('properties');
await metadataViewPage.checkMetadataGroupIsExpand('properties');
});
it('[C280560] Should show/hide the more properties button when displayDefaultProperties is true/false', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.checkMetadataGroupIsPresent('properties');
await togglePage.disableToggle(metadataViewPage.defaultPropertiesSwitch);
await metadataViewPage.checkMetadataGroupIsNotPresent('properties');
});
it('[C307975] Should be able to choose which aspect to show expanded in the info-drawer', async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.typeAspectName('EXIF');
await metadataViewPage.clickApplyAspect();
await metadataViewPage.checkMetadataGroupIsExpand('EXIF');
await metadataViewPage.checkMetadataGroupIsNotExpand('properties');
await CheckboxPage.check(metadataViewPage.displayEmptySwitch);
await metadataViewPage.checkPropertyIsVisible('properties.exif:flash', 'boolean');
await metadataViewPage.checkPropertyIsVisible('properties.exif:model', 'textitem');
await metadataViewPage.typeAspectName('nonexistent');
await metadataViewPage.clickApplyAspect();
await metadataViewPage.checkMetadataGroupIsNotPresent('nonexistent');
await metadataViewPage.typeAspectName('Properties');
await metadataViewPage.clickApplyAspect();
await metadataViewPage.checkMetadataGroupIsPresent('properties');
await metadataViewPage.checkMetadataGroupIsExpand('properties');
});
});

View File

@@ -1,237 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
LocalStorageUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { MetadataViewPage } from '../../core/pages/metadata-view.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { format } from 'date-fns';
describe('Metadata component', () => {
const METADATA = {
DATA_FORMAT: 'PP',
TITLE: 'Details',
COMMENTS_TAB: 'Comments',
PROPERTY_TAB: 'Properties',
DEFAULT_ASPECT: 'General info'
};
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const viewerPage = new ViewerPage();
const metadataViewPage = new MetadataViewPage();
const navigationBarPage = new NavigationBarPage();
let acsUser: UserModel;
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-');
Object.assign(pngFileModel, pngUploadedFile.entry);
pngFileModel.update(pngUploadedFile.entry);
});
describe('Viewer Metadata', () => {
beforeAll(async () => {
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await LocalStorageUtil.setConfigField(
'content-metadata',
JSON.stringify({
presets: {
default: {
'exif:exif': '*'
}
}
})
);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.checkFileIsLoaded();
});
afterEach(async () => {
await viewerPage.clickCloseButton();
await contentServicesPage.waitForTableBody();
});
it('[C245652] Should be possible to display a file properties', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
const title = await metadataViewPage.getTitle();
const activeTab = await viewerPage.getActiveTab();
const expandedAspectName = await metadataViewPage.getExpandedAspectName();
const name = await metadataViewPage.getName();
const creator = await metadataViewPage.getCreator();
const createdDate = await metadataViewPage.getCreatedDate();
const modifier = await metadataViewPage.getModifier();
const modifiedDate = await metadataViewPage.getModifiedDate();
const mimeTypeName = await metadataViewPage.getMimetypeName();
const size = await metadataViewPage.getSize();
expect(title).toEqual(METADATA.TITLE);
expect(activeTab).toEqual(METADATA.PROPERTY_TAB);
expect(expandedAspectName).toEqual(METADATA.DEFAULT_ASPECT);
expect(name).toEqual(pngFileModel.name);
expect(creator).toEqual(pngFileModel.getCreatedByUser().displayName);
expect(createdDate).toEqual(format(new Date(pngFileModel.createdAt), METADATA.DATA_FORMAT), pngFileModel.createdAt);
expect(modifier).toEqual(pngFileModel.getCreatedByUser().displayName);
expect(modifiedDate).toEqual(format(new Date(pngFileModel.createdAt), METADATA.DATA_FORMAT), pngFileModel.createdAt);
expect(mimeTypeName).toEqual(pngFileModel.getContent().mimeTypeName);
expect(size).toEqual(pngFileModel.getContent().getSizeInBytes());
});
it('[C270952] Should be possible to open/close properties using info icon', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsNotDisplayed();
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.COMMENTS_TAB);
await metadataViewPage.clickOnPropertiesTab();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
});
it('[C245654] Should be possible edit the basic Metadata Info of a Document', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
await metadataViewPage.clickEditIconGeneral();
await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText');
await metadataViewPage.clickResetMetadata();
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
await metadataViewPage.clickEditIconGeneral();
await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText.png');
await metadataViewPage.enterPropertyText('properties.cm:title', 'example title');
await metadataViewPage.enterDescriptionText('example description');
await metadataViewPage.clickSaveGeneralMetadata();
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description');
await viewerPage.clickCloseButton();
await contentServicesPage.waitForTableBody();
await viewerPage.viewFile('exampleText.png');
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('exampleText.png');
expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title');
await metadataViewPage.clickEditIconGeneral();
await metadataViewPage.enterPropertyText('properties.cm:name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name);
await metadataViewPage.clickSaveGeneralMetadata();
});
it('[C260181] Should be possible edit all the metadata aspect', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
await metadataViewPage.clickMetadataGroupEditIcon('EXIF');
await metadataViewPage.enterPropertyText('properties.exif:software', 'test custom text software');
await metadataViewPage.enterPropertyText('properties.exif:isoSpeedRatings', 'test custom text isoSpeedRatings');
await metadataViewPage.enterPropertyText('properties.exif:fNumber', 22);
await metadataViewPage.clickSaveMetadata();
expect(await metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings');
expect(await metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software');
expect(await metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22');
});
});
it('[C279960] Should show the last username modifier when modify a File', async () => {
await loginPage.loginWithProfile('admin');
await BrowserActions.getUrl(browser.baseUrl + `/files(overlay:files/${pngFileModel.id}/view)`);
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
await metadataViewPage.isEditGeneralIconDisplayed();
expect(await viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB);
await metadataViewPage.clickEditIconGeneral();
await metadataViewPage.enterDescriptionText('check author example description');
await metadataViewPage.clickSaveGeneralMetadata();
expect(await metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description');
await navigationBarPage.clickLogoutButton();
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await viewerPage.viewFile(pngFileModel.name);
await viewerPage.checkFileIsLoaded();
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab();
expect(await metadataViewPage.getPropertyText('modifiedByUser.displayName')).toEqual('Administrator');
await viewerPage.clickCloseButton();
await contentServicesPage.waitForTableBody();
});
});

View File

@@ -1,123 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, browser, ElementFinder, $, $$ } from 'protractor';
import { BrowserVisibility, BrowserActions, materialLocators } from '@alfresco/adf-testing';
export class UploadDialogPage {
closeButton = $('#adf-upload-dialog-close');
dialog = $('div[id="upload-dialog"]');
minimizedDialog = $('div[class*="upload-dialog--minimized"]');
uploadedStatusIcon = '.adf-file-uploading-row__status--done';
cancelledStatusIcon = 'div[class*="status--cancelled"]';
errorStatusIcon = `div[class*="status--error"] ${materialLocators.Icon.root}`;
rowByRowName = by.xpath('ancestor::adf-file-uploading-list-row');
title = $('span[class*="upload-dialog__title"]');
toggleMinimizeButton = $(`[data-automation-id='adf-upload-dialog__toggle-minimize']`);
async clickOnCloseButton(): Promise<void> {
await this.checkCloseButtonIsDisplayed();
await BrowserActions.click(this.closeButton);
}
async checkCloseButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
}
async dialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dialog);
}
async dialogIsMinimized(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.minimizedDialog);
}
async dialogIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.dialog);
}
async getRowByRowName(content: string): Promise<ElementFinder> {
const row = await $$(`div[class*='uploading-row'] span[title="${content}"]`).last();
await BrowserVisibility.waitUntilElementIsVisible(row);
return row.element(this.rowByRowName);
}
async fileIsUploaded(content: string): Promise<void> {
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon), 10000);
}
async fileIsError(content: string) {
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.errorStatusIcon));
}
async filesAreUploaded(content: string[]): Promise<void> {
for (const item of content) {
await this.fileIsUploaded(item);
}
}
async fileIsNotDisplayedInDialog(content: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible($(`div[class*='uploading-row'] span[title="${content}"]`));
}
async fileIsCancelled(content: string): Promise<void> {
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.cancelledStatusIcon), 10000);
}
async removeUploadedFile(content: string): Promise<void> {
const row: ElementFinder = await this.getRowByRowName(content);
await BrowserVisibility.waitUntilElementIsVisible(row.$(this.uploadedStatusIcon));
const elementRow = await this.getRowByRowName(content);
await BrowserActions.click(elementRow.$(this.uploadedStatusIcon));
}
async getTitleText(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.title);
return this.title.getText();
}
async numberOfCurrentFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[0];
}
async numberOfInitialFilesUploaded(): Promise<string> {
const text = await this.getTitleText();
return text.split('Uploaded ')[1].split(' / ')[1];
}
async minimizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.toggleMinimizeButton);
}
async maximizeUploadDialog(): Promise<void> {
await BrowserActions.click(this.toggleMinimizeButton);
}
async displayTooltip(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($(this.errorStatusIcon));
await browser.actions().mouseMove($(this.errorStatusIcon)).perform();
}
async getTooltip(): Promise<string> {
return BrowserActions.getAttribute($(this.errorStatusIcon), 'title');
}
}

View File

@@ -1,165 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 * as path from 'path';
import { BrowserActions, TestElement, TogglePage, materialLocators } from '@alfresco/adf-testing';
import { $, browser } from 'protractor';
export class VersionManagePage {
togglePage = new TogglePage();
showNewVersionButton = TestElement.byId('adf-show-version-upload-button');
uploadNewVersionInput = TestElement.byCss('.adf-upload-version-button input[data-automation-id="upload-single-file"]');
uploadNewVersionButton = TestElement.byCss('.adf-upload-version-button');
uploadNewVersionContainer = TestElement.byId('adf-new-version-uploader-container');
cancelButton = TestElement.byId('adf-new-version-cancel');
majorRadio = TestElement.byId('adf-new-version-major');
minorRadio = TestElement.byId('adf-new-version-minor');
commentText = TestElement.byId('adf-new-version-text-area');
readOnlySwitch = $('#adf-version-manager-switch-readonly');
downloadSwitch = $('#adf-version-manager-switch-download');
commentsSwitch = $('#adf-version-manager-switch-comments');
confirmAccept = TestElement.byId('adf-confirm-accept');
confirmCancel = TestElement.byId('adf-confirm-cancel');
async uploadNewVersionFile(fileLocation: string): Promise<void> {
const filePath = path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation));
await this.uploadNewVersionInput.waitPresent();
await this.uploadNewVersionInput.elementFinder.sendKeys(filePath);
await this.showNewVersionButton.waitVisible();
}
getFileVersionName(version: string): Promise<string> {
return TestElement.byCss(`[id="adf-version-list-item-name-${version}"]`).getText();
}
checkFileVersionExist(version: string): Promise<void> {
return TestElement.byId(`adf-version-list-item-version-${version}`).waitVisible();
}
checkFileVersionNotExist(version: string): Promise<void> {
return TestElement.byId(`adf-version-list-item-version-${version}`).waitNotVisible();
}
getFileVersionComment(version: string): Promise<string> {
return TestElement.byId(`adf-version-list-item-comment-${version}`).getText();
}
getFileVersionDate(version: string): Promise<string> {
return TestElement.byId(`adf-version-list-item-date-${version}`).getText();
}
/**
* disables readOnly
*/
async disableReadOnly(): Promise<void> {
await this.togglePage.disableToggle(this.readOnlySwitch);
}
/**
* enables readOnly
*/
async enableReadOnly(): Promise<void> {
await this.togglePage.enableToggle(this.readOnlySwitch);
}
/**
* disables download
*/
async disableDownload(): Promise<void> {
await this.togglePage.disableToggle(this.downloadSwitch);
}
/**
* enables download
*/
async enableDownload(): Promise<void> {
await this.togglePage.enableToggle(this.downloadSwitch);
}
/**
*
* disables comments
*/
async disableComments(): Promise<void> {
await this.togglePage.disableToggle(this.commentsSwitch);
}
/**
* enables comments
*/
async enableComments(): Promise<void> {
await this.togglePage.enableToggle(this.commentsSwitch);
}
async clickActionButton(version: string): Promise<void> {
await TestElement.byId(`adf-version-list-action-menu-button-${version}`).click();
await TestElement.byCss(`.cdk-overlay-container ${materialLocators.Menu.content.class}`).waitVisible();
}
async closeActionsMenu(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
}
async closeDisabledActionsMenu(): Promise<void> {
const container = TestElement.byCss('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing');
await BrowserActions.closeDisabledMenu();
await container.waitNotVisible();
}
async downloadFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const downloadButton = TestElement.byId(`adf-version-list-action-download-${version}`);
await downloadButton.click();
await downloadButton.waitNotVisible();
}
async deleteFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const deleteButton = TestElement.byId(`adf-version-list-action-delete-${version}`);
await deleteButton.click();
}
async restoreFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const restoreButton = TestElement.byId(`adf-version-list-action-restore-${version}`);
await restoreButton.click();
}
async viewFileVersion(version): Promise<void> {
await this.clickActionButton(version);
const viewButton = TestElement.byId(`adf-version-list-action-view-${version}`);
await viewButton.click();
}
async checkActionsArePresent(version: string): Promise<void> {
await TestElement.byId(`adf-version-list-action-download-${version}`).waitVisible();
await TestElement.byId(`adf-version-list-action-delete-${version}`).waitVisible();
await TestElement.byId(`adf-version-list-action-restore-${version}`).waitVisible();
}
async closeVersionDialog(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await this.uploadNewVersionContainer.waitNotVisible();
}
}

View File

@@ -1,124 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page';
import { FileModel } from '../../models/ACS/file.model';
describe('Upload component', async () => {
const apiService = createApiService();
const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage();
const uploadToggles = new UploadTogglesPage();
const loginPage = new LoginPage();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const mediumFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.MEDIUM_FILE.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.MEDIUM_FILE.file_location
});
const largeFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
const deleteNodesInCurrentPage = async () => {
const nodeList = await contentServicesPage.getElementsDisplayedId();
for (const node of nodeList) {
try {
await uploadActions.deleteFileOrFolder(node);
} catch (error) {}
}
};
it('[C272792] Should be possible to cancel upload of a big file using row cancel icon', async () => {
await browser.executeScript(`setInterval(() => {document.querySelector('div[data-automation-id="cancel-upload-progress"]').click();}, 500)`);
await contentServicesPage.uploadFile(mediumFile.location);
expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(mediumFile.name);
});
it('[C287790] Should be possible to cancel upload of a big file through the cancel uploads button', async () => {
await browser.executeScript(
' setInterval(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 500)'
);
await contentServicesPage.uploadFile(largeFile.location);
expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
});
it('[C272793] Should be able to cancel multiple files upload', async () => {
await uploadToggles.enableMultipleFileUpload();
await browser.executeScript(
' setInterval(() => {document.querySelector("#adf-upload-dialog-cancel-all").click();' +
'document.querySelector("#adf-upload-dialog-cancel").click(); }, 500)'
);
await contentServicesPage.uploadMultipleFile([mediumFile.location, largeFile.location]);
expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(mediumFile.name);
await contentServicesPage.checkContentIsNotDisplayed(largeFile.name);
await uploadToggles.disableMultipleFileUpload();
});
it('[C315257] Should be able to cancel file in upload queue', async () => {
await uploadToggles.enableMultipleFileUpload();
await browser.executeScript(`setInterval(() => {document.querySelector('button[data-automation-id="cancel-upload-queue"]').click();}, 500)`);
await contentServicesPage.uploadMultipleFile([mediumFile.location, pngFile.location]);
await uploadDialog.fileIsCancelled(pngFile.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableMultipleFileUpload();
await deleteNodesInCurrentPage();
});
});

View File

@@ -1,163 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element } from 'protractor';
import { createApiService,
DropActions,
LocalStorageUtil,
LoginPage,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FolderModel } from '../../models/ACS/folder.model';
describe('Upload component - Excluded Files', () => {
const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage();
const uploadToggles = new UploadTogglesPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
const iniExcludedFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.INI.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.INI.file_location
});
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const folderUpload = new FolderModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEXT_FOLDER.folder_location
});
const acceptedFileInsideFolder = new FolderModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.FILE_ACCEPTED_INSIDE_TEXT_FOLDER.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.FILE_ACCEPTED_INSIDE_TEXT_FOLDER.file_location
});
const excludedFileInsideFolder = new FolderModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.FILE_EXCLUDED_INSIDE_TEXT_FOLDER.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.FILE_EXCLUDED_INSIDE_TEXT_FOLDER.file_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
afterEach(async () => {
await contentServicesPage.goToDocumentList();
});
it('[C279914] Should not allow upload default excluded files using D&D', async () => {
await contentServicesPage.checkDragAndDropDIsDisplayed();
const dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
await DropActions.dropFile(dragAndDropArea, iniExcludedFile.location);
await browser.sleep(5000);
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(iniExcludedFile.name);
});
it('[C260122] Should not allow upload default excluded files using Upload button', async () => {
await contentServicesPage.uploadFile(iniExcludedFile.location);
await contentServicesPage.checkContentIsNotDisplayed(iniExcludedFile.name);
});
it('[C212862] Should not allow upload file excluded in the files extension of app.config.json', async () => {
await LocalStorageUtil.setConfigField('files', JSON.stringify({
excluded: ['.DS_Store', 'desktop.ini', '*.txt'],
'match-options': { nocase: true }
}));
await contentServicesPage.goToDocumentList();
await contentServicesPage
.uploadFile(txtFileModel.location);
await contentServicesPage.checkContentIsNotDisplayed(txtFileModel.name);
});
it('[C260125] Should not upload excluded file when they are in a Folder', async () => {
await LocalStorageUtil.setConfigField('files', JSON.stringify({
excluded: ['*.cpio'],
'match-options': { nocase: true }
}));
await uploadToggles.enableFolderUpload();
await contentServicesPage.uploadFolder(folderUpload.location);
await contentServicesPage.checkContentIsDisplayed(folderUpload.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.openFolder(folderUpload.name);
await contentServicesPage.checkContentIsDisplayed(acceptedFileInsideFolder.name);
await contentServicesPage.checkContentIsNotDisplayed(excludedFileInsideFolder.name);
});
it('[C274688] Should extension type added as excluded and accepted not be uploaded', async () => {
await LocalStorageUtil.setConfigField('files', JSON.stringify({
excluded: ['.DS_Store', 'desktop.ini', '*.png'],
'match-options': { nocase: true }
}));
await contentServicesPage.goToDocumentList();
await uploadToggles.enableExtensionFilter();
await browser.sleep(1000);
await uploadToggles.addExtension('.png');
await contentServicesPage.uploadFile(pngFile.location);
await browser.sleep(1000);
await contentServicesPage.checkContentIsNotDisplayed(pngFile.name);
});
});

View File

@@ -1,167 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { VersionManagePage } from '../pages/version-manager.page';
describe('Upload component', () => {
const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage();
const uploadToggles = new UploadTogglesPage();
const loginPage = new LoginPage();
const versionManagePage = new VersionManagePage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
const FILES = browser.params.resources.Files;
const firstPdfFileModel = new FileModel({
name: FILES.ADF_DOCUMENTS.PDF_B.file_name,
location: FILES.ADF_DOCUMENTS.PDF_B.file_location
});
const docxFileModel = new FileModel({
name: FILES.ADF_DOCUMENTS.DOCX.file_name,
location: FILES.ADF_DOCUMENTS.DOCX.file_location
});
const pdfFileModel = new FileModel({
name: FILES.ADF_DOCUMENTS.PDF.file_name,
location: FILES.ADF_DOCUMENTS.PDF.file_location
});
const pngFileModelTwo = new FileModel({
name: FILES.ADF_DOCUMENTS.PNG_B.file_name,
location: FILES.ADF_DOCUMENTS.PNG_B.file_location
});
const pngFileModel = new FileModel({
name: FILES.ADF_DOCUMENTS.PNG.file_name,
location: FILES.ADF_DOCUMENTS.PNG.file_location
});
const filesLocation = [pdfFileModel.location, docxFileModel.location, pngFileModel.location, firstPdfFileModel.location];
const filesName = [pdfFileModel.name, docxFileModel.name, pngFileModel.name, firstPdfFileModel.name];
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
});
afterEach(async () => {
const nbResults = await contentServicesPage.emptyFolder.isPresent();
if (!nbResults) {
const nodeIds = await contentServicesPage.getElementsDisplayedId();
for (const nodeId of nodeIds) {
await uploadActions.deleteFileOrFolder(nodeId);
}
}
});
it('[C260143] Should be possible to maximize/minimize the upload dialog', async () => {
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.fileIsUploaded(docxFileModel.name);
await uploadDialog.checkCloseButtonIsDisplayed();
expect(await uploadDialog.numberOfCurrentFilesUploaded()).toEqual('1');
expect(await uploadDialog.numberOfInitialFilesUploaded()).toEqual('1');
await uploadDialog.minimizeUploadDialog();
await uploadDialog.dialogIsMinimized();
expect(await uploadDialog.numberOfCurrentFilesUploaded()).toEqual('1');
expect(await uploadDialog.numberOfInitialFilesUploaded()).toEqual('1');
await uploadDialog.maximizeUploadDialog();
await uploadDialog.dialogIsDisplayed();
await uploadDialog.fileIsUploaded(docxFileModel.name);
expect(await uploadDialog.numberOfCurrentFilesUploaded()).toEqual('1');
expect(await uploadDialog.numberOfInitialFilesUploaded()).toEqual('1');
await uploadDialog.checkCloseButtonIsDisplayed();
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C291902] Should be shown upload counter display in dialog box', async () => {
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.fileIsUploaded(docxFileModel.name);
await uploadDialog.checkCloseButtonIsDisplayed();
expect(await uploadDialog.getTitleText()).toEqual('Uploaded 1 / 1');
await uploadDialog.checkCloseButtonIsDisplayed();
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C260176] Should remove files from upload dialog box when closed', async () => {
await contentServicesPage.uploadFile(pngFileModelTwo.location);
await contentServicesPage.checkContentIsDisplayed(pngFileModelTwo.name);
await uploadDialog.fileIsUploaded(pngFileModelTwo.name);
await contentServicesPage.uploadFile(pngFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pngFileModel.name);
await uploadDialog.fileIsUploaded(pngFileModel.name);
await uploadDialog.fileIsUploaded(pngFileModelTwo.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await uploadDialog.fileIsUploaded(pdfFileModel.name);
await uploadDialog.fileIsNotDisplayedInDialog(pngFileModel.name);
await uploadDialog.fileIsNotDisplayedInDialog(pngFileModelTwo.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C260170] Should be possible to upload multiple files', async () => {
await contentServicesPage.checkAcsContainer();
await uploadToggles.enableMultipleFileUpload();
await contentServicesPage.uploadMultipleFile(filesLocation);
await contentServicesPage.checkContentsAreDisplayed(filesName);
await uploadDialog.filesAreUploaded(filesName);
expect(await uploadDialog.getTitleText()).toEqual('Uploaded 4 / 4');
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableMultipleFileUpload();
});
it('[C311305] Should NOT be able to remove uploaded version', async () => {
await contentServicesPage.uploadFile(docxFileModel.location);
await uploadDialog.fileIsUploaded(docxFileModel.name);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await contentServicesPage.versionManagerContent(docxFileModel.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(pngFileModel.location);
await versionManagePage.closeVersionDialog();
await uploadDialog.removeUploadedFile(pngFileModel.name);
await contentServicesPage.checkContentIsDisplayed(pngFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
});

View File

@@ -1,255 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element } from 'protractor';
import { createApiService, DropActions, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Upload component', () => {
const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage();
const uploadToggles = new UploadTogglesPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
let acsUser: UserModel;
const firstPdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_path
});
const docxFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_location
});
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_location
});
const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const fileWithSpecificSize = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_400B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_400B.file_location
});
const emptyFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
await loginPage.login(acsUser.username, acsUser.password);
const pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, '-my-');
Object.assign(firstPdfFileModel, pdfUploadedFile.entry);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
});
describe('', () => {
afterEach(async () => {
const nodeList = await contentServicesPage.getElementsDisplayedId();
for (const node of nodeList) {
try {
await uploadActions.deleteFileOrFolder(node);
} catch (error) {}
}
});
it('[C272788] Should display upload button', async () => {
await contentServicesPage.checkUploadButton();
await contentServicesPage.checkContentIsDisplayed(firstPdfFileModel.name);
});
it('[C272789] Should be able to upload PDF file', async () => {
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await uploadDialog.fileIsUploaded(pdfFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C272790] Should be able to upload text file', async () => {
await contentServicesPage.uploadFile(docxFileModel.location);
await contentServicesPage.checkContentIsDisplayed(docxFileModel.name);
await uploadDialog.fileIsUploaded(docxFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C260141] Should be possible to upload PNG file', async () => {
await contentServicesPage.uploadFile(pngFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pngFileModel.name);
await uploadDialog.fileIsUploaded(pngFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
});
it('[C279920] Should rename a file uploaded twice', async () => {
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1');
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.getVersionName());
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
pdfFileModel.setVersion('');
});
it('[C260172] Should be possible to enable versioning', async () => {
await uploadToggles.enableVersioning();
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
pdfFileModel.setVersion('1');
await contentServicesPage.uploadFile(pdfFileModel.location);
await contentServicesPage.checkContentIsDisplayed(pdfFileModel.name);
await uploadDialog.fileIsUploaded(pdfFileModel.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsNotDisplayed(pdfFileModel.getVersionName());
pdfFileModel.setVersion('');
await uploadToggles.disableVersioning();
});
it('[C260174] Should be possible to set a max size', async () => {
await contentServicesPage.goToDocumentList();
await uploadToggles.enableMaxSize();
await uploadToggles.addMaxSize('400');
await contentServicesPage.uploadFile(fileWithSpecificSize.location);
await uploadDialog.fileIsUploaded(fileWithSpecificSize.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.deleteContent(fileWithSpecificSize.name);
await contentServicesPage.checkContentIsNotDisplayed(fileWithSpecificSize.name);
await uploadToggles.addMaxSize('399');
await contentServicesPage.uploadFile(fileWithSpecificSize.location);
await contentServicesPage.checkContentIsNotDisplayed(fileWithSpecificSize.name);
await uploadDialog.fileIsNotDisplayedInDialog(fileWithSpecificSize.name);
await contentServicesPage.uploadFile(emptyFile.location);
await contentServicesPage.checkContentIsDisplayed(emptyFile.name);
await uploadDialog.fileIsUploaded(emptyFile.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableMaxSize();
});
it('[C272796] Should be possible to set max size to 0', async () => {
await contentServicesPage.goToDocumentList();
await uploadToggles.enableMaxSize();
await uploadToggles.addMaxSize('0');
await contentServicesPage.uploadFile(fileWithSpecificSize.location);
// expect(await contentServicesPage.getErrorMessage()).toEqual('File ' + fileWithSpecificSize.name + ' is larger than the allowed file size');
await uploadDialog.fileIsNotDisplayedInDialog(fileWithSpecificSize.name);
await contentServicesPage.uploadFile(emptyFile.location);
await contentServicesPage.checkContentIsDisplayed(emptyFile.name);
await uploadDialog.fileIsUploaded(emptyFile.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableMaxSize();
});
it('[C272797] Should be possible to set max size to 1', async () => {
await uploadToggles.enableMaxSize();
await browser.sleep(1000);
await uploadToggles.addMaxSize('1');
await uploadToggles.disableMaxSize();
await contentServicesPage.uploadFile(fileWithSpecificSize.location);
await uploadDialog.fileIsUploaded(fileWithSpecificSize.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed(fileWithSpecificSize.name);
});
});
it('[C260171] Should upload only the extension filter allowed when Enable extension filter is enabled', async () => {
await uploadToggles.enableExtensionFilter();
await browser.sleep(1000);
await uploadToggles.addExtension('.docx');
await contentServicesPage.uploadFile(pngFileModel.location);
await contentServicesPage.checkContentIsNotDisplayed(pngFileModel.name);
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableExtensionFilter();
});
it('[C274687] Should upload with drag and drop only the extension filter allowed when Enable extension filter is enabled', async () => {
await uploadToggles.enableExtensionFilter();
await browser.sleep(1000);
await uploadToggles.addExtension('.docx');
const dragAndDropArea = element.all(by.css('adf-upload-drag-area div')).first();
await DropActions.dropFile(dragAndDropArea, pngFileModel.location);
await contentServicesPage.checkContentIsNotDisplayed(pngFileModel.name);
await uploadDialog.dialogIsNotDisplayed();
await uploadToggles.disableExtensionFilter();
});
it('[C291921] Should display tooltip for uploading files on a not found location', async () => {
const folderName = StringUtil.generateRandomString(8);
const folderUploadedModel = await uploadActions.createFolder(folderName, '-my-');
await navigationBarPage.openContentServicesFolder(folderUploadedModel.entry.id);
await contentServicesPage.checkUploadButton();
await uploadActions.deleteFileOrFolder(folderUploadedModel.entry.id);
await contentServicesPage.uploadFile(pdfFileModel.location);
await uploadDialog.displayTooltip();
expect(await uploadDialog.getTooltip()).toEqual('Upload location no longer exists [404]');
});
});

View File

@@ -1,135 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, SnackbarPage, StringUtil, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
import CONSTANTS = require('../../util/constants');
import { SiteEntry, SitesApi } from '@alfresco/js-api';
describe('Upload - User permission', () => {
const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const emptyFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_location
});
let acsUser: UserModel;
let acsUserTwo: UserModel;
let consumerSite: SiteEntry;
let managerSite: SiteEntry;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser(acsUser);
acsUserTwo = await usersActions.createUser(acsUserTwo);
await loginPage.login(acsUser.username, acsUser.password);
});
beforeEach(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
consumerSite = await sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PUBLIC'
});
managerSite = await sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(consumerSite.entry.id, {
id: acsUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
await sitesApi.createSiteMembership(managerSite.entry.id, {
id: acsUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
});
afterEach(async () => {
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(managerSite.entry.id, { permanent: true });
await sitesApi.deleteSite(consumerSite.entry.id, { permanent: true });
});
describe('Consumer permissions', () => {
beforeEach(async () => {
await contentServicesPage.goToDocumentList();
});
it('[C291921] Should display tooltip for uploading files without permissions', async () => {
await navigationBarPage.openContentServicesFolder(consumerSite.entry.guid);
await contentServicesPage.checkDragAndDropDIsDisplayed();
await contentServicesPage.dragAndDropFile(emptyFile.location);
await uploadDialog.fileIsError(emptyFile.name);
await uploadDialog.displayTooltip();
expect(await uploadDialog.getTooltip()).toEqual('Insufficient permissions to upload in this location [403]');
});
it('[C279915] Should not be allowed to upload a file in folder with consumer permissions', async () => {
await contentServicesPage.uploadFile(emptyFile.location);
await contentServicesPage.checkContentIsDisplayed(emptyFile.name);
await uploadDialog.fileIsUploaded(emptyFile.name);
await uploadDialog.clickOnCloseButton();
await uploadDialog.dialogIsNotDisplayed();
await navigationBarPage.openContentServicesFolder(consumerSite.entry.guid);
await browser.sleep(3000);
await contentServicesPage.uploadFile(emptyFile.location);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual(`You don't have the create permission to upload the content`);
});
});
describe('full permissions', () => {
beforeEach(async () => {
await apiService.loginWithProfile('admin');
await navigationBarPage.openContentServicesFolder(managerSite.entry.guid);
await contentServicesPage.goToDocumentList();
});
it('[C279917] Should be allowed to upload a file in a folder with manager permissions', async () => {
await contentServicesPage.uploadFile(emptyFile.location);
await uploadDialog.fileIsUploaded(emptyFile.name);
});
});
});

View File

@@ -1,185 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
BrowserActions,
BrowserVisibility,
FileBrowserUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { browser, by, element } from 'protractor';
import { FileModel } from '../../models/ACS/file.model';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { VersionManagePage } from '../pages/version-manager.page';
describe('Version component actions', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const versionManagePage = new VersionManagePage();
const navigationBarPage = new NavigationBarPage();
const uploadDialog = new UploadDialogPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const viewerPage = new ViewerPage();
let acsUser: UserModel;
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const fileModelVersionTwo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_location
});
const bigFileToCancel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.LARGE_FILE.file_location
});
beforeAll(async () => {
const uploadActions = new UploadActions(apiService);
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const txtUploadedFile = await uploadActions.uploadFile(txtFileModel.location, txtFileModel.name, '-my-');
Object.assign(txtFileModel, txtUploadedFile.entry);
txtFileModel.update(txtUploadedFile.entry);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
beforeEach(async () => {
await contentServicesPage.versionManagerContent(txtFileModel.name);
});
afterEach(async () => {
await BrowserActions.closeMenuAndDialogs();
});
it('[C280003] Should not be possible delete a file version if there is only one version', async () => {
await versionManagePage.clickActionButton('1.0');
expect(await element(by.css(`[id="adf-version-list-action-delete-1.0"]`)).isEnabled()).toBe(false);
await versionManagePage.closeActionsMenu();
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`[id="adf-version-list-action-delete-1.0"]`)));
});
it('[C280004] Should not be possible restore the version if there is only one version', async () => {
await versionManagePage.clickActionButton('1.0');
expect(await element(by.css(`[id="adf-version-list-action-restore-1.0"]`)).isEnabled()).toBe(false);
await versionManagePage.closeActionsMenu();
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`[id="adf-version-list-action-restore-1.0"]`)));
});
it('[C280005] Should be showed all the default action when you have more then one version', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.clickActionButton('1.1');
await versionManagePage.checkActionsArePresent('1.1');
await versionManagePage.closeActionsMenu();
await versionManagePage.closeVersionDialog();
await uploadDialog.clickOnCloseButton();
});
it('[C269081] Should be possible download all the version of a file', async () => {
await versionManagePage.downloadFileVersion('1.0');
await FileBrowserUtil.isFileDownloaded(txtFileModel.name);
await versionManagePage.downloadFileVersion('1.1');
await FileBrowserUtil.isFileDownloaded(fileModelVersionTwo.name);
});
it('[C272819] Should be possible delete a version when click on delete version action', async () => {
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
await versionManagePage.checkFileVersionExist('1.0');
});
it('[C280006] Should be possible prevent a version to be deleted when click on No on the confirm dialog', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.1');
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.confirmCancel.click();
await versionManagePage.checkFileVersionExist('1.1');
await versionManagePage.checkFileVersionExist('1.0');
await versionManagePage.closeVersionDialog();
});
it('[C280007] Should be possible to restore an old version of your file and the document list updated', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.restoreFileVersion('1.0');
await versionManagePage.checkFileVersionExist('2.0');
await versionManagePage.closeVersionDialog();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(txtFileModel.name);
});
it('[C362240] Should be possible to view a previous document version', async () => {
await contentServicesPage.versionManagerContent(fileModelVersionTwo.name);
await versionManagePage.viewFileVersion('1.0');
await viewerPage.expectUrlToContain('1.0');
});
it('[C362241] Should be possible to download a previous document version', async () => {
await viewerPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded(fileModelVersionTwo.name);
await viewerPage.clickCloseButton();
});
it('[C307033] Should be possible to cancel the upload of a new version', async () => {
await browser.refresh();
await contentServicesPage.versionManagerContent(txtFileModel.name);
await versionManagePage.showNewVersionButton.click();
await browser.executeScript(
' setTimeout(() => {document.querySelector("div[data-automation-id=\'cancel-upload-progress\']").click();}, 1000)'
);
await versionManagePage.uploadNewVersionFile(bigFileToCancel.location);
await versionManagePage.closeVersionDialog();
expect(await uploadDialog.getTitleText()).toEqual('Upload canceled');
await browser.refresh();
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.checkContentIsDisplayed(txtFileModel.name);
});
});

View File

@@ -1,321 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element } from 'protractor';
import { createApiService, LoginPage, SnackbarPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { VersionManagePage } from '../pages/version-manager.page';
import { UploadDialogPage } from '../pages/upload-dialog.page';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model';
import CONSTANTS = require('../../util/constants');
import { NodesApi, SitesApi } from '@alfresco/js-api';
describe('Version component permissions', () => {
const loginPage = new LoginPage();
const versionManagePage = new VersionManagePage();
const navigationBarPage = new NavigationBarPage();
const uploadDialog = new UploadDialogPage();
const contentServices = new ContentServicesPage();
let site;
const acsUser = new UserModel();
const consumerUser = new UserModel();
const collaboratorUser = new UserModel();
const contributorUser = new UserModel();
const managerUser = new UserModel();
const fileCreatorUser = new UserModel();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const nodesApi = new NodesApi(apiService.getInstance());
const newVersionFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_location
});
const lockFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_path
});
const differentCreatorFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_D.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_D.file_path
});
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await usersActions.createUser(consumerUser);
await usersActions.createUser(collaboratorUser);
await usersActions.createUser(contributorUser);
await usersActions.createUser(managerUser);
await usersActions.createUser(fileCreatorUser);
const sitesApi = new SitesApi(apiService.getInstance());
site = await sitesApi.createSite({
title: StringUtil.generateRandomString(),
visibility: 'PUBLIC'
});
await sitesApi.createSiteMembership(site.entry.id, {
id: consumerUser.username,
role: CONSTANTS.CS_USER_ROLES.CONSUMER
});
await sitesApi.createSiteMembership(site.entry.id, {
id: collaboratorUser.username,
role: CONSTANTS.CS_USER_ROLES.COLLABORATOR
});
await sitesApi.createSiteMembership(site.entry.id, {
id: contributorUser.username,
role: CONSTANTS.CS_USER_ROLES.CONTRIBUTOR
});
await sitesApi.createSiteMembership(site.entry.id, {
id: managerUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
await sitesApi.createSiteMembership(site.entry.id, {
id: fileCreatorUser.username,
role: CONSTANTS.CS_USER_ROLES.MANAGER
});
const lockFileUploaded = await uploadActions.uploadFile(lockFileModel.location, lockFileModel.name, site.entry.guid);
Object.assign(lockFileModel, lockFileUploaded.entry);
await nodesApi.lockNode(lockFileModel.id, {
type: 'FULL',
lifetime: 'PERSISTENT'
});
await apiService.login(fileCreatorUser.username, fileCreatorUser.password);
await uploadActions.uploadFile(differentCreatorFile.location, differentCreatorFile.name, site.entry.guid);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
const sitesApi = new SitesApi(apiService.getInstance());
await sitesApi.deleteSite(site.entry.id, { permanent: true });
});
describe('Manager', () => {
const sameCreatorFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
beforeAll(async () => {
await apiService.login(managerUser.username, managerUser.password);
const sameCreatorFileUploaded = await uploadActions.uploadFile(sameCreatorFile.location, sameCreatorFile.name, site.entry.guid);
Object.assign(sameCreatorFile, sameCreatorFileUploaded.entry);
await loginPage.login(managerUser.username, managerUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await nodesApi.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});
it('[C277200] should a user with Manager permission be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionName('1.1')).toEqual(newVersionFile.name);
expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
await versionManagePage.closeVersionDialog();
await uploadDialog.clickOnCloseButton();
});
it('[C277204] Should be disabled the option for locked file', async () => {
await contentServices.getDocumentList().rightClickOnRow(lockFileModel.name);
expect(await contentServices.isContextActionEnabled('Manage versions')).toBe(false, 'Manage versions is enabled');
});
});
describe('Consumer', () => {
beforeAll(async () => {
await loginPage.login(consumerUser.username, consumerUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C277197] Should a user with Consumer permission not be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual(`You don't have access to do this.`);
});
it('[C277201] Should a user with Consumer permission not be able to upload a new version for a locked file', async () => {
await contentServices.getDocumentList().rightClickOnRow(lockFileModel.name);
expect(await contentServices.isContextActionEnabled('Manage versions')).toBe(false);
});
});
describe('Contributor', () => {
const sameCreatorFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
beforeAll(async () => {
await apiService.login(contributorUser.username, contributorUser.password);
const sameCreatorFileUploaded = await uploadActions.uploadFile(sameCreatorFile.location, sameCreatorFile.name, site.entry.guid);
Object.assign(sameCreatorFile, sameCreatorFileUploaded.entry);
await loginPage.login(contributorUser.username, contributorUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await nodesApi.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});
it('[C277177] Should a user with Contributor permission be able to upload a new version for the created file', async () => {
await contentServices.versionManagerContent(sameCreatorFile.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionName('1.1')).toEqual(newVersionFile.name);
expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
await versionManagePage.closeVersionDialog();
await uploadDialog.clickOnCloseButton();
});
it('[C277198] Should a user with Contributor permission not be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual(`You don't have access to do this.`);
});
it('[C277202] Should be disabled the option for a locked file', async () => {
await contentServices.getDocumentList().rightClickOnRow(lockFileModel.name);
expect(await contentServices.isContextActionEnabled('Manage versions')).toBe(false);
});
});
describe('Collaborator', () => {
const sameCreatorFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
beforeAll(async () => {
await apiService.login(collaboratorUser.username, collaboratorUser.password);
const sameCreatorFileUploaded = await uploadActions.uploadFile(sameCreatorFile.location, sameCreatorFile.name, site.entry.guid);
Object.assign(sameCreatorFile, sameCreatorFileUploaded.entry);
await loginPage.login(collaboratorUser.username, collaboratorUser.password);
await navigationBarPage.openContentServicesFolder(site.entry.guid);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await nodesApi.deleteNode(sameCreatorFile.id);
await navigationBarPage.clickLogoutButton();
});
it('[C277195] Should a user with Collaborator permission be able to upload a new version for the created file', async () => {
await contentServices.versionManagerContent(sameCreatorFile.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionName('1.1')).toEqual(newVersionFile.name);
expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.deleteFileVersion('1.1');
await versionManagePage.confirmAccept.click();
await versionManagePage.checkFileVersionNotExist('1.1');
await versionManagePage.closeVersionDialog();
await uploadDialog.clickOnCloseButton();
});
it('[C277199] should a user with Collaborator permission be able to upload a new version for a file with different creator', async () => {
await contentServices.versionManagerContent(differentCreatorFile.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(newVersionFile.location);
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionName('1.1')).toEqual(newVersionFile.name);
expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
await versionManagePage.clickActionButton('1.1');
expect(await element(by.css(`[id="adf-version-list-action-delete-1.1"]`)).isEnabled()).toBe(false);
await versionManagePage.closeActionsMenu();
await versionManagePage.closeVersionDialog();
});
it('[C277203] Should a user with Collaborator permission not be able to upload a new version for a locked file', async () => {
await contentServices.getDocumentList().rightClickOnRow(lockFileModel.name);
expect(await contentServices.isContextActionEnabled('Manage versions')).toBe(false);
});
});
});

View File

@@ -1,111 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, by, element } from 'protractor';
import { createApiService, BrowserVisibility, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { VersionManagePage } from '../pages/version-manager.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Version Properties', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const versionManagePage = new VersionManagePage();
const navigationBarPage = new NavigationBarPage();
const viewerPage = new ViewerPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path
});
const fileModelVersionTwo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
const txtUploadedFile = await uploadActions.uploadFile(txtFileModel.location, txtFileModel.name, '-my-');
Object.assign(txtFileModel, txtUploadedFile.entry);
txtFileModel.update(txtUploadedFile.entry);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
});
beforeEach(async () => {
await contentServicesPage.versionManagerContent(txtFileModel.name);
});
it('[C277277] Should show/hide actions menu when readOnly is true/false', async () => {
await versionManagePage.disableReadOnly();
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-menu-button-1.0"]`)));
await versionManagePage.enableReadOnly();
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`[id="adf-version-list-action-menu-button-1.0"]`)));
});
it('[C279994] Should show/hide upload new version button when readOnly is true/false', async () => {
await versionManagePage.disableReadOnly();
await versionManagePage.showNewVersionButton.waitVisible();
await versionManagePage.enableReadOnly();
await versionManagePage.showNewVersionButton.waitNotVisible();
await versionManagePage.uploadNewVersionButton.waitNotVisible();
});
it('[C272817] Should NOT be present the download action when allowDownload property is false', async () => {
await versionManagePage.disableDownload();
await versionManagePage.clickActionButton('1.0');
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`[id="adf-version-list-action-download-1.0"]`)));
await versionManagePage.closeDisabledActionsMenu();
await viewerPage.clickCloseButton();
});
it('[C279992] Should be present the download action when allowDownload property is true', async () => {
await versionManagePage.enableDownload();
await versionManagePage.clickActionButton('1.0');
await BrowserVisibility.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-download-1.0"]`)));
});
it('[C269085] Should show/hide comments when showComments true/false', async () => {
await versionManagePage.enableComments();
await versionManagePage.showNewVersionButton.click();
await versionManagePage.commentText.typeText('Example comment text');
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionComment('1.1')).toEqual('Example comment text');
await versionManagePage.disableComments();
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.css(`[id="adf-version-list-item-comment-1.1"]`)));
});
});

View File

@@ -1,152 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, LoginPage, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { VersionManagePage } from '../pages/version-manager.page';
import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Version component', () => {
let txtUploadedFile;
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const navigationBarPage = new NavigationBarPage();
const versionManagePage = new VersionManagePage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
let acsUser: UserModel;
const txtFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TXT.file_path
});
const fileModelVersionTwo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_location
});
const fileModelVersionThree = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_B.file_location
});
const fileModelVersionFor = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_C.file_location
});
const fileModelVersionFive = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG_D.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG_D.file_location
});
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
acsUser = await usersActions.createUser();
await apiService.login(acsUser.username, acsUser.password);
txtUploadedFile = await uploadActions.uploadFile(txtFileModel.location, txtFileModel.name, '-my-');
Object.assign(txtFileModel, txtUploadedFile.entry);
txtFileModel.update(txtUploadedFile.entry);
await loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody();
await contentServicesPage.versionManagerContent(txtFileModel.name);
});
it('[C272768] Should be visible the first file version when you upload a file', async () => {
await versionManagePage.showNewVersionButton.waitVisible();
await versionManagePage.checkFileVersionExist('1.0');
expect(await versionManagePage.getFileVersionName('1.0')).toEqual(txtFileModel.name);
expect(await versionManagePage.getFileVersionDate('1.0')).not.toBeUndefined();
});
it('[C279995] Should show/hide the new upload file options when click on add New version/cancel button', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.cancelButton.waitVisible();
await versionManagePage.majorRadio.waitVisible();
await versionManagePage.minorRadio.waitVisible();
await versionManagePage.commentText.waitVisible();
await versionManagePage.uploadNewVersionButton.waitVisible();
await versionManagePage.cancelButton.click();
await versionManagePage.cancelButton.waitNotVisible();
await versionManagePage.majorRadio.waitNotVisible();
await versionManagePage.minorRadio.waitNotVisible();
await versionManagePage.commentText.waitNotVisible();
await versionManagePage.uploadNewVersionButton.waitNotVisible();
await versionManagePage.showNewVersionButton.waitVisible();
});
it('[C260244] Should show the version history when select a file with multiple version', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionTwo.location);
await versionManagePage.checkFileVersionExist('1.0');
expect(await versionManagePage.getFileVersionName('1.0')).toEqual(txtFileModel.name);
expect(await versionManagePage.getFileVersionDate('1.0')).not.toBeUndefined();
await versionManagePage.checkFileVersionExist('1.1');
expect(await versionManagePage.getFileVersionName('1.1')).toEqual(fileModelVersionTwo.name);
expect(await versionManagePage.getFileVersionDate('1.1')).not.toBeUndefined();
});
it('[C269084] Should be possible add a comment when add a new version', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.commentText.typeText('Example comment text');
await versionManagePage.uploadNewVersionFile(fileModelVersionThree.location);
await versionManagePage.checkFileVersionExist('1.2');
expect(await versionManagePage.getFileVersionName('1.2')).toEqual(fileModelVersionThree.name);
expect(await versionManagePage.getFileVersionDate('1.2')).not.toBeUndefined();
expect(await versionManagePage.getFileVersionComment('1.2')).toEqual('Example comment text');
});
it('[C275719] Should be possible preview the file when you add a new version', async () => {
await versionManagePage.showNewVersionButton.click();
await versionManagePage.majorRadio.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionFor.location);
await versionManagePage.checkFileVersionExist('2.0');
expect(await versionManagePage.getFileVersionName('2.0')).toEqual(fileModelVersionFor.name);
await versionManagePage.showNewVersionButton.click();
await versionManagePage.minorRadio.click();
await versionManagePage.uploadNewVersionFile(fileModelVersionFive.location);
await versionManagePage.checkFileVersionExist('2.1');
expect(await versionManagePage.getFileVersionName('2.1')).toEqual(fileModelVersionFive.name);
});
});

View File

@@ -1,98 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { LoginPage, SettingsPage, BrowserVisibility } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../../core/pages/navigation-bar.page';
import { LoginShellPage } from '../../../core/pages/login-shell.page';
describe('Login component - SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginPage();
const loginPage = new LoginShellPage();
const navigationBarPage = new NavigationBarPage();
describe('Login component - SSO implicit Flow', () => {
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
await browser.refresh();
});
it('[C261050] Should be possible login with SSO', async () => {
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false,
true,
browser.params.testConfig.appConfig.oauth2.clientId,
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
);
await browser.refresh();
await loginSSOPage.loginSSOIdentityService(
browser.params.testConfig.users.admin.username,
browser.params.testConfig.users.admin.password
);
});
it('[C280667] Should be redirect directly to keycloak without show the login page with silent login', async () => {
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
true,
true,
browser.params.testConfig.appConfig.oauth2.clientId,
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
);
await browser.refresh();
await loginSSOPage.loginSSOIdentityService(
browser.params.testConfig.users.admin.username,
browser.params.testConfig.users.admin.password
);
});
});
describe('Login component - SSO Grant type password (implicit flow false)', () => {
it('[C299158] Should be possible to login with SSO, with grant type password (Implicit Flow false)', async () => {
await settingsPage.setProviderEcmSsoWithoutCodeFlow(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false,
false,
browser.params.testConfig.appConfig.oauth2.clientId,
browser.params.testConfig.appConfig.oauth2.redirectUriLogout
);
await browser.refresh();
await loginPage.waitForElements();
await loginPage.enterUsername(browser.params.testConfig.users.admin.username);
await loginPage.enterPassword(browser.params.testConfig.users.admin.password);
await loginPage.clickSignInButton();
await BrowserVisibility.waitUntilElementIsVisible(loginPage.sidenavLayout);
});
});
});

View File

@@ -1,69 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, TabsPage } from '@alfresco/adf-testing';
import { $, $$ } from 'protractor';
export class CommentsPage {
tabsPage = new TabsPage();
numberOfComments = $('#comment-header');
commentUserIcon = $$('.adf-comment-img-container');
commentUserName = $$('.adf-comment-user-name');
commentMessage = $$('.adf-comment-message');
commentTime = $$('.adf-comment-message-time');
commentInput = $('#comment-input');
addCommentButton = $('[data-automation-id=\'comments-input-add\']');
async getTotalNumberOfComments(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementHasText(this.numberOfComments, text);
}
async checkUserIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentUserIcon.first());
}
getUserName(position: number): Promise<string> {
return BrowserActions.getText(this.commentUserName.get(position));
}
getMessage(position: number): Promise<string> {
return BrowserActions.getText(this.commentMessage.get(position));
}
getTime(position: number): Promise<string> {
return BrowserActions.getText(this.commentTime.get(position));
}
async checkCommentInputIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.commentInput);
}
async addComment(comment: string): Promise<void> {
await BrowserActions.clearSendKeys(this.commentInput, comment);
await BrowserActions.click(this.addCommentButton);
}
async checkCommentsTabIsSelected(): Promise<void> {
await this.tabsPage.checkTabIsSelectedByTitle('Comments');
}
async checkCommentInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.commentInput);
}
}

View File

@@ -1,324 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger, materialLocators } from '@alfresco/adf-testing';
import { $$, browser, protractor, $ } from 'protractor';
import { FolderDialogPage } from './dialog/folder-dialog.page';
import { NavigationBarPage } from './navigation-bar.page';
import * as path from 'path';
export class ContentServicesPage {
columns = {
name: 'Display name',
size: 'Size',
nodeId: 'Node id',
createdBy: 'Created by',
created: 'Created'
};
contentList = new DocumentListPage($$('adf-upload-drag-area adf-document-list').first());
createFolderDialog = new FolderDialogPage();
uploadBorder = $('#document-list-container');
currentFolder = $('div[class*="adf-breadcrumb-item adf-active"] div');
createFolderButton = $('button[data-automation-id="create-new-folder"]');
uploadFileButton = $('.adf-upload-button-file-container label');
uploadFileButtonInput = $('input[data-automation-id="upload-single-file"]');
uploadMultipleFileButton = $('input[data-automation-id="upload-multiple-files"]');
uploadFolderButton = $('input[data-automation-id="uploadFolder"]');
emptyPagination = $('adf-pagination[class*="adf-pagination__empty"]');
dragAndDrop = $$('adf-upload-drag-area div').first();
nameHeader = $$('div[data-automation-id="auto_header_content_id_name"] > span').first();
sizeHeader = $$('div[data-automation-id="auto_header_content_id_content.sizeInBytes"] > span').first();
createdByHeader = $$('div[data-automation-id="auto_header_content_id_createdByUser.displayName"] > span').first();
createdHeader = $$('div[data-automation-id="auto_header_content_id_createdAt"] > span').first();
emptyFolder = $('.adf-empty-folder-this-space-is-empty');
emptyFolderImage = $('.adf-empty-folder-image');
nameColumnHeader = 'name';
createdByColumnHeader = 'createdByUser.displayName';
createdColumnHeader = 'createdAt';
deleteContentElement = $('button[data-automation-id="Delete"]');
versionManagerAction = $('button[data-automation-id="Manage versions"]');
downloadContent = $('button[data-automation-id="Download"]');
downloadButton = $('button[title="Download"]');
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectionModeDropdown = $(`${materialLocators.Select.class}[placeholder="Selection Mode"]`);
async isContextActionEnabled(actionName: string): Promise<boolean> {
const actionButton = $(`button[data-automation-id="context-${actionName}"`);
await BrowserVisibility.waitUntilElementIsVisible(actionButton);
return actionButton.isEnabled();
}
getDocumentList(): DocumentListPage {
return this.contentList;
}
async deleteContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.deleteContentElement);
await this.checkContentIsNotDisplayed(content);
}
async versionManagerContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.versionManagerAction);
}
async getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
}
// @deprecated prefer waitTillContentLoaded
async checkDocumentListElementsAreDisplayed(): Promise<void> {
await this.checkAcsContainer();
await this.waitForTableBody();
}
// @deprecated prefer waitTillContentLoaded
async checkAcsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.uploadBorder);
}
// @deprecated prefer waitTillContentLoaded
async waitForTableBody(): Promise<void> {
await this.contentList.dataTablePage().waitTillContentLoaded();
}
async goToDocumentList(): Promise<void> {
const navigationBarPage = new NavigationBarPage();
await navigationBarPage.navigateToContentServices();
await this.contentList.dataTablePage().waitTillContentLoaded();
}
async numberOfResultsDisplayed(): Promise<number> {
return this.contentList.dataTablePage().numberOfRows();
}
async currentFolderName(): Promise<string> {
return BrowserActions.getText(this.currentFolder);
}
async getAllRowsNameColumn(): Promise<any> {
return this.contentList.getAllRowsColumnValues(this.columns.name);
}
async sortByName(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.nameColumnHeader);
}
async sortByAuthor(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdByColumnHeader);
}
async sortByCreated(sortOrder: string): Promise<any> {
await this.contentList.dataTable.sortByColumn(sortOrder, this.createdColumnHeader);
}
async sortAndCheckListIsOrderedByName(sortOrder: string): Promise<any> {
await this.sortByName(sortOrder);
return this.checkListIsSortedByNameColumn(sortOrder);
}
async checkListIsSortedByNameColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.name);
}
async checkListIsSortedByCreatedColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.created);
}
async checkListIsSortedByAuthorColumn(sortOrder: string): Promise<any> {
return this.contentList.dataTablePage().checkListIsSorted(sortOrder, this.columns.createdBy);
}
async sortAndCheckListIsOrderedByAuthor(sortOrder: string): Promise<any> {
await this.sortByAuthor(sortOrder);
return this.checkListIsSortedByAuthorColumn(sortOrder);
}
async sortAndCheckListIsOrderedByCreated(sortOrder: string): Promise<any> {
await this.sortByCreated(sortOrder);
return this.checkListIsSortedByCreatedColumn(sortOrder);
}
async doubleClickRow(nodeName: string): Promise<void> {
Logger.log(`Open Folder/File ${nodeName}`);
await this.contentList.doubleClickRow(nodeName);
}
async selectRow(nodeName: string): Promise<void> {
await this.contentList.selectRow(nodeName);
}
async clickOnCreateNewFolder(): Promise<void> {
await BrowserActions.click(this.createFolderButton);
}
async createNewFolder(folderName: string): Promise<void> {
await this.clickOnCreateNewFolder();
await this.createFolderDialog.addFolderName(folderName);
await this.createFolderDialog.clickOnCreateUpdateButton();
}
async createAndOpenNewFolder(folderName: string): Promise<void> {
await this.createNewFolder(folderName);
await this.checkContentIsDisplayed(folderName);
await this.openFolder(folderName);
}
async openFolder(folderName: string): Promise<void> {
await this.doubleClickRow(folderName);
await this.contentList.dataTablePage().waitTillContentLoaded();
}
async checkContentIsDisplayed(content: string): Promise<void> {
await this.contentList.dataTablePage().checkContentIsDisplayed(this.columns.name, content);
}
async checkContentsAreDisplayed(content: string[]): Promise<void> {
for (const item of content) {
await this.checkContentIsDisplayed(item);
}
}
async checkContentIsNotDisplayed(content: string): Promise<void> {
await this.contentList.dataTablePage().checkContentIsNotDisplayed(this.columns.name, content);
}
async deleteAndCheckFolderNotDisplayed(folderName: string): Promise<void> {
await this.deleteContent(folderName);
await this.checkContentIsNotDisplayed(folderName);
}
async deleteSubFolderUnderRoot(folderName: string, subFolderName: string): Promise<void> {
await this.goToDocumentList();
await this.openFolder(folderName);
await this.deleteAndCheckFolderNotDisplayed(subFolderName);
}
async uploadFile(fileLocation: string): Promise<void> {
await this.checkUploadButton();
await this.uploadFileButtonInput.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
await this.checkUploadButton();
}
async uploadMultipleFile(files: string[]): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
let allFiles = path.resolve(path.join(browser.params.testConfig.main.rootPath, files[0]));
for (let i = 1; i < files.length; i++) {
allFiles = allFiles + '\n' + path.resolve(path.join(browser.params.testConfig.main.rootPath, files[i]));
}
await this.uploadMultipleFileButton.sendKeys(allFiles);
await BrowserVisibility.waitUntilElementIsPresent(this.uploadMultipleFileButton);
}
async uploadFolder(folderLocation: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.uploadFolderButton);
await this.uploadFolderButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, folderLocation)));
}
async checkUploadButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
}
async checkPaginationIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
}
async getDocumentListRowNumber(): Promise<number> {
const documentList = $('adf-upload-drag-area adf-document-list');
await BrowserVisibility.waitUntilElementIsVisible(documentList);
return $$('adf-upload-drag-area adf-document-list .adf-datatable-row').count();
}
async checkColumnNameHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.nameHeader);
}
async checkColumnSizeHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.sizeHeader);
}
async checkColumnCreatedByHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdByHeader);
}
async checkColumnCreatedHeader(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.createdHeader);
}
async checkDragAndDropDIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dragAndDrop);
}
async dragAndDropFile(file: string): Promise<void> {
await this.checkDragAndDropDIsDisplayed();
await DropActions.dropFile(this.dragAndDrop, file);
}
async checkLockIsDisplayedForElement(name: string): Promise<void> {
const lockButton = $(`div.adf-datatable-cell[data-automation-id="${name}"] button`);
await BrowserVisibility.waitUntilElementIsVisible(lockButton);
}
async getColumnValueForRow(file: string, columnName: string): Promise<string> {
return this.contentList.dataTablePage().getColumnValueForRow(this.columns.name, file, columnName);
}
async checkEmptyFolderTextToBe(text: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyFolder);
expect(await this.emptyFolder.getText()).toContain(text);
}
async checkEmptyFolderImageUrlToContain(url): Promise<void> {
expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
}
async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
const elementSize = $(
`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`
);
return BrowserActions.getText(elementSize);
}
async clickDownloadButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.downloadButton);
}
async clickMultiSelectToggle() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.multiSelectToggle);
}
async selectFolder(folderName: string): Promise<void> {
const folderSelected = $(`div[data-automation-id="${folderName}"] .adf-datatable-center-img-ie`);
await BrowserVisibility.waitUntilElementIsVisible(folderSelected);
await BrowserActions.click(folderSelected);
}
async selectFolderWithCommandKey(folderName: string): Promise<void> {
await browser.actions().sendKeys(protractor.Key.COMMAND).perform();
await this.selectRow(folderName);
await browser.actions().sendKeys(protractor.Key.NULL).perform();
}
async chooseSelectionMode(option: string): Promise<void> {
const dropdownPage = new DropdownPage(this.selectionModeDropdown);
await dropdownPage.selectDropdownOption(option);
}
}

View File

@@ -1,34 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { $$ } from 'protractor';
import { BrowserActions } from '@alfresco/adf-testing';
export class FolderDialogPage {
folderDialog = $$('adf-folder-dialog').first();
folderNameField = this.folderDialog.$('#adf-folder-name-input');
createUpdateButton = this.folderDialog.$('#adf-folder-create-button');
cancelButton = this.folderDialog.$('#adf-folder-cancel-button');
async clickOnCreateUpdateButton(): Promise<void> {
await BrowserActions.click(this.createUpdateButton);
}
async addFolderName(folderName: string): Promise<void> {
await BrowserActions.clearSendKeys(this.folderNameField, folderName);
}
}

View File

@@ -1,80 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { $ } from 'protractor';
import { BrowserActions, BrowserVisibility, TogglePage } from '@alfresco/adf-testing';
export class UploadTogglesPage {
togglePage = new TogglePage();
multipleFileUploadToggle = $('#adf-multiple-upload-switch');
uploadFolderToggle = $('#adf-folder-upload-switch');
extensionFilterToggle = $('#adf-extension-filter-upload-switch');
maxSizeToggle = $('#adf-max-size-filter-upload-switch');
versioningToggle = $('#adf-version-upload-switch');
extensionAcceptedField = $('[data-automation-id="accepted-files-type"]');
maxSizeField = $('[data-automation-id="max-files-size"]');
async enableMultipleFileUpload(): Promise<void> {
await this.togglePage.enableToggle(this.multipleFileUploadToggle);
}
async disableMultipleFileUpload(): Promise<void> {
await this.togglePage.disableToggle(this.multipleFileUploadToggle);
}
async enableFolderUpload(): Promise<void> {
await this.togglePage.enableToggle(this.uploadFolderToggle);
}
async enableExtensionFilter(): Promise<void> {
await this.togglePage.enableToggle(this.extensionFilterToggle);
}
async disableExtensionFilter(): Promise<void> {
await this.togglePage.disableToggle(this.extensionFilterToggle);
}
async enableMaxSize(): Promise<void> {
await this.togglePage.enableToggle(this.maxSizeToggle);
}
async disableMaxSize(): Promise<void> {
await this.togglePage.disableToggle(this.maxSizeToggle);
}
async enableVersioning(): Promise<void> {
await this.togglePage.enableToggle(this.versioningToggle);
}
async disableVersioning(): Promise<void> {
await this.togglePage.disableToggle(this.versioningToggle);
}
async addExtension(extension: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
await this.extensionAcceptedField.sendKeys(',' + extension);
}
async addMaxSize(size): Promise<void> {
await this.clearText();
await this.maxSizeField.sendKeys(size);
}
async clearText(): Promise<void> {
await BrowserActions.clearSendKeys(this.maxSizeField, '');
}
}

View File

@@ -1,43 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { $ } from 'protractor';
import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';
export class LoginShellPage {
private txtUsername = $('input[id="username"]');
private txtPassword = $('input[id="password"]');
private signInButton = $('#login-button');
sidenavLayout = $(`[data-automation-id="sidenav-layout"]`);
async waitForElements(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.txtUsername);
await BrowserVisibility.waitUntilElementIsVisible(this.txtPassword);
}
async enterUsername(username: string): Promise<void> {
await BrowserActions.clearSendKeys(this.txtUsername, username);
}
async enterPassword(password: string): Promise<void> {
await BrowserActions.clearSendKeys(this.txtPassword, password);
}
async clickSignInButton(): Promise<void> {
await BrowserActions.click(this.signInButton);
}
}

View File

@@ -1,281 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, Key, protractor, ElementFinder } from 'protractor';
import { BrowserActions, BrowserVisibility, DropdownPage, TestElement, Logger, materialLocators } from '@alfresco/adf-testing';
export class MetadataViewPage {
title = $(`div[info-drawer-title]`);
expandedAspect = $(`${materialLocators.Expansion.panel.header.root}[aria-expanded='true']`);
aspectTitle = materialLocators.Panel.title;
name = $(`[data-automation-id='card-textitem-value-properties.cm:name']`);
creator = $(`[data-automation-id='card-textitem-value-createdByUser.displayName']`);
createdDate = $(`span[data-automation-id='card-dateitem-createdAt']`);
modifier = $(`[data-automation-id='card-textitem-value-modifiedByUser.displayName']`);
modifiedDate = $(`span[data-automation-id='card-dateitem-modifiedAt']`);
mimetypeName = $(`[data-automation-id='card-textitem-value-content.mimeTypeName']`);
size = $(`[data-automation-id='card-textitem-value-content.sizeInBytes']`);
description = $(`span[data-automation-id='card-textitem-value-properties.cm:description']`);
author = $(`[data-automation-id='card-textitem-value-properties.cm:author']`);
editIcon = $(`button[data-automation-id='meta-data-card-toggle-edit']`);
editIconGeneral = $(`button[data-automation-id='meta-data-general-info-edit']`);
displayEmptySwitch = $(`#adf-metadata-empty`);
readonlySwitch = $(`#adf-metadata-readonly`);
multiSwitch = $(`#adf-metadata-multi`);
defaultPropertiesSwitch = $('#adf-metadata-default-properties');
closeButton = element(by.cssContainingText(`button${materialLocators.Button.class} span`, 'Close'));
displayAspect = $(`input[placeholder='Display Aspect']`);
applyAspect = element(by.cssContainingText(`button span${materialLocators.Button.label}`, 'Apply Aspect'));
saveMetadataButton = $(`[data-automation-id='save-metadata']`);
saveGeneralMetadataButton = $(`[data-automation-id='save-general-info-metadata']`);
resetMetadataButton = $(`[data-automation-id='reset-metadata']`);
informationButton = $(`button[data-automation-id='meta-data-card-toggle-expand']`);
private getMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`[data-automation-id="adf-metadata-group-${groupName}"]`);
private getMetadataGroupEditIconLocator = async (groupName: string): Promise<ElementFinder> =>
$(`[data-automation-id="adf-metadata-group-${groupName}"]`).$(this.editIcon.locator().value);
private getExpandedMetadataGroupLocator = async (groupName: string): Promise<ElementFinder> =>
$(`[data-automation-id="adf-metadata-group-${groupName}"] > ${materialLocators.Expansion.panel.header.root}`);
async getTitle(): Promise<string> {
return BrowserActions.getText(this.title);
}
async getExpandedAspectName(): Promise<string> {
return BrowserActions.getText(this.expandedAspect.$(this.aspectTitle));
}
async getName(): Promise<string> {
return BrowserActions.getInputValue(this.name);
}
async getCreator(): Promise<string> {
return BrowserActions.getInputValue(this.creator);
}
async getCreatedDate(): Promise<string> {
return BrowserActions.getText(this.createdDate);
}
async getModifier(): Promise<string> {
return BrowserActions.getInputValue(this.modifier);
}
async getModifiedDate(): Promise<string> {
return BrowserActions.getText(this.modifiedDate);
}
async getMimetypeName(): Promise<string> {
return BrowserActions.getInputValue(this.mimetypeName);
}
async getSize(): Promise<string> {
return BrowserActions.getInputValue(this.size);
}
async getDescription(): Promise<string> {
return BrowserActions.getInputValue(this.description);
}
async getAuthor(): Promise<string> {
return BrowserActions.getInputValue(this.author);
}
async editIconIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editIcon);
}
async editIconIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editIcon);
}
async isEditGeneralIconDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editIconGeneral);
}
async clickEditIconGeneral(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.editIconGeneral);
await BrowserActions.click(this.editIconGeneral);
}
async clickOnPropertiesTab(): Promise<void> {
const propertiesTab = element(by.cssContainingText(`.adf-info-drawer-layout-content ${materialLocators.Tab.labels.class}`, `Properties`));
await BrowserActions.click(propertiesTab);
}
async getEditIconTooltip(): Promise<string> {
return BrowserActions.getAttribute(this.editIcon, 'title');
}
async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]');
await BrowserActions.clearSendKeys(textField, text.toString());
await textField.sendKeys(protractor.Key.ENTER);
}
async enterDescriptionText(text: string): Promise<void> {
const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]');
await BrowserActions.clearSendKeys(textField, text);
await textField.sendKeys(Key.TAB);
}
async getPropertyText(propertyName: string, type?: string): Promise<string> {
const propertyType = type || 'textitem';
const textField = $('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]');
return BrowserActions.getInputValue(textField);
}
async clickMetadataGroup(groupName: string): Promise<void> {
const group = await this.getMetadataGroupLocator(groupName);
await BrowserActions.click(group);
}
async clickMetadataGroupEditIcon(groupName: string): Promise<void> {
const group = await this.getMetadataGroupEditIconLocator(groupName);
await BrowserActions.click(group);
}
async checkMetadataGroupIsPresent(groupName: string): Promise<void> {
const group = await this.getMetadataGroupLocator(groupName);
await BrowserVisibility.waitUntilElementIsVisible(group);
}
async checkMetadataGroupIsNotPresent(groupName: string): Promise<void> {
const group = await this.getMetadataGroupLocator(groupName);
await BrowserVisibility.waitUntilElementIsNotVisible(group);
}
async checkMetadataGroupIsExpand(groupName: string): Promise<void> {
const group = await this.getExpandedMetadataGroupLocator(groupName);
expect(await BrowserActions.getAttribute(group, 'class')).toContain(materialLocators.Expanded.root);
}
async checkMetadataGroupIsNotExpand(groupName: string): Promise<void> {
const group = await this.getExpandedMetadataGroupLocator(groupName);
expect(await BrowserActions.getAttribute(group, 'class')).not.toContain(materialLocators.Expanded.root);
}
async checkPropertyIsVisible(propertyName: string, type: string): Promise<void> {
const property = $('[data-automation-id="card-' + type + '-label-' + propertyName + '"]');
await BrowserVisibility.waitUntilElementIsVisible(property);
}
async hasContentType(contentType: string, attempt = 0, maxAttempt = 3): Promise<boolean> {
const contentTypeSelector = '[data-automation-id="select-readonly-value-nodeType"]';
const type = TestElement.byText(contentTypeSelector, contentType);
try {
if (attempt > maxAttempt) {
return false;
}
await type.waitVisible();
const isPresent = await type.isPresent();
if (isPresent) {
return true;
}
return this.hasContentType(contentType, attempt + 1, maxAttempt);
} catch (e) {
Logger.log(`re trying content type attempt :: ${attempt}`);
return this.hasContentType(contentType, attempt + 1, maxAttempt);
}
}
async checkPropertyDisplayed(propertyName: string, type?: string, attempt = 0, maxAttempt = 3): Promise<string> {
try {
if (attempt > maxAttempt) {
return '';
}
const propertyType = type || 'textitem';
await TestElement.byCss('[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]').waitVisible();
return this.getPropertyText(propertyName);
} catch (e) {
Logger.log(`re trying custom property attempt :: ${attempt}`);
return this.checkPropertyDisplayed(propertyName, type, attempt + 1, maxAttempt);
}
}
async changeContentType(option: string, attempt = 0, maxAttempt = 3): Promise<boolean> {
const nodeType = TestElement.byCss(`div[data-automation-id="header-nodeType"] ${materialLocators.Select.trigger}`);
if (attempt > maxAttempt) {
Logger.error(`content type select option not found. check acs version may be lesser than 7.0.0`);
return false;
}
try {
await nodeType.waitVisible();
if (await nodeType.isPresent()) {
await nodeType.click();
const typesDropDownPage = new DropdownPage(nodeType.elementFinder);
await typesDropDownPage.checkOptionIsDisplayed(option);
await typesDropDownPage.selectOption(option);
return true;
}
return this.changeContentType(option, attempt + 1, maxAttempt);
} catch (error) {
Logger.log(`re trying content type options attempt :: ${attempt}`);
await BrowserActions.closeMenuAndDialogs();
return this.changeContentType(option, attempt + 1, maxAttempt);
}
}
async checkConfirmDialogDisplayed(): Promise<void> {
const confirmButton = TestElement.byCss('adf-content-type-dialog');
await confirmButton.waitPresent();
}
async applyNodeProperties(): Promise<void> {
const confirmButton = TestElement.byId('content-type-dialog-apply-button');
await confirmButton.click();
}
async cancelNodeProperties(): Promise<void> {
const cancelButton = TestElement.byId('content-type-dialog-actions-cancel');
await cancelButton.click();
}
async checkPropertyIsNotVisible(propertyName: string, type: string): Promise<void> {
await TestElement.byCss('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]').waitNotVisible();
}
async typeAspectName(aspectName): Promise<void> {
await BrowserActions.clearSendKeys(this.displayAspect, aspectName);
}
async clickApplyAspect(): Promise<void> {
await BrowserActions.click(this.applyAspect);
}
async clickSaveMetadata(): Promise<void> {
await BrowserActions.click(this.saveMetadataButton);
}
async clickResetMetadata(): Promise<void> {
await BrowserActions.click(this.resetMetadataButton);
}
async clickSaveGeneralMetadata(): Promise<void> {
await BrowserActions.click(this.saveGeneralMetadataButton);
}
async informationButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.informationButton);
}
async informationButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.informationButton);
}
}

View File

@@ -1,112 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { AppListCloudPage, BrowserActions, BrowserVisibility, Logger } from '@alfresco/adf-testing';
import { $, browser, ElementFinder } from 'protractor';
import { ProcessServicesPage } from '../../process-services/pages/process-services.page';
export class NavigationBarPage {
linkMenuChildrenContainer = $('.nestedMenu');
processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]');
processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]');
formButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Form"]');
logoutSection = $('[data-automation-id="adf-logout-section"]');
personalFiles = $('div [title="Personal Files"]');
getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`);
async clickNavigationBarItem(title: string, untilElementIsVisible?: ElementFinder): Promise<void> {
Logger.log(`clickNavigationBarItem ${title}`);
const menu = $(`.app-sidenav-link[data-automation-id="${title}"]`);
await BrowserActions.closeMenuAndDialogs();
if (untilElementIsVisible) {
await BrowserActions.clickUntilIsNotVisible(menu, untilElementIsVisible);
} else {
await BrowserActions.click(menu);
}
}
async clickHomeButton(): Promise<void> {
await this.clickNavigationBarItem('Home');
}
async navigateToContentServices(): Promise<void> {
await this.clickNavigationBarItem('Content Services', this.personalFiles);
}
async clickTaskListButton(): Promise<void> {
await this.clickNavigationBarItem('Task List');
}
async clickProcessCloudButton() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Cloud'), this.linkMenuChildrenContainer);
}
async navigateToProcessServicesCloudPage(): Promise<AppListCloudPage> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.processServicesCloudHomeButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new AppListCloudPage();
}
async navigateToFormCloudPage(): Promise<void> {
await this.clickProcessCloudButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
private async clickProcessServicesButton() {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickUntilIsNotVisible(this.getMenuItemLocator('Process Services'), this.linkMenuChildrenContainer);
}
async navigateToProcessServicesPage(): Promise<ProcessServicesPage> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.processServicesNestedButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
return new ProcessServicesPage();
}
async navigateToProcessServicesFormPage(): Promise<void> {
await this.clickProcessServicesButton();
await BrowserActions.click(this.formButton);
await BrowserVisibility.waitUntilElementIsNotPresent(this.linkMenuChildrenContainer);
}
async clickLogoutButton(): Promise<void> {
Logger.log('Logout');
try {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.clickExecuteScript('.app-sidenav-link[adf-logout]');
await BrowserVisibility.waitUntilElementIsPresent(this.logoutSection);
} catch (error) {
Logger.log('Logout section NOT found');
}
}
async openContentServicesFolder(folderId): Promise<void> {
await BrowserActions.getUrl(`${browser.baseUrl}/files/${folderId}`);
}
async goToSite(site): Promise<void> {
await BrowserActions.getUrl(browser.baseUrl + `/files/${site.entry.guid}/display/list`);
}
}

View File

@@ -1,149 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
ArrayUtil,
LoginPage,
PaginationPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { NodeEntry } from '@alfresco/js-api';
import { browser } from 'protractor';
import { FileModel } from '../models/ACS/file.model';
import { FolderModel } from '../models/ACS/folder.model';
import { ContentServicesPage } from './pages/content-services.page';
describe('Pagination - returns to previous page when current is empty', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const paginationPage = new PaginationPage();
const viewerPage = new ViewerPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const acsUser = new UserModel();
const folderModel = new FolderModel({ name: 'folderOne' });
const parentFolderModel = new FolderModel({ name: 'parentFolder' });
let fileNames = [];
const nrOfFiles = 6;
const nrOfFolders = 5;
const lastFile = 'newFile6.txt';
let lastFolderResponse: NodeEntry;
let pngFileUploaded: any;
const folderNames = ['t1', 't2', 't3', 't4', 't5', 't6'];
const itemsPerPage = {
five: '5',
fiveValue: 5
};
const files = {
base: 'newFile',
extension: '.txt'
};
const pngFileInfo = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
beforeAll(async () => {
const uploadActions = new UploadActions(apiService);
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
fileNames = StringUtil.generateFilesNames(1, nrOfFiles, files.base, files.extension);
await apiService.login(acsUser.username, acsUser.password);
const folderUploadedModel = await uploadActions.createFolder(folderModel.name, '-my-');
const parentFolderResponse = await uploadActions.createFolder(parentFolderModel.name, '-my-');
for (let i = 0; i < nrOfFolders; i++) {
await uploadActions.createFolder(folderNames[i], parentFolderResponse.entry.id);
}
await uploadActions.createEmptyFiles(fileNames, folderUploadedModel.entry.id);
lastFolderResponse = await uploadActions.createFolder(folderNames[5], parentFolderResponse.entry.id);
pngFileUploaded = await uploadActions.uploadFile(pngFileInfo.location, pngFileInfo.name, lastFolderResponse.entry.id);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
it('[C274710] Should redirect to previous page when current is emptied', async () => {
await contentServicesPage.openFolder(folderModel.name);
await paginationPage.selectItemsPerPage(itemsPerPage.five);
await contentServicesPage.checkDocumentListElementsAreDisplayed();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
let list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
await paginationPage.clickOnNextPage();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(5, 6))).toEqual(true);
await contentServicesPage.deleteContent(lastFile);
await contentServicesPage.checkContentIsNotDisplayed(lastFile);
expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
list = await contentServicesPage.getAllRowsNameColumn();
expect(ArrayUtil.arrayContainsArray(list, fileNames.slice(0, 5))).toEqual(true);
});
it('[C297494] Should display content when navigating to a non-empty folder not in the first page', async () => {
await contentServicesPage.goToDocumentList();
await contentServicesPage.openFolder(parentFolderModel.name);
await paginationPage.selectItemsPerPage(itemsPerPage.five);
await contentServicesPage.checkDocumentListElementsAreDisplayed();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
expect(await paginationPage.getCurrentItemsPerPage()).toEqual(itemsPerPage.five);
expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(itemsPerPage.fiveValue);
await paginationPage.clickOnNextPage();
await contentServicesPage.checkDocumentListElementsAreDisplayed();
await contentServicesPage.openFolder(lastFolderResponse.entry.name);
await contentServicesPage.checkContentIsDisplayed(pngFileInfo.name);
await viewerPage.viewFile(pngFileUploaded.entry.name);
await viewerPage.checkImgViewerIsDisplayed();
await viewerPage.clickCloseButton();
});
});

View File

@@ -1,18 +0,0 @@
let fallback = require('connect-history-api-fallback');
module.exports = {
injectChanges: false, // workaround for Angular 2 styleUrls loading
files: ['./**/*.{html,htm,css,js}'],
watchOptions: {
ignoreInitial: true,
ignored: '*'
},
ghostMode : false,
'port': 4200,
open: false,
server: {
middleware: {
1: fallback({index: '/index.html', verbose: true})
}
}
};

View File

@@ -1,49 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var ContentModel = function (details) {
this.mimeType = '';
this.mimeTypeName = '';
this.sizeInBytes = '';
this.encoding = '';
this.getMimeType = function () {
return this.mimeType;
};
this.getMimeTypeName = function () {
return this.mimeTypeName;
};
this.getSizeInBytes = function () {
if (this.sizeInBytes >= 1024) {
return (this.sizeInBytes / 1024).toFixed(2) + ' KB';
}
else {
return this.sizeInBytes;
}
};
this.getEncoding = function () {
return this.encoding;
};
Object.assign(this, details);
};
module.exports = ContentModel;

View File

@@ -1,38 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var ContentPropertiesModel = function (details) {
this['cm:author'] = '';
this['cm:description'] = '';
this['cm:title'] = '';
this.getAuthor = function () {
return this['cm:author'];
};
this.getDescription = function () {
return this['cm:description'];
};
this.getTitle = function () {
return this['cm:title'];
};
Object.assign(this, details);
};
module.exports = ContentPropertiesModel;

View File

@@ -1,36 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { StringUtil } from '@alfresco/adf-testing';
export class CreatedByModel {
displayName = StringUtil.generateRandomString();
id = StringUtil.generateRandomString();
constructor(details?: any) {
Object.assign(this, details);
}
getId() {
return this.id;
}
getDisplayName() {
return this.displayName;
}
}

View File

@@ -1,117 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 ContentModel = require('./contentModel');
import ContentPropertiesModel = require('./contentProperties');
import { CreatedByModel } from './created-by-model';
import { StringUtil } from '@alfresco/adf-testing';
export class FileModel {
id = StringUtil.generateRandomString();
name = StringUtil.generateRandomString();
shortName = this.name;
location = browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path;
tooltip = this.name;
version = '';
firstPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.first_page_text;
lastPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_text;
secondPageText = browser.params.resources.Files.ADF_DOCUMENTS.PDF.second_page_text;
lastPageNumber = browser.params.resources.Files.ADF_DOCUMENTS.PDF.last_page_number;
createdAt: Date = null;
password = '';
createdByUser = new CreatedByModel();
modifiedByUser = new CreatedByModel();
content: ContentModel = {};
properties: ContentPropertiesModel = {};
constructor(details?: any) {
Object.assign(this, details);
}
getName() {
return this.name;
}
setVersion(ver) {
this.version = '-' + ver;
}
getVersionName() {
const extension = this.name.split('.')[1];
const name = this.name.split('.')[0];
return name + this.version + '.' + extension;
}
getShortName() {
return this.shortName;
}
getLocation() {
return this.location;
}
getTooltip() {
return this.tooltip;
}
getId() {
return this.id;
}
getFirstPageText() {
return this.firstPageText;
}
getLastPageText() {
return this.lastPageText;
}
getSecondPageText() {
return this.secondPageText;
}
getLastPageNumber() {
return this.lastPageNumber;
}
getCreatedByUser(): CreatedByModel {
return this.createdByUser;
}
getModifiedByUser(): CreatedByModel {
return this.modifiedByUser;
}
getContent(): ContentModel {
return this.content;
}
getProperties(): ContentPropertiesModel {
return this.properties;
}
update(details) {
Object.assign(this, {
createdByUser: new CreatedByModel(details.createdByUser),
modifiedByUser: new CreatedByModel(details.modifiedByUser),
content: new ContentModel(details.content),
properties: new ContentPropertiesModel(details.properties)
});
}
}

View File

@@ -1,53 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { StringUtil } from '@alfresco/adf-testing';
export class FolderModel {
id = StringUtil.generateRandomString();
name = StringUtil.generateRandomString();
shortName = this.name;
tooltip = this.name;
location = '';
description = '';
constructor(details?: any) {
Object.assign(this, details);
}
getName() {
return this.name;
}
getShortName() {
return this.shortName;
}
getTooltip() {
return this.tooltip;
}
getId() {
return this.id;
}
getLocation() {
return this.location;
}
}

View File

@@ -1,31 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
/**
* App definition publish representation JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var AppPublish = function (details) {
this.comment = '';
this.force = true;
Object.assign(this, details);
};
module.exports = AppPublish;

View File

@@ -1,56 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var FormDefinitionFieldModel = function (details) {
this.fieldType = undefined;
this.id = undefined;
this.name = undefined;
this.value = undefined;
this.type = undefined;
this.required = undefined;
this.readOnly = undefined;
this.overrideId = undefined;
this.colspan = undefined;
this.placeholder = undefined;
this.minLength = undefined;
this.maxLength = undefined;
this.minValue = undefined;
this.maxValue = undefined;
this.regexPattern = undefined;
this.optionType = undefined;
this.hasEmptyValue = undefined;
this.options = undefined;
this.restUrl = undefined;
this.restResponsePath = undefined;
this.restIdProperty = undefined;
this.setRestLabelProperty = undefined;
this.tab = undefined;
this.className = undefined;
this.dateDisplayFormat = undefined;
this.layout = {};
this.sizeX = undefined;
this.sizeY = undefined;
this.row = undefined;
this.col = undefined;
this.columnDefinitions = undefined;
this.visibilityCondition = undefined;
this.numberOfColumns = undefined;
this.fields = {};
Object.assign(this, details);
};
module.exports = FormDefinitionFieldModel;

View File

@@ -1,61 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var FormDefinitionFieldModel = require('./FormDefinitionFieldModel');
var FormDefinitionModel = function (fields) {
var fields = null;
var widgets = null;
this.setFields = function (arr) {
fields = arr.map(function(item) {
return new FormDefinitionFieldModel(item);
})
};
this.setAllWidgets = function (arr) {
widgets = arr.reduce(function(acc, item) {
if(item.type === 'container') {
var children = Object.keys(item.fields).map(function(key) {
return item.fields[key][0];
});
return acc.concat(children);
}
return acc.concat(item);
}, []);
};
this.getWidgets = function () {
return widgets;
};
this.getWidgetBy = function (key, value) {
return widgets.find(function(widget) {
return widget[key]===value;
})
};
this.findFieldBy = function(key, value) {
return fields.find(function(field) {
return field[key]===value;
})
};
};
module.exports = FormDefinitionModel;

View File

@@ -1,57 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var FormModel = function (details) {
this.id = undefined;
this.name = undefined;
this.description = undefined;
this.modelId = undefined;
this.appDefinitionId = undefined;
this.appDeploymentId = undefined;
this.tenantId = undefined;
this.getName = function () {
return this.name;
};
this.getId = function () {
return this.id;
};
this.getDescription = function () {
return this.description;
};
this.getModelId = function () {
return this.modelId;
};
this.getAppDefinitionId = function () {
return this.appDefinitionId;
};
this.getAppDeploymentId = function () {
return this.appDeploymentId;
};
this.getTenantId = function () {
return this.tenantId;
};
Object.assign(this, details);
};
module.exports = FormModel;

View File

@@ -1,31 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
/**
* Create and manage task JSON Object
*
* @param details - JSON object used to overwrite the default values
* @constructor
*/
var Task = function (details) {
this.processInstanceId = undefined;
this.sort = undefined;
Object.assign(this, details);
};
module.exports = Task;

View File

@@ -1,47 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var TaskAssigneeModel = function (details) {
this.id = undefined;
this.firstName = undefined;
this.lastName = undefined;
this.email = undefined;
this.getFirstName = function () {
return this.firstName;
};
this.getId = function () {
return this.id;
};
this.getLastName = function () {
return this.lastName;
};
this.getEmail = function () {
return this.email;
};
this.getEntireName = function () {
return this.firstName + ' ' + this.getLastName();
};
Object.assign(this, details);
};
module.exports = TaskAssigneeModel;

View File

@@ -1,90 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
var TaskAssigneeModel = require('./TaskAssigneeModel');
var TaskModel = function (details) {
this.id = undefined;
this.name = undefined;
this.description = undefined;
this.category = undefined;
this.created = undefined;
this.dueDate = undefined;
this.priority = undefined;
this.parentTaskName = undefined;
this.parentTaskId = undefined;
this.formKey = undefined;
this.duration = undefined;
this.endDate = undefined;
this.assignee = {};
this.getName = function () {
return this.name;
};
this.getId = function () {
return this.id;
};
this.getDescription = function () {
return this.description;
};
this.getCategory = function () {
return this.category;
};
this.getCreated = function () {
return this.created;
};
this.getDueDate = function () {
return this.dueDate;
};
this.getPriority = function () {
return this.priority;
};
this.getDuration = function () {
return this.duration;
};
this.getEndDate = function () {
return this.endDate;
};
this.getParentTaskName = function () {
return this.parentTaskName;
};
this.getParentTaskId = function () {
return this.parentTaskId;
};
this.getFormKey = function () {
return this.formKey;
};
this.getAssignee = function () {
return this.assignee;
};
Object.assign(this, details);
Object.assign(this.assignee, new TaskAssigneeModel(details.assignee));
};
module.exports = TaskModel;

View File

@@ -1,55 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export class EditProcessFilterConfiguration {
getConfiguration() {
return {
filterProperties:
[
'appName',
'status',
'sort',
'order',
'processName',
'lastModified',
'processInstanceId',
'initiator',
'processDefinitionId',
'processDefinitionKey'
],
sortProperties:
[
'id',
'name',
'status',
'initiator',
'processDefinitionId',
'processDefinitionKey',
'lastModified',
'startDate',
'businessKey'
],
actions:
[
'save',
'saveAs',
'delete'
]
};
}
}

View File

@@ -1,89 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export class ProcessListCloudConfiguration {
getConfiguration() {
return {
presets: {
default: [
{
key: 'id',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID',
sortable: true
},
{
key: 'name',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME',
sortable: true
},
{
key: 'status',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS',
sortable: true
},
{
key: 'startDate',
type: 'date',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
sortable: true,
format: 'timeAgo'
},
{
key: 'appName',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME',
sortable: true
},
{
key: 'businessKey',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY',
sortable: true
},
{
key: 'initiator',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STARTED_BY',
sortable: true
},
{
key: 'lastModified',
type: 'date',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED',
sortable: true
},
{
key: 'processDefinitionId',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_ID',
sortable: true
},
{
key: 'processDefinitionKey',
type: 'text',
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_KEY',
sortable: true
}
]
}
};
}
}

View File

@@ -1,39 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export class StartProcessCloudConfiguration {
getConfiguration() {
return {
name: 'processwithstarteventform',
values: [
{
name: 'FirstName',
value: 'sample name'
},
{
name: 'Number07vyx9',
value: 17
}
],
variable: {
mykey1: 'myvalue',
mykey2: 'myvalue2'
}
};
}
}

View File

@@ -1,53 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export const taskFilterConfiguration = {
filterProperties: [
'taskId',
'appName',
'status',
'assignee',
'taskName',
'parentTaskId',
'priority',
'standalone',
'owner',
'processDefinitionId',
'processInstanceId',
'lastModified',
'sort',
'order'
],
sortProperties: [
'id',
'name',
'createdDate',
'priority',
'processDefinitionId',
'processInstanceId',
'parentTaskId',
'priority',
'standalone',
'owner',
'assignee'
],
actions: [
'save',
'saveAs',
'delete'
]
};

View File

@@ -1,114 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export class TaskListCloudConfiguration {
constructor() {
}
getConfiguration() {
return {
presets: {
default: [
{
key: 'id',
type: 'text',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.ID',
sortable: true
},
{
key: 'name',
type: 'text',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.NAME',
sortable: true,
cssClass: 'full-width name-column ellipsis-cell'
},
{
key: 'processDefinitionId',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_ID',
sortable: true,
cssClass: 'full-width name-column ellipsis-cell'
},
{
key: 'processInstanceId',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
sortable: true,
cssClass: 'full-width name-column ellipsis-cell'
},
{
key: 'status',
type: 'text',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.STATUS',
sortable: true
},
{
key: 'priority',
type: 'text',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY',
sortable: true
},
{
key: 'createdDate',
type: 'date',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED_DATE',
sortable: true,
format: 'timeAgo'
},
{
key: 'lastModified',
type: 'date',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.LAST_MODIFIED',
sortable: true,
format: 'timeAgo'
},
{
key: 'assignee',
type: 'text',
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.ASSIGNEE',
sortable: true
},
{
key: 'parentTaskId',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PARENT_TASK_ID',
sortable: true
},
{
key: 'priority',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PRIORITY',
sortable: true
},
{
key: 'standalone',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',
sortable: true
},
{
key: 'owner',
type: 'text',
title: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.OWNER',
sortable: true
}
]
}
};
}
}

View File

@@ -1,241 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
ProcessCloudWidgetPage,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
TaskFormCloudComponent,
TaskHeaderCloudPage,
TasksService,
SnackbarPage,
materialLocators
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Form Field Component - Dropdown Widget', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskFormCloudComponent = new TaskFormCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const widget = new ProcessCloudWidgetPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
const tasksService = new TasksService(apiService);
const dropdown = widget.dropdown();
let testUser: { idIdentityService: string; username: string; password: string };
const runningTasks = {};
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
beforeAll(async () => {
const { processes } = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP;
let runningProcessInstance: Record<string, any>;
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const processesData = ['dropdownOptionsProcess', 'multiselect-dropdown', 'dropdown-search'];
for (const process of processesData) {
const processDef = await processDefinitionService.getProcessDefinitionByName(processes[process], simpleApp);
await processInstancesService.createProcessInstance(processDef.entry.key, simpleApp);
runningProcessInstance = await processInstancesService.createProcessInstance(processDef.entry.key, simpleApp);
const tasklist = await queryService.getProcessInstanceTasks(runningProcessInstance.entry.id, simpleApp);
await tasksService.claimTask(tasklist.list.entries[0].entry.id, simpleApp);
runningTasks[process] = tasklist.list.entries[0].entry;
}
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C601606] Should be able to finish task with multiselect dropdown form field', async () => {
const optionsToSelect = ['First', 'Third'];
const { name: multiselectTaskName } = runningTasks['multiselect-dropdown'];
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(multiselectTaskName);
await taskList.selectRow(multiselectTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await dropdown.openDropdown('#DropdownMultiselect');
await dropdown.selectMultipleOptions(optionsToSelect);
await dropdown.closeDropdownFor('DropdownMultiselect');
const optionsSelected = [await dropdown.getSelectedOptionText('DropdownMultiselect')];
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(multiselectTaskName);
await taskList.selectRow(multiselectTaskName);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('DropdownMultiselect');
optionsSelected.push(await dropdown.getSelectedOptionText('DropdownMultiselect'));
expect(optionsSelected.toString().replace(/\s+/g, '')).toEqual([optionsToSelect, optionsToSelect].toString());
});
it('[C309878] Should be able to select a dropdown option, save and complete the task form', async () => {
const { name: dropdownOptionTaskName } = runningTasks['dropdownOptionsProcess'];
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(dropdownOptionTaskName);
await taskList.selectRow(dropdownOptionTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('DropdownOptions');
await dropdown.selectOption('option2', `dropdown-cloud-widget ${materialLocators.Select.root}`);
expect(await dropdown.getSelectedOptionText('DropdownOptions')).toBe('option2');
await taskFormCloudComponent.checkSaveButtonIsDisplayed();
await taskFormCloudComponent.clickSaveButton();
expect(await dropdown.getSelectedOptionText('DropdownOptions')).toBe('option2');
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsNotDisplayedByName(dropdownOptionTaskName);
const message = await new SnackbarPage().getSnackBarMessage();
expect(message).toEqual('Task has been saved successfully');
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(dropdownOptionTaskName);
await taskList.selectRow(dropdownOptionTaskName);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('DropdownOptions');
expect(await dropdown.getSelectedOptionText('DropdownOptions')).toBe('option2');
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C601606] Should be able to search and select multiple options from multiple choice dropdown', async () => {
const { name: dropdownOptionTaskName } = runningTasks['dropdown-search'];
const expectedOptions = ['Albania', 'Colombia', 'Italy', 'Poland', 'United Kingdom of Great Britain and Northern Ireland'];
const dropdownId = 'DropdownCountriesMultiple';
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(dropdownOptionTaskName);
await taskList.selectRow(dropdownOptionTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await dropdown.openDropdown(`#${dropdownId}`);
await dropdown.searchAndChooseOptionsFromList(...expectedOptions);
await dropdown.closeDropdownFor(dropdownId);
const actualSelectedOptions = await dropdown.getSelectedOptionText(dropdownId);
expect(actualSelectedOptions).toEqual(expectedOptions.join(', '));
});
it('[C601606] Should be able to search and select single options from the single choice dropdown', async () => {
const { name: dropdownOptionTaskName } = runningTasks['dropdown-search'];
const firstOption = 'Mauritius';
const expectedOption = 'Namibia';
const dropdownId = 'DropdownCountriesSingle';
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(dropdownOptionTaskName);
await taskList.selectRow(dropdownOptionTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await dropdown.openDropdown(`#${dropdownId}`);
await dropdown.searchAndChooseOptionFromList(firstOption);
await dropdown.openDropdown(`#${dropdownId}`);
await dropdown.searchAndChooseOptionFromList(expectedOption);
const actualSelectedOptions = await dropdown.getSelectedOptionText(dropdownId);
expect(actualSelectedOptions).toEqual(expectedOption);
});
it('[C601606] Should not be able to search if there is less than 6 options to choose', async () => {
const { name: dropdownOptionTaskName } = runningTasks['dropdown-search'];
const dropdownId = 'DropdownSingleFive';
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(dropdownOptionTaskName);
await taskList.selectRow(dropdownOptionTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await dropdown.openDropdown(`#${dropdownId}`);
const searchDropdownFieldIsPresent = await dropdown.searchElementLocator.isPresent(1000);
expect(searchDropdownFieldIsPresent).toBeFalsy();
});
});

View File

@@ -1,106 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
EditJsonDialog,
FormCloudService,
LoginPage,
ProcessCloudWidgetPage,
StringUtil,
TaskFormCloudComponent,
TaskHeaderCloudPage,
TasksService
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Form Field Component - JSON Widget', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskFormCloudComponent = new TaskFormCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const editJsonDialog = new EditJsonDialog();
const widget = new ProcessCloudWidgetPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const formCloudService = new FormCloudService(apiService);
const jsonWidget = widget.json();
let testUser;
let groupInfo;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const taskName = StringUtil.generateRandomString();
const formWithJson = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.formWithJsonWidget;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const formId = await formCloudService.getIdByFormName(simpleApp, formWithJson.name);
await tasksService.createStandaloneTaskWithForm(taskName, simpleApp, formId, { assignee: testUser.username });
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await taskList.getDataTable().waitForTableBody();
});
it('[C593999] View json field in standalone task ', async () => {
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await jsonWidget.checkWidgetIsVisible(formWithJson.widgets.displayJsonWidgetId);
await jsonWidget.clickJsonButton(formWithJson.widgets.displayJsonWidgetId);
await editJsonDialog.checkDialogIsDisplayed();
expect(await editJsonDialog.getDialogContent()).toBe('{}');
await editJsonDialog.clickCloseButton();
await editJsonDialog.checkDialogIsNotDisplayed();
});
});

View File

@@ -1,176 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { FormCloudComponentPage, FormPage, LoginPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing';
import {
peopleSingleModeFormMock,
peopleMultipleModeFormMock,
peopleRequiredFormMock,
groupSingleModeFormMock,
groupMultipleModeFormMock,
groupRequiredFormMock,
peopleReadOnlyFormMock,
groupReadOnlyFormMock
} from '../../resources/forms/people-group-formwidget-mocks';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('People and Group of people Widgets', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const formCloudComponentPage = new FormCloudComponentPage();
const widget = new ProcessCloudWidgetPage();
const formPage = new FormPage();
const peopleCloudWidget = widget.peopleCloudWidget();
const groupCloudWidget = widget.groupCloudWidget();
const widgets = {
peopleCloudWidgetSingleModeId: 'PeopleSingleMode',
peopleCloudWidgetMultipleModeId: 'PeopleMultipleMode',
peopleCloudWidgetReadOnlyId: 'PeopleReadOnly',
peopleCloudWidgetRequiredId: 'PeopleRequired',
groupCloudWidgetSingleModeId: 'GroupSingleMode',
groupCloudWidgetMultipleModeId: 'GroupMultipleMode',
groupCloudWidgetReadOnlyId: 'GroupReadOnly',
groupCloudWidgetRequiredId: 'GroupRequired'
};
const peopleValueString = {
peopleCloudWidgetSingleModeField: 'PeopleSingleMode',
peopleCloudWidgetMultipleModeField: 'PeopleMultipleMode',
peopleCloudWidgetReadOnlyField: 'PeopleReadOnly',
peopleCloudWidgetRequiredField: 'PeopleRequired'
};
const groupValueString = {
groupCloudWidgetSingleModeField: 'GroupSingleMode',
groupCloudWidgetMultipleModeField: 'GroupMultipleMode',
groupCloudWidgetReadOnlyField: 'GroupReadOnly',
groupCloudWidgetRequiredField: 'GroupRequired'
};
beforeAll(async () => {
await loginSSOPage.loginWithProfile('hrUser');
await navigationBarPage.navigateToFormCloudPage();
});
it('[C325002] Should be able to add a user in People field when Single mode is chosen', async () => {
await formCloudComponentPage.setConfigToEditor(peopleSingleModeFormMock);
await peopleCloudWidget.clickPeopleInput(widgets.peopleCloudWidgetSingleModeId);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetSingleModeField);
const peopleSingleMode = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetSingleModeId);
expect(peopleSingleMode).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
await peopleCloudWidget.checkSelectedPeople('HR User');
});
it('[C325122] Should be able to add multiple users in People field when Multiple mode is chosen', async () => {
await formCloudComponentPage.setConfigToEditor(peopleMultipleModeFormMock);
await peopleCloudWidget.clickPeopleInput(widgets.peopleCloudWidgetMultipleModeId);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetMultipleModeField);
const peopleMultipleMode = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetMultipleModeId);
expect(peopleMultipleMode).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
await peopleCloudWidget.searchAssigneeAndSelect('Sales User');
await peopleCloudWidget.checkSelectedPeople('HR User');
await peopleCloudWidget.checkSelectedPeople('Sales User');
});
it('[C325182] Should not be able to type in the People field if the readOnly option is checked', async () => {
await formCloudComponentPage.setConfigToEditor(peopleReadOnlyFormMock);
const readOnlyAttribute = await peopleCloudWidget.checkPeopleWidgetIsReadOnly();
const activePeopleField = await peopleCloudWidget.checkPeopleActiveField('HR User');
expect(readOnlyAttribute).toBe(true);
expect(activePeopleField).toBe(false);
});
it('[C325004] Should save button be enabled for both valid and invalid inputs in the People field', async () => {
await formCloudComponentPage.setConfigToEditor(peopleRequiredFormMock);
await peopleCloudWidget.isPeopleWidgetVisible(peopleValueString.peopleCloudWidgetRequiredField);
expect(await formPage.isSaveButtonDisabled()).toBe(false);
expect(await formPage.isValidationIconRed()).toBe(true);
const requiredPeople = await peopleCloudWidget.getFieldValue(widgets.peopleCloudWidgetRequiredId);
expect(requiredPeople).toEqual('');
await peopleCloudWidget.searchAssigneeAndSelect('HR User');
await peopleCloudWidget.checkSelectedPeople('HR User');
expect(await formPage.isSaveButtonDisabled()).toBe(false);
expect(await formPage.isValidationIconBlue()).toBe(true);
});
it('[C325003] Should be able to add a user in Group of people field when Single mode is chosen', async () => {
await formCloudComponentPage.setConfigToEditor(groupSingleModeFormMock);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetSingleModeField);
const groupSingleMode = await groupCloudWidget.getGroupsFieldContent();
expect(groupSingleMode).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
await groupCloudWidget.checkSelectedGroup('hr');
});
it('[C325123] Should be able to add multiple users in Group of people field when Multiple mode is chosen', async () => {
await formCloudComponentPage.setConfigToEditor(groupMultipleModeFormMock);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetMultipleModeField);
const groupSingleMode = await groupCloudWidget.getGroupsFieldContent();
expect(groupSingleMode).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
await groupCloudWidget.searchGroups('sales');
await groupCloudWidget.selectGroupFromList('sales');
await groupCloudWidget.checkSelectedGroup('hr');
await groupCloudWidget.checkSelectedGroup('sales');
});
it('[C325183] Should not be able to type in the Group field if the readOnly option is checked', async () => {
await formCloudComponentPage.setConfigToEditor(groupReadOnlyFormMock);
const readOnlyGroupAttribute = await groupCloudWidget.checkGroupWidgetIsReadOnly();
const activeGroupField = await groupCloudWidget.checkGroupActiveField('hr');
expect(readOnlyGroupAttribute).toBe(true);
expect(activeGroupField).toBe(false);
});
it('[C325005] Should save button be enabled for both valid and invalid inputs in the Group of people field', async () => {
await formCloudComponentPage.setConfigToEditor(groupRequiredFormMock);
await groupCloudWidget.isGroupWidgetVisible(groupValueString.groupCloudWidgetRequiredField);
expect(await formPage.isSaveButtonDisabled()).toBe(false);
expect(await formPage.isValidationIconRed()).toBe(true);
const groupRequired = await groupCloudWidget.getGroupsFieldContent();
expect(groupRequired).toEqual('');
await groupCloudWidget.searchGroups('hr');
await groupCloudWidget.selectGroupFromList('hr');
await groupCloudWidget.checkSelectedGroup('hr');
expect(await formPage.isSaveButtonDisabled()).toBe(false);
expect(await formPage.isValidationIconBlue()).toBe(true);
});
});

View File

@@ -1,162 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
LoginPage,
AppListCloudPage,
IdentityService,
GroupIdentityService,
createApiService,
StringUtil,
StartTasksCloudPage,
TaskFormCloudComponent,
StartProcessCloudPage,
ProcessCloudWidgetPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
import { ProcessCloudDemoPage } from '.././pages/process-cloud-demo.page';
describe('Task cloud visibility', async () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const startTask = new StartTasksCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const startProcessPage = new StartProcessCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processList = processCloudDemoPage.processListCloudComponent();
const loginSSOPage = new LoginPage();
const widget = new ProcessCloudWidgetPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const standaloneTaskName = StringUtil.generateRandomString(5);
const processName = StringUtil.generateRandomString(5);
let testUser;
let groupInfo;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C315170] Should be able to complete a task with a form with required number widgets', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(standaloneTaskName);
await startTask.selectFormDefinition(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.requirednumbervisibility.name);
await startTask.clickStartButton();
await taskList.getDataTable().waitTillContentLoaded();
await taskList.selectRow(standaloneTaskName);
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number1');
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().setFieldValue('Number1', '5');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number2');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.formFields().setFieldValue('Number1', '123');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Number2');
});
it('[C315232] Should be able to complete a process with visibility condition for boolean widgets', async () => {
await processCloudDemoPage.openNewProcessForm();
await startProcessPage.clearField(startProcessPage.processNameInput);
await startProcessPage.selectFromProcessDropdown(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.booleanvisibilityprocess);
await startProcessPage.enterProcessName(processName);
await browser.sleep(400);
await startProcessPage.clickStartProcessButton();
await editProcessFilter.setFilter({ processName });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(processName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.selectRow('boolean_visibility_task');
await taskFormCloudComponent.clickClaimButton();
await browser.sleep(400);
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Checkbox2');
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Checkbox3');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await widget.checkboxWidget().clickCheckboxInput('Checkbox1');
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxDisplayed('Checkbox3');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();
});
it('[C315208] Should be able to complete a task with Checkbox widgets', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(standaloneTaskName);
await startTask.selectFormDefinition(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.booleanvisibility.name);
await startTask.clickStartButton();
await taskList.getDataTable().waitTillContentLoaded();
await taskList.selectRow(standaloneTaskName);
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Checkbox2');
await taskFormCloudComponent.formFields().checkWidgetIsHidden('Checkbox3');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(false);
await widget.checkboxWidget().clickCheckboxInput('Checkbox1');
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxDisplayed('Checkbox3');
expect(await taskFormCloudComponent.formFields().isCompleteFormButtonEnabled()).toEqual(true);
await taskFormCloudComponent.clickCompleteButton();
});
});

View File

@@ -1,204 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { FormCloudComponentPage, LoginPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import {
tabFieldValueVisibilityJson,
tabVarValueVisibilityJson,
tabVarFieldVisibilityJson,
tabFieldFieldVisibilityJson,
tabFieldVarVisibilityJson,
tabVarVarVisibilityJson,
tabNextOperatorsVisibilityJson
} from '../../resources/forms/tab-visibility-conditions';
describe('Visibility conditions on tabs - cloud', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const formCloudDemoPage = new FormCloudComponentPage();
const widget = new ProcessCloudWidgetPage();
const widgets = {
textOneId: 'TextOne',
textTwoId: 'TextTwo',
textThreeId: 'TextThree'
};
const value = {
displayTab: 'showTab',
notDisplayTab: 'anythingElse'
};
const tab = {
tabWithFields: 'tabWithFields',
tabFieldValue: 'tabBasicFieldValue',
tabVarValue: 'tabBasicVarValue',
tabVarField: 'tabBasicVarField',
tabFieldField: 'tabBasicFieldField',
tabVarVar: 'tabBasicVarVar',
tabNextOperators: 'tabNextOperators'
};
beforeAll(async () => {
await loginSSOPage.loginWithProfile('hrUser');
await navigationBarPage.navigateToFormCloudPage();
});
it('[C309647] Should be able to see tab when visibility condition refers to a field with specific value', async () => {
await formCloudDemoPage.setConfigToEditor(tabFieldValueVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await widget.tab().clickTabByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textTwoId);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
});
it('[C315148] Should be able to see tab when visibility condition refers to a variable with specific value', async () => {
await formCloudDemoPage.setConfigToEditor(tabVarValueVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarValue);
await widget.textWidget().isWidgetVisible(widgets.textTwoId);
const visibleTab = tabVarValueVisibilityJson;
visibleTab.formRepresentation.formDefinition.variables[0].value = value.notDisplayTab;
await formCloudDemoPage.setConfigToEditor(visibleTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarValue);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
});
it('[C315149] Should be able to see tab when visibility condition refers to a form variable and a field', async () => {
await formCloudDemoPage.setConfigToEditor(tabVarFieldVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarField);
await widget.tab().clickTabByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textTwoId);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
});
it('[C315150] Should be able to see tab when visibility condition refers to a field and another field', async () => {
await formCloudDemoPage.setConfigToEditor(tabFieldFieldVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetVisible(widgets.textThreeId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
});
it('[C315151] Should be able to see tab when visibility condition refers to a field and form variable', async () => {
await formCloudDemoPage.setConfigToEditor(tabFieldVarVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarField);
await widget.tab().clickTabByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textTwoId);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
});
it('[C315152] Should be able to see tab when visibility condition refers to form variable and another form variable', async () => {
await formCloudDemoPage.setConfigToEditor(tabVarVarVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
const visibleTab = tabVarVarVisibilityJson;
visibleTab.formRepresentation.formDefinition.variables[0].value = value.notDisplayTab;
await formCloudDemoPage.setConfigToEditor(visibleTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetNotVisible(widgets.textOneId);
visibleTab.formRepresentation.formDefinition.variables[1].value = value.notDisplayTab;
await formCloudDemoPage.setConfigToEditor(visibleTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
visibleTab.formRepresentation.formDefinition.variables[0].value = value.displayTab;
await formCloudDemoPage.setConfigToEditor(visibleTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetNotVisible(widgets.textOneId);
});
it('[C315153] Should be able to see tab when has multiple visibility conditions and next condition operators', async () => {
await formCloudDemoPage.setConfigToEditor(tabNextOperatorsVisibilityJson);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabNextOperators);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetVisible(widgets.textThreeId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabNextOperators);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabNextOperators);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabNextOperators);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabNextOperators);
await widget.textWidget().setValue(widgets.textThreeId, value.notDisplayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabNextOperators);
});
});

View File

@@ -1,361 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { FormCloudComponentPage, LoginPage, ProcessCloudWidgetPage } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { checkboxVisibilityFormJson, multipleCheckboxVisibilityFormJson } from '../../resources/forms/checkbox-visibility-condition';
import { multipleTextVisibilityFormJson, multipleVisibilityFormJson } from '../../resources/forms/multiple-visibility-conditions';
import { displayValueTextJson } from '../../resources/forms/display-value-visibility-conditions';
import { dropdownVisibilityFormFieldJson, dropdownVisibilityFormVariableJson } from '../../resources/forms/dropdown-visibility-condition';
describe('Visibility conditions - cloud', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const formCloudDemoPage = new FormCloudComponentPage();
const widget = new ProcessCloudWidgetPage();
let visibleCheckbox;
const widgets = {
textOneId: 'textOne',
textTwoId: 'textTwo',
textThreeId: 'textThree',
checkboxBasicVariable: 'CheckboxBasicVariableField',
checkboxBasicField: 'CheckboxBasicFieldValue',
textOneDisplay: 'TextOne',
textTwoDisplay: 'TextTwo'
};
const value = {
displayCheckbox: 'showCheckbox',
notDisplayCheckbox: 'anythingElse'
};
const checkbox = {
checkboxFieldValue: 'CheckboxFieldValue',
checkboxVariableField: 'CheckboxVariableField',
checkboxFieldVariable: 'CheckboxFieldVariable',
checkboxFieldField: 'CheckboxFieldField',
checkboxVariableValue: 'CheckboxVariableValue',
checkboxVariableVariable: 'CheckboxVariableVariable',
checkbox1: 'Checkbox1'
};
const displayValueString = {
displayValueNoConditionField: 'DisplayValueNoCondition',
displayValueSingleConditionField: 'DisplayValueSingleCondition',
displayValueMultipleConditionsField: 'DisplayValueMultipleCondition'
};
const dropdownVisibilityTest = {
widgets: {
textId: 'textFour',
numberId: 'numberOne',
amountId: 'amountOne',
dropdownId: 'dropdownOne'
},
displayValue: {
text: 'text1',
// eslint-disable-next-line
number: '11'
},
notDisplayValue: {
amount: '90'
}
};
beforeAll(async () => {
await loginSSOPage.loginWithProfile('hrUser');
await navigationBarPage.navigateToFormCloudPage();
await formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
});
it('[C309647] Should be able to see Checkbox widget when visibility condition refers to another field with specific value', async () => {
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldValue);
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldValue);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldValue);
});
it('[C309648] Should be able to see Checkbox widget when visibility condition refers to a form variable and a field', async () => {
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableField);
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableField);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableField);
});
it('[C309649] Should be able to see Checkbox widget when visibility condition refers to a field and a form variable', async () => {
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldVariable);
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldVariable);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldVariable);
});
it('[C311425] Should be able to see Checkbox widget when visibility condition refers to a field and another field', async () => {
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetVisible(widgets.textTwoId);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
await widget.textWidget().setValue(widgets.textOneId, value.displayCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
await widget.textWidget().setValue(widgets.textTwoId, value.displayCheckbox);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxFieldField);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxFieldField);
});
it('[C311424] Should be able to see Checkbox widget when visibility condition refers to a variable with specific value', async () => {
await formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableValue);
visibleCheckbox = checkboxVisibilityFormJson;
visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.notDisplayCheckbox;
await formCloudDemoPage.setConfigToEditor(visibleCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableValue);
visibleCheckbox = checkboxVisibilityFormJson;
visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.displayCheckbox;
await formCloudDemoPage.setConfigToEditor(visibleCheckbox);
});
it('[C311426] Should be able to see Checkbox widget when visibility condition refers to form variable and another form variable', async () => {
await formCloudDemoPage.setConfigToEditor(checkboxVisibilityFormJson);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableVariable);
visibleCheckbox = checkboxVisibilityFormJson;
visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.notDisplayCheckbox;
await formCloudDemoPage.setConfigToEditor(visibleCheckbox);
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkboxVariableVariable);
visibleCheckbox = checkboxVisibilityFormJson;
visibleCheckbox.formRepresentation.formDefinition.variables[1].value = value.notDisplayCheckbox;
await formCloudDemoPage.setConfigToEditor(visibleCheckbox);
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkboxVariableVariable);
visibleCheckbox = checkboxVisibilityFormJson;
visibleCheckbox.formRepresentation.formDefinition.variables[0].value = value.displayCheckbox;
visibleCheckbox.formRepresentation.formDefinition.variables[1].value = value.displayCheckbox;
await formCloudDemoPage.setConfigToEditor(visibleCheckbox);
});
it('[C312400] Should be able to see Checkbox widget when has visibility condition related to checkbox', async () => {
await formCloudDemoPage.setConfigToEditor(multipleCheckboxVisibilityFormJson);
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().clickCheckboxInput('Checkbox3');
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkbox1);
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkbox1);
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().clickCheckboxInput('Checkbox3');
await widget.checkboxWidget().isCheckboxDisplayed(checkbox.checkbox1);
await widget.checkboxWidget().clickCheckboxInput('Checkbox2');
await widget.checkboxWidget().isCheckboxHidden(checkbox.checkbox1);
});
it('[C309650] Should be able to see Checkbox widget when has multiple visibility conditions and next condition operators', async () => {
let text1;
let text2;
await formCloudDemoPage.setConfigToEditor(multipleVisibilityFormJson);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('');
expect(text2).toEqual('');
await widget.textWidget().setValue(widgets.textOneId, 'aaa');
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('aaa');
expect(text2).toEqual('');
await widget.checkboxWidget().isCheckboxDisplayed(widgets.checkboxBasicVariable);
await widget.textWidget().setValue(widgets.textOneId, 'bbb');
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('bbb');
expect(text2).toEqual('');
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
await widget.textWidget().setValue(widgets.textTwoId, 'aaa');
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('bbb');
expect(text2).toEqual('aaa');
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
await widget.textWidget().setValue(widgets.textOneId, 'aaa');
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('aaa');
expect(text2).toEqual('aaa');
await widget.checkboxWidget().isCheckboxHidden(widgets.checkboxBasicField);
await widget.textWidget().setValue(widgets.textTwoId, 'bbb');
text1 = await widget.textWidget().getFieldValue(widgets.textOneId);
text2 = await widget.textWidget().getFieldValue(widgets.textTwoId);
expect(text1).toEqual('aaa');
expect(text2).toEqual('bbb');
await widget.checkboxWidget().isCheckboxDisplayed(widgets.checkboxBasicField);
});
it('[C312443] Should be able to see text widget when has multiple visibility conditions and OR NOT next condition operators', async () => {
await formCloudDemoPage.setConfigToEditor(multipleTextVisibilityFormJson);
await widget.textWidget().setValue(widgets.textTwoId, 'test');
await widget.textWidget().setValue(widgets.textThreeId, 'test');
await widget.textWidget().isWidgetNotVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textTwoId, 'test');
await widget.textWidget().setValue(widgets.textThreeId, 'something');
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textTwoId, 'something');
await widget.textWidget().setValue(widgets.textThreeId, 'test');
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textTwoId, 'something');
await widget.textWidget().setValue(widgets.textThreeId, 'something');
await widget.textWidget().isWidgetVisible(widgets.textOneId);
});
it('[C309867] Should be able to see the value of a form variable in the Display Value Widget when no visibility conditions are added', async () => {
await formCloudDemoPage.setConfigToEditor(displayValueTextJson);
await widget.displayValueWidget().isDisplayValueWidgetVisible(displayValueString.displayValueNoConditionField);
const textDisplayWidgetNoCondition = await widget.displayValueWidget().getFieldValue(displayValueString.displayValueNoConditionField);
expect(textDisplayWidgetNoCondition).toEqual('No cats');
});
it('[C309869] Should be able to see Display text widget when visibility condition refers to a form variable and a field', async () => {
await formCloudDemoPage.setConfigToEditor(displayValueTextJson);
await widget.textWidget().isWidgetVisible(widgets.textOneDisplay);
let textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueSingleConditionField);
await widget.textWidget().setValue(widgets.textOneDisplay, 'cat');
textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('cat');
await widget.displayValueWidget().isDisplayValueWidgetVisible(displayValueString.displayValueSingleConditionField);
const textDisplayWidgetSingleCondition = await widget.displayValueWidget().getFieldValue(displayValueString.displayValueSingleConditionField);
expect(textDisplayWidgetSingleCondition).toEqual('cat');
await widget.textWidget().setValue(widgets.textOneDisplay, 'dog');
textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('dog');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueSingleConditionField);
});
it('[C309871] Should be able to see Display text widget when has multiple visibility conditions and next condition operators', async () => {
await formCloudDemoPage.setConfigToEditor(displayValueTextJson);
await widget.textWidget().isWidgetVisible(widgets.textOneDisplay);
let textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('');
await widget.textWidget().isWidgetVisible(widgets.textTwoDisplay);
let textTwoField = await widget.textWidget().getFieldValue(widgets.textTwoDisplay);
expect(textTwoField).toEqual('');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueSingleConditionField);
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueMultipleConditionsField);
await widget.textWidget().setValue(widgets.textOneDisplay, 'cat');
textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('cat');
await widget.displayValueWidget().isDisplayValueWidgetVisible(displayValueString.displayValueMultipleConditionsField);
const textDisplayWidgetMultipleCondition = await widget
.displayValueWidget()
.getFieldValue(displayValueString.displayValueMultipleConditionsField);
expect(textDisplayWidgetMultipleCondition).toEqual('more cats');
await widget.textWidget().setValue(widgets.textOneDisplay, 'dog');
textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('dog');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueMultipleConditionsField);
await widget.textWidget().setValue(widgets.textTwoDisplay, 'cat');
textTwoField = await widget.textWidget().getFieldValue(widgets.textTwoDisplay);
expect(textTwoField).toEqual('cat');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueMultipleConditionsField);
await widget.textWidget().setValue(widgets.textOneDisplay, 'cat');
textOneField = await widget.textWidget().getFieldValue(widgets.textOneDisplay);
expect(textOneField).toEqual('cat');
await widget.displayValueWidget().checkDisplayValueWidgetIsHidden(displayValueString.displayValueMultipleConditionsField);
await widget.textWidget().setValue(widgets.textTwoDisplay, 'dog');
textTwoField = await widget.textWidget().getFieldValue(widgets.textTwoDisplay);
expect(textTwoField).toEqual('dog');
await widget.displayValueWidget().isDisplayValueWidgetVisible(displayValueString.displayValueMultipleConditionsField);
expect(textDisplayWidgetMultipleCondition).toEqual('more cats');
});
it('[C309680] Should be able to see dropdown widget when has multiple Visibility Conditions set on Form Fields', async () => {
await formCloudDemoPage.setConfigToEditor(dropdownVisibilityFormFieldJson);
await widget.dropdown().isWidgetHidden(dropdownVisibilityTest.widgets.dropdownId);
await widget.textWidget().setValue(dropdownVisibilityTest.widgets.textId, dropdownVisibilityTest.displayValue.text);
await widget.dropdown().isWidgetHidden(dropdownVisibilityTest.widgets.dropdownId);
await widget.numberWidget().setFieldValue(dropdownVisibilityTest.widgets.numberId, dropdownVisibilityTest.displayValue.number);
await widget.dropdown().isWidgetVisible(dropdownVisibilityTest.widgets.dropdownId);
await widget.amountWidget().setFieldValue(dropdownVisibilityTest.widgets.amountId, dropdownVisibilityTest.notDisplayValue.amount);
await widget.dropdown().isWidgetHidden(dropdownVisibilityTest.widgets.dropdownId);
});
it('[C309682] Should be able to see dropdown widget when has multiple Visibility Conditions set on Form Variables', async () => {
await formCloudDemoPage.setConfigToEditor(dropdownVisibilityFormVariableJson);
await widget.dropdown().isWidgetVisible(dropdownVisibilityTest.widgets.dropdownId);
});
});

View File

@@ -1,51 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, EditProcessFilterCloudComponentPage, ProcessFiltersCloudComponentPage, ProcessListCloudComponentPage } from '@alfresco/adf-testing';
import { $ } from 'protractor';
export class ProcessCloudDemoPage {
createButton = $('button[data-automation-id="create-button"]');
newProcessButton = $('button[data-automation-id="btn-start-process"]');
processListCloud = new ProcessListCloudComponentPage();
editProcessFilterCloud = new EditProcessFilterCloudComponentPage();
processFilterCloudComponent = new ProcessFiltersCloudComponentPage();
editProcessFilterCloudComponent(): EditProcessFilterCloudComponentPage {
return this.editProcessFilterCloud;
}
processListCloudComponent(): ProcessListCloudComponentPage {
return this.processListCloud;
}
async openNewProcessForm(): Promise<void> {
await this.clickOnCreateButton();
await this.newProcessButtonIsDisplayed();
await BrowserActions.click(this.newProcessButton);
}
async newProcessButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.newProcessButton);
}
async clickOnCreateButton(): Promise<void> {
await BrowserActions.click(this.createButton);
}
}

View File

@@ -1,36 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing';
import { by, element } from 'protractor';
export class ProcessDetailsCloudDemoPage {
dataTable: DataTableComponentPage = new DataTableComponentPage();
async checkTaskIsDisplayed(taskName: string): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Task Name', taskName);
}
async selectProcessTaskByName(taskName: string): Promise<void> {
await this.dataTable.selectRow('Task Name', taskName);
}
async checkListedSelectedProcessInstance(processInstanceId: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('div ul', processInstanceId)));
}
}

View File

@@ -1,54 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
TaskFiltersCloudComponentPage,
EditTaskFilterCloudComponentPage,
TaskListCloudComponentPage,
BrowserActions,
TestElement,
DataTableComponentPage,
materialLocators
} from '@alfresco/adf-testing';
export class TasksCloudDemoPage {
createButton = TestElement.byCss('button[data-automation-id="create-button"');
newTaskButton = TestElement.byCss('button[data-automation-id="btn-start-task"]');
spinner = TestElement.byTag(materialLocators.Progress.spinner.root);
editTaskFilterCloud = new EditTaskFilterCloudComponentPage();
taskFilterCloudComponent = new TaskFiltersCloudComponentPage();
dataTableComponentPage = new DataTableComponentPage();
taskListCloudComponent(): TaskListCloudComponentPage {
return new TaskListCloudComponentPage();
}
async openNewTaskForm(): Promise<void> {
await this.createButton.click();
await BrowserActions.clickExecuteScript('button[data-automation-id="btn-start-task"]');
}
async clickStartNewTaskButton() {
await this.createButton.click();
await this.newTaskButton.click();
}
async waitTillContentLoaded(): Promise<void> {
await this.dataTableComponentPage.waitTillContentLoaded();
}
}

View File

@@ -1,265 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
BrowserActions,
FilterProps,
GroupIdentityService,
IdentityService,
LocalStorageUtil,
LoginPage,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
StringUtil,
TasksService
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
import { ProcessListCloudConfiguration } from './../config/process-list-cloud.config';
describe('Process list cloud', () => {
// en-US values for the process status
const PROCESS_STATUS = {
ALL: 'All',
RUNNING: 'Running',
SUSPENDED: 'Suspended',
COMPLETED: 'Completed'
};
// en-US values for the sort direction
const SORT_DIRECTION = {
ASC: 'Ascending',
DESC: 'Descending'
};
describe('Process List', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processList = processCloudDemoPage.processListCloudComponent();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
const tasksService = new TasksService(apiService);
const processListCloudConfiguration = new ProcessListCloudConfiguration();
const editProcessFilterConfiguration = new EditProcessFilterConfiguration();
const processListCloudConfigFile = processListCloudConfiguration.getConfiguration();
const editProcessFilterConfigFile = editProcessFilterConfiguration.getConfiguration();
let completedProcess;
let runningProcessInstance;
let switchProcessInstance;
let noOfApps;
let testUser;
let groupInfo;
let anotherProcessInstance;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateGroupProcess,
candidateBaseApp
);
const anotherProcessDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.anotherCandidateGroupProcess,
candidateBaseApp
);
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
runningProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
anotherProcessInstance = await processInstancesService.createProcessInstance(anotherProcessDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
switchProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
completedProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
const task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, candidateBaseApp);
const claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, candidateBaseApp);
await tasksService.completeTask(claimedTask.entry.id, candidateBaseApp);
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-edit-process-filter', JSON.stringify(editProcessFilterConfigFile));
await LocalStorageUtil.setConfigField('adf-cloud-process-list', JSON.stringify(processListCloudConfigFile));
});
afterAll(async () => {
await apiService.login(testUser.username, testUser.password);
await processInstancesService.deleteProcessInstance(anotherProcessInstance.entry.id, candidateBaseApp);
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(candidateBaseApp);
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
});
/**
* Set the filter
*
* @param props FilterProps
*/
async function setFilter(props: FilterProps): Promise<void> {
await editProcessFilter.setFilter(props);
await waitTillContentLoaded();
}
/**
* Wait for the content to be loaded
*/
async function waitTillContentLoaded() {
await processList.getDataTable().waitTillContentLoaded();
}
it('[C291783] Should display processes ordered by id when Id is selected from sort dropdown', async () => {
await setFilter({ status: PROCESS_STATUS.RUNNING });
await setFilter({ sort: 'Id' });
await setFilter({ order: SORT_DIRECTION.ASC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Id')).toBe(true);
await setFilter({ order: SORT_DIRECTION.DESC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Id')).toBe(true);
});
it('[C305054] Should display processes ordered by status when Status is selected from sort dropdown', async () => {
await setFilter({ status: PROCESS_STATUS.ALL });
await setFilter({ sort: 'Status' });
await setFilter({ order: SORT_DIRECTION.ASC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Status')).toBe(true);
await setFilter({ order: SORT_DIRECTION.DESC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Status')).toBe(true);
});
it('[C305054] Should display processes ordered by last modified date when Last Modified is selected from sort dropdown', async () => {
await setFilter({ status: PROCESS_STATUS.ALL });
await setFilter({ sort: 'Last Modified' });
await setFilter({ order: SORT_DIRECTION.ASC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Last Modified')).toBe(true);
await setFilter({ order: SORT_DIRECTION.DESC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Last Modified')).toBe(true);
});
it('[C305054] Should display processes ordered by business key date when BusinessKey is selected from sort dropdown', async () => {
await setFilter({ status: PROCESS_STATUS.ALL });
await setFilter({ sort: 'Business Key' });
await setFilter({ order: SORT_DIRECTION.ASC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.ASC, 'Business Key')).toBe(true);
await setFilter({ order: SORT_DIRECTION.DESC });
expect(await processList.getDataTable().checkListIsSorted(SORT_DIRECTION.DESC, 'Business Key')).toBe(true);
});
it('[C297697] The value of the filter should be preserved when saving it', async () => {
await processCloudDemoPage.processFilterCloudComponent.clickAllProcessesFilter();
await editProcessFilter.openFilter();
await editProcessFilter.setProcessInstanceId(completedProcess.entry.id);
await editProcessFilter.saveAs('New');
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('New');
await processList.checkContentIsDisplayedById(completedProcess.entry.id);
expect(await processList.getDataTable().numberOfRows()).toBe(1);
expect(await editProcessFilter.getProcessInstanceId()).toEqual(completedProcess.entry.id);
});
it('[C297646] Should display the filter dropdown fine , after switching between saved filters', async () => {
await editProcessFilter.openFilter();
noOfApps = await editProcessFilter.getNumberOfAppNameOptions();
expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
await BrowserActions.closeMenuAndDialogs();
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.RUNNING);
await editProcessFilter.setAppNameDropDown(candidateBaseApp);
await editProcessFilter.setProcessInstanceId(runningProcessInstance.entry.id);
await waitTillContentLoaded();
await processList.checkContentIsDisplayedById(runningProcessInstance.entry.id);
expect(await editProcessFilter.getNumberOfAppNameOptions()).toBe(noOfApps);
expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
await BrowserActions.closeMenuAndDialogs();
await editProcessFilter.saveAs('SavedFilter');
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('SavedFilter');
expect(await editProcessFilter.getProcessInstanceId()).toEqual(runningProcessInstance.entry.id);
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.RUNNING);
await editProcessFilter.setAppNameDropDown(candidateBaseApp);
await editProcessFilter.setProcessInstanceId(switchProcessInstance.entry.id);
await waitTillContentLoaded();
await processList.checkContentIsDisplayedById(switchProcessInstance.entry.id);
await editProcessFilter.saveAs('SwitchFilter');
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe('SwitchFilter');
expect(await editProcessFilter.getProcessInstanceId()).toEqual(switchProcessInstance.entry.id);
expect(await editProcessFilter.getNumberOfAppNameOptions()).toBe(noOfApps);
expect(await editProcessFilter.checkAppNamesAreUnique()).toBe(true);
await BrowserActions.closeMenuAndDialogs();
});
});
});

View File

@@ -1,374 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LocalStorageUtil,
LoginPage,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
StringUtil,
TasksService
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessListPage } from '../../process-services/pages/process-list.page';
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
import { ProcessListCloudConfiguration } from './../config/process-list-cloud.config';
import { addDays, format, subDays } from 'date-fns';
describe('Process filters cloud', () => {
// en-US values for the process status
const PROCESS_STATUS = {
ALL: 'All',
RUNNING: 'Running',
SUSPENDED: 'Suspended',
COMPLETED: 'Completed'
};
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processList = processCloudDemoPage.processListCloudComponent();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const processListPage = new ProcessListPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
const tasksService = new TasksService(apiService);
const beforeDate = format(subDays(new Date(), 2), 'dd/MM/yyyy');
const currentDate = format(new Date(), 'dd/MM/yyyy');
const afterDate = format(addDays(new Date(), 2), 'dd/MM/yyyy');
const processListCloudConfiguration = new ProcessListCloudConfiguration();
const editProcessFilterConfiguration = new EditProcessFilterConfiguration();
const processListCloudConfigFile = processListCloudConfiguration.getConfiguration();
const editProcessFilterConfigFile = editProcessFilterConfiguration.getConfiguration();
let completedProcess: any;
let runningProcessInstance: any;
let suspendProcessInstance: any;
let testUser: any;
let anotherUser: any;
let groupInfo: any;
let anotherProcessInstance: any;
let processDefinition: any;
let anotherProcessDefinition: any;
let differentAppUserProcessInstance: any;
let simpleAppProcessDefinition: any;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const setProcessName = async (propertyValue: string, propertyName = 'lastModifiedTo') => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty(propertyName, propertyValue);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
};
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
anotherUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await identityService.addUserToGroup(anotherUser.idIdentityService, groupInfo.id);
await apiService.login(anotherUser.username, anotherUser.password);
simpleAppProcessDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.simpleProcess,
simpleApp
);
differentAppUserProcessInstance = await processInstancesService.createProcessInstance(simpleAppProcessDefinition.entry.key, simpleApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
await apiService.login(testUser.username, testUser.password);
processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateGroupProcess,
candidateBaseApp
);
anotherProcessDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.anotherCandidateGroupProcess,
candidateBaseApp
);
runningProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
anotherProcessInstance = await processInstancesService.createProcessInstance(anotherProcessDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
suspendProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
await processInstancesService.suspendProcessInstance(suspendProcessInstance.entry.id, candidateBaseApp);
completedProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
const task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, candidateBaseApp);
const claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, candidateBaseApp);
await tasksService.completeTask(claimedTask.entry.id, candidateBaseApp);
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-edit-process-filter', JSON.stringify(editProcessFilterConfigFile));
await LocalStorageUtil.setConfigField('adf-cloud-process-list', JSON.stringify(processListCloudConfigFile));
});
afterAll(async () => {
await processInstancesService.deleteProcessInstance(runningProcessInstance.entry.id, candidateBaseApp);
await processInstancesService.deleteProcessInstance(anotherProcessInstance.entry.id, candidateBaseApp);
await processInstancesService.deleteProcessInstance(suspendProcessInstance.entry.id, candidateBaseApp);
await apiService.login(anotherUser.username, anotherUser.password);
await processInstancesService.deleteProcessInstance(differentAppUserProcessInstance.entry.id, simpleApp);
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
await identityService.deleteIdentityUser(anotherUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(candidateBaseApp);
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
await processCloudDemoPage.processFilterCloudComponent.clickRunningProcessesFilter();
});
it('[C306887] Should be able to filter by appName', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setAppNameDropDown(candidateBaseApp);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setInitiator(`${testUser.firstName} ${testUser.lastName}`);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(differentAppUserProcessInstance.entry.name);
});
it('[C306889] Should be able to see "No process found" when using an app with no processes in the appName field', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setAppNameDropDown('subprocessapp');
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setInitiator(`${testUser.firstName} ${testUser.lastName}`);
await processList.getDataTable().waitTillContentLoaded();
expect(await processListPage.getDisplayedProcessListTitle()).toEqual('No Processes Found');
});
it('[C306890] Should be able to filter by initiator', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setInitiator(`${testUser.firstName} ${testUser.lastName}`);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(differentAppUserProcessInstance.entry.name);
});
it('[C311315] Should be able to filter by process definition id', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty('processDefinitionId', processDefinition.entry.id);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProperty('processDefinitionId', anotherProcessDefinition.entry.id);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311316] Should be able to filter by process definition key', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty('processDefinitionKey', processDefinition.entry.key);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProcessName(anotherProcessInstance.entry.name);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProperty('processDefinitionKey', anotherProcessDefinition.entry.key);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311317] Should be able to filter by process instance id', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty('processInstanceId', runningProcessInstance.entry.id);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
expect(await processList.getDataTable().getNumberOfRows()).toBe(1);
await editProcessFilter.setProperty('processInstanceId', anotherProcessInstance.entry.id);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
expect(await processList.getDataTable().getNumberOfRows()).toBe(1);
});
it('[C311321] Should be able to filter by process name', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProcessName(anotherProcessInstance.entry.name);
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
});
it('[C306892-1] Should be able to filter by process status - Running', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.RUNNING);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProcessName(suspendProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(suspendProcessInstance.entry.name);
await editProcessFilter.setProcessName(anotherProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await editProcessFilter.setProcessName(completedProcess.entry.name);
await processList.checkContentIsNotDisplayedByName(completedProcess.entry.name);
});
it('[C306892-2] Should be able to filter by process status - Completed', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.COMPLETED);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(completedProcess.entry.name);
await processList.checkContentIsDisplayedByName(completedProcess.entry.name);
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProcessName(suspendProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(suspendProcessInstance.entry.name);
await editProcessFilter.setProcessName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(anotherProcessInstance.entry.name);
});
it('[C306892-3] Should be able to filter by process status - Suspended', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.SUSPENDED);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(suspendProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(suspendProcessInstance.entry.name);
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
await editProcessFilter.setProcessName(anotherProcessInstance.entry.name);
await processList.checkContentIsNotDisplayedByName(anotherProcessInstance.entry.name);
await editProcessFilter.setProcessName(completedProcess.entry.name);
await processList.checkContentIsNotDisplayedByName(completedProcess.entry.name);
});
it('[C306892-4] Should be able to filter by process status - All', async () => {
await processCloudDemoPage.processFilterCloudComponent.clickAllProcessesFilter();
await editProcessFilter.openFilter();
await editProcessFilter.setStatusFilterDropDown(PROCESS_STATUS.ALL);
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(anotherProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(suspendProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(completedProcess.entry.name);
});
it('[C311318-1] Should be able to filter by lastModifiedFrom - displays record when date = currentDate', async () => {
await setProcessName(currentDate, 'lastModifiedFrom');
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311318-2] Should be able to filter by lastModifiedFrom - displays record when date = beforeDate', async () => {
await setProcessName(beforeDate, 'lastModifiedFrom');
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311318-3] Should be able to filter by lastModifiedFrom - does not display record when date = afterDate', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProperty('lastModifiedFrom', afterDate);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311319-1] Should be able to filter by lastModifiedTo - displays record when date = currentDate', async () => {
await setProcessName(currentDate);
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311319-2] Should be able to filter by lastModifiedTo - does not display record when date = beforeDate', async () => {
await setProcessName(beforeDate);
await processList.checkContentIsNotDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311319-3] Should be able to filter by lastModifiedTo - displays record when date = afterDate', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty('lastModifiedTo', afterDate);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProcessName(runningProcessInstance.entry.name);
await processList.checkContentIsDisplayedByName(runningProcessInstance.entry.name);
});
it('[C311319-4] Should not display any processes when the lastModifiedFrom and lastModifiedTo are set to a future date', async () => {
await editProcessFilter.openFilter();
await editProcessFilter.setProperty('lastModifiedFrom', afterDate);
await processList.getDataTable().waitTillContentLoaded();
await editProcessFilter.setProperty('lastModifiedTo', afterDate);
expect(await processListPage.getDisplayedProcessListTitle()).toEqual('No Processes Found');
});
});

View File

@@ -1,147 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
StringUtil,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
TasksService,
EditProcessFilterCloudComponentPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Process filters cloud', () => {
describe('Process Filters', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editProcessFilterCloudComponentPage = new EditProcessFilterCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const queryService = new QueryService(apiService);
const tasksService = new TasksService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
let runningProcess;
let completedProcess;
let testUser;
let groupInfo;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const PROCESSES = CONSTANTS.PROCESS_FILTERS;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateGroupProcess,
candidateBaseApp
);
runningProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
completedProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
const task = await queryService.getProcessInstanceTasks(completedProcess.entry.id, candidateBaseApp);
const claimedTask = await tasksService.claimTask(task.list.entries[0].entry.id, candidateBaseApp);
await tasksService.completeTask(claimedTask.entry.id, candidateBaseApp);
await loginSSOPage.login(testUser.username, testUser.password);
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(candidateBaseApp);
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
await processCloudDemoPage.processFilterCloudComponent.clickOnProcessFilters();
});
it('[C290021] Should be able to view default filters', async () => {
await processCloudDemoPage.processFilterCloudComponent.checkCompletedProcessesFilterIsDisplayed();
await processCloudDemoPage.processFilterCloudComponent.checkRunningProcessesFilterIsDisplayed();
await processCloudDemoPage.processFilterCloudComponent.checkAllProcessesFilterIsDisplayed();
});
it('[C290043] Should display process in Running Processes List when process is started', async () => {
await processCloudDemoPage.processFilterCloudComponent.clickRunningProcessesFilter();
await editProcessFilterCloudComponentPage.openFilter();
await editProcessFilterCloudComponentPage.setProcessName(runningProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.RUNNING);
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(runningProcess.entry.id);
await processCloudDemoPage.processFilterCloudComponent.clickCompletedProcessesFilter();
await editProcessFilterCloudComponentPage.setProcessName(runningProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.COMPLETED);
await processCloudDemoPage.processListCloudComponent().checkContentIsNotDisplayedById(runningProcess.entry.id);
await processCloudDemoPage.processFilterCloudComponent.clickAllProcessesFilter();
await editProcessFilterCloudComponentPage.setProcessName(runningProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.ALL);
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(runningProcess.entry.id);
});
it('[C290044] Should display process in Completed Processes List when process is completed', async () => {
await processCloudDemoPage.processFilterCloudComponent.clickRunningProcessesFilter();
await editProcessFilterCloudComponentPage.openFilter();
await editProcessFilterCloudComponentPage.setProcessName(completedProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.RUNNING);
await processCloudDemoPage.processListCloudComponent().checkContentIsNotDisplayedById(completedProcess.entry.id);
await processCloudDemoPage.processFilterCloudComponent.clickCompletedProcessesFilter();
await editProcessFilterCloudComponentPage.setProcessName(completedProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.COMPLETED);
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(completedProcess.entry.id);
await processCloudDemoPage.processFilterCloudComponent.clickAllProcessesFilter();
await editProcessFilterCloudComponentPage.setProcessName(completedProcess.entry.name);
expect(await processCloudDemoPage.processFilterCloudComponent.getActiveFilterName()).toBe(PROCESSES.ALL);
await processCloudDemoPage.processListCloudComponent().checkContentIsDisplayedById(completedProcess.entry.id);
});
});
});

View File

@@ -1,175 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
ProcessDefinitionsService,
ProcessHeaderCloudPage,
ProcessInstancesService,
QueryService,
StringUtil,
LocalStorageUtil
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
import { EditProcessFilterConfiguration } from './../config/edit-process-filter.config';
import { DateFnsUtils } from '../../../lib/core/src/lib/common/utils/date-fns-utils';
describe('Process Header cloud component', () => {
describe('Process Header cloud component', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const subProcessApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SUB_PROCESS_APP.name;
const formatDate = 'MMM D, YYYY';
const processHeaderCloudPage = new ProcessHeaderCloudPage();
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const processList = processCloudDemoPage.processListCloudComponent();
const editProcessFilterConfiguration = new EditProcessFilterConfiguration();
const editProcessFilterConfigFile = editProcessFilterConfiguration.getConfiguration();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
let testUser;
let groupInfo;
let runningProcess;
let runningCreatedDate;
let parentCompleteProcess;
let childCompleteProcess;
let completedCreatedDate;
const PROCESSES = CONSTANTS.PROCESS_FILTERS;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const simpleProcess = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.simpleProcess,
simpleApp
);
const processparent = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.SUB_PROCESS_APP.processes.processparent,
subProcessApp
);
runningProcess = await processInstancesService.createProcessInstance(simpleProcess.entry.key, simpleApp, {
name: StringUtil.generateRandomString(),
businessKey: 'test'
});
runningCreatedDate = DateFnsUtils.formatDate(new Date(runningProcess.entry.startDate), formatDate);
parentCompleteProcess = await processInstancesService.createProcessInstance(processparent.entry.key, subProcessApp);
const parentProcessInstance = await queryService.getProcessInstanceSubProcesses(parentCompleteProcess.entry.id, subProcessApp);
childCompleteProcess = parentProcessInstance.list.entries[0];
completedCreatedDate = DateFnsUtils.formatDate(new Date(childCompleteProcess.entry.startDate), formatDate);
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-edit-process-filter', JSON.stringify(editProcessFilterConfigFile));
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
});
it('[C305010] Should display process details for running process', async () => {
await appListCloudComponent.goToApp(simpleApp);
await taskList.checkTaskListIsLoaded();
await processFilter.clickOnProcessFilters();
await processFilter.clickRunningProcessesFilter();
expect(await processFilter.getActiveFilterName()).toBe(PROCESSES.RUNNING);
await editProcessFilter.setFilter({ processName: runningProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(runningProcess.entry.name);
await processList.selectRow(runningProcess.entry.name);
expect(await processHeaderCloudPage.getId()).toEqual(runningProcess.entry.id);
expect(await processHeaderCloudPage.getName()).toEqual(runningProcess.entry.name);
expect(await processHeaderCloudPage.getStatus()).toEqual('RUNNING');
expect(await processHeaderCloudPage.getInitiator()).toEqual(runningProcess.entry.initiator);
expect(await processHeaderCloudPage.getStartDate()).toEqual(runningCreatedDate);
expect(await processHeaderCloudPage.getParentId()).toEqual(CONSTANTS.PROCESS_DETAILS.NO_PARENT);
expect(await processHeaderCloudPage.getBusinessKey()).toEqual(runningProcess.entry.businessKey);
expect(await processHeaderCloudPage.getLastModified()).toEqual(runningCreatedDate);
});
it('[C305008] Should display process details for completed process', async () => {
await appListCloudComponent.goToApp(subProcessApp);
await taskList.checkTaskListIsLoaded();
await processFilter.clickOnProcessFilters();
await processFilter.clickCompletedProcessesFilter();
expect(await processFilter.getActiveFilterName()).toBe(PROCESSES.COMPLETED);
await editProcessFilter.setFilter({ initiator: `${testUser.firstName} ${testUser.lastName}` });
await processList.getDataTable().waitTillContentLoaded();
await processList.checkContentIsDisplayedByName(childCompleteProcess.entry.name);
await processList.checkProcessListIsLoaded();
await processList.selectRowById(childCompleteProcess.entry.id);
expect(await processHeaderCloudPage.getId()).toEqual(childCompleteProcess.entry.id);
expect(await processHeaderCloudPage.getName()).toEqual(CONSTANTS.PROCESS_DETAILS.NO_NAME);
expect(await processHeaderCloudPage.getStatus()).toEqual('COMPLETED');
expect(await processHeaderCloudPage.getInitiator()).toEqual(childCompleteProcess.entry.initiator);
expect(await processHeaderCloudPage.getStartDate()).toEqual(completedCreatedDate);
expect(await processHeaderCloudPage.getParentId()).toEqual(childCompleteProcess.entry.parentId);
expect(await processHeaderCloudPage.getBusinessKey()).toEqual(CONSTANTS.PROCESS_DETAILS.NO_BUSINESS_KEY);
expect(await processHeaderCloudPage.getLastModified()).toEqual(completedCreatedDate);
});
});
});

View File

@@ -1,127 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
BrowserActions,
GroupIdentityService,
IdentityService,
LoginPage,
StartProcessCloudPage,
StringUtil
} from '@alfresco/adf-testing';
import { browser, protractor } from 'protractor';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Start Process', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const processList = processCloudDemoPage.processListCloudComponent();
const startProcessPage = new StartProcessCloudPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const processName = StringUtil.generateRandomString(10);
const processName255Characters = StringUtil.generateRandomString(255);
const processNameBiggerThen255Characters = StringUtil.generateRandomString(256);
const lengthValidationError = 'Length exceeded, 255 characters max.';
const requiredError = 'Process Name is required';
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
let testUser;
let groupInfo;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await loginSSOPage.login(testUser.username, testUser.password);
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
afterEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
});
it('[C291857] Should be possible to cancel a process', async () => {
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
await appListCloudComponent.goToApp(simpleApp);
await processCloudDemoPage.openNewProcessForm();
await startProcessPage.clearField(startProcessPage.processNameInput);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
await startProcessPage.checkValidationErrorIsDisplayed(requiredError);
expect(await startProcessPage.isStartProcessButtonDisabled()).toEqual(true);
await BrowserActions.closeMenuAndDialogs();
await startProcessPage.clickCancelProcessButton();
});
it('[C291842] Should be displayed an error message if process name exceed 255 characters', async () => {
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
await appListCloudComponent.goToApp(simpleApp);
await processCloudDemoPage.openNewProcessForm();
await startProcessPage.selectFirstOptionFromProcessDropdown();
await startProcessPage.enterProcessName(processName255Characters);
expect(await startProcessPage.isStartProcessButtonEnabled()).toEqual(true);
await startProcessPage.enterProcessName(processNameBiggerThen255Characters);
await startProcessPage.checkValidationErrorIsDisplayed(lengthValidationError);
expect(await startProcessPage.isStartProcessButtonDisabled()).toEqual(true);
});
it('[C291860] Should be able to start a process', async () => {
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
await appListCloudComponent.goToApp(simpleApp);
await processCloudDemoPage.openNewProcessForm();
await startProcessPage.selectFirstOptionFromProcessDropdown();
await startProcessPage.clearField(startProcessPage.processNameInput);
await startProcessPage.enterProcessName(processName);
expect(await startProcessPage.isStartProcessButtonEnabled()).toEqual(true);
await startProcessPage.clickStartProcessButton();
await processFilter.clickOnProcessFilters();
await processFilter.clickRunningProcessesFilter();
await editProcessFilter.openFilter();
await editProcessFilter.setProcessName(processName);
expect(await processFilter.getActiveFilterName()).toBe(CONSTANTS.PROCESS_FILTERS.RUNNING);
await processList.checkContentIsDisplayedByName(processName);
});
});

View File

@@ -1,229 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
import {
LoginPage,
AppListCloudPage,
StringUtil,
TaskHeaderCloudPage,
StartTasksCloudPage,
PeopleCloudComponentPage,
TasksService,
createApiService,
IdentityService,
GroupIdentityService
} from '@alfresco/adf-testing';
describe('Start Task', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const startTask = new StartTasksCloudPage();
const peopleCloudComponent = new PeopleCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const standaloneTaskName = StringUtil.generateRandomString(5);
const reassignTaskName = StringUtil.generateRandomString(5);
const unassignedTaskName = StringUtil.generateRandomString(5);
const taskName255Characters = StringUtil.generateRandomString(255);
const taskNameBiggerThen255Characters = StringUtil.generateRandomString(256);
const lengthValidationError = 'Length exceeded, 255 characters max.';
const requiredError = 'Field required';
const dateValidationError = 'Date format DD/MM/YYYY';
let apsUser;
let testUser;
let activitiUser;
let groupInfo;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
apsUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER, identityService.ROLES.ACTIVITI_USER]);
activitiUser = await identityService.createIdentityUser();
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await identityService.addUserToGroup(apsUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
const tasksService = new TasksService(apiService);
let taskId = await tasksService.getTaskId(standaloneTaskName, simpleApp);
await tasksService.deleteTask(taskId, simpleApp);
taskId = await tasksService.getTaskId(unassignedTaskName, simpleApp);
await tasksService.deleteTask(taskId, simpleApp);
await apiService.login(apsUser.username, apsUser.password);
taskId = await tasksService.getTaskId(reassignTaskName, simpleApp);
await tasksService.deleteTask(taskId, simpleApp);
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(activitiUser.idIdentityService);
await identityService.deleteIdentityUser(apsUser.idIdentityService);
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
await appListCloudComponent.goToApp(simpleApp);
await taskList.getDataTable().waitForTableBody();
});
it('[C297675] Should create a task unassigned when assignee field is empty in Start Task form', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await peopleCloudComponent.clearAssigneeFromChip(testUser.username);
await startTask.addName(unassignedTaskName);
await startTask.clickStartButton();
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await taskList.getDataTable().waitForTableBody();
await taskList.checkContentIsDisplayedByName(unassignedTaskName);
const taskId = await taskList.getIdCellValue(unassignedTaskName);
await taskList.selectRow(unassignedTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
expect(await taskHeaderCloudPage.getId()).toBe(taskId);
expect(await taskHeaderCloudPage.getAssignee()).toBe('No assignee');
});
it('[C291956] Should be able to create a new standalone task without assignee', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await peopleCloudComponent.clearAssigneeFromChip(testUser.username);
await startTask.addName(unassignedTaskName);
await startTask.checkStartButtonIsEnabled();
await startTask.clickStartButton();
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('Created');
await editTaskFilter.clearAssignee();
await taskList.checkContentIsDisplayedByName(unassignedTaskName);
});
it('[C290166] Should be possible to cancel a task', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.checkStartButtonIsDisabled();
await startTask.blur(await startTask.name);
await startTask.checkValidationErrorIsDisplayed(requiredError);
await startTask.addName(standaloneTaskName);
await startTask.addDescription('descriptions');
await startTask.addDueDate('12/12/2018');
await startTask.checkStartButtonIsEnabled();
await startTask.clickCancelButton();
await taskList.checkContentIsNotDisplayedByName(standaloneTaskName);
});
it('[C290180] Should be able to create a new standalone task', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(standaloneTaskName);
await startTask.addDescription('descriptions');
await startTask.addDueDate('12/12/2018');
await startTask.addPriority('Normal');
await startTask.clickStartButton();
await taskList.checkContentIsDisplayedByName(standaloneTaskName);
});
it('[C290181] Should be displayed an error message if task name exceed 255 characters', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(taskName255Characters);
await startTask.checkStartButtonIsEnabled();
await startTask.addName(taskNameBiggerThen255Characters);
await startTask.blur(await startTask.name);
await startTask.checkValidationErrorIsDisplayed(lengthValidationError);
await startTask.checkStartButtonIsDisabled();
await startTask.clickCancelButton();
});
it('[C291774] Should be displayed an error message if the date is invalid', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.addDueDate('12/12/2018');
await startTask.checkStartButtonIsEnabled();
await startTask.addDueDate('invalid date');
await startTask.blur(await startTask.dueDate);
await startTask.validateDate(dateValidationError);
await startTask.checkStartButtonIsDisabled();
await startTask.clickCancelButton();
});
it('[C290182] Should be possible to assign the task to another user', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(standaloneTaskName);
await peopleCloudComponent.searchAssigneeAndSelect(`${apsUser.firstName} ${apsUser.lastName}`);
await startTask.checkStartButtonIsEnabled();
await startTask.clickStartButton();
await browser.driver.sleep(1000);
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
});
it('[C305050] Should be able to reassign the removed user when starting a new task', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(reassignTaskName);
await peopleCloudComponent.checkSelectedPeople(`${testUser.firstName} ${testUser.lastName}`);
await peopleCloudComponent.searchAssignee(apsUser.username);
await peopleCloudComponent.checkUserIsDisplayed(`${apsUser.firstName} ${apsUser.lastName}`);
await peopleCloudComponent.selectAssigneeFromList(`${apsUser.firstName} ${apsUser.lastName}`);
await startTask.clickStartButton();
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await taskList.checkContentIsDisplayedByName(reassignTaskName);
await browser.driver.sleep(1000);
await taskList.selectRow(reassignTaskName);
expect(await taskHeaderCloudPage.getAssignee()).toBe(apsUser.username);
});
});

View File

@@ -1,443 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import {
LoginPage,
AppListCloudPage,
BreadcrumbDropdownPage,
StringUtil,
StartTasksCloudPage,
createApiService,
IdentityService,
GroupIdentityService,
TaskFormCloudComponent,
LocalStorageUtil,
TaskHeaderCloudPage,
TasksService,
UploadActions,
ContentNodeSelectorDialogPage,
ProcessInstancesService,
ProcessDefinitionsService,
FileBrowserUtil,
ProcessCloudWidgetPage,
QueryService
} from '@alfresco/adf-testing';
import { StartProcessCloudConfiguration } from './../config/start-process-cloud.config';
import { ProcessCloudDemoPage } from './../pages/process-cloud-demo.page';
import { ProcessDetailsCloudDemoPage } from './../pages/process-details-cloud-demo.page';
import { FileModel } from '../../models/ACS/file.model';
describe('Start Task Form', () => {
const loginSSOPage = new LoginPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const startTask = new StartTasksCloudPage();
const contentNodeSelectorDialogPage = new ContentNodeSelectorDialogPage();
const breadCrumbDropdownPage = new BreadcrumbDropdownPage();
const processDetailsCloudDemoPage = new ProcessDetailsCloudDemoPage();
const widget = new ProcessCloudWidgetPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processList = processCloudDemoPage.processListCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const apiService = createApiService();
const uploadActions = new UploadActions(apiService);
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const queryService = new QueryService(apiService);
const tasksService = new TasksService(apiService);
const startProcessCloudConfiguration = new StartProcessCloudConfiguration();
const startProcessCloudConfig = startProcessCloudConfiguration.getConfiguration();
const standaloneTaskName = StringUtil.generateRandomString(5);
let testUser;
let groupInfo;
let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService;
let processDefinition;
let uploadLocalFileProcess;
let uploadContentFileProcess;
let uploadDefaultFileProcess;
let cancelUploadFileProcess;
let completeUploadFileProcess;
let downloadContentFileProcess;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const pdfFile = new FileModel({ name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name });
const pdfFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
});
const testFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_path
});
const folderName = StringUtil.generateRandomString(5);
let uploadedFolder;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
processDefinitionService = new ProcessDefinitionsService(apiService);
processInstancesService = new ProcessInstancesService(apiService);
processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.uploadFileProcess,
candidateBaseApp
);
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
uploadLocalFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
uploadContentFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
const task = await queryService.getProcessInstanceTasks(uploadContentFileProcess.entry.id, candidateBaseApp);
await tasksService.claimTask(task.list.entries[0].entry.id, candidateBaseApp);
uploadDefaultFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
cancelUploadFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
completeUploadFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
downloadContentFileProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp, {
name: StringUtil.generateRandomString(),
businessKey: StringUtil.generateRandomString()
});
await apiService.login(testUser.username, testUser.password);
uploadedFolder = await uploadActions.createFolder(folderName, '-my-');
await uploadActions.uploadFile(testFileModel.location, testFileModel.name, uploadedFolder.entry.id);
await uploadActions.uploadFile(pdfFileModel.location, pdfFileModel.name, uploadedFolder.entry.id);
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-start-process', JSON.stringify(startProcessCloudConfig));
});
afterAll(async () => {
await uploadActions.deleteFileOrFolder(uploadedFolder.entry.id);
await apiService.login(testUser.username, testUser.password);
const standaloneTaskId = await tasksService.getTaskId(standaloneTaskName, candidateBaseApp);
await tasksService.deleteTask(standaloneTaskId, candidateBaseApp);
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
describe('StandaloneTask with form', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.checkAppIsDisplayed(candidateBaseApp);
await appListCloudComponent.goToApp(candidateBaseApp);
await taskList.getDataTable().waitForTableBody();
});
it('[C307976] Should be able to start and save a task with a form', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.addName(standaloneTaskName);
await startTask.selectFormDefinition(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.starteventform);
await startTask.clickStartButton();
await taskList.checkContentIsDisplayedByName(standaloneTaskName);
await taskList.selectRow(standaloneTaskName);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('FirstName');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number07vyx9');
await widget.textWidget().setValue('FirstName', 'sample');
await widget.numberWidget().setFieldValue('Number07vyx9', 26);
await taskFormCloudComponent.checkSaveButtonIsDisplayed();
await taskFormCloudComponent.clickSaveButton();
expect(await widget.textWidget().getFieldValue('FirstName')).toBe('sample');
expect(await widget.numberWidget().getFieldValue('Number07vyx9')).toBe('26');
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.checkAppIsDisplayed(candidateBaseApp);
await appListCloudComponent.goToApp(candidateBaseApp);
await taskList.getDataTable().waitForTableBody();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsDisplayedByName(standaloneTaskName);
await taskList.selectRow(standaloneTaskName);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
expect(await widget.textWidget().getFieldValue('FirstName')).toBe('sample');
expect(await widget.numberWidget().getFieldValue('Number07vyx9')).toBe('26');
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
});
it('[C311428] Should display the Standalone forms based on the flag set', async () => {
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
await startTask.checkFormDefinitionIsNotDisplayed(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.uploadfileform);
await startTask.checkFormDefinitionIsDisplayed(browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.starteventform);
await startTask.checkFormDefinitionIsDisplayed(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.formtotestvalidations
);
});
});
describe('Attach content to process-cloud task form using upload widget', async () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.checkAppIsDisplayed(candidateBaseApp);
await appListCloudComponent.goToApp(candidateBaseApp);
await processFilter.clickOnProcessFilters();
await processFilter.clickRunningProcessesFilter();
await processList.checkProcessListIsLoaded();
});
it('[C310358] Should be able to attach a file to a form from local', async () => {
await editProcessFilter.setFilter({ processName: uploadLocalFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadLocalFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
await taskFormCloudComponent.clickClaimButton();
const localFileWidget = widget.attachFileWidgetCloud('Attachlocalfile');
await localFileWidget.clickAttachContentFile('Attachlocalfile');
await contentNodeSelectorDialogPage.attachFilesFromLocal([pdfFile]);
await localFileWidget.checkFileIsAttached(pdfFile.name);
await localFileWidget.removeFile(pdfFile.name);
await localFileWidget.checkFileIsNotAttached(pdfFile.name);
});
it('[C311285] Should be able to attach a file to a form from acs repository', async () => {
await editProcessFilter.setFilter({ processName: uploadContentFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadContentFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.attachFileFromContentNode(folderName, testFileModel.name);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.removeFile(testFileModel.name);
await contentFileWidget.checkFileIsNotAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsDisplayed('Attachsinglecontentfile');
});
it('[C311287] Content node selector default location when attaching a file to a form from acs repository', async () => {
await editProcessFilter.setFilter({ processName: uploadDefaultFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadDefaultFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
await taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.checkDialogIsDisplayed();
expect(await breadCrumbDropdownPage.getTextOfCurrentFolder()).toBe(testUser.username);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowContentIsDisplayed(folderName);
expect(await contentNodeSelectorDialogPage.checkCancelButtonIsEnabled()).toBe(true);
expect(await contentNodeSelectorDialogPage.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(folderName);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(folderName);
expect(await contentNodeSelectorDialogPage.checkCancelButtonIsEnabled()).toBe(true);
expect(await contentNodeSelectorDialogPage.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelectorDialogPage.clickCancelButton();
await contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
});
it('[C311288] No file should be attached when canceling the content node selector', async () => {
await editProcessFilter.setFilter({ processName: cancelUploadFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(cancelUploadFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
await taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.checkDialogIsDisplayed();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowContentIsDisplayed(folderName);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
await contentNodeSelectorDialogPage.clickCancelButton();
await contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
await contentFileWidget.checkFileIsNotAttached(testFileModel.name);
});
it('[C311289] Should be able to attach single file', async () => {
await editProcessFilter.setFilter({ processName: uploadContentFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadContentFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.attachFileFromContentNode(folderName, testFileModel.name);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
it('[C311292] Attached file is not displayed anymore after release if the form is not saved', async () => {
await editProcessFilter.setFilter({ processName: uploadContentFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadContentFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.attachFileFromContentNode(folderName, testFileModel.name);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
await taskFormCloudComponent.clickReleaseButton();
await taskFormCloudComponent.clickClaimButton();
await contentFileWidget.checkFileIsNotAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsDisplayed('Attachsinglecontentfile');
});
it('[C311293] Attached file is displayed after release if the form was saved', async () => {
await editProcessFilter.setFilter({ processName: uploadContentFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(uploadContentFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.attachFileFromContentNode(folderName, testFileModel.name);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
await taskFormCloudComponent.clickSaveButton();
await taskFormCloudComponent.clickReleaseButton();
await taskFormCloudComponent.clickClaimButton();
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
it('[C311295] Attached file is displayed after complete', async () => {
await editProcessFilter.setFilter({ processName: completeUploadFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(completeUploadFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
await taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.attachFileFromContentNode(folderName, testFileModel.name);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
const taskId = await taskHeaderCloudPage.getId();
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsNotDisplayedById(taskId);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedById(taskId);
await taskList.selectRowByTaskId(taskId);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.checkUploadContentButtonIsNotDisplayed('Attachsinglecontentfile');
});
it('[C315292] Should be able to download attached file from acs repository', async () => {
await editProcessFilter.setFilter({ processName: downloadContentFileProcess.entry.name });
await processList.getDataTable().waitTillContentLoaded();
await processList.selectRow(downloadContentFileProcess.entry.name);
await processDetailsCloudDemoPage.checkTaskIsDisplayed('UploadFileTask');
await processDetailsCloudDemoPage.selectProcessTaskByName('UploadFileTask');
await taskFormCloudComponent.clickClaimButton();
const contentFileWidget = widget.attachFileWidgetCloud('Attachsinglecontentfile');
await contentFileWidget.clickAttachContentFile('Attachsinglecontentfile');
await contentNodeSelectorDialogPage.checkDialogIsDisplayed();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().doubleClickRowByContent(folderName);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().waitTillContentLoaded();
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().clickRowByContent(testFileModel.name);
await contentNodeSelectorDialogPage.contentListPage().dataTablePage().checkRowByContentIsSelected(testFileModel.name);
await contentNodeSelectorDialogPage.clickMoveCopyButton();
await contentNodeSelectorDialogPage.checkDialogIsNotDisplayed();
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.downloadFile(testFileModel.name);
await FileBrowserUtil.isFileDownloaded(testFileModel.name);
const taskId = await taskHeaderCloudPage.getId();
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsNotDisplayedById(taskId);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedById(taskId);
await taskList.selectRowByTaskId(taskId);
await contentFileWidget.checkFileIsAttached(testFileModel.name);
await contentFileWidget.downloadFile(testFileModel.name);
await FileBrowserUtil.isFileDownloaded(testFileModel.name);
});
});
});

View File

@@ -1,172 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from '.././pages/tasks-cloud-demo.page';
import {
LoginPage,
AppListCloudPage,
StringUtil,
GroupCloudComponentPage,
StartTasksCloudPage,
PeopleCloudComponentPage,
TasksService, createApiService,
IdentityService,
GroupIdentityService
} from '@alfresco/adf-testing';
describe('Start Task - Group Cloud Component', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const startTask = new StartTasksCloudPage();
const peopleCloudComponent = new PeopleCloudComponentPage();
const groupCloud = new GroupCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const bothGroupsTaskName = StringUtil.generateRandomString(5);
const oneGroupTaskName = StringUtil.generateRandomString(5);
let apsUser; let testUser; let hrGroup; let testGroup;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUser();
hrGroup = await groupIdentityService.getGroupInfoByGroupName('hr');
apsUser = await identityService.createIdentityUser();
testGroup = await groupIdentityService.getGroupInfoByGroupName('testgroup');
await identityService.addUserToGroup(testUser.idIdentityService, hrGroup.id);
await identityService.addUserToGroup(apsUser.idIdentityService, testGroup.id);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.login(testUser.username, testUser.password);
const tasksService = new TasksService(apiService);
const bothGroupsTaskId = await tasksService.getTaskId(bothGroupsTaskName, simpleApp);
await tasksService.deleteTask(bothGroupsTaskId, simpleApp);
const oneGroupTaskId = await tasksService.getTaskId(oneGroupTaskName, simpleApp);
await tasksService.deleteTask(oneGroupTaskId, simpleApp);
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(apsUser.idIdentityService);
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.checkAppIsDisplayed(simpleApp);
await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
await tasksCloudDemoPage.openNewTaskForm();
await startTask.checkFormIsDisplayed();
});
it('[C291954] Should be able to select/delete an group for a standalone task', async () => {
await peopleCloudComponent.clearAssignee();
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsDisplayed(testGroup.name);
await groupCloud.selectGroupFromList(testGroup.name);
await groupCloud.checkSelectedGroup(testGroup.name);
await groupCloud.searchGroups(hrGroup.name);
await groupCloud.checkGroupIsDisplayed(hrGroup.name);
await groupCloud.selectGroupFromList(hrGroup.name);
await groupCloud.checkSelectedGroup(hrGroup.name);
await groupCloud.removeSelectedGroup(testGroup.name);
await groupCloud.checkGroupNotSelected(testGroup.name);
await startTask.addName(oneGroupTaskName);
await startTask.clickStartButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(oneGroupTaskName);
});
it('[C291955] Should be able to select multiple groups when the selection mode=multiple', async () => {
await peopleCloudComponent.clearAssignee();
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsDisplayed(testGroup.name);
await groupCloud.selectGroupFromList(testGroup.name);
await groupCloud.checkSelectedGroup(testGroup.name);
await groupCloud.searchGroups(hrGroup.name);
await groupCloud.checkGroupIsDisplayed(hrGroup.name);
await groupCloud.selectGroupFromList(hrGroup.name);
await groupCloud.checkSelectedGroup(hrGroup.name);
await startTask.addName(bothGroupsTaskName);
await startTask.clickStartButton();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitForTableBody();
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(bothGroupsTaskName);
});
it('[C291993] Should NOT be able to find a group already selected', async () => {
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsDisplayed(testGroup.name);
await groupCloud.selectGroupFromList(testGroup.name);
await groupCloud.checkSelectedGroup(testGroup.name);
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsNotDisplayed(testGroup.name);
});
it('[C291995] Should be able to add a group previously removed', async () => {
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsDisplayed(testGroup.name);
await groupCloud.selectGroupFromList(testGroup.name);
await groupCloud.checkSelectedGroup(testGroup.name);
await groupCloud.removeSelectedGroup(testGroup.name);
await browser.sleep(1000);
await groupCloud.checkGroupNotSelected(testGroup.name);
await groupCloud.searchGroups(testGroup.name);
await groupCloud.checkGroupIsDisplayed(testGroup.name);
await groupCloud.selectGroupFromList(testGroup.name);
await groupCloud.checkSelectedGroup(testGroup.name);
});
});

View File

@@ -1,191 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, AppListCloudPage, GroupIdentityService, IdentityService, LoginPage } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { ProcessCloudDemoPage } from '../pages/process-cloud-demo.page';
import { TasksCloudDemoPage } from '../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Edit process filters cloud', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const processCloudDemoPage = new ProcessCloudDemoPage();
const editProcessFilter = processCloudDemoPage.editProcessFilterCloudComponent();
const processFilter = processCloudDemoPage.processFilterCloudComponent;
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
let testUser;
let groupInfo;
const PROCESSES = CONSTANTS.PROCESS_FILTERS;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await tasksCloudDemoPage.taskListCloudComponent().checkTaskListIsLoaded();
await processFilter.clickOnProcessFilters();
await editProcessFilter.openFilter();
await processFilter.clickAllProcessesFilter();
});
it('[C291804] Delete Save and Save as actions should be displayed when clicking on default filter header', async () => {
await processFilter.clickAllProcessesFilter();
expect(await processFilter.getActiveFilterName()).toBe('All');
await editProcessFilter.checkSaveButtonIsDisplayed();
await editProcessFilter.checkSaveAsButtonIsDisplayed();
await editProcessFilter.checkDeleteButtonIsDisplayed();
});
it('[C586757] Delete Save and Save as actions should be displayed and enabled when clicking on custom filter header', async () => {
await createNewProcessCustomFilter('New');
expect(await processFilter.getActiveFilterName()).toBe('New');
await processFilter.clickProcessFilter('custom-new');
await editProcessFilter.setSortFilterDropDown('Start Date');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
expect(await editProcessFilter.getOrderFilterDropDownValue()).toEqual('Descending');
expect(await editProcessFilter.getStateFilterDropDownValue()).toEqual('All');
await editProcessFilter.checkSaveButtonIsDisplayed();
await editProcessFilter.checkSaveAsButtonIsDisplayed();
await editProcessFilter.checkDeleteButtonIsDisplayed();
expect(await editProcessFilter.isCustomFilterNameDisplayed('New')).toEqual(true);
expect(await editProcessFilter.checkSaveButtonIsEnabled()).toEqual(true);
expect(await editProcessFilter.checkSaveAsButtonIsEnabled()).toEqual(true);
expect(await editProcessFilter.checkDeleteButtonIsEnabled()).toEqual(true);
});
it('[C291805] New process filter is added when clicking Save As button', async () => {
await createNewProcessCustomFilter('New');
expect(await processFilter.getActiveFilterName()).toBe('New');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await processFilter.clickAllProcessesFilter();
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await processFilter.clickProcessFilter('custom-new');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await editProcessFilter.clickDeleteButton();
});
it('[C291807] A process filter is updated when clicking on save button', async () => {
await createNewProcessCustomFilter('New');
expect(await processFilter.getActiveFilterName()).toBe('New');
await editProcessFilter.setSortFilterDropDown('Process Name');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Process Name');
await editProcessFilter.clickSaveButton();
expect(await processFilter.getActiveFilterName()).toBe('New');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Process Name');
await editProcessFilter.clickDeleteButton();
});
it('[C291808] A process filter is deleted when clicking on delete button', async () => {
await createNewProcessCustomFilter('New');
expect(await processFilter.getActiveFilterName()).toBe('New');
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Id');
await editProcessFilter.clickDeleteButton();
await browser.driver.sleep(1000);
expect(await processFilter.getActiveFilterName()).toBe(CONSTANTS.PROCESS_FILTERS.RUNNING);
await processFilter.checkProcessFilterNotDisplayed('New');
});
it('[C291810] Process filter should not be created when process filter dialog is closed', async () => {
await editProcessFilter.setSortFilterDropDown('Id');
await editProcessFilter.clickSaveAsButton();
await editProcessFilter.editProcessFilterDialog().setFilterName('Cancel');
expect(await editProcessFilter.editProcessFilterDialog().getFilterName()).toEqual('Cancel');
await editProcessFilter.editProcessFilterDialog().clickOnCancelButton();
await processFilter.checkProcessFilterNotDisplayed('Cancel');
expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.ALL);
await processFilter.clickRunningProcessesFilter();
expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.RUNNING);
await processFilter.clickAllProcessesFilter();
expect(await processFilter.getActiveFilterName()).toEqual(PROCESSES.ALL);
expect(await editProcessFilter.getSortFilterDropDownValue()).toEqual('Start Date');
await editProcessFilter.closeFilter();
});
it('[C291811] Save button of process filter dialog should be disabled when process name is empty ', async () => {
await editProcessFilter.setSortFilterDropDown('Id');
await editProcessFilter.clickSaveAsButton();
const dialog = editProcessFilter.editProcessFilterDialog();
await dialog.clearFilterName();
expect(await dialog.getFilterName()).toEqual('');
expect(await dialog.checkSaveButtonIsEnabled()).toEqual(false);
expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
await dialog.clickOnCancelButton();
});
it('[C291809] Process filter dialog is displayed when clicking on Save As button', async () => {
await editProcessFilter.setSortFilterDropDown('Name');
await editProcessFilter.clickSaveAsButton();
const dialog = editProcessFilter.editProcessFilterDialog();
await dialog.clearFilterName();
expect(await dialog.checkCancelButtonIsEnabled()).toEqual(true);
expect(await dialog.checkSaveButtonIsEnabled()).toEqual(false);
expect(await dialog.getTitle()).toEqual('Save filter as');
expect(await dialog.getFilterName()).toEqual('');
await dialog.clickOnCancelButton();
});
/**
* Create a new process custom filter
*
* @param name Filter name
* @param sort Sort value
*/
async function createNewProcessCustomFilter(name: string, sort = 'Id'): Promise<void> {
await processFilter.clickAllProcessesFilter();
await editProcessFilter.setSortFilterDropDown(sort);
await editProcessFilter.saveAs(name);
}
});

View File

@@ -1,360 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
AppListCloudPage,
StringUtil,
createApiService,
LoginPage,
TasksService,
IdentityService,
GroupIdentityService,
EditTaskFilterDialogPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Edit task filters cloud', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const editTaskFilterDialog = new EditTaskFilterDialogPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
let testUser;
let groupInfo;
const completedTaskName = StringUtil.generateRandomString();
const assignedTaskName = StringUtil.generateRandomString();
/**
* Click on the specified task filter
*
* @param name filter name
*/
async function clickTaskFilter(name: string) {
await taskFilter.clickTaskFilter(name);
}
/**
* Wait till the datatable component is loaded
*/
async function waitTillContentLoaded() {
await tasksCloudDemoPage.taskListCloudComponent().getDataTable().waitTillContentLoaded();
}
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
const assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
await tasksService.claimTask(assignedTask.entry.id, simpleApp);
await tasksService.createAndCompleteTask(completedTaskName, simpleApp);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
afterEach(async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
});
it('[C291785] All the filters property should be set up accordingly with the Query Param', async () => {
await editTaskFilter.openFilter();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
expect(await editTaskFilter.getStatusFilterDropDownValue()).toEqual('Assigned');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
expect(await editTaskFilter.getOrderFilterDropDownValue()).toEqual('Descending');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(assignedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(completedTaskName);
await clickTaskFilter('completed-tasks');
await waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
expect(await editTaskFilter.getStatusFilterDropDownValue()).toEqual('Completed');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
expect(await editTaskFilter.getOrderFilterDropDownValue()).toEqual('Descending');
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsNotDisplayedByName(assignedTaskName);
await tasksCloudDemoPage.taskListCloudComponent().checkContentIsDisplayedByName(completedTaskName);
await editTaskFilter.closeFilter();
});
it('[C306896] Delete Save and Save as actions should be displayed and disabled when clicking on default filter header', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.checkSaveButtonIsDisplayed();
await editTaskFilter.checkSaveAsButtonIsDisplayed();
await editTaskFilter.checkDeleteButtonIsDisplayed();
expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(false);
expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(false);
expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(false);
await editTaskFilter.closeFilter();
});
it('[C586756] Delete, Save and Save as actions should be displayed and enabled when clicking on custom filter header', async () => {
await createNewCustomFilter('New');
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.checkSaveButtonIsDisplayed();
await editTaskFilter.checkSaveAsButtonIsDisplayed();
await editTaskFilter.checkDeleteButtonIsDisplayed();
expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(true);
expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(true);
expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(true);
});
it('[C291795] New filter is added when clicking Save As button', async () => {
await createNewCustomFilter('New');
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.openFilter();
expect(await editTaskFilter.checkSaveButtonIsEnabled()).toEqual(false);
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
expect(await editTaskFilter.checkSaveAsButtonIsEnabled()).toEqual(false);
expect(await editTaskFilter.checkDeleteButtonIsEnabled()).toEqual(true);
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
});
it('[C291796] Two filters with same name can be created when clicking the Save As button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.openFilter();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.clickSaveAsButton();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.openFilter();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('priority');
await editTaskFilter.clickDeleteButton();
await clickTaskFilter('custom-new');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
});
it('[C291797] A filter is overridden when clicking on save button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.openFilter();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.setSortFilterDropDown('name');
await editTaskFilter.clickSaveButton();
await editTaskFilter.openFilter();
expect(await taskFilter.getActiveFilterName()).toBe('New');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('name');
await editTaskFilter.clickDeleteButton();
});
it('[C291798] A filter is deleted when clicking on delete button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
await editTaskFilterDialog.setFilterName('New');
await editTaskFilterDialog.clickOnSaveButton();
expect(await taskFilter.getActiveFilterName()).toBe('New');
await editTaskFilter.openFilter();
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickDeleteButton();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskFilter.checkTaskFilterNotDisplayed('New');
});
it('[C291800] Task filter should not be created when task filter dialog is closed', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('priority');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('priority');
await editTaskFilter.clickSaveAsButton();
expect(await editTaskFilterDialog.getFilterName()).toEqual('My Tasks');
await editTaskFilterDialog.setFilterName('Cancel');
expect(await editTaskFilterDialog.getFilterName()).toEqual('Cancel');
await editTaskFilterDialog.clickOnCancelButton();
await taskFilter.checkTaskFilterNotDisplayed('Cancel');
expect(await taskFilter.getActiveFilterName()).toEqual('My Tasks');
await clickTaskFilter('completed-tasks');
await waitTillContentLoaded();
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('createdDate');
await editTaskFilter.closeFilter();
});
it('[C291801] Save button of task filter dialog should be disabled when task name is empty', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickSaveAsButton();
expect(await editTaskFilterDialog.getFilterName()).toEqual('My Tasks');
await editTaskFilterDialog.clearFilterName();
expect(await editTaskFilterDialog.getFilterName()).toEqual('');
expect(await editTaskFilterDialog.checkSaveButtonIsEnabled()).toEqual(false);
expect(await editTaskFilterDialog.checkCancelButtonIsEnabled()).toEqual(true);
await editTaskFilterDialog.clickOnCancelButton();
});
it('[C291799] Task filter dialog is displayed when clicking on Save As button', async () => {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
expect(await editTaskFilter.getSortFilterDropDownValue()).toEqual('id');
await editTaskFilter.clickSaveAsButton();
expect(await editTaskFilterDialog.checkSaveButtonIsEnabled()).toEqual(true);
expect(await editTaskFilterDialog.checkCancelButtonIsEnabled()).toEqual(true);
expect(await editTaskFilterDialog.getTitle()).toEqual('Save filter as');
expect(await editTaskFilterDialog.getFilterName()).toEqual('My Tasks');
await editTaskFilterDialog.clickOnCancelButton();
});
/**
* Creates new custom filter
*
* @param name Filter name
*/
async function createNewCustomFilter(name: string): Promise<void> {
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.openFilter();
await editTaskFilter.setSortFilterDropDown('id');
await clickTaskFilter('my-tasks');
await waitTillContentLoaded();
await editTaskFilter.clickSaveAsButton();
await editTaskFilterDialog.setFilterName(name);
await editTaskFilterDialog.clickOnSaveButton();
}
});

View File

@@ -1,117 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
LoginPage,
TasksService,
createApiService,
AppListCloudPage,
StringUtil,
IdentityService,
GroupIdentityService,
QueryService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task filters cloud', () => {
describe('Task Filters', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = createApiService();
const queryService = new QueryService(apiService);
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
let testUser;
let groupInfo;
const newTask = StringUtil.generateRandomString(5);
const completedTask = StringUtil.generateRandomString(5);
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C290009] Should display default filters and created task', async () => {
const task = await tasksService.createStandaloneTask(newTask, simpleApp);
await tasksService.claimTask(task.entry.id, simpleApp);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsNotDisplayedByName(newTask);
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsDisplayedByName(newTask);
});
it('[C289955] Should display task in Complete Tasks List when task is completed', async () => {
const toBeCompletedTask = await tasksService.createStandaloneTask(completedTask, simpleApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, simpleApp);
await tasksService.completeTask(toBeCompletedTask.entry.id, simpleApp);
await queryService.getTaskByStatus(toBeCompletedTask.entry.name, simpleApp, 'COMPLETED');
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsNotDisplayedByName(completedTask);
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsDisplayedByName(completedTask);
});
});
});

View File

@@ -1,391 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
AppListCloudPage,
StringUtil,
createApiService,
LoginPage,
TasksService,
ProcessDefinitionsService,
ProcessInstancesService,
TaskHeaderCloudPage,
TaskFormCloudComponent,
IdentityService,
GroupIdentityService,
ProcessCloudWidgetPage,
FormCloudService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task form cloud component', () => {
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new ProcessCloudWidgetPage();
let processDefinitionService: ProcessDefinitionsService;
let processInstancesService: ProcessInstancesService;
let identityService: IdentityService;
let completedTask;
let assigneeTask;
let toBeCompletedTask;
let formValidationsTask;
let testUser;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const completedTaskName = StringUtil.generateRandomString();
const assignedTaskName = StringUtil.generateRandomString();
const apiService = createApiService();
const apiServiceHrUser = createApiService();
const visibilityConditionTasks = [];
const tab = {
tabWithFields: 'tabWithFields',
tabFieldValue: 'tabBasicFieldValue',
tabVarValue: 'tabBasicVarValue',
tabVarField: 'tabBasicVarField',
tabFieldField: 'tabBasicFieldField',
tabVarVar: 'tabBasicVarVar',
tabFieldVar: 'tabBasicFieldVar',
tabNextOperators: 'tabNextOperators',
tabMultipleConditions: 'tabMultipleConditions'
};
const widgets = {
textOneId: 'TextOne',
textTwoId: 'TextTwo',
textThreeId: 'TextThree',
textFourId: 'TextFour',
numberOneId: 'NumberOne'
};
const value = {
displayTab: 'showTab',
notDisplayTab: 'anythingElse'
};
const myTasksFilter = 'my-tasks';
const myTasksFilterTitle = 'My Tasks';
const completedTasksFilter = 'completed-tasks';
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiServiceHrUser.login(testUser.username, testUser.password);
const tasksService = new TasksService(apiServiceHrUser);
assigneeTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(assigneeTask.entry.id, candidateBaseApp);
const formCloudService = new FormCloudService(apiServiceHrUser);
const tabVisibilityFieldsId = await formCloudService.getIdByFormName(
simpleApp,
browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.tabVisibilityFields.name
);
const tabVisibilityVarsId = await formCloudService.getIdByFormName(
simpleApp,
browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms.tabVisibilityVars.name
);
for (let i = 0; i < 4; i++) {
visibilityConditionTasks[i] = await tasksService.createStandaloneTaskWithForm(
StringUtil.generateRandomString(),
simpleApp,
tabVisibilityFieldsId
);
await tasksService.claimTask(visibilityConditionTasks[i].entry.id, simpleApp);
}
for (let i = 4; i < 7; i++) {
visibilityConditionTasks[i] = await tasksService.createStandaloneTaskWithForm(
StringUtil.generateRandomString(),
simpleApp,
tabVisibilityVarsId
);
await tasksService.claimTask(visibilityConditionTasks[i].entry.id, simpleApp);
}
const formToTestValidationsKey = await formCloudService.getIdByFormName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name,
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.formtotestvalidations
);
formValidationsTask = await tasksService.createStandaloneTaskWithForm(
StringUtil.generateRandomString(),
candidateBaseApp,
formToTestValidationsKey
);
await tasksService.claimTask(formValidationsTask.entry.id, candidateBaseApp);
toBeCompletedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, candidateBaseApp);
completedTask = await tasksService.createStandaloneTask(assignedTaskName, candidateBaseApp);
await tasksService.claimTask(completedTask.entry.id, candidateBaseApp);
await tasksService.createAndCompleteTask(completedTaskName, candidateBaseApp);
processDefinitionService = new ProcessDefinitionsService(apiServiceHrUser);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes.candidateUserProcess,
candidateBaseApp
);
processInstancesService = new ProcessInstancesService(apiServiceHrUser);
await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
await loginSSOPage.login(testUser.username, testUser.password);
}, 5 * 60 * 1000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
afterAll(async () => {
try {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
} catch (error) {}
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
describe('Complete task with form - cloud directive', () => {
it('[C315174] Should be able to complete a standalone task with visible tab with empty value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[0].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[0].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[0].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldValue);
});
it('[C315177] Should be able to complete a standalone task with invisible tab with invalid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[1].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldField);
await widget.tab().clickTabByLabel(tab.tabFieldField);
await widget.textWidget().isWidgetVisible(widgets.numberOneId);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[1].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[1].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldField);
});
it('[C315178] Should be able to complete a standalone task with invisible tab with valid value', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[2].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textFourId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabFieldVar);
await widget.tab().clickTabByLabel(tab.tabFieldVar);
await widget.textWidget().isWidgetVisible(widgets.textFourId);
await widget.textWidget().setValue(widgets.textFourId, value.displayTab);
await widget.tab().clickTabByLabel(tab.tabWithFields);
await widget.textWidget().setValue(widgets.textOneId, value.notDisplayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[2].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[2].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabFieldVar);
});
it('[C315175] Should be able to complete a standalone task with invisible tab with empty value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[4].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarValue);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.textTwoId);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[4].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[4].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarValue);
});
it('[C315176] Should not be able to complete a standalone task with visible tab with invalid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[5].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabVarField);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().isWidgetNotVisible(widgets.numberOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarField);
await widget.tab().clickTabByLabel(tab.tabVarField);
await widget.textWidget().setValue(widgets.numberOneId, value.displayTab);
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toEqual(false);
});
it('[C315179] Should be able to complete a standalone task with visible tab with valid value for field', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[6].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.tab().clickTabByLabel(tab.tabVarVar);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[6].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[6].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabVarVar);
});
it('[C315180] Should be able to complete a standalone task with tab when has multiple visibility conditions and next condition operators', async () => {
await chooseFilter(myTasksFilter, myTasksFilterTitle);
await selectTaskByName(visibilityConditionTasks[3].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabMultipleConditions);
await widget.textWidget().isWidgetVisible(widgets.textOneId);
await widget.textWidget().setValue(widgets.textOneId, value.displayTab);
await widget.textWidget().isWidgetVisible(widgets.textThreeId);
await widget.textWidget().setValue(widgets.textThreeId, value.displayTab);
await widget.tab().checkTabIsNotDisplayedByLabel(tab.tabMultipleConditions);
await widget.textWidget().setValue(widgets.textThreeId, value.notDisplayTab);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabMultipleConditions);
await taskFormCloudComponent.clickCompleteButton();
expect(await taskFilter.getActiveFilterName()).toBe(myTasksFilterTitle);
await taskList.checkContentIsNotDisplayedByName(visibilityConditionTasks[3].entry.name);
await chooseFilterAndSelectTaskByName(completedTasksFilter, visibilityConditionTasks[3].entry.name);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabWithFields);
await widget.tab().checkTabIsDisplayedByLabel(tab.tabMultipleConditions);
});
/**
* Choose a filter and select a task by name
*
* @param filterName Filter name
* @param taskName Task name
*/
async function chooseFilterAndSelectTaskByName(filterName: string, taskName: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
}
/**
* Select a task by name
*
* @param taskName Task name
*/
async function selectTaskByName(taskName: string): Promise<void> {
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
}
/**
* Choose a filter
*
* @param filterName Filter name
* @param filterTitle Filter title
*/
async function chooseFilter(filterName: string, filterTitle: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe(filterTitle);
}
});
});

View File

@@ -1,460 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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, protractor } from 'protractor';
import {
createApiService,
AppListCloudPage,
LoginPage,
ProcessCloudWidgetPage,
ProcessDefinitionsService,
ProcessInstancesService,
QueryService,
StringUtil,
TaskFormCloudComponent,
TaskHeaderCloudPage,
TasksService,
FormCloudService,
Logger
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task form cloud component', () => {
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const candidateBaseAppProcesses = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.processes;
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const simpleAppProcess = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes;
const simpleAppForm = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.forms;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const widget = new ProcessCloudWidgetPage();
const apiService = createApiService();
const tasksService = new TasksService(apiService);
const queryService = new QueryService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const formCloudService = new FormCloudService(apiService);
const completedTaskName = StringUtil.generateRandomString();
const assignedTaskName = StringUtil.generateRandomString();
const myTasksFilter = 'my-tasks';
const completedTasksFilter = 'completed-tasks';
const dateFieldId = 'Date0rzbb6';
const defaultDate = '2020-07-09';
const changedDate = '2020-07-10';
const dropdownFieldId = 'DropdownOptions';
let completedTask;
let createdTask;
let assigneeTask;
let toBeCompletedTask;
let formValidationsTask;
let formTaskId;
let assigneeTaskId;
let assigneeReleaseTask;
let candidateUsersTask;
let dateTimerTaskId;
let dateTimerTask;
let dateTimerChangedTaskId;
let dateTimerChangedTask;
let dropdownOptionsTask;
beforeAll(async () => {
try {
await apiService.loginWithProfile('hrUser');
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
assigneeTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(assigneeTask.entry.id, candidateBaseApp);
const formToTestValidationsKey = await formCloudService.getIdByFormName(
candidateBaseApp,
browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.forms.formtotestvalidations
);
formValidationsTask = await tasksService.createStandaloneTaskWithForm(
StringUtil.generateRandomString(),
candidateBaseApp,
formToTestValidationsKey
);
await tasksService.claimTask(formValidationsTask.entry.id, candidateBaseApp);
toBeCompletedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(toBeCompletedTask.entry.id, candidateBaseApp);
completedTask = await tasksService.createStandaloneTask(assignedTaskName, candidateBaseApp);
await tasksService.claimTask(completedTask.entry.id, candidateBaseApp);
await tasksService.createAndCompleteTask(completedTaskName, candidateBaseApp);
let processDefinition = await processDefinitionService.getProcessDefinitionByName(
candidateBaseAppProcesses.candidateUserProcess,
candidateBaseApp
);
const candidateUsersProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
const processInstanceTasks = await queryService.getProcessInstanceTasks(candidateUsersProcessInstance.entry.id, candidateBaseApp);
candidateUsersTask = processInstanceTasks.list.entries[0];
await tasksService.claimTask(candidateUsersTask.entry.id, candidateBaseApp);
processDefinition = await processDefinitionService.getProcessDefinitionByName(
candidateBaseAppProcesses.candidateUserProcess,
candidateBaseApp
);
const formProcess = await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateBaseApp);
const formTasks = await queryService.getProcessInstanceTasks(formProcess.entry.id, candidateBaseApp);
formTaskId = formTasks.list.entries[0].entry.id;
const dropdownOptionsId = await formCloudService.getIdByFormName(simpleApp, simpleAppForm.dropdownWithOptions.name);
dropdownOptionsTask = await tasksService.createStandaloneTaskWithForm(StringUtil.generateRandomString(), simpleApp, dropdownOptionsId);
await tasksService.claimTask(dropdownOptionsTask.entry.id, simpleApp);
const timerProcessDefinition = await processDefinitionService.getProcessDefinitionByName(
simpleAppProcess.intermediateDateProcessVarTimer,
simpleApp
);
const dateTimerProcess = await processInstancesService.createProcessInstance(timerProcessDefinition.entry.key, simpleApp);
dateTimerTask = await queryService.getProcessInstanceTasks(dateTimerProcess.entry.id, simpleApp);
dateTimerTaskId = dateTimerTask.list.entries[0].entry.id;
const timerChangedProcessDefinition = await processDefinitionService.getProcessDefinitionByName(
simpleAppProcess.intermediateDateProcessVarTimer,
simpleApp
);
const dateTimerChangedProcess = await processInstancesService.createProcessInstance(timerChangedProcessDefinition.entry.key, simpleApp);
dateTimerChangedTask = await queryService.getProcessInstanceTasks(dateTimerChangedProcess.entry.id, simpleApp);
dateTimerChangedTaskId = dateTimerChangedTask.list.entries[0].entry.id;
/* cspell: disable-next-line */
const assigneeProcessDefinition = await processDefinitionService.getProcessDefinitionByName(simpleAppProcess.calledprocess, simpleApp);
const assigneeProcess = await processInstancesService.createProcessInstance(assigneeProcessDefinition.entry.key, simpleApp);
assigneeReleaseTask = await queryService.getProcessInstanceTasks(assigneeProcess.entry.id, simpleApp);
assigneeTaskId = assigneeReleaseTask.list.entries[0].entry.id;
await loginSSOPage.loginWithProfile('hrUser');
} catch (error) {
Logger.error('Error in beforeAll: ', error);
}
}, 5 * 60 * 1000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
});
afterAll(async () => {
await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();');
});
it('[C310366] Should refresh buttons and form after an action is complete', async () => {
await appListCloudComponent.goToApp(candidateBaseApp);
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await taskList.checkContentIsDisplayedById(formTaskId);
await taskList.selectRowByTaskId(formTaskId);
await taskFormCloudComponent.checkFormIsReadOnly();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
await taskFormCloudComponent.clickClaimButton();
await taskFormCloudComponent.checkFormIsDisplayed();
await taskFormCloudComponent.checkFormIsNotReadOnly();
await taskFormCloudComponent.checkClaimButtonIsNotDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
await openTaskByIdFromFilters(completedTasksFilter, formTaskId);
await taskFormCloudComponent.checkFormIsReadOnly();
await taskFormCloudComponent.checkClaimButtonIsNotDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
await taskFormCloudComponent.checkCancelButtonIsDisplayed();
});
it('[C306872] Should not be able to Release a process task which has only assignee', async () => {
await appListCloudComponent.goToApp(simpleApp);
await openTaskByIdFromFilters(myTasksFilter, assigneeTaskId);
expect(await taskHeaderCloudPage.getAssignee()).toEqual(assigneeReleaseTask.list.entries[0].entry.assignee);
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
await taskFormCloudComponent.checkReleaseButtonIsNotDisplayed();
});
it('[C310200] Should be able to save a task form', async () => {
const selectedOption = 'option1';
const dropdownId = '#DropdownOptions';
await goToAppOpenDropdownTaskByNameFromFilters(myTasksFilter, dropdownOptionsTask.entry.name);
await widget.dropdown().openDropdown(dropdownId);
await widget.dropdown().selectOption(selectedOption, dropdownId);
await taskFormCloudComponent.checkSaveButtonIsDisplayed();
await taskFormCloudComponent.clickSaveButton();
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await goToAppOpenDropdownTaskByNameFromFilters(myTasksFilter, dropdownOptionsTask.entry.name);
expect(await widget.dropdown().getSelectedOptionText(dropdownFieldId)).toBe(selectedOption);
});
it('[C313200] Should be able to complete a Task form with process date variable mapped to a Date widget in the form', async () => {
await appListCloudComponent.goToApp(simpleApp);
await openTaskByIdFromFilters(myTasksFilter, dateTimerTaskId);
await verifyDateInput(dateFieldId, defaultDate);
await completeTask();
await verifyDateCompletedTask(dateTimerTaskId, defaultDate);
await openTaskByIdFromFilters(myTasksFilter, dateTimerChangedTaskId);
await verifyDateInput(dateFieldId, defaultDate);
await widget.dateWidget().clearDateInput(dateFieldId);
await widget.dateWidget().setDateInput(dateFieldId, changedDate);
await completeTask();
await verifyDateCompletedTask(dateTimerChangedTaskId, changedDate);
});
describe('Candidate Base App', () => {
beforeEach(async () => {
await appListCloudComponent.goToApp(candidateBaseApp);
});
it('[C307032] Should display the appropriate title for the unclaim option of a Task', async () => {
await openTaskByIdFromFilters(myTasksFilter, candidateUsersTask.entry.id);
expect(await taskFormCloudComponent.getReleaseButtonText()).toBe('RELEASE');
});
it('[C310142] Empty content is displayed when having a task without form', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(assigneeTask.entry.name);
await taskList.selectRow(assigneeTask.entry.name);
await taskFormCloudComponent.checkFormIsNotDisplayed();
expect(await taskFormCloudComponent.getFormTitle()).toBe(assigneeTask.entry.name);
await taskFormCloudComponent.checkFormContentIsEmpty();
expect(await taskFormCloudComponent.getEmptyFormContentTitle()).toBe(`No form available`);
expect(await taskFormCloudComponent.getEmptyFormContentSubtitle()).toBe(`Attach a form that can be viewed later`);
});
it('[C310199] Should not be able to complete a task when required field is empty or invalid data is added to a field', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await selectTaskByName(formValidationsTask.entry.name);
await taskFormCloudComponent.formFields().checkFormIsDisplayed();
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Text0tma8h');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Date0m1moq');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Number0klykr');
await taskFormCloudComponent.formFields().checkWidgetIsVisible('Amount0mtp1h');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.textWidget().setValue('Text0tma8h', 'Some random text');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.dateWidget().setDateInput('Date0m1moq', 'invalid date');
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.dateWidget().setDateInput('Date0m1moq', '20-10-2018');
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.numberWidget().setFieldValue('Number0klykr', 'invalid number');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.numberWidget().setFieldValue('Number0klykr', '26');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
await widget.amountWidget().setFieldValue('Amount0mtp1h', 'invalid amount');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(false);
await widget.amountWidget().setFieldValue('Amount0mtp1h', '660');
expect(await taskFormCloudComponent.isCompleteButtonEnabled()).toBe(true);
});
it('[C307093] Complete button is not displayed when the task is already completed', async () => {
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('Completed Tasks');
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.selectRow(completedTaskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307095] Task can not be completed by owner user', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await selectTaskByName(createdTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307110] Task list is displayed after clicking on Cancel button', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(assigneeTask.entry.name);
await taskFormCloudComponent.clickCancelButton();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await taskList.checkContentIsDisplayedByName(assigneeTask.entry.name);
});
it('[C307094] Standalone Task can be completed by a user that is owner and assignee', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(toBeCompletedTask.entry.name);
await completeTask();
await taskList.checkContentIsNotDisplayedByName(toBeCompletedTask.entry.name);
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(toBeCompletedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
it('[C307111] Task of a process can be completed by a user that is owner and assignee', async () => {
await taskFilter.clickTaskFilter(myTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
expect(await taskFilter.getActiveFilterName()).toBe('My Tasks');
await selectTaskByName(completedTask.entry.name);
await completeTask();
await taskList.checkContentIsNotDisplayedByName(completedTask.entry.name);
await taskFilter.clickTaskFilter(completedTasksFilter);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(completedTask.entry.name);
await taskFormCloudComponent.checkCompleteButtonIsNotDisplayed();
});
});
/**
* Open task by id from filters
*
* @param filterName Filter name
* @param taskId Task id
*/
async function openTaskByIdFromFilters(filterName: string, taskId: string): Promise<void> {
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedById(taskId);
await taskList.selectRowByTaskId(taskId);
}
/**
* Verify date input
*
* @param widgetId Widget id
* @param input input value
*/
async function verifyDateInput(widgetId: string, input: string): Promise<void> {
await widget.dateWidget().checkWidgetIsVisible(widgetId);
expect(await widget.dateWidget().getDateInput(widgetId)).toBe(input);
}
/**
* Select task by name
*
* @param taskName Task name
*/
async function selectTaskByName(taskName: string): Promise<void> {
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
}
/**
* Verify date completed task
*
* @param taskId Task id
* @param input input value
*/
async function verifyDateCompletedTask(taskId: string, input: string): Promise<void> {
await openTaskByIdFromFilters(completedTasksFilter, taskId);
await taskFormCloudComponent.checkFormIsReadOnly();
await verifyDateInput(dateFieldId, input);
await taskFormCloudComponent.clickCancelButton();
}
/**
* Go to app open dropdown task by name from filters
*
* @param filterName Filter name
* @param taskName Task name
*/
async function goToAppOpenDropdownTaskByNameFromFilters(filterName: string, taskName: string): Promise<void> {
await appListCloudComponent.goToApp(simpleApp);
await taskFilter.clickTaskFilter(filterName);
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(taskName);
await taskList.selectRow(taskName);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await widget.dropdown().isWidgetVisible(dropdownFieldId);
}
/**
* Complete task
*/
async function completeTask(): Promise<void> {
await taskFormCloudComponent.checkCompleteButtonIsDisplayed();
await taskFormCloudComponent.clickCompleteButton();
}
});

View File

@@ -1,252 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 CONSTANTS = require('../../util/constants');
import {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LoginPage,
StringUtil,
TaskHeaderCloudPage,
TasksService,
PeopleCloudComponentPage
} from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { DateFnsUtils } from '../../../lib/core/src/lib/common/utils/date-fns-utils';
const isValueInvalid = (value: any): boolean => value === null || value === undefined;
describe('Task Header cloud component', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const peopleCloudComponentPage = new PeopleCloudComponentPage();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const basicCreatedTaskName = StringUtil.generateRandomString();
const completedTaskName = StringUtil.generateRandomString();
const unclaimedTaskName = StringUtil.generateRandomString();
let basicCreatedTask: any;
let basicCreatedDate: any;
let completedTask: any;
let completedCreatedDate: string;
let dueDate: string;
let subTask: any;
let subTaskCreatedDate: string;
let completedEndDate: string;
let groupInfo: any;
let testUser: any;
let unclaimedTask: any;
const priority = 0;
const description = 'descriptionTask';
const formatDate = 'MMM D, YYYY';
const dateTimeFormat = 'MMM D, Y, H:mm';
const createCompletedTask = async () => {
const completedTaskId = await tasksService.createStandaloneTask(completedTaskName, simpleApp, {
priority,
description,
dueDate: basicCreatedTask.entry.createdDate
});
await tasksService.claimTask(completedTaskId.entry.id, simpleApp);
await tasksService.completeTask(completedTaskId.entry.id, simpleApp);
return tasksService.getTask(completedTaskId.entry.id, simpleApp);
};
const createSubTask = async (createdTaskId) => {
const subTaskId = await tasksService.createStandaloneSubtask(createdTaskId.entry.id, simpleApp, StringUtil.generateRandomString());
await tasksService.claimTask(subTaskId.entry.id, simpleApp);
return tasksService.getTask(subTaskId.entry.id, simpleApp);
};
const createTask = async () => {
const createdTaskId = await tasksService.createStandaloneTask(basicCreatedTaskName, simpleApp);
await tasksService.claimTask(createdTaskId.entry.id, simpleApp);
basicCreatedTask = await tasksService.getTask(createdTaskId.entry.id, simpleApp);
basicCreatedDate = DateFnsUtils.formatDate(new Date(basicCreatedTask.entry.createdDate), formatDate);
return createdTaskId;
};
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
unclaimedTask = await tasksService.createStandaloneTask(unclaimedTaskName, simpleApp);
const createdTaskId = await createTask();
completedTask = await createCompletedTask();
completedCreatedDate = DateFnsUtils.formatDate(new Date(completedTask.entry.createdDate), formatDate);
dueDate = DateFnsUtils.formatDate(new Date(completedTask.entry.dueDate), dateTimeFormat);
completedEndDate = DateFnsUtils.formatDate(new Date(completedTask.entry.completedDate), formatDate);
subTask = await createSubTask(createdTaskId);
subTaskCreatedDate = DateFnsUtils.formatDate(new Date(subTask.entry.createdDate), formatDate);
await browser.sleep(3000);
await loginSSOPage.login(testUser.username, testUser.password);
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
});
it('[C291943] Should display task details for assigned task', async () => {
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(basicCreatedTaskName);
await taskList.selectRow(basicCreatedTaskName);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
expect(await taskHeaderCloudPage.getId()).toEqual(basicCreatedTask.entry.id);
expect(await taskHeaderCloudPage.getDescription()).toEqual(
isValueInvalid(basicCreatedTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : basicCreatedTask.entry.description
);
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
expect(await taskHeaderCloudPage.getPriority()).toEqual('None');
expect(await taskHeaderCloudPage.getCategory()).toEqual(
!basicCreatedTask.entry.category ? CONSTANTS.TASK_DETAILS.NO_CATEGORY : basicCreatedTask.entry.category
);
expect(await taskHeaderCloudPage.getDueDate()).toEqual(
isValueInvalid(basicCreatedTask.entry.dueDate) ? CONSTANTS.TASK_DETAILS.NO_DATE : basicCreatedDate
);
expect(await taskHeaderCloudPage.getEndDate()).toEqual('');
expect(await taskHeaderCloudPage.getCreated()).toEqual(basicCreatedDate);
expect(await taskHeaderCloudPage.getAssignee()).toEqual(
isValueInvalid(basicCreatedTask.entry.assignee) ? '' : basicCreatedTask.entry.assignee
);
expect(await taskHeaderCloudPage.getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
});
it('[C291944] Should display task details for completed task', async () => {
await taskFilter.clickTaskFilter('completed-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.selectRow(completedTaskName);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
expect(await taskHeaderCloudPage.getId()).toEqual(completedTask.entry.id);
expect(await taskHeaderCloudPage.getDescription()).toEqual(
isValueInvalid(completedTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : completedTask.entry.description
);
expect(await taskHeaderCloudPage.getStatus()).toEqual('COMPLETED');
expect(await taskHeaderCloudPage.getReadonlyPriority()).toEqual('None');
expect(await taskHeaderCloudPage.getCategory()).toEqual(
!completedTask.entry.category ? CONSTANTS.TASK_DETAILS.NO_CATEGORY : completedTask.entry.category
);
expect(await taskHeaderCloudPage.getDueDate()).toEqual(
isValueInvalid(completedTask.entry.dueDate) ? CONSTANTS.TASK_DETAILS.NO_DATE : dueDate
);
expect(await taskHeaderCloudPage.getEndDate()).toEqual(completedEndDate);
expect(await taskHeaderCloudPage.getCreated()).toEqual(completedCreatedDate);
expect(await taskHeaderCloudPage.getAssignee()).toEqual(isValueInvalid(completedTask.entry.assignee) ? '' : completedTask.entry.assignee);
expect(await taskHeaderCloudPage.getParentName()).toEqual(CONSTANTS.TASK_DETAILS.NO_PARENT);
});
it('[C291945] Should Parent Name and Parent Id not be empty in task details for sub task', async () => {
await taskFilter.clickTaskFilter('my-tasks');
await taskList.getDataTable().waitTillContentLoaded();
await taskList.checkContentIsDisplayedByName(subTask.entry.name);
await taskList.selectRow(subTask.entry.name);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
expect(await taskHeaderCloudPage.getId()).toEqual(subTask.entry.id);
expect(await taskHeaderCloudPage.getDescription()).toEqual(
isValueInvalid(subTask.entry.description) ? CONSTANTS.TASK_DETAILS.NO_DESCRIPTION : subTask.entry.description
);
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
expect(await taskHeaderCloudPage.getPriority()).toEqual('None');
expect(await taskHeaderCloudPage.getCategory()).toEqual(
!subTask.entry.category ? CONSTANTS.TASK_DETAILS.NO_CATEGORY : subTask.entry.category
);
expect(await taskHeaderCloudPage.getDueDate()).toEqual(
isValueInvalid(subTask.entry.dueDate) ? CONSTANTS.TASK_DETAILS.NO_DATE : subTaskCreatedDate
);
expect(await taskHeaderCloudPage.getEndDate()).toEqual('');
expect(await taskHeaderCloudPage.getCreated()).toEqual(subTaskCreatedDate);
expect(await taskHeaderCloudPage.getAssignee()).toEqual(isValueInvalid(subTask.entry.assignee) ? '' : subTask.entry.assignee);
expect(await taskHeaderCloudPage.getParentName()).toEqual(basicCreatedTask.entry.name);
expect(await taskHeaderCloudPage.getParentTaskId()).toEqual(isValueInvalid(subTask.entry.parentTaskId) ? '' : subTask.entry.parentTaskId);
});
it('[C309698] Should validate the Priority field', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await taskList.checkContentIsDisplayedByName(unclaimedTask.entry.name);
await taskList.selectRow(unclaimedTask.entry.name);
await tasksCloudDemoPage.waitTillContentLoaded();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
const currentAssignee = await taskHeaderCloudPage.assigneeCardTextItem.getFieldValue();
expect(currentAssignee).toBe('No assignee');
await taskHeaderCloudPage.priorityCardSelectItem.checkElementIsReadonly();
await taskHeaderCloudPage.statusCardTextItem.checkElementIsReadonly();
});
it('[C291991] Should be able to assign a task only to the users that have access to the selected app', async () => {
await tasksCloudDemoPage.clickStartNewTaskButton();
const currentAssignee = await peopleCloudComponentPage.getChipAssignee();
expect(currentAssignee).toContain(testUser.firstName);
expect(currentAssignee).toContain(testUser.lastName);
await peopleCloudComponentPage.searchAssignee('hrUser');
await peopleCloudComponentPage.selectAssigneeFromList('HR User');
await peopleCloudComponentPage.checkSelectedPeople('HR User');
await peopleCloudComponentPage.searchAssignee('modeler');
await peopleCloudComponentPage.checkNoResultsFoundError();
});
});

View File

@@ -1,242 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
StringUtil,
TasksService,
LoginPage,
createApiService,
AppListCloudPage,
LocalStorageUtil,
IdentityService,
GroupIdentityService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
describe('Edit task filters and task list properties', () => {
const SORT_ORDER = {
ASC: 'Ascending',
DESC: 'Descending'
};
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
let createdTask;
let notDisplayedTask;
let noPriorityTask;
let lowPriorityTask;
let normalPriorityTask;
let hightPriorityTask;
let subTask;
let otherOwnerTask;
let testUser;
let groupInfo;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
otherOwnerTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(otherOwnerTask.entry.id, simpleApp);
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
noPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 0 });
lowPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 1 });
normalPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 2 });
hightPriorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority: 3 });
await tasksService.claimTask(noPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(lowPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(normalPriorityTask.entry.id, simpleApp);
await tasksService.claimTask(hightPriorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { parentTaskId: createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-task-list', JSON.stringify(jsonFile));
await LocalStorageUtil.setConfigField(
'adf-edit-task-filter',
JSON.stringify({
filterProperties: [
'taskId',
'appName',
'status',
'assignee',
'taskName',
'parentTaskId',
'priority',
'standalone',
'owner',
'processDefinitionId',
'processInstanceId',
'lastModified',
'sort',
'order'
],
sortProperties: [
'id',
'name',
'createdDate',
'priority',
'processDefinitionId',
'processInstanceId',
'parentTaskId',
'priority',
'standalone',
'owner',
'assignee'
],
actions: ['save', 'saveAs', 'delete']
})
);
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
describe('Edit task filters and task list properties - sort properties', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await editTaskFilter.openFilter();
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
});
it('[C306901] Should display tasks sorted by task name when taskName is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('name');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Task Name')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Task Name')).toBe(true);
});
it('[C290156] Should display tasks ordered by id when Id is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('id');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Id')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Id')).toBe(true);
});
it('[C306903] Should display tasks sorted by processDefinitionId when processDefinitionId is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('processDefinitionId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ProcessDefinitionId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ProcessDefinitionId')).toBe(true);
});
it('[C306905] Should display tasks sorted by processInstanceId when processInstanceId is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('Assigned');
await editTaskFilter.setSortFilterDropDown('processInstanceId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ProcessInstanceId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ProcessInstanceId')).toBe(true);
});
it('[C306907] Should display tasks sorted by assignee when assignee is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('assignee');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Assignee')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Assignee')).toBe(true);
});
it('[C306911] Should display tasks sorted by parentTaskId when parentTaskId is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('parentTaskId');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'ParentTaskId')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'ParentTaskId')).toBe(true);
});
it('[C290087] Should display tasks ordered by priority when Priority is selected from sort dropdown', async () => {
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('priority');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Priority', 'PRIORITY')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Priority', 'PRIORITY')).toBe(true);
});
it('[C307115] Should display tasks sorted by owner when owner is selected from sort dropdown', async () => {
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.setSortFilterDropDown('owner');
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.ASC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.ASC, 'Owner')).toBe(true);
await editTaskFilter.setOrderFilterDropDown(SORT_ORDER.DESC);
expect(await taskList.getDataTable().checkListIsSorted(SORT_ORDER.DESC, 'Owner')).toBe(true);
});
});
});

View File

@@ -1,315 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
StringUtil,
TasksService,
ProcessDefinitionsService,
ProcessInstancesService,
LoginPage,
createApiService,
AppListCloudPage,
LocalStorageUtil,
IdentityService,
GroupIdentityService
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { TaskListCloudConfiguration } from './../config/task-list-cloud.config';
import { taskFilterConfiguration } from './../config/task-filter.config';
import { addDays, format, subDays } from 'date-fns';
describe('Edit task filters and task list properties', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const candidateBaseApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskFilter = tasksCloudDemoPage.taskFilterCloudComponent;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const noTasksFoundMessage = 'No Tasks Found';
let createdTask: any;
let notAssigned: any;
let notDisplayedTask: any;
let processDefinition: any;
let processInstance: any;
let priorityTask: any;
let subTask: any;
let otherOwnerTask: any;
let testUser: any;
let groupInfo: any;
let simpleTask: any;
const priority = 1;
const beforeDate = format(subDays(new Date(), 1), 'dd/MM/yyyy');
const currentDate = format(new Date(), 'dd/MM/yyyy');
const afterDate = format(addDays(new Date(), 1), 'dd/MM/yyyy');
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
otherOwnerTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(otherOwnerTask.entry.id, simpleApp);
createdTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
await tasksService.claimTask(createdTask.entry.id, simpleApp);
simpleTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
notAssigned = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp);
priorityTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { priority });
await tasksService.claimTask(priorityTask.entry.id, simpleApp);
notDisplayedTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), candidateBaseApp);
await tasksService.claimTask(notDisplayedTask.entry.id, candidateBaseApp);
processDefinition = await processDefinitionService.getProcessDefinitionByName(
browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.candidateUsersGroup,
simpleApp
);
processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
subTask = await tasksService.createStandaloneTask(StringUtil.generateRandomString(), simpleApp, { parentTaskId: createdTask.entry.id });
await tasksService.claimTask(subTask.entry.id, simpleApp);
const jsonFile = new TaskListCloudConfiguration().getConfiguration();
await loginSSOPage.login(testUser.username, testUser.password);
await LocalStorageUtil.setConfigField('adf-cloud-task-list', JSON.stringify(jsonFile));
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify(taskFilterConfiguration));
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
});
describe('Edit task filters and task list properties - filter properties', () => {
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await editTaskFilter.openFilter();
await taskFilter.checkTaskFilterIsDisplayed('my-tasks');
});
it('[C292004] Filter by appName', async () => {
expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(simpleApp);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notDisplayedTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setAppNameDropDown(candidateBaseApp);
expect(await editTaskFilter.getAppNameDropDownValue()).toEqual(candidateBaseApp);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(notDisplayedTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C291906] Should be able to see only the task with specific taskId when typing it in the task Id field', async () => {
await editTaskFilter.setId(createdTask.entry.id);
expect(await editTaskFilter.getId()).toEqual(createdTask.entry.id);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedById(createdTask.entry.id);
await taskList.getRowsWithSameId(createdTask.entry.id).then(async (list) => {
expect(list.length).toEqual(1);
});
});
it('[C291907] Should be able to see No tasks found when typing an invalid task id', async () => {
await editTaskFilter.setId('invalidId');
expect(await editTaskFilter.getId()).toEqual('invalidId');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297476] Filter by taskName', async () => {
await editTaskFilter.setTaskName(createdTask.entry.name);
expect(await editTaskFilter.getTaskName()).toEqual(createdTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.getRowsWithSameName(createdTask.entry.name).then(async (list) => {
expect(list.length).toEqual(1);
});
});
it('[C297613] Should be able to see No tasks found when typing a task name that does not exist', async () => {
await editTaskFilter.setTaskName('invalidName');
expect(await editTaskFilter.getTaskName()).toEqual('invalidName');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297480] Should be able to see only tasks that are part of a specific process when processInstanceId is set', async () => {
await editTaskFilter.setProcessInstanceId(processInstance.entry.id);
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await editTaskFilter.closeFilter();
expect(await taskList.getDataTable().getNumberOfRows()).toBe(1);
await taskList.checkContentIsDisplayedByProcessInstanceId(processInstance.entry.id);
});
it('[C297684] Should be able to see No tasks found when typing an invalid processInstanceId', async () => {
await editTaskFilter.setProcessInstanceId('invalidTaskId');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297478] Should be able to see only tasks that are assigned to a specific user when assignee is set', async () => {
await editTaskFilter.setAssignee(testUser.username);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(notAssigned.entry.name);
});
it('[C297686] Should be able to see No tasks found when typing an invalid user to assignee field', async () => {
await editTaskFilter.setAssignee('invalid');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297482] Should be able to see only tasks with specific priority when priority is set', async () => {
await editTaskFilter.setPriority('Low');
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(priorityTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297687] Should be able to see No tasks found when typing unused value for priority field', async () => {
await editTaskFilter.setPriority('Normal');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297481] Should be able to see only tasks with specific parentTaskId when parentTaskId is set', async () => {
await editTaskFilter.setParentTaskId(subTask.entry.parentTaskId);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(subTask.entry.name);
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297486] Filter by Owner', async () => {
await editTaskFilter.setStatusFilterDropDown('All');
await editTaskFilter.clearAssignee();
await editTaskFilter.setOwner(testUser.username);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(notAssigned.entry.name);
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setOwner('invalid');
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
});
it('[C297484] Task is displayed when typing into lastModifiedFrom field a date before the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setLastModifiedFrom(afterDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297689] Task is not displayed when typing into lastModifiedFrom field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedFrom(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it('[C297485] Task is displayed when typing into lastModifiedTo field a date after the task CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
await editTaskFilter.openFilter();
await editTaskFilter.setLastModifiedTo(beforeDate);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(createdTask.entry.name);
});
it('[C297690] Task is not displayed when typing into lastModifiedTo field the same date as tasks CreatedDate', async () => {
await editTaskFilter.setLastModifiedTo(currentDate);
await editTaskFilter.setTaskName(simpleTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsNotDisplayedByName(simpleTask.entry.name);
});
it(
'[C297691] Task is not displayed when typing into lastModifiedFrom field a date before the task due date ' +
'and into lastModifiedTo a date before task due date',
async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(beforeDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
}
);
it(
'[C297692] Task is displayed when typing into lastModifiedFrom field a date before the tasks due date ' +
'and into lastModifiedTo a date after',
async () => {
await editTaskFilter.setLastModifiedFrom(beforeDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.setTaskName(createdTask.entry.name);
await editTaskFilter.closeFilter();
await taskList.checkContentIsDisplayedByName(createdTask.entry.name);
}
);
it(
'[C297693] Task is not displayed when typing into lastModifiedFrom field a date after the tasks due date ' +
'and into lastModifiedTo a date after',
async () => {
await editTaskFilter.setLastModifiedFrom(afterDate);
await editTaskFilter.setLastModifiedTo(afterDate);
await editTaskFilter.closeFilter();
expect(await taskList.getNoTasksFoundMessage()).toEqual(noTasksFoundMessage);
}
);
});
});

View File

@@ -1,227 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
AppListCloudPage,
GroupIdentityService,
IdentityService,
LocalStorageUtil,
LoginPage,
ProcessDefinitionsService,
ProcessInstancesService,
StatusType,
TaskFormCloudComponent,
TaskHeaderCloudPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
import { ProcessInstanceCloud } from '@alfresco/adf-process-services-cloud';
import { taskFilterConfiguration } from './../config/task-filter.config';
describe('Task claim/release', () => {
const candidateApp = browser.params.resources.ACTIVITI_CLOUD_APPS.CANDIDATE_BASE_APP;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = tasksCloudDemoPage.taskListCloudComponent();
const taskHeaderCloudPage = new TaskHeaderCloudPage();
const taskFormCloudComponent = new TaskFormCloudComponent();
const apiService = createApiService();
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
let processInstance: ProcessInstanceCloud;
describe('candidate user', () => {
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(
candidateApp.processes.candidateUserProcess,
candidateApp.name
);
processInstance = (await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateApp.name)).entry;
});
beforeEach(async () => {
await navigateToApp(browser.params.testConfig.users.hrUser);
});
afterAll(async () => {
await processInstancesService.deleteProcessInstance(processInstance.id, processInstance.appName);
await navigationBarPage.clickLogoutButton();
});
it('[C306874] Should be able to Claim/Release a process task which has a candidate user', async () => {
await setStatusTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.candidateUserTask);
await taskList.selectRow(candidateApp.tasks.candidateUserTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual(browser.params.testConfig.users.hrUser.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
});
});
describe('candidate group', () => {
let candidate;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
candidate = await identityService.createIdentityUserWithRole([identityService.ROLES.ACTIVITI_USER]);
const groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(candidate.idIdentityService, groupInfo.id);
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
const processDefinition = await processDefinitionService.getProcessDefinitionByName(
candidateApp.processes.uploadFileProcess,
candidateApp.name
);
processInstance = (await processInstancesService.createProcessInstance(processDefinition.entry.key, candidateApp.name)).entry;
});
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(candidate.idIdentityService);
await apiService.login(browser.params.testConfig.users.hrUser.username, browser.params.testConfig.users.hrUser.password);
await processInstancesService.deleteProcessInstance(processInstance.id, processInstance.appName);
await navigationBarPage.clickLogoutButton();
});
it('[C306875] should be able to Claim/Release a process task which has a candidate group', async () => {
await navigateToApp(browser.params.testConfig.users.hrUser);
await setStatusTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.uploadFileTask);
await taskList.selectRow(candidateApp.tasks.uploadFileTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual(browser.params.testConfig.users.hrUser.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await navigationBarPage.clickLogoutButton();
await navigateToApp(candidate);
await setStatusTaskFilter('Created', processInstance.id);
await taskList.checkContentIsDisplayedByName(candidateApp.tasks.uploadFileTask);
await taskList.selectRow(candidateApp.tasks.uploadFileTask);
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
await taskFormCloudComponent.clickClaimButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkReleaseButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('ASSIGNED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual(candidate.username);
await taskFormCloudComponent.clickReleaseButton();
await browser.refresh();
await taskHeaderCloudPage.checkTaskPropertyListIsDisplayed();
await taskFormCloudComponent.checkClaimButtonIsDisplayed();
expect(await taskHeaderCloudPage.getStatus()).toEqual('CREATED');
expect(await taskHeaderCloudPage.getAssignee()).toEqual('No assignee');
});
});
interface UserType {
username: string;
password: string;
}
/**
* Navigate to the app
*
* @param user user
*/
async function navigateToApp(user: UserType) {
await loginSSOPage.login(user.username, user.password);
await LocalStorageUtil.setConfigField('adf-edit-task-filter', JSON.stringify(taskFilterConfiguration));
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(candidateApp.name);
await taskList.getDataTable().waitForTableBody();
}
/**
* Set status task filter
*
* @param status status type
* @param processInstanceId process instance id
*/
async function setStatusTaskFilter(status: StatusType, processInstanceId: string) {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown(status);
await editTaskFilter.setProcessInstanceId(processInstanceId);
await editTaskFilter.closeFilter();
}
});

View File

@@ -1,185 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
StringUtil,
TasksService,
QueryService,
ProcessDefinitionsService,
ProcessInstancesService,
LoginPage, createApiService,
IdentityService,
GroupIdentityService,
AppListCloudPage, TaskListCloudComponentPage
} from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { TasksCloudDemoPage } from './../pages/tasks-cloud-demo.page';
describe('Task filters cloud', () => {
describe('Filters', () => {
const simpleApp = browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.name;
const loginSSOPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const appListCloudComponent = new AppListCloudPage();
const tasksCloudDemoPage = new TasksCloudDemoPage();
const editTaskFilter = tasksCloudDemoPage.editTaskFilterCloud;
const taskList = new TaskListCloudComponentPage();
const apiService = createApiService();
const identityService = new IdentityService(apiService);
const groupIdentityService = new GroupIdentityService(apiService);
const tasksService = new TasksService(apiService);
const processDefinitionService = new ProcessDefinitionsService(apiService);
const processInstancesService = new ProcessInstancesService(apiService);
const queryService = new QueryService(apiService);
const createdTaskName = StringUtil.generateRandomString();
const completedTaskName = StringUtil.generateRandomString();
const assignedTaskName = StringUtil.generateRandomString(); const deletedTaskName = StringUtil.generateRandomString();
let assignedTask; let deletedTask; let testUser; let groupInfo;
const orderByNameAndPriority = ['cCreatedTask', 'dCreatedTask', 'eCreatedTask'];
let priority = 1;
const nrOfTasks = 3;
beforeAll(async () => {
await apiService.loginWithProfile('identityAdmin');
testUser = await identityService.createIdentityUserWithRole( [identityService.ROLES.ACTIVITI_USER]);
groupInfo = await groupIdentityService.getGroupInfoByGroupName('hr');
await identityService.addUserToGroup(testUser.idIdentityService, groupInfo.id);
await apiService.login(testUser.username, testUser.password);
await tasksService.createStandaloneTask(createdTaskName, simpleApp);
assignedTask = await tasksService.createStandaloneTask(assignedTaskName, simpleApp);
await tasksService.claimTask(assignedTask.entry.id, simpleApp);
await tasksService.createAndCompleteTask(completedTaskName, simpleApp);
deletedTask = await tasksService.createStandaloneTask(deletedTaskName, simpleApp);
await tasksService.deleteTask(deletedTask.entry.id, simpleApp);
for (let i = 0; i < nrOfTasks; i++) {
await tasksService.createStandaloneTask(orderByNameAndPriority[i], simpleApp, { priority });
priority = priority + 1;
}
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.simpleProcess, simpleApp);
const processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
const secondProcessInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
await queryService.getProcessInstanceTasks(secondProcessInstance.entry.id, simpleApp);
await processInstancesService.suspendProcessInstance(processInstance.entry.id, simpleApp);
await processInstancesService.deleteProcessInstance(secondProcessInstance.entry.id, simpleApp);
await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await loginSSOPage.login(testUser.username, testUser.password);
}, 5 * 60 * 1000);
afterAll(async () => {
await apiService.loginWithProfile('identityAdmin');
await identityService.deleteIdentityUser(testUser.idIdentityService);
}, 60000);
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesCloudPage();
await appListCloudComponent.checkApsContainer();
await appListCloudComponent.goToApp(simpleApp);
await taskList.getDataTable().waitForTableBody();
});
it('[C290045] Should display only tasks with Assigned status when Assigned is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('Assigned');
await taskList.checkContentIsDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290061] Should display only tasks with Completed status when Completed is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.setStatusFilterDropDown('Completed');
await taskList.checkContentIsDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290139] Should display only tasks with all statuses when All is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('All');
await taskList.checkContentIsDisplayedByName(deletedTaskName);
await taskList.checkContentIsDisplayedByName(assignedTaskName);
await taskList.checkContentIsDisplayedByName(createdTaskName);
await taskList.checkContentIsDisplayedByName(completedTaskName);
});
it('[C290060] Should display only tasks with Created status when Created is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Created');
await taskList.checkContentIsDisplayedByName(createdTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(deletedTaskName);
});
it('[C290155] Should display only tasks with Cancelled status when Cancelled is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Cancelled');
await taskList.checkContentIsDisplayedByName(deletedTaskName);
await taskList.checkContentIsNotDisplayedByName(assignedTaskName);
await taskList.checkContentIsNotDisplayedByName(completedTaskName);
await taskList.checkContentIsNotDisplayedByName(createdTaskName);
});
describe('Dropdown', () => {
let taskAssigned;
beforeEach(async () => {
const processDefinition = await processDefinitionService
.getProcessDefinitionByName(browser.params.resources.ACTIVITI_CLOUD_APPS.SIMPLE_APP.processes.candidateUsersGroup, simpleApp);
const processInstance = await processInstancesService.createProcessInstance(processDefinition.entry.key, simpleApp);
taskAssigned = await queryService.getProcessInstanceTasks(processInstance.entry.id, simpleApp);
await processInstancesService.suspendProcessInstance(processInstance.entry.id, simpleApp);
});
it('[C317658] Should display only tasks with Suspended status when SUSPENDED is selected from status dropdown', async () => {
await editTaskFilter.openFilter();
await editTaskFilter.clearAssignee();
await editTaskFilter.setStatusFilterDropDown('Suspended');
await taskList.checkContentIsDisplayedByName(taskAssigned.list.entries[0].entry.name);
});
});
});
});

View File

@@ -1,27 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export const infoDrawerConfiguration = {
presets: {
properties: [
'assignee',
'status',
'priority',
'parentName'
]
}
};

View File

@@ -1,152 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ModelsActions, createApiService, ApplicationsUtil, LoginPage, UsersActions } from '@alfresco/adf-testing';
import { ProcessServicesPage } from '../pages/process-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
import { AppDefinitionRepresentation, AppDefinitionsApi } from '@alfresco/js-api';
describe('Modify applications', () => {
const app = browser.params.resources.Files.APP_WITH_PROCESSES;
const appToBeDeleted = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const replacingApp = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const processServicesPage = new ProcessServicesPage();
const apiService = createApiService();
const modelActions = new ModelsActions(apiService);
const apps = new ApplicationsUtil(apiService);
const usersActions = new UsersActions(apiService);
const applicationService = new ApplicationsUtil(apiService);
const appsApi = new AppDefinitionsApi(apiService.getInstance());
let firstApp: AppDefinitionRepresentation;
let appVersionToBeDeleted: AppDefinitionRepresentation;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
const user = await usersActions.createUser();
await apiService.login(user.username, user.password);
firstApp = await applicationService.importPublishDeployApp(app.file_path);
appVersionToBeDeleted = await applicationService.importPublishDeployApp(appToBeDeleted.file_path);
await loginPage.login(user.username, user.password);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
});
it('[C260198] Should the app be displayed on dashboard when is deployed on APS', async () => {
expect(await processServicesPage.getAppIconType(app.title)).toEqual(CONSTANTS.APP_ICON.UNIT);
expect(await processServicesPage.getBackgroundColor(app.title)).toEqual(CONSTANTS.APP_COLOR.BLUE);
expect(await processServicesPage.getDescription(app.title)).toEqual(app.description);
});
it('[C260213] Should a new version of the app be displayed on dashboard when is replaced by importing another app in APS', async () => {
expect(await processServicesPage.getAppIconType(app.title)).toEqual(CONSTANTS.APP_ICON.UNIT);
expect(await processServicesPage.getBackgroundColor(app.title)).toEqual(CONSTANTS.APP_COLOR.BLUE);
expect(await processServicesPage.getDescription(app.title)).toEqual(app.description);
await apps.importNewVersionAppDefinitionPublishDeployApp(replacingApp.file_location, firstApp.id);
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
expect(await processServicesPage.getAppIconType(app.title)).toEqual(CONSTANTS.APP_ICON.FAVORITE);
expect(await processServicesPage.getBackgroundColor(app.title)).toEqual(CONSTANTS.APP_COLOR.GREY);
expect(await processServicesPage.getDescription(app.title)).toEqual(app.description);
});
it('[C260220] Should the app not be displayed on dashboard after it was deleted in APS', async () => {
await processServicesPage.checkAppIsDisplayed(app.title);
await modelActions.deleteEntireModel(firstApp.id);
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.checkAppIsNotDisplayed(app.title);
});
it('[C260215] Should the penultimate version of an app be displayed on dashboard when the last version is deleted in APS', async () => {
await processServicesPage.checkAppIsDisplayed(appToBeDeleted.title);
expect(await processServicesPage.getBackgroundColor(appToBeDeleted.title)).toEqual(CONSTANTS.APP_COLOR.ORANGE);
await apps.importNewVersionAppDefinitionPublishDeployApp(replacingApp.file_location, appVersionToBeDeleted.id);
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.getBackgroundColor(appToBeDeleted.title);
expect(await processServicesPage.getBackgroundColor(appToBeDeleted.title)).toEqual(CONSTANTS.APP_COLOR.GREY);
await modelActions.deleteModel(appVersionToBeDeleted.id);
await modelActions.deleteModel(appVersionToBeDeleted.id);
await apps.publishDeployApp(appVersionToBeDeleted.id);
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesPage();
await processServicesPage.checkApsContainer();
await processServicesPage.checkAppIsDisplayed(appToBeDeleted.title);
expect(await processServicesPage.getBackgroundColor(appToBeDeleted.title)).toEqual(CONSTANTS.APP_COLOR.ORANGE);
});
it('[C260207] Should the app be updated when is edited in APS', async () => {
const newDescription = 'new description';
expect(await processServicesPage.getAppIconType(appToBeDeleted.title)).toEqual(CONSTANTS.APP_ICON.USER);
expect(await processServicesPage.getBackgroundColor(appToBeDeleted.title)).toEqual(CONSTANTS.APP_COLOR.ORANGE);
expect(await processServicesPage.getDescription(appToBeDeleted.title)).toEqual(appToBeDeleted.description);
const appDefinition = {
appDefinition: {
id: appVersionToBeDeleted.id,
name: appToBeDeleted.title,
description: newDescription,
definition: {
models: [firstApp['definition'].models[0]],
theme: 'theme-4',
icon: 'glyphicon-user'
}
},
publish: true,
force: true
};
await appsApi.updateAppDefinition(appVersionToBeDeleted.id, appDefinition);
await navigationBarPage.clickHomeButton();
await navigationBarPage.navigateToProcessServicesPage();
expect(await processServicesPage.getDescription(appToBeDeleted.title)).toEqual(newDescription);
expect(await processServicesPage.getBackgroundColor(appToBeDeleted.title)).toEqual(CONSTANTS.APP_COLOR.RED);
expect(await processServicesPage.getAppIconType(appToBeDeleted.title)).toEqual(CONSTANTS.APP_ICON.USER);
});
});

View File

@@ -1,142 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService,
ApplicationsUtil,
ContentNodeSelectorDialogPage,
IntegrationService,
LocalStorageUtil,
LoginPage,
UploadActions,
UserModel,
UsersActions,
Widget,
SearchService
} from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Attach File - Content service', () => {
const app = browser.params.resources.Files.WIDGET_CHECK_APP;
const loginPage = new LoginPage();
const widget = new Widget();
const taskPage = new TasksPage();
const navigationBarPage = new NavigationBarPage();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
const apiServiceExternal = createApiService({
provider: 'ECM',
hostEcm: browser.params.testConfig.adf_external_acs.host,
authType: 'BASIC'
});
const usersActionsExternal = new UsersActions(apiServiceExternal);
const apiService = createApiService({ provider: 'ALL' });
const integrationService = new IntegrationService(apiService);
const applicationService = new ApplicationsUtil(apiService);
const searchService = new SearchService(apiService);
const uploadActions = new UploadActions(apiService);
const usersActions = new UsersActions(apiService);
const pdfFileOne = {
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_path
};
const pdfFileTwo = {
name: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PDF_B.file_path
};
const externalFile = 'Project Overview.ppt';
const csIntegrations = ['adf dev', 'adf master'];
let user: UserModel;
beforeAll(async () => {
await LocalStorageUtil.setStorageItem('providers', 'ALL');
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiServiceExternal.loginWithProfile('admin');
await usersActionsExternal.createUser(user);
await integrationService.addCSIntegration({
tenantId: user.tenantId,
name: csIntegrations[0],
host: browser.params.testConfig.appConfig.ecmHost
});
await integrationService.addCSIntegration({
tenantId: user.tenantId,
name: csIntegrations[1],
host: browser.params.testConfig.adf_external_acs.host
});
await apiService.login(user.username, user.password);
await uploadActions.uploadFile(pdfFileTwo.location, pdfFileTwo.name, '-my-');
await applicationService.importPublishDeployApp(app.file_path);
await searchService.isSearchable(pdfFileTwo.name);
await searchService.isSearchable(externalFile);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(user.tenantId);
});
beforeEach(async () => {
await loginPage.login(user.username, user.password);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C315268] Attach file - Able to upload more than one file (both ACS and local)', async () => {
const name = 'Attach local and acs file';
await taskPage.createTask({ name, formName: app.UPLOAD_FILE_FORM_CS.formName });
await widget.attachFileWidget().attachFile(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileOne.location);
await widget.attachFileWidget().checkFileIsAttached(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileOne.name);
await widget.attachFileWidget().clickUploadButton(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id);
await widget.attachFileWidget().selectUploadSource(csIntegrations[0]);
await contentNodeSelector.checkDialogIsDisplayed();
await searchService.isSearchable(pdfFileTwo.name);
await contentNodeSelector.searchAndSelectResult(pdfFileTwo.name, pdfFileTwo.name);
await contentNodeSelector.clickMoveCopyButton();
await widget.attachFileWidget().checkFileIsAttached(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileTwo.name);
});
it('[C246522] Attach file - Local file', async () => {
const name = 'Attach local file';
await taskPage.createTask({ name, formName: app.UPLOAD_FILE_FORM_CS.formName });
await widget.attachFileWidget().attachFile(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileOne.location);
await widget.attachFileWidget().checkFileIsAttached(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id, pdfFileOne.name);
await widget.attachFileWidget().clickUploadButton(app.UPLOAD_FILE_FORM_CS.FIELD.widget_id);
});
});

View File

@@ -1,102 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService,
ApplicationsUtil,
LoginPage,
UserModel,
UsersActions,
ViewerPage,
Widget
} from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { FileModel } from '../../models/ACS/file.model';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Start Task - Task App', () => {
const app = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
const loginPage = new LoginPage();
const viewerPage = new ViewerPage();
const widget = new Widget();
const taskPage = new TasksPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const applicationService = new ApplicationsUtil(apiService);
let user: UserModel;
const pdfFile = new FileModel({ name: browser.params.resources.Files.ADF_DOCUMENTS.PDF.file_name });
const wordFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.DOCX.file_path
});
const appFields = app.form_fields;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await apiService.login(user.username, user.password);
await applicationService.importPublishDeployApp(app.file_path);
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(user.tenantId);
});
it('[C274690] Should be able to open a file attached to a start form', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const newTask = await taskPage.createNewTask();
await newTask.addName('View file');
await newTask.selectForm(app.formName);
await newTask.clickStartButton();
await widget.attachFileWidget().attachFile(appFields.attachFile_id, pdfFile.location);
await widget.attachFileWidget().checkFileIsAttached(appFields.attachFile_id, pdfFile.name);
await widget.attachFileWidget().viewFile(pdfFile.name);
await viewerPage.checkFileContent('1', pdfFile.firstPageText);
await viewerPage.checkCloseButtonIsDisplayed();
await viewerPage.clickCloseButton();
await taskPage.tasksListPage().checkContentIsDisplayed('View file');
});
it('[C260418] Uploading single file form', async () => {
const name = 'View Doc file';
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.createTask({ name, formName: app.formName });
await widget.attachFileWidget().attachFile(appFields.attachFile_id, wordFile.location);
await widget.attachFileWidget().checkUploadIsNotVisible(appFields.attachFile_id);
await widget.attachFileWidget().checkFileIsAttached(appFields.attachFile_id, wordFile.name);
await taskPage.taskDetails().clickCompleteFormTask();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(name);
await widget.attachFileWidget().checkUploadIsNotVisible(appFields.attachFile_id);
await widget.attachFileWidget().checkFileIsAttached(appFields.attachFile_id, wordFile.name);
});
});

View File

@@ -1,122 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 {
createApiService,
ApplicationsUtil,
ContentNodeSelectorDialogPage,
IntegrationService,
LocalStorageUtil,
LoginPage,
StringUtil,
UserModel,
UsersActions,
UploadActions,
Widget,
SearchService
} from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import CONSTANTS = require('../../util/constants');
describe('Attach Folder', () => {
const app = browser.params.resources.Files.WIDGET_CHECK_APP;
const apiService = createApiService({ provider: 'ALL' });
const searchService = new SearchService(apiService);
const integrationService = new IntegrationService(apiService);
const applicationService = new ApplicationsUtil(apiService);
const usersActions = new UsersActions(apiService);
const loginPage = new LoginPage();
const widget = new Widget();
const taskPage = new TasksPage();
const navigationBarPage = new NavigationBarPage();
const contentNodeSelector = new ContentNodeSelectorDialogPage();
let user: UserModel;
const folderName = StringUtil.generateRandomString(5);
beforeAll(async () => {
await LocalStorageUtil.setStorageItem('providers', 'ALL');
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
await integrationService.addCSIntegration({
tenantId: user.tenantId,
name: 'adf dev',
host: browser.params.testConfig.appConfig.ecmHost
});
await apiService.login(user.username, user.password);
await applicationService.importPublishDeployApp(app.file_path);
await new UploadActions(apiService).createFolder(folderName, '-my-');
await searchService.isSearchable(folderName);
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(user.tenantId);
});
it('[C246534] Attach folder - ACS', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.createTask({ name: 'Attach folder', formName: app.UPLOAD_FOLDER_FORM_CS.formName });
const contentFileWidget = widget.attachFolderWidget();
await contentFileWidget.clickWidget(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id);
await searchService.isSearchable(folderName);
await contentNodeSelector.searchAndSelectResult(folderName, folderName);
expect(await contentNodeSelector.checkCancelButtonIsEnabled()).toBe(true);
expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(true);
await searchService.isSearchable('Meeting Notes');
await contentNodeSelector.searchAndSelectResult('Meeting Notes', 'Meeting Notes');
expect(await contentNodeSelector.checkCancelButtonIsEnabled()).toBe(true);
expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(false);
await contentNodeSelector.clickCancelButton();
await widget.attachFolderWidget().checkFolderIsNotAttached(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id, folderName);
await contentFileWidget.clickWidget(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id);
await contentNodeSelector.checkDialogIsDisplayed();
await contentNodeSelector.searchAndSelectResult(folderName, folderName);
expect(await contentNodeSelector.checkCancelButtonIsEnabled()).toBe(true);
expect(await contentNodeSelector.checkCopyMoveButtonIsEnabled()).toBe(true);
await contentNodeSelector.clickMoveCopyButton();
await widget.attachFolderWidget().checkFolderIsAttached(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id, folderName);
await widget.attachFolderWidget().removeFolder(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id, folderName);
await taskPage.formFields().checkWidgetIsVisible(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id);
await widget.attachFolderWidget().checkFolderIsNotAttached(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id, folderName);
await contentFileWidget.clickWidget(app.UPLOAD_FOLDER_FORM_CS.FIELD.widget_id);
await contentNodeSelector.checkDialogIsDisplayed();
await searchService.isSearchable(folderName);
await contentNodeSelector.searchAndSelectResult(folderName, folderName);
await contentNodeSelector.checkCancelButtonIsEnabled();
await contentNodeSelector.checkCopyMoveButtonIsEnabled();
await contentNodeSelector.clickMoveCopyButton();
await taskPage.taskDetails().clickCompleteFormTask();
});
});

View File

@@ -1,163 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, FormFields, LoginPage, ModelsActions, TaskUtil, UsersActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { AttachFormPage } from './../pages/attach-form.page';
import { TasksPage } from './../pages/tasks.page';
import { TaskDetailsPage } from './../pages/task-details.page';
import CONSTANTS = require('../../util/constants');
describe('Attach Form Component', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const taskDetailsPage = new TaskDetailsPage();
const attachFormPage = new AttachFormPage();
const formFields = new FormFields();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const applicationService = new ApplicationsUtil(apiService);
const taskUtil = new TaskUtil(apiService);
const modelsActions = new ModelsActions(apiService);
const formTextField = app.form_fields.form_fieldId;
let user;
let tenantId;
let appModel;
const testNames = {
taskName: 'Test Task',
formTitle: 'Select Form To Attach',
formName: 'Simple form',
widgetTitle: 'textfield',
formFieldValue: 'Test value'
};
const standaloneTask = {
taskName: 'Standalone Task',
formTitle: 'Select Form To Attach',
formName: 'Simple form',
widgetTitle: 'textfield'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
tenantId = user.tenantId;
await apiService.login(user.username, user.password);
appModel = await applicationService.importPublishDeployApp(app.file_path);
await taskUtil.createStandaloneTask(testNames.taskName);
await taskUtil.createStandaloneTask(standaloneTask.taskName);
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await modelsActions.deleteModel(appModel.id);
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(tenantId);
});
it('[C280047] Should be able to view the attach-form component after creating a standalone task', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow(testNames.taskName);
await taskPage.taskDetails().checkStandaloneNoFormMessageIsDisplayed();
await taskPage.taskDetails().checkAttachFormButtonIsDisplayed();
await taskPage.taskDetails().checkCompleteTaskButtonIsDisplayed();
});
it('[C280048] Should be able to view the attach-form component after clicking cancel button', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow(testNames.taskName);
await taskPage.taskDetails().clickAttachFormButton();
await attachFormPage.checkDefaultFormTitleIsDisplayed(testNames.formTitle);
await attachFormPage.checkFormDropdownIsDisplayed();
await attachFormPage.checkCancelButtonIsDisplayed();
await attachFormPage.checkAttachFormButtonIsDisabled();
await attachFormPage.selectAttachFormOption(testNames.formName);
await formFields.checkWidgetIsReadOnlyMode(testNames.widgetTitle);
await attachFormPage.clickCancelButton();
await taskPage.taskDetails().checkAttachFormButtonIsDisplayed();
});
it('[C280017] Should be able to attach a form on a standalone task and complete', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow(testNames.taskName);
await taskDetailsPage.clickAttachFormButton();
await attachFormPage.selectAttachFormOption(testNames.formName);
await attachFormPage.clickAttachFormButton();
await formFields.setFieldValue(formTextField, testNames.formFieldValue);
await formFields.completeForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(testNames.taskName);
expect(await formFields.getFieldValue(formTextField)).toEqual(testNames.formFieldValue);
});
it('[C329804] Attach form from standalone task with no form template', async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.tasksListPage().selectRow(standaloneTask.taskName);
await taskPage.taskDetails().clickAttachFormButton();
await attachFormPage.checkDefaultFormTitleIsDisplayed(standaloneTask.formTitle);
await attachFormPage.checkCancelButtonIsDisplayed();
await attachFormPage.checkAttachFormButtonIsDisabled();
await attachFormPage.openDropDownForms();
await attachFormPage.checkFormDropdownIsDisplayed();
await attachFormPage.selectAttachFormOption(standaloneTask.formName);
await formFields.checkWidgetIsReadOnlyMode(standaloneTask.widgetTitle);
await attachFormPage.clickCancelButton();
await taskPage.taskDetails().checkAttachFormButtonIsDisplayed();
await taskDetailsPage.clickAttachFormButton();
await attachFormPage.checkDefaultFormTitleIsDisplayed(standaloneTask.formTitle);
await attachFormPage.checkCancelButtonIsDisplayed();
await attachFormPage.checkAttachFormButtonIsDisabled();
await attachFormPage.openDropDownForms();
await attachFormPage.checkFormDropdownIsDisplayed();
await attachFormPage.selectAttachFormOption(standaloneTask.formName);
await formFields.checkWidgetIsReadOnlyMode(standaloneTask.widgetTitle);
await attachFormPage.clickAttachFormButton();
await taskPage.taskDetails().checkAttachFormButtonIsNotDisplayed();
});
});

View File

@@ -1,197 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, LoginPage, TaskUtil, UsersActions, UserModel } from '@alfresco/adf-testing';
import { TasksPage } from '../pages/tasks.page';
import { ProcessServicesPage } from '../pages/process-services.page';
import { ChecklistDialog } from '../pages/dialog/create-checklist-dialog.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
import * as CONSTANTS from '../../util/constants';
describe('Checklist component', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const taskPage = new TasksPage();
const processServices = new ProcessServicesPage();
const checklistDialog = new ChecklistDialog();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const applicationService = new ApplicationsUtil(apiService);
const taskUtil = new TaskUtil(apiService);
let processUserModel: UserModel;
const tasks = ['no checklist created task', 'checklist number task', 'remove running checklist', 'remove completed checklist', 'hierarchy'];
const checklists = ['cancelCheckList', 'dialogChecklist', 'addFirstChecklist', 'addSecondChecklist'];
const removeChecklist = [
'removeFirstRunningChecklist',
'removeSecondRunningChecklist',
'removeFirstCompletedChecklist',
'removeSecondCompletedChecklist'
];
const hierarchyChecklist = ['checklistOne', 'checklistTwo', 'checklistOneChild', 'checklistTwoChild'];
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await applicationService.importPublishDeployApp(app.file_path);
await apiService.login(processUserModel.username, processUserModel.password);
for (const item of tasks) {
await taskUtil.createStandaloneTask(item);
}
await loginPage.login(processUserModel.username, processUserModel.password);
});
beforeEach(async () => {
await navigationBarPage.navigateToProcessServicesPage();
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
it('[C279976] Should no checklist be created when no title is typed', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
await taskPage.clickOnAddChecklistButton();
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistDialogIsNotDisplayed();
await taskPage.checkNoChecklistIsDisplayed();
expect(await taskPage.getNumberOfChecklists()).toEqual('0');
});
it('[C279975] Should no checklist be created when clicking on Cancel button on checklist dialog', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
await (await taskPage.clickOnAddChecklistButton()).addName(checklists[0]);
await checklistDialog.clickCancelButton();
await taskPage.checkChecklistDialogIsNotDisplayed();
await taskPage.checkNoChecklistIsDisplayed();
expect(await taskPage.getNumberOfChecklists()).toEqual('0');
});
it('[C261025] Should Checklist dialog be displayed when clicking on add checklist button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
await taskPage.clickOnAddChecklistButton();
await taskPage.checkChecklistDialogIsDisplayed();
expect(await taskPage.usingCheckListDialog().getDialogTitle()).toEqual('New Check');
expect(await taskPage.usingCheckListDialog().getNameFieldPlaceholder()).toEqual('Name');
await taskPage.usingCheckListDialog().checkAddChecklistButtonIsEnabled();
await checklistDialog.checkCancelButtonIsEnabled();
await taskPage.usingCheckListDialog().clickCancelButton();
});
it('[C261026] Should Checklist number increase when a new checklist is added', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[1]);
await taskPage.tasksListPage().selectRow(tasks[1]);
await (await taskPage.clickOnAddChecklistButton()).addName(checklists[2]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(checklists[2]);
expect(await taskPage.getNumberOfChecklists()).toEqual('1');
await (await taskPage.clickOnAddChecklistButton()).addName(checklists[3]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(checklists[3]);
await taskPage.checkChecklistIsDisplayed(checklists[2]);
expect(await taskPage.getNumberOfChecklists()).toEqual('2');
});
it('[C279980] Should checklist be removed when clicking on remove button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[2]);
await taskPage.tasksListPage().selectRow(tasks[2]);
await taskPage.clickOnAddChecklistButton();
await taskPage.checkChecklistDialogIsDisplayed();
await checklistDialog.addName(removeChecklist[0]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(removeChecklist[0]);
await (await taskPage.clickOnAddChecklistButton()).addName(removeChecklist[1]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(removeChecklist[1]);
await taskPage.removeChecklists(removeChecklist[1]);
await taskPage.checkChecklistIsDisplayed(removeChecklist[0]);
await taskPage.checkChecklistIsNotDisplayed(removeChecklist[1]);
});
it('[C261027] Should not be able to remove a completed Checklist when clicking on remove button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[3]);
await taskPage.tasksListPage().selectRow(tasks[3]);
await (await taskPage.clickOnAddChecklistButton()).addName(removeChecklist[2]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(removeChecklist[2]);
await (await taskPage.clickOnAddChecklistButton()).addName(removeChecklist[3]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(removeChecklist[3]);
await taskPage.tasksListPage().selectRow(removeChecklist[3]);
await taskPage.completeTaskNoForm();
await taskPage.tasksListPage().checkContentIsNotDisplayed(removeChecklist[3]);
await taskPage.tasksListPage().selectRow(tasks[3]);
await taskPage.checkChecklistIsDisplayed(removeChecklist[2]);
await taskPage.checkChecklistIsDisplayed(removeChecklist[3]);
expect(await taskPage.getNumberOfChecklists()).toEqual('2');
await taskPage.checkChecklistsRemoveButtonIsNotDisplayed(removeChecklist[3]);
});
it('[C261028] Should all checklists of a task be completed when the task is completed', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.tasksListPage().selectRow(tasks[4]);
await (await taskPage.clickOnAddChecklistButton()).addName(hierarchyChecklist[0]);
await checklistDialog.clickCreateChecklistButton();
await (await taskPage.clickOnAddChecklistButton()).addName(hierarchyChecklist[1]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.tasksListPage().selectRow(hierarchyChecklist[0]);
await (await taskPage.clickOnAddChecklistButton()).addName(hierarchyChecklist[2]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(hierarchyChecklist[2]);
await taskPage.tasksListPage().selectRow(hierarchyChecklist[1]);
await (await taskPage.clickOnAddChecklistButton()).addName(hierarchyChecklist[3]);
await checklistDialog.clickCreateChecklistButton();
await taskPage.checkChecklistIsDisplayed(hierarchyChecklist[3]);
await taskPage.tasksListPage().selectRow(tasks[4]);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[4]);
await taskPage.tasksListPage().checkContentIsDisplayed(hierarchyChecklist[0]);
await taskPage.tasksListPage().checkContentIsDisplayed(hierarchyChecklist[1]);
await taskPage.tasksListPage().checkContentIsDisplayed(hierarchyChecklist[2]);
await taskPage.tasksListPage().checkContentIsDisplayed(hierarchyChecklist[3]);
});
});

View File

@@ -1,84 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, LoginPage, ModelsActions, UsersActions, Widget, UserModel } from '@alfresco/adf-testing';
import { ProcessFiltersPage } from '../pages/process-filters.page';
import { ProcessServiceTabBarPage } from '../pages/process-service-tab-bar.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
describe('Dynamic Table', () => {
const loginPage = new LoginPage();
const processFiltersPage = new ProcessFiltersPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const navigationBarPage = new NavigationBarPage();
const widget = new Widget();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const modelsActions = new ModelsActions(apiService);
let user: UserModel;
let tenantId: number;
let appId: number;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
tenantId = user.tenantId;
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(tenantId);
});
describe('Required Dropdown', () => {
const app = browser.params.resources.Files.APP_DYNAMIC_TABLE_DROPDOWN;
const dropdown = widget.dropdown();
beforeAll(async () => {
await apiService.login(user.username, user.password);
const applicationsService = new ApplicationsUtil(apiService);
const importedApp = await applicationsService.importPublishDeployApp(app.file_path);
appId = importedApp.id;
await loginPage.login(user.username, user.password);
});
afterAll(async () => {
await apiService.login(user.username, user.password);
await modelsActions.deleteModel(appId);
});
beforeEach(async () => {
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToApp(app.title)).clickProcessButton();
await processServiceTabBarPage.clickProcessButton();
await processFiltersPage.clickCreateProcessButton();
await processFiltersPage.clickNewProcessDropdown();
});
it('[C286519] Should be able to save row with required dropdown column', async () => {
const dropdownOption = 'Option 1';
await widget.dynamicTable().clickAddRow();
await dropdown.selectOption(dropdownOption);
await widget.dynamicTable().clickSaveButton();
await widget.dynamicTable().checkItemIsPresent(dropdownOption);
});
});
});

View File

@@ -1,96 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, FormPage, LoginPage, UserModel, UsersActions, Widget } from '@alfresco/adf-testing';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Form Component', () => {
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const formPage = new FormPage();
const widget = new Widget();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
let tenantId: number;
let user: UserModel;
const fields = {
dateWidgetId: 'label7',
numberWidgetId: 'label4',
amountWidgetId: 'label11'
};
const message = {
test: 'Text Test',
warningNumberAndAmount: 'Use a different number format',
warningDate: 'D-M-YYYY',
errorLogNumber: 'Error Label4 Use a different number format',
errorLogDate: 'Error Label7 D-M-YYYY',
errorLogAmount: 'Error Label11 Use a different number format',
errorLabel: 'Error Label4'
};
beforeAll(async () => {
await apiService.loginWithProfile('admin');
user = await usersActions.createUser();
tenantId = user.tenantId;
await apiService.login(user.username, user.password);
await loginPage.login(user.username, user.password);
await navigationBarPage.navigateToProcessServicesFormPage();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(tenantId);
});
it('[C286505] Should be able to display errors under the Error Log section', async () => {
await widget.numberWidget().getNumberFieldLabel(fields.numberWidgetId);
await widget.numberWidget().setFieldValue(fields.numberWidgetId, message.test);
await formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount);
await formPage.checkErrorLogMessage(message.errorLogNumber);
await widget.dateWidget().checkLabelIsVisible(fields.dateWidgetId);
await widget.dateWidget().setDateInput(fields.dateWidgetId, message.test);
await formPage.saveForm();
await formPage.checkErrorMessageForWidgetIsDisplayed(message.warningDate);
await formPage.checkErrorLogMessage(message.errorLogDate);
await widget.amountWidget().getAmountFieldLabel(fields.amountWidgetId);
await widget.amountWidget().setFieldValue(fields.amountWidgetId, message.test);
await formPage.checkErrorMessageForWidgetIsDisplayed(message.warningNumberAndAmount);
await formPage.checkErrorLogMessage(message.errorLogAmount);
await widget.amountWidget().removeFromAmountWidget(fields.amountWidgetId);
await formPage.checkErrorMessageIsNotDisplayed(message.errorLogAmount);
await widget.dateWidget().clearDateInput(fields.dateWidgetId);
await widget.numberWidget().clearFieldValue(fields.numberWidgetId);
await formPage.checkErrorMessageForWidgetIsNotDisplayed(message.warningDate);
await formPage.checkErrorMessageIsNotDisplayed(message.errorLogDate);
await formPage.checkErrorLogMessage(message.errorLabel);
});
});

View File

@@ -1,104 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, LoginPage, StartProcessPage, UsersActions, Widget } from '@alfresco/adf-testing';
import { ProcessFiltersPage } from './../pages/process-filters.page';
import { ProcessDetailsPage } from './../pages/process-details.page';
import { TaskDetailsPage } from './../pages/task-details.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
import { ProcessServiceTabBarPage } from './../pages/process-service-tab-bar.page';
import { TaskFormsApi } from '@alfresco/js-api';
describe('Form widgets - People ', () => {
const app = browser.params.resources.Files.APP_WITH_USER_WIDGET;
const loginPage = new LoginPage();
const processFiltersPage = new ProcessFiltersPage();
const startProcess = new StartProcessPage();
const processDetailsPage = new ProcessDetailsPage();
const taskDetails = new TaskDetailsPage();
const processServiceTabBarPage = new ProcessServiceTabBarPage();
const widget = new Widget();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const taskFormsApi = new TaskFormsApi(apiService.getInstance());
let processUserModel;
let appModel;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
const applicationsService = new ApplicationsUtil(apiService);
appModel = await applicationsService.importPublishDeployApp(app.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(processUserModel.tenantId);
});
beforeEach(async () => {
await (await (await new NavigationBarPage().navigateToProcessServicesPage()).goToApp(appModel.name)).clickProcessButton();
await processFiltersPage.clickCreateProcessButton();
await processFiltersPage.clickNewProcessDropdown();
await widget.peopleWidget().checkPeopleFieldIsDisplayed();
await widget.peopleWidget().fillPeopleField(processUserModel.firstName);
await widget.peopleWidget().selectUserFromDropdown();
});
it('[C286577] Should be able to start a process with people widget', async () => {
await startProcess.clickFormStartProcessButton();
await processDetailsPage.activeTask.click();
const taskId = await taskDetails.getId();
const taskForm: any = await taskFormsApi.getTaskForm(taskId);
const userEmail = taskForm['fields'][0].fields['1'][0].value.email;
expect(userEmail).toEqual(processUserModel.email);
});
it('[C286576] Should be able to see user in completed task', async () => {
await startProcess.enterProcessName(app.processName);
await startProcess.clickFormStartProcessButton();
await processDetailsPage.activeTask.click();
await taskDetails.checkCompleteFormButtonIsDisplayed();
await taskDetails.clickCompleteFormTask();
await processServiceTabBarPage.clickProcessButton();
await processFiltersPage.clickCompletedFilterButton();
await processFiltersPage.selectFromProcessList(app.processName);
await processDetailsPage.completedTask.click();
const taskId = await taskDetails.getId();
const taskForm: any = await taskFormsApi.getTaskForm(taskId);
const userEmail = taskForm['fields'][0].fields['1'][0].value.email;
expect(userEmail).toEqual(processUserModel.email);
});
});

View File

@@ -1,251 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, LoginPage, ProcessUtil, UsersActions, Widget } from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { browser } from 'protractor';
import CONSTANTS = require('../../util/constants');
import FormDefinitionModel = require('../../models/APS/FormDefinitionModel');
import { TaskFormsApi } from '@alfresco/js-api';
const formInstance = new FormDefinitionModel();
describe('Form widgets', () => {
const taskPage = new TasksPage();
const loginPage = new LoginPage();
const widget = new Widget();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const applicationsService = new ApplicationsUtil(apiService);
const taskFormsApi = new TaskFormsApi(apiService.getInstance());
const processUtil = new ProcessUtil(apiService);
const newTask = 'First task';
let processUserModel;
let appModelWidget;
describe('Form widgets', () => {
const appWidget = browser.params.resources.Files.WIDGETS_SMOKE_TEST;
const appFields = appWidget.form_fields;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
appModelWidget = await applicationsService.importPublishDeployApp(appWidget.file_path);
await loginPage.login(processUserModel.username, processUserModel.password);
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToApp(appModelWidget.name);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
const task = await taskPage.createNewTask();
await task.addName(newTask);
await task.addDescription('Description');
await task.selectForm(appWidget.formName);
await task.clickStartButton();
await taskPage.tasksListPage().checkContentIsDisplayed(newTask);
await taskPage.formFields().checkFormIsDisplayed();
expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
const response = await taskPage.taskDetails().getId();
const formDefinition = await taskFormsApi.getTaskForm(response);
formInstance.setFields(formDefinition.fields);
formInstance.setAllWidgets(formDefinition.fields);
});
afterAll(async () => {
await new NavigationBarPage().clickLogoutButton();
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(processUserModel.tenantId);
await apiService.getInstance().logout();
});
it('[C272778] Should display text and multi-line in form', async () => {
expect(await taskPage.formFields().getFieldLabel(appFields.text_id)).toEqual(formInstance.getWidgetBy('id', appFields.text_id).name);
expect(await taskPage.formFields().getFieldValue(appFields.text_id)).toEqual(
formInstance.getWidgetBy('id', appFields.text_id).value || ''
);
expect(await widget.multilineTextWidget().getFieldValue(appFields.multiline_id)).toEqual(
formInstance.getWidgetBy('id', appFields.multiline_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.multiline_id)).toEqual(
formInstance.getWidgetBy('id', appFields.multiline_id).name
);
});
it('[C272779] Should display number and amount in form', async () => {
expect(await taskPage.formFields().getFieldValue(appFields.number_id)).toEqual(
formInstance.getWidgetBy('id', appFields.number_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.number_id)).toEqual(formInstance.getWidgetBy('id', appFields.number_id).name);
expect(await taskPage.formFields().getFieldValue(appFields.amount_id)).toEqual(
formInstance.getWidgetBy('id', appFields.amount_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.amount_id)).toEqual(formInstance.getWidgetBy('id', appFields.amount_id).name);
});
it('[C272780] Should display attach file and attach folder in form', async () => {
expect(await taskPage.formFields().getFieldLabel(appFields.attachFolder_id)).toEqual(
formInstance.getWidgetBy('id', appFields.attachFolder_id).name
);
expect(await taskPage.formFields().getFieldLabel(appFields.attachFile_id)).toEqual(
formInstance.getWidgetBy('id', appFields.attachFile_id).name
);
});
it('[C272781] Should display date and date & time in form', async () => {
expect(await taskPage.formFields().getFieldLabel(appFields.date_id)).toContain(formInstance.getWidgetBy('id', appFields.date_id).name);
expect(await taskPage.formFields().getFieldValue(appFields.date_id)).toEqual(
formInstance.getWidgetBy('id', appFields.date_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.dateTime_id)).toContain(
formInstance.getWidgetBy('id', appFields.dateTime_id).name
);
expect(await taskPage.formFields().getFieldValue(appFields.dateTime_id)).toEqual(
formInstance.getWidgetBy('id', appFields.dateTime_id).value || ''
);
});
it('[C272782] Should display people and group in form', async () => {
expect(await taskPage.formFields().getFieldValue(appFields.people_id)).toEqual(
formInstance.getWidgetBy('id', appFields.people_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.people_id)).toEqual(formInstance.getWidgetBy('id', appFields.people_id).name);
expect(await taskPage.formFields().getFieldValue(appFields.group_id)).toEqual(
formInstance.getWidgetBy('id', appFields.group_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.group_id)).toEqual(formInstance.getWidgetBy('id', appFields.group_id).name);
});
it('[C272783] Should display displayText and displayValue in form', async () => {
const expected0 = formInstance.getWidgetBy('id', appFields.displayText_id).value;
const expected1 = (formInstance.getWidgetBy('id', appFields.displayValue_id).value as string) || 'Display value';
const expected2 = (formInstance.getWidgetBy('id', appFields.displayValue_id).value as string) || '';
expect(await widget.displayTextWidget().getFieldLabel(appFields.displayText_id)).toEqual(expected0);
expect(await widget.displayValueWidget().getFieldLabel(appFields.displayValue_id)).toEqual(expected1);
expect(await widget.displayValueWidget().getFieldValue(appFields.displayValue_id)).toEqual(expected2);
});
it('[C272784] Should display typeahead and header in form', async () => {
expect(await widget.headerWidget().getFieldLabel(appFields.header_id)).toEqual(formInstance.getWidgetBy('id', appFields.header_id).name);
expect(await taskPage.formFields().getFieldValue(appFields.typeAhead_id)).toEqual(
formInstance.getWidgetBy('id', appFields.typeAhead_id).value || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.typeAhead_id)).toEqual(
formInstance.getWidgetBy('id', appFields.typeAhead_id).name
);
});
it('[C272785] Should display checkbox and radio button in form', async () => {
const radioOption = 1;
expect(await taskPage.formFields().getFieldLabel(appFields.checkbox_id)).toContain(
formInstance.getWidgetBy('id', appFields.checkbox_id).name
);
expect(await taskPage.formFields().getFieldLabel(appFields.radioButtons_id)).toContain(
formInstance.getWidgetBy('id', appFields.radioButtons_id).name
);
expect(await widget.radioWidget().getSpecificOptionLabel(appFields.radioButtons_id, radioOption)).toContain(
formInstance.getWidgetBy('id', appFields.radioButtons_id).options[radioOption - 1].name
);
});
it('[C268149] Should display hyperlink, dropdown and dynamic table in form', async () => {
expect(await widget.hyperlink().getFieldText(appFields.hyperlink_id)).toEqual(
formInstance.getWidgetBy('id', appFields.hyperlink_id).hyperlinkUrl || ''
);
expect(await taskPage.formFields().getFieldLabel(appFields.hyperlink_id)).toEqual(
formInstance.getWidgetBy('id', appFields.hyperlink_id).name
);
expect(await taskPage.formFields().getFieldLabel(appFields.dropdown_id)).toContain(
formInstance.getWidgetBy('id', appFields.dropdown_id).name
);
expect(widget.dropdown().getSelectedOptionText(appFields.dropdown_id)).toContain(
formInstance.getWidgetBy('id', appFields.dropdown_id).value
);
expect(await widget.dynamicTable().getFieldLabel(appFields.dynamicTable_id)).toContain(
formInstance.getWidgetBy('id', appFields.dynamicTable_id).name
);
expect(await widget.dynamicTable().getColumnName(appFields.dynamicTable_id)).toContain(
formInstance.getWidgetBy('id', appFields.dynamicTable_id).columnDefinitions[0].name
);
});
});
describe('with fields involving other people', () => {
const app = browser.params.resources.Files.FORM_ADF;
let process;
const appFields = app.form_fields;
let appModel;
beforeAll(async () => {
await apiService.loginWithProfile('admin');
processUserModel = await usersActions.createUser();
await apiService.login(processUserModel.username, processUserModel.password);
appModel = await applicationsService.importPublishDeployApp(app.file_path);
process = await processUtil.startProcessOfApp(appModel.name);
await loginPage.login(processUserModel.username, processUserModel.password);
});
beforeEach(async () => {
await (await new NavigationBarPage().navigateToProcessServicesPage()).goToApp(appModel.name);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
await taskPage.formFields().checkFormIsDisplayed();
});
afterAll(async () => {
await processUtil.cancelProcessInstance(process.id);
await apiService.loginWithProfile('admin');
await usersActions.deleteTenant(processUserModel.tenantId);
});
it('[C260405] Value fields configured with process variables', async () => {
await taskPage.formFields().checkFormIsDisplayed();
expect(await taskPage.taskDetails().getTitle()).toEqual('Activities');
await taskPage.formFields().setValueInInputById('label', 'value 1');
await taskPage.formFields().completeForm();
/* cspell:disable-next-line */
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
expect(await widget.displayTextWidget().getFieldText(appFields.displayText_id)).toContain('value 1');
expect(await widget.textWidget().getFieldValue(appFields.text_id)).toEqual('value 1');
expect(await widget.displayValueWidget().getFieldValue(appFields.displayValue_id)).toEqual('value 1');
});
});
});

View File

@@ -1,233 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { createApiService, ApplicationsUtil, LoginPage, TaskUtil, UserModel, UsersActions } from '@alfresco/adf-testing';
import { TasksPage } from './../pages/tasks.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { ProcessServicesPage } from './../pages/process-services.page';
import { browser } from 'protractor';
import * as CONSTANTS from '../../util/constants';
describe('People component', () => {
const app = browser.params.resources.Files.SIMPLE_APP_WITH_USER_FORM;
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const taskPage = new TasksPage();
const processServices = new ProcessServicesPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const taskUtil = new TaskUtil(apiService);
const applicationUtil = new ApplicationsUtil(apiService);
let processUserModel;
let assigneeUserModel;
let secondAssigneeUserModel;
const peopleTitle = 'People this task is shared with ';
const tasks = ['no people involved task', 'remove people task', 'can not complete task', 'multiple users', 'completed filter'];
beforeAll(async () => {
await apiService.loginWithProfile('admin');
assigneeUserModel = await usersActions.createUser();
secondAssigneeUserModel = await usersActions.createUser(new UserModel({ tenantId: assigneeUserModel.tenantId }));
processUserModel = await usersActions.createUser(new UserModel({ tenantId: assigneeUserModel.tenantId }));
await apiService.login(processUserModel.username, processUserModel.password);
await applicationUtil.importApplication(app.file_path);
await taskUtil.createStandaloneTask(tasks[0]);
await taskUtil.createStandaloneTask(tasks[1]);
await taskUtil.createStandaloneTask(tasks[2]);
await taskUtil.createStandaloneTask(tasks[3]);
await taskUtil.createStandaloneTask(tasks[4]);
});
beforeEach(async () => {
await loginPage.login(processUserModel.username, processUserModel.password);
await navigationBarPage.navigateToProcessServicesPage();
await (await processServices.goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.MY_TASKS);
});
afterEach(async () => {
await navigationBarPage.clickLogoutButton();
});
it('[C279989] Should no people be involved when no user is typed', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
await taskPage.taskDetails().clickInvolvePeopleButton();
await taskPage.taskDetails().clickAddInvolvedUserButton();
await taskPage.taskDetails().checkNoPeopleIsInvolved();
});
it('[C279990] Should no people be involved when clicking on Cancel button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickCancelInvolvePeopleButton();
await taskPage.taskDetails().checkNoPeopleIsInvolved();
});
it('[C261029] Should People dialog be displayed when clicking on add people button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
expect(await taskPage.taskDetails().getInvolvePeopleHeader()).toEqual('Add people and groups');
expect(await taskPage.taskDetails().getInvolvePeoplePlaceholder()).toEqual('Search user');
await taskDetails.checkAddPeopleButtonIsEnabled();
await taskDetails.checkCancelButtonIsEnabled();
await taskDetails.clickCancelInvolvePeopleButton();
});
it('[C279991] Should not be able to involve a user when is the creator of the task', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(processUserModel.firstName + ' ' + processUserModel.lastName);
await taskDetails.noUserIsDisplayedInSearchInvolvePeople(processUserModel.firstName + ' ' + processUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
await taskPage.taskDetails().checkNoPeopleIsInvolved();
});
it('[C261030] Should involved user be removed when clicking on remove button', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[0]);
await taskPage.tasksListPage().selectRow(tasks[0]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)).toEqual(
assigneeUserModel.email
);
await taskPage.taskDetails().removeInvolvedUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().checkNoPeopleIsInvolved();
});
it('[C280013] Should not be able to complete a task by a involved user', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[1]);
await taskPage.tasksListPage().selectRow(tasks[1]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)).toEqual(
assigneeUserModel.email
);
await navigationBarPage.clickLogoutButton();
await loginPage.login(assigneeUserModel.username, assigneeUserModel.password);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[1]);
await taskPage.tasksListPage().selectRow(tasks[1]);
await taskPage.completeTaskNoFormNotDisplayed();
});
it('[C261031] Should be able to involve multiple users to a task', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[2]);
await taskPage.tasksListPage().selectRow(tasks[2]);
const taskDetails = taskPage.taskDetails();
await taskPage.taskDetails().clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)).toEqual(
assigneeUserModel.email
);
expect(await taskPage.taskDetails().getInvolvedPeopleTitle()).toEqual(peopleTitle + '(1)');
const taskDetails2 = taskPage.taskDetails();
await taskDetails2.clickInvolvePeopleButton();
await taskDetails2.typeUser(secondAssigneeUserModel.firstName + ' ' + secondAssigneeUserModel.lastName);
await taskDetails2.selectUserToInvolve(secondAssigneeUserModel.firstName + ' ' + secondAssigneeUserModel.lastName);
await taskDetails2.checkUserIsSelected(secondAssigneeUserModel.firstName + ' ' + secondAssigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
expect(await taskPage.taskDetails().getInvolvedUserEmail(secondAssigneeUserModel.firstName + ' ' + secondAssigneeUserModel.lastName)).toEqual(
secondAssigneeUserModel.email
);
expect(await taskPage.taskDetails().getInvolvedPeopleTitle()).toEqual(peopleTitle + '(2)');
});
it('[C280014] Should involved user see the task in completed filters when the task is completed', async () => {
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[3]);
await taskPage.tasksListPage().selectRow(tasks[3]);
const taskDetails = taskPage.taskDetails();
await taskDetails.clickInvolvePeopleButton();
await taskDetails.typeUser(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.selectUserToInvolve(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskDetails.checkUserIsSelected(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName);
await taskPage.taskDetails().clickAddInvolvedUserButton();
expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)).toEqual(
assigneeUserModel.email
);
await taskPage.completeTaskNoForm();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().selectRow(tasks[3]);
expect(await taskPage.taskDetails().getInvolvedUserEmail(assigneeUserModel.firstName + ' ' + assigneeUserModel.lastName)).toEqual(
assigneeUserModel.email
);
await navigationBarPage.clickLogoutButton();
await loginPage.login(assigneeUserModel.username, assigneeUserModel.password);
await (await (await navigationBarPage.navigateToProcessServicesPage()).goToTaskApp()).clickTasksButton();
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.COMPLETED_TASKS);
await taskPage.tasksListPage().checkContentIsDisplayed(tasks[3]);
await taskPage.tasksListPage().selectRow(tasks[3]);
await taskPage.filtersPage().goToFilter(CONSTANTS.TASK_FILTERS.INV_TASKS);
await taskPage.tasksListPage().checkContentIsNotDisplayed(tasks[3]);
});
});

View File

@@ -1,66 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { $ } from 'protractor';
import { BrowserVisibility, BrowserActions, DropdownPage, materialLocators } from '@alfresco/adf-testing';
export class AttachFormPage {
noFormMessage = $('.adf-empty-content__title');
attachFormButton = $('#adf-attach-form-attach-button');
completeButton = $('#adf-attach-form-complete-button');
formDropdown = $('#form_id');
cancelButton = $('#adf-attach-form-cancel-button');
defaultTitle = $(materialLocators.Card.title.class);
attachFormDropdown = new DropdownPage($('.adf-attach-form-row'));
async checkAttachFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
}
async clickAttachFormButton(): Promise<void> {
await BrowserActions.click(this.attachFormButton);
}
async checkDefaultFormTitleIsDisplayed(formTitle: string): Promise<void> {
const result = await BrowserActions.getText(this.defaultTitle);
expect(result).toEqual(formTitle);
}
async openDropDownForms(): Promise<void> {
await BrowserActions.click(this.formDropdown);
}
async checkFormDropdownIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.formDropdown);
}
async checkCancelButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelButton);
}
async selectAttachFormOption(option: string): Promise<void> {
await this.attachFormDropdown.selectDropdownOption(option);
}
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async checkAttachFormButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($('button[id="adf-attach-form-attach-button"][disabled]'));
}
}

View File

@@ -1,89 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { protractor, browser, $, $$ } from 'protractor';
import * as path from 'path';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class AttachmentListPage {
attachFileButton = $('input[type=\'file\']');
buttonMenu = $('button[data-automation-id=\'action_menu_0\']');
viewButton = $('button[data-automation-id*=\'MENU_ACTIONS.VIEW_CONTENT\']');
removeButton = $('button[data-automation-id*=\'MENU_ACTIONS.REMOVE_CONTENT\']');
downloadButton = $('button[data-automation-id*=\'MENU_ACTIONS.DOWNLOAD_CONTENT\']');
noContentContainer = $('div[class*=\'adf-no-content-container\']');
async checkEmptyAttachmentList(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentContainer);
}
async clickAttachFileButton(fileLocation: string): Promise<void> {
await browser.sleep(500);
await BrowserVisibility.waitUntilElementIsPresent(this.attachFileButton);
await this.attachFileButton.sendKeys(path.resolve(path.join(browser.params.testConfig.main.rootPath, fileLocation)));
}
async checkFileIsAttached(name: string): Promise<void> {
const fileAttached = $$('div[data-automation-id="' + name + '"]').first();
await BrowserVisibility.waitUntilElementIsVisible(fileAttached);
}
async checkAttachFileButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.attachFileButton);
}
async viewFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.viewButton);
await browser.sleep(500);
}
async removeFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.removeButton);
await browser.sleep(500);
}
async downloadFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click($$('div[data-automation-id="' + name + '"]').first());
await BrowserActions.click(this.buttonMenu);
await browser.sleep(500);
await BrowserActions.click(this.downloadButton);
}
async doubleClickFile(name: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible($$(`div[data-automation-id="${name}"]`).first());
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
await BrowserActions.click(fileAttached);
await browser.actions().sendKeys(protractor.Key.ENTER).perform();
}
async checkFileIsRemoved(name: string): Promise<void> {
const fileAttached = $$(`div[data-automation-id="${name}"]`).first();
await BrowserVisibility.waitUntilElementIsNotVisible(fileAttached);
}
}

View File

@@ -1,58 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { $ } from 'protractor';
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
export class ChecklistDialog {
nameField = $('input[data-automation-id="checklist-name"]');
addChecklistButton = $('button[id="add-check"]');
closeButton = $('button[id="close-check-dialog"]');
dialogTitle = $('#add-checklist-title');
async addName(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.nameField, name);
}
async clickCreateChecklistButton(): Promise<void> {
await BrowserActions.click(this.addChecklistButton);
}
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
getDialogTitle(): Promise<string> {
return BrowserActions.getText(this.dialogTitle);
}
async getNameFieldPlaceholder(): Promise<string> {
return BrowserActions.getAttribute(this.nameField, 'placeholder');
}
async checkCancelButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
await BrowserVisibility.waitUntilElementIsClickable(this.closeButton);
}
async checkAddChecklistButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addChecklistButton);
await BrowserVisibility.waitUntilElementIsClickable(this.addChecklistButton);
}
}

View File

@@ -1,93 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { element, by, Key, ElementFinder, $ } from 'protractor';
import { BrowserVisibility, BrowserActions, DropdownPage, materialLocators } from '@alfresco/adf-testing';
export class StartTaskDialogPage {
name = $('input[id="name_id"]');
dueDate = $('input[id="date_id"]');
description = $('textarea[id="description_id"]');
assignee = $('div#people-widget-content input');
startButton = $('button[id="button-start"]');
startButtonEnabled = $('button[id="button-start"]:not(disabled)');
cancelButton = $('button[id="button-cancel"]');
selectFormDropdown = new DropdownPage($(`${materialLocators.Select.root}[id="form_id"]`));
selectAssigneeDropdown = new DropdownPage();
async addName(userName: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.name);
await this.name.clear();
await this.name.sendKeys(userName);
}
async addDescription(userDescription: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.description);
await this.description.sendKeys(userDescription);
}
async addDueDate(date: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.dueDate);
await this.dueDate.sendKeys(date);
}
async addAssignee(name: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.assignee);
await this.assignee.sendKeys(name);
await this.selectAssigneeFromList(name);
}
async selectAssigneeFromList(name: string): Promise<void> {
await this.selectAssigneeDropdown.selectOption(name);
}
async getAssignee(): Promise<string> {
return BrowserActions.getAttribute(this.assignee, 'placeholder');
}
async selectForm(form): Promise<void> {
await this.selectFormDropdown.selectDropdownOption(form);
}
async clickStartButton(): Promise<void> {
return BrowserActions.click(this.startButton);
}
async checkStartButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.startButtonEnabled);
}
async checkStartButtonIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($('button[id="button-start"]:disabled'));
}
async clickCancelButton(): Promise<void> {
await BrowserActions.click(this.cancelButton);
}
async blur(locator: ElementFinder): Promise<void> {
await BrowserActions.click(locator);
await locator.sendKeys(Key.TAB);
}
async checkValidationErrorIsDisplayed(error: string, elementRef = materialLocators.Error.root): Promise<void> {
const errorElement = element(by.cssContainingText(elementRef, error));
await BrowserVisibility.waitUntilElementIsVisible(errorElement);
}
}

View File

@@ -1,49 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, DataTableComponentPage } from '@alfresco/adf-testing';
import { $ } from 'protractor';
export class FiltersPage {
activeFilter = $('.adf-active');
dataTable: DataTableComponentPage = new DataTableComponentPage();
async getActiveFilter(): Promise<string> {
return BrowserActions.getText(this.activeFilter);
}
async goToFilter(filterName): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const filter = $(`button[data-automation-id="${filterName}_filter"]`);
await BrowserActions.click(filter);
await this.dataTable.waitTillContentLoaded();
}
async sortByName(sortOrder: string): Promise<void> {
await this.dataTable.sortByColumn(sortOrder, 'name');
}
async getAllRowsNameColumn(): Promise<string[]> {
return this.dataTable.getAllRowsColumnValues('Task Name');
}
async checkFilterIsHighlighted(filterName: string): Promise<void> {
const highlightedFilter = $(`.adf-active [data-automation-id='${filterName}_filter']`);
await BrowserVisibility.waitUntilElementIsVisible(highlightedFilter);
}
}

View File

@@ -1,96 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { protractor } from 'protractor';
import { ProcessInstanceHeaderPage, TestElement, materialLocators } from '@alfresco/adf-testing';
export class ProcessDetailsPage {
processInstanceHeaderPage = new ProcessInstanceHeaderPage();
processTitle = TestElement.byCss(materialLocators.Card.title.class);
processDetailsMessage = TestElement.byCss('adf-process-instance-details div');
showDiagramButtonDisabled = TestElement.byCss('button[id="show-diagram-button"][disabled]');
propertiesList = TestElement.byCss('.adf-property-list');
showDiagramButton = TestElement.byId('show-diagram-button');
diagramCanvas = TestElement.byCss('svg[xmlns="http://www.w3.org/2000/svg"]');
backButton = TestElement.byCss('#btn-diagram-back');
commentInput = TestElement.byId('comment-input');
auditLogButton = TestElement.byCss('button[adf-process-audit]');
cancelProcessButton = TestElement.byCss('div[data-automation-id="header-status"] > button');
activeTask = TestElement.byCss('div[data-automation-id="active-tasks"]');
completedTask = TestElement.byCss('div[data-automation-id="completed-tasks"]');
taskTitle = TestElement.byCss('.adf-activiti-task-details__header');
checkProcessTitleIsDisplayed(): Promise<string> {
return this.processTitle.getText();
}
checkProcessDetailsMessage(): Promise<string> {
return this.processDetailsMessage.getText();
}
async checkProcessHeaderDetailsAreVisible(): Promise<void> {
await this.processInstanceHeaderPage.checkDetailsAreDisplayed();
}
getProcessStatus(): Promise<string> {
return this.processInstanceHeaderPage.getStatusFieldValue();
}
getEndDate(): Promise<string> {
return this.processInstanceHeaderPage.getEndDateFieldValue();
}
getProcessCategory(): Promise<string> {
return this.processInstanceHeaderPage.getCategoryFieldValue();
}
getBusinessKey(): Promise<string> {
return this.processInstanceHeaderPage.getBusinessKeyFieldValue();
}
getCreatedBy(): Promise<string> {
return this.processInstanceHeaderPage.getStartedByFieldValue();
}
getCreated(): Promise<string> {
return this.processInstanceHeaderPage.getStartDateFieldValue();
}
getId(): Promise<string> {
return this.processInstanceHeaderPage.getIdFieldValue();
}
getProcessDescription(): Promise<string> {
return this.processInstanceHeaderPage.getDescriptionFieldValue();
}
async clickShowDiagram(): Promise<void> {
await this.showDiagramButton.click();
await this.diagramCanvas.waitVisible();
await this.backButton.click();
}
async addComment(comment: string): Promise<void> {
await this.commentInput.waitVisible();
await this.commentInput.elementFinder.sendKeys(comment);
await this.commentInput.elementFinder.sendKeys(protractor.Key.ENTER);
}
checkCommentIsDisplayed(comment: string): Promise<void> {
return TestElement.byText('div.adf-comment-message', comment).waitVisible();
}
}

View File

@@ -1,98 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, DataTableComponentPage, StartProcessPage } from '@alfresco/adf-testing';
import { $, $$ } from 'protractor';
export class ProcessFiltersPage {
dataTable = new DataTableComponentPage();
createProcessButton = $('.app-processes-menu button[data-automation-id="create-button"] > span');
newProcessButton = $('div > button[data-automation-id="btn-start-process"]');
processesPage = $('#app-processes-menu');
buttonWindow = $('div > button[data-automation-id="btn-start-process"] > div');
noContentMessage = $$('.adf-empty-content__title').first();
rows = $$('adf-process-instance-list .adf-datatable-body adf-datatable-row[class*="adf-datatable-row"]');
startProcessEl = $('adf-start-process .adf-start-process');
getButtonFilterLocatorByName = (name: string) => $(`button[data-automation-id='${name}_filter']`);
async startProcess(): Promise<StartProcessPage> {
await this.clickCreateProcessButton();
await this.clickNewProcessDropdown();
return new StartProcessPage();
}
async clickRunningFilterButton(): Promise<void> {
await BrowserActions.click(await this.getButtonFilterLocatorByName('Running'));
}
async clickCompletedFilterButton(): Promise<void> {
const completedFilterButtonLocator = await this.getButtonFilterLocatorByName('Completed');
await BrowserActions.click(completedFilterButtonLocator);
expect(await completedFilterButtonLocator.isEnabled()).toBe(true);
}
async clickAllFilterButton(): Promise<void> {
const allFilterButtonLocator = await this.getButtonFilterLocatorByName('All');
await BrowserActions.click(allFilterButtonLocator);
expect(await allFilterButtonLocator.isEnabled()).toBe(true);
}
async clickCreateProcessButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserVisibility.waitUntilElementIsVisible(this.processesPage);
await BrowserActions.click(this.createProcessButton);
}
async clickNewProcessDropdown(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.buttonWindow);
await BrowserActions.click(this.newProcessButton);
}
async checkStartProcessIsDisplay(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.startProcessEl);
}
async checkNoContentMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noContentMessage);
}
async selectFromProcessList(title: string): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
const processName = $$(`div[data-automation-id="text_${title}"]`).first();
await BrowserActions.click(processName);
}
async numberOfProcessRows(): Promise<number> {
await BrowserVisibility.waitUntilElementIsVisible(await this.rows.first());
return this.rows.count();
}
async waitForTableBody(): Promise<void> {
await this.dataTable.waitForTableBody();
}
async checkFilterIsDisplayed(name: string): Promise<void> {
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsVisible(filterName);
}
async checkFilterIsNotDisplayed(name: string): Promise<void> {
const filterName = await this.getButtonFilterLocatorByName(name);
await BrowserVisibility.waitUntilElementIsNotVisible(filterName);
}
}

View File

@@ -1,93 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, DataTableComponentPage, DropdownPage, materialLocators } from '@alfresco/adf-testing';
import { $, by, element } from 'protractor';
export class ProcessListDemoPage {
appIdInput = $('input[data-automation-id="app-id"]');
resetButton = element(by.cssContainingText('button span', 'Reset'));
emptyProcessContent = $('.adf-empty-content');
processDefinitionInput = $('input[data-automation-id="process-definition-id"]');
processInstanceInput = $('input[data-automation-id="process-instance-id"]');
stateDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id="state"]`));
sortDropdown = new DropdownPage($(`${materialLocators.Select.root}[data-automation-id="sort"]`));
dataTable = new DataTableComponentPage();
getDisplayedProcessesNames(): Promise<any> {
return this.dataTable.getAllRowsColumnValues('Name');
}
async selectSorting(sortingOption: string): Promise<void> {
await this.sortDropdown.selectDropdownOption(sortingOption);
}
async selectStateFilter(stateOption: string): Promise<void> {
await this.stateDropdown.selectDropdownOption(stateOption);
}
async addAppId(appId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.appIdInput, appId);
}
async clickResetButton(): Promise<void> {
await BrowserActions.click(this.resetButton);
}
async checkErrorMessageIsDisplayed(error: string): Promise<void> {
const errorMessage = element(by.cssContainingText(materialLocators.Error.root, error));
await BrowserVisibility.waitUntilElementIsVisible(errorMessage);
}
async checkNoProcessFoundIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyProcessContent);
}
async checkProcessIsNotDisplayed(processName: string): Promise<void> {
await this.dataTable.checkContentIsNotDisplayed('Name', processName);
}
async checkProcessIsDisplayed(processName: string): Promise<void> {
await this.dataTable.checkContentIsDisplayed('Name', processName);
}
async checkAppIdFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.appIdInput);
}
async checkProcessInstanceIdFieldIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceInput);
}
async checkStateDropdownIsDisplayed(): Promise<void> {
await this.stateDropdown.checkDropdownIsVisible();
}
async checkSortDropdownIsDisplayed(): Promise<void> {
await this.sortDropdown.checkDropdownIsVisible();
}
async addProcessDefinitionId(procDefinitionId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.processDefinitionInput, procDefinitionId);
}
async addProcessInstanceId(procInstanceId: string): Promise<void> {
await BrowserActions.clearSendKeys(this.processInstanceInput, procInstanceId);
}
}

View File

@@ -1,37 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
import { $ } from 'protractor';
export class ProcessListPage {
processListTitle = $('.adf-empty-content__title');
processInstanceList = $('adf-process-instance-list');
getDisplayedProcessListTitle(): Promise<string> {
return BrowserActions.getText(this.processListTitle);
}
async isProcessListDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.processInstanceList);
return true;
} catch (error) {
return false;
}
}
}

View File

@@ -1,42 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserVisibility, BrowserActions, materialLocators } from '@alfresco/adf-testing';
import { element, by, browser } from 'protractor';
export class ProcessServiceTabBarPage {
tasksButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Tasks')).first();
processButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Process')).first();
reportsButton = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class}`, 'Reports')).first();
reportsButtonSelected = element.all(by.cssContainingText(`div${materialLocators.Tab.labels.container.class} ${materialLocators.Tab.labels.class} div[aria-selected="true"]`, 'Reports')).first();
async clickTasksButton(): Promise<void> {
await BrowserActions.click(this.tasksButton);
await browser.sleep(100);
}
async clickProcessButton(): Promise<void> {
await BrowserActions.click(this.processButton);
await browser.sleep(100);
}
async clickReportsButton(): Promise<void> {
await BrowserActions.click(this.reportsButton);
await BrowserVisibility.waitUntilElementIsVisible(this.reportsButtonSelected);
}
}

View File

@@ -1,86 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { ProcessServiceTabBarPage } from './process-service-tab-bar.page';
import { browser, $, ElementFinder } from 'protractor';
import { BrowserVisibility, BrowserActions, materialLocators } from '@alfresco/adf-testing';
import { TasksPage } from './tasks.page';
export class ProcessServicesPage {
apsAppsContainer = $('.adf-app-listgrid');
iconTypeLocator = `${materialLocators.Icon.root}[class*="card-logo-icon"]`;
descriptionLocator = `${materialLocators.Card.subtitle.root}[class*="subtitle"]`;
getApplicationNameLocator = (name: string): ElementFinder => $(`${materialLocators.Card.root}[title="${name}"]`);
async checkApsContainer(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.apsAppsContainer);
}
async goToApp(applicationName: string): Promise<ProcessServiceTabBarPage> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserActions.click(app);
const taskPage = new TasksPage();
await taskPage.tasksListPage().checkTaskListIsLoaded();
return new ProcessServiceTabBarPage();
}
async goToTaskApp(): Promise<ProcessServiceTabBarPage> {
const taskAppLocator = this.getApplicationNameLocator('Task App');
await BrowserActions.click(taskAppLocator);
return new ProcessServiceTabBarPage();
}
async goToAppByAppId(appId: string | number): Promise<void> {
const urlToNavigateTo = `${browser.baseUrl}/activiti/apps/${appId}/tasks/`;
await BrowserActions.getUrl(urlToNavigateTo);
const taskPage = new TasksPage();
await taskPage.tasksListPage().checkTaskListIsLoaded();
}
async getAppIconType(applicationName: string): Promise<string> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
const iconType = await app.$(this.iconTypeLocator);
return BrowserActions.getText(iconType);
}
async getBackgroundColor(applicationName: string): Promise<string> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
return app.getCssValue('background-color');
}
async getDescription(applicationName: string): Promise<string> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
const description = await app.$(this.descriptionLocator);
return BrowserActions.getText(description);
}
async checkAppIsNotDisplayed(applicationName: string): Promise<void> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsNotVisible(app);
}
async checkAppIsDisplayed(applicationName: string): Promise<void> {
const app = this.getApplicationNameLocator(applicationName);
await BrowserVisibility.waitUntilElementIsVisible(app);
}
}

View File

@@ -1,403 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions, BrowserVisibility, DropdownPage, TabsPage, materialLocators } from '@alfresco/adf-testing';
import { browser, by, element, Key, $, $$ } from 'protractor';
export class TaskDetailsPage {
formContent = $('adf-form');
formNameField = $('[data-automation-id="card-textitem-value-formName"]');
formNameButton = $('[data-automation-id="card-textitem-toggle-formName"]');
assigneeField = $('[data-automation-id="card-textitem-value-assignee"]');
assigneeButton = $('[data-automation-id="card-textitem-toggle-assignee"]');
statusField = $('[data-automation-id="card-textitem-value-status"]');
categoryField = $('[data-automation-id="card-textitem-value-category"] ');
parentNameField = $('span[data-automation-id*="parentName"] span');
parentTaskIdField = $('[data-automation-id="card-textitem-value-parentTaskId"] ');
durationField = $('[data-automation-id="card-textitem-value-duration"] ');
endDateField = $$('span[data-automation-id*="endDate"] span').first();
createdField = $('span[data-automation-id="card-dateitem-created"]');
idField = $$('[data-automation-id="card-textitem-value-id"]').first();
descriptionField = $('[data-automation-id="card-textitem-value-description"]');
dueDateField = $$('span[data-automation-id*="dueDate"] span').first();
activitiesTitle = $('div[class*="adf-info-drawer-layout-header-title"] div');
commentField = $('#comment-input');
addCommentButton = $('[data-automation-id="comments-input-add"]');
involvePeopleButton = $('div[class*="add-people"]');
addPeopleField = $('input[data-automation-id="adf-people-search-input"]');
addInvolvedUserButton = $('button[id="add-people"]');
taskDetailsSection = $('div[data-automation-id="app-tasks-details"]');
taskDetailsEmptySection = $('div[data-automation-id="adf-tasks-details--empty"]');
completeTask = $('button[id="adf-no-form-complete-button"]');
completeFormTask = $('button[id="adf-form-complete"]');
taskDetailsTitle = $('.adf-activiti-task-details__header span');
auditLogButton = $('button[adf-task-audit]');
noPeopleInvolved = $('#no-people-label');
cancelInvolvePeopleButton = $('#close-people-search');
involvePeopleHeader = $('.adf-search-text-header');
removeInvolvedPeople = $('button[data-automation-id="Remove"]');
peopleTitle = $('#people-title');
noFormMessage = $('span[id*="no-form-message"]');
attachFormButton = $('#adf-no-form-attach-form-button');
removeAttachForm = $('#adf-attach-form-remove-button');
emptyTaskDetails = $('adf-task-details > div > div');
priority = $('[data-automation-id*="card-textitem-value-priority"]');
editableAssignee = $('[data-automation-id="card-textitem-value-assignee"][class*="clickable"]');
claimElement = $('[data-automation-id="header-claim-button"]');
releaseElement = $('[data-automation-id="header-unclaim-button"]');
saveFormButton = $('button[id="adf-form-save"]');
attachFormDropdown = new DropdownPage($('.adf-attach-form-row'));
async checkEditableAssigneeIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.editableAssignee);
}
async checkEditableFormIsNotDisplayed(): Promise<void> {
const editableForm = $('[data-automation-id="card-textitem-value-formName"][class*="clickable"]');
await BrowserVisibility.waitUntilElementIsNotVisible(editableForm);
}
async checkDueDatePickerButtonIsNotDisplayed(): Promise<void> {
const dueDatePickerButton = $('[data-automation-id="datepickertoggle-dueDate"]');
await BrowserVisibility.waitUntilElementIsNotVisible(dueDatePickerButton);
}
getTaskDetailsTitle(): Promise<string> {
return BrowserActions.getText(this.taskDetailsTitle);
}
async checkSelectedForm(formName: string): Promise<void> {
await this.attachFormDropdown.checkOptionIsSelected(formName);
}
async checkAttachFormButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.attachFormButton);
}
async noFormIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.formContent);
}
async checkRemoveAttachFormIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.removeAttachForm);
}
async clickRemoveAttachForm(): Promise<void> {
await BrowserActions.click(this.removeAttachForm);
await browser.sleep(2000);
}
async checkAttachFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.attachFormButton);
}
async checkAttachFormButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.attachFormButton);
}
async clickAttachFormButton(): Promise<void> {
return BrowserActions.click(this.attachFormButton);
}
async checkFormIsAttached(formName: string): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(this.formNameField, formName);
}
async waitFormNameEqual(formName: string): Promise<void> {
await BrowserVisibility.waitUntilElementHasValue(this.formNameField, formName);
}
async clickForm(): Promise<void> {
await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.formNameButton);
}
async checkStandaloneNoFormMessageIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noFormMessage);
}
async getNoFormMessage(): Promise<string> {
return BrowserActions.getText(this.noFormMessage);
}
getAssignee(): Promise<string> {
return BrowserActions.getInputValue(this.assigneeField);
}
isAssigneeClickable(): Promise<string> {
return BrowserVisibility.waitUntilElementIsVisible(this.editableAssignee);
}
getStatus(): Promise<string> {
return BrowserActions.getInputValue(this.statusField);
}
getCategory(): Promise<string> {
return BrowserActions.getInputValue(this.categoryField);
}
getParentName(): Promise<string> {
return BrowserActions.getText(this.parentNameField);
}
getParentTaskId(): Promise<string> {
return BrowserActions.getInputValue(this.parentTaskIdField);
}
getDuration(): Promise<string> {
return BrowserActions.getInputValue(this.durationField);
}
getEndDate(): Promise<string> {
return BrowserActions.getText(this.endDateField);
}
getCreated(): Promise<string> {
return BrowserActions.getText(this.createdField);
}
getId(): Promise<string> {
return BrowserActions.getInputValue(this.idField);
}
getDescription(): Promise<string> {
return BrowserActions.getInputValue(this.descriptionField);
}
async getDescriptionPlaceholder(): Promise<string> {
return BrowserActions.getAttribute(this.descriptionField, 'placeholder');
}
getDueDate(): Promise<string> {
return BrowserActions.getText(this.dueDateField);
}
getPriority(): Promise<string> {
return BrowserActions.getInputValue(this.priority);
}
async updatePriority(priority?: string): Promise<void> {
await BrowserActions.click(this.priority);
await BrowserActions.clearWithBackSpace(this.priority);
await BrowserActions.clearSendKeys($('input[data-automation-id="card-textitem-value-priority"]'), priority, 500);
await this.priority.sendKeys(Key.TAB);
await browser.sleep(1000);
}
async updateDueDate(): Promise<void> {
await BrowserActions.click(this.dueDateField);
await BrowserActions.click($$(materialLocators.DatetimePicker.calendar.body.cell.class).first());
await browser.sleep(1000);
}
async updateDescription(description?: string): Promise<void> {
await BrowserActions.click(this.descriptionField);
await BrowserActions.clearWithBackSpace(this.descriptionField);
await BrowserActions.clearSendKeys($('[data-automation-id="card-textitem-value-description"]'), description ? description : '');
await this.descriptionField.sendKeys(Key.TAB);
await browser.sleep(1000);
}
async updateAssignee(fullName: string): Promise<void> {
await BrowserActions.click(this.assigneeButton);
await BrowserActions.clearSendKeys($('[id="userSearchText"]'), fullName);
await BrowserActions.click(element(by.cssContainingText('.adf-people-full-name', fullName)));
await BrowserVisibility.waitUntilElementIsVisible($(`adf-datatable-row[class*='is-selected']`));
await browser.sleep(2000);
await BrowserActions.click($('button[id="add-people"]'));
}
getTitle(): Promise<string> {
return BrowserActions.getText(this.activitiesTitle);
}
async selectActivityTab(): Promise<void> {
const tabsPage: TabsPage = new TabsPage();
await tabsPage.clickTabByTitle('Activity');
}
async selectDetailsTab(): Promise<void> {
const tabsPage: TabsPage = new TabsPage();
await tabsPage.clickTabByTitle('Details');
}
async addComment(comment: string): Promise<void> {
await BrowserActions.clearSendKeys(this.commentField, comment);
await BrowserActions.click(this.addCommentButton);
}
async checkCommentIsDisplayed(comment: string): Promise<void> {
const row = element(by.cssContainingText('div.adf-comment-message', comment));
await BrowserVisibility.waitUntilElementIsVisible(row);
}
async checkIsEmptyCommentListDisplayed(): Promise<void> {
const emptyList = element(by.cssContainingText('div[id="comment-header"]', '(0)'));
await BrowserVisibility.waitUntilElementIsVisible(emptyList);
}
async clickInvolvePeopleButton(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.involvePeopleButton);
await BrowserVisibility.waitUntilElementIsClickable(this.involvePeopleButton);
await browser.actions().mouseMove(this.involvePeopleButton).perform();
await BrowserActions.click(this.involvePeopleButton);
}
async typeUser(user: string): Promise<void> {
await BrowserActions.clearSendKeys(this.addPeopleField, user);
}
async selectUserToInvolve(user: string): Promise<void> {
const row = this.getRowsUser(user);
await BrowserActions.click(row);
}
async checkUserIsSelected(user: string): Promise<void> {
const row = this.getRowsUser(user);
await BrowserVisibility.waitUntilElementIsVisible(row);
await browser.sleep(2000);
}
async clickAddInvolvedUserButton(): Promise<void> {
await BrowserActions.click(this.addInvolvedUserButton);
}
getRowsUser(user: string) {
return $(`div[data-automation-id="adf-people-full-name-${user.replace(' ', '-')}"]`);
}
async removeInvolvedUser(user: string): Promise<void> {
const row = this.getRowsUser(user).element(by.xpath('ancestor::adf-datatable-row[contains(@class, "adf-datatable-row")]'));
await BrowserActions.click(row.$('button[data-automation-id="action_menu_0"]'));
await BrowserVisibility.waitUntilElementIsVisible(this.removeInvolvedPeople);
await BrowserActions.click(this.removeInvolvedPeople);
}
async getInvolvedUserEmail(user: string): Promise<string> {
return BrowserActions.getText($(`div[data-automation-id="adf-people-email-${user.replace(' ', '-')}"]`));
}
async clickAuditLogButton(): Promise<void> {
await BrowserActions.click(this.auditLogButton);
}
async checkNoPeopleIsInvolved(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.noPeopleInvolved);
}
async clickCancelInvolvePeopleButton(): Promise<void> {
await BrowserActions.click(this.cancelInvolvePeopleButton);
}
getInvolvePeopleHeader(): Promise<string> {
return BrowserActions.getText(this.involvePeopleHeader);
}
async getInvolvePeoplePlaceholder(): Promise<string> {
return BrowserActions.getAttribute(this.addPeopleField, 'placeholder');
}
async checkCancelButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.cancelInvolvePeopleButton);
await BrowserVisibility.waitUntilElementIsClickable(this.cancelInvolvePeopleButton);
}
async checkAddPeopleButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.addInvolvedUserButton);
await BrowserVisibility.waitUntilElementIsClickable(this.addInvolvedUserButton);
}
async noUserIsDisplayedInSearchInvolvePeople(user): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.cssContainingText('div[class*="people-full-name"]', user)));
}
getInvolvedPeopleTitle(): Promise<string> {
return BrowserActions.getText(this.peopleTitle);
}
checkTaskDetailsEmpty(): Promise<string> {
return BrowserActions.getText(this.taskDetailsEmptySection);
}
async checkTaskDetailsDisplayed(): Promise<string> {
await BrowserVisibility.waitUntilElementIsVisible(this.taskDetailsSection);
await BrowserVisibility.waitUntilElementIsVisible(this.formNameField);
await BrowserVisibility.waitUntilElementIsVisible(this.assigneeField);
await BrowserVisibility.waitUntilElementIsVisible(this.statusField);
await BrowserVisibility.waitUntilElementIsVisible(this.categoryField);
await BrowserVisibility.waitUntilElementIsVisible(this.parentNameField);
await BrowserVisibility.waitUntilElementIsVisible(this.createdField);
await BrowserVisibility.waitUntilElementIsVisible(this.idField);
await BrowserVisibility.waitUntilElementIsVisible(this.descriptionField);
await BrowserVisibility.waitUntilElementIsVisible(this.dueDateField);
await BrowserVisibility.waitUntilElementIsVisible(this.priority);
await BrowserVisibility.waitUntilElementIsVisible(this.activitiesTitle);
return BrowserActions.getText(this.taskDetailsSection);
}
async clickCompleteTask(): Promise<void> {
await BrowserActions.click(this.completeTask);
}
async checkCompleteFormButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeFormTask);
}
async checkCompleteTaskButtonIsEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsClickable(this.completeTask);
}
async checkCompleteTaskButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.completeTask);
}
async clickCompleteFormTask(): Promise<void> {
await BrowserActions.click(this.completeFormTask);
}
async getEmptyTaskDetailsMessage(): Promise<string> {
return BrowserActions.getText(this.emptyTaskDetails);
}
async isCompleteButtonWithFormEnabled(): Promise<boolean> {
return this.completeFormTask.isEnabled();
}
async checkClaimEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.claimElement);
}
async checkReleaseEnabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(this.releaseElement);
}
async claimTask(): Promise<void> {
await BrowserActions.click(this.claimElement);
}
async releaseTask(): Promise<void> {
await BrowserActions.click(this.releaseElement);
}
async saveTaskForm(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.saveFormButton);
await BrowserActions.click(this.saveFormButton);
}
}

View File

@@ -1,53 +0,0 @@
/*!
* @license
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { BrowserActions } from '@alfresco/adf-testing';
import { $ } from 'protractor';
import { TaskFiltersPage } from './task-filters.page';
export class TaskFiltersDemoPage {
myTasks = $('button[data-automation-id="My Tasks_filter"]');
queuedTask = $('button[data-automation-id="Queued Tasks_filter"]');
completedTask = $('button[data-automation-id="Completed Tasks_filter"]');
involvedTask = $('button[data-automation-id="Involved Tasks_filter"]');
activeFilter = $('adf-task-filters .adf-active');
myTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.myTasks);
}
queuedTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.queuedTask);
}
completedTasksFilter() {
return new TaskFiltersPage(this.completedTask);
}
involvedTasksFilter(): TaskFiltersPage {
return new TaskFiltersPage(this.involvedTask);
}
customTaskFilter(filterName: string): TaskFiltersPage {
return new TaskFiltersPage($(`button[data-automation-id="${filterName}_filter"]`));
}
async checkActiveFilterActive(): Promise<string> {
return BrowserActions.getText(this.activeFilter);
}
}

Some files were not shown because too many files have changed in this diff Show More