From c85fedad01ce03cb0aaa77ed51cd97d2c3bbe18c Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 15:55:23 +0100 Subject: [PATCH 01/23] [ci:force] cleanup protractor tests --- demo-shell/src/app/app.module.ts | 11 +- .../app/components/files/files.component.html | 5 - .../app/components/files/files.component.ts | 19 - .../metadata-dialog-adapter.component.html | 10 - .../metadata-dialog-adapter.component.ts | 38 -- .../components/permissions-component.e2e.ts | 413 ------------------ .../metadata/aspect-oriented-config.e2e.ts | 320 -------------- .../metadata/metadata-smoke-tests.e2e.ts | 74 +--- .../pages/permissions.page.ts | 97 ---- e2e/core/pages/content-services.page.ts | 10 - e2e/core/pages/metadata-view.page.ts | 25 -- .../actions/permission.actions.ts | 49 --- .../content-services/actions/public-api.ts | 1 - .../dialog/add-permissions-dialog.page.ts | 99 ----- .../content-services/dialog/public-api.ts | 1 - .../protractor/core/actions/search.service.ts | 40 +- 16 files changed, 21 insertions(+), 1191 deletions(-) delete mode 100644 demo-shell/src/app/components/files/metadata-dialog-adapter.component.html delete mode 100644 demo-shell/src/app/components/files/metadata-dialog-adapter.component.ts delete mode 100644 e2e/content-services/components/permissions-component.e2e.ts delete mode 100644 e2e/content-services/metadata/aspect-oriented-config.e2e.ts delete mode 100644 e2e/content-services/pages/permissions.page.ts delete mode 100644 lib/testing/src/lib/protractor/content-services/actions/permission.actions.ts delete mode 100644 lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index cf1ee4faa3a..787e8869394 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -22,14 +22,7 @@ import { NgChartsModule } from 'ng2-charts'; import { HttpClientModule } from '@angular/common/http'; import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateModule } from '@ngx-translate/core'; -import { - AppConfigService, - DebugAppConfigService, - CoreModule, - CoreAutomationService, - AuthModule, - provideTranslations -} from '@alfresco/adf-core'; +import { AppConfigService, DebugAppConfigService, CoreModule, CoreAutomationService, AuthModule, provideTranslations } from '@alfresco/adf-core'; import { ExtensionsModule } from '@alfresco/adf-extensions'; import { AppComponent } from './app.component'; import { MaterialModule } from './material.module'; @@ -46,7 +39,6 @@ import { FormNodeViewerComponent } from './components/process-service/form-node- import { AppsViewComponent } from './components/process-service/apps-view.component'; import { FilesComponent } from './components/files/files.component'; import { VersionManagerDialogAdapterComponent } from './components/files/version-manager-dialog-adapter.component'; -import { MetadataDialogAdapterComponent } from './components/files/metadata-dialog-adapter.component'; import { appRoutes } from './app.routes'; import { TaskAttachmentsComponent } from './components/process-service/task-attachments.component'; import { ProcessAttachmentsComponent } from './components/process-service/process-attachments.component'; @@ -114,7 +106,6 @@ import { UserInfoComponent } from './components/app-layout/user-info/user-info.c FilesComponent, FormComponent, VersionManagerDialogAdapterComponent, - MetadataDialogAdapterComponent, TaskAttachmentsComponent, ProcessAttachmentsComponent, DemoPermissionComponent, diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 273b030f699..975fcf96924 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -240,11 +240,6 @@ (success)="onDeleteActionSuccess($event)" handler="delete"> - - Metadata -
- - -
-
- -
diff --git a/demo-shell/src/app/components/files/metadata-dialog-adapter.component.ts b/demo-shell/src/app/components/files/metadata-dialog-adapter.component.ts deleted file mode 100644 index 4e570015be2..00000000000 --- a/demo-shell/src/app/components/files/metadata-dialog-adapter.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { Component, Inject, ViewEncapsulation } from '@angular/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { Node } from '@alfresco/js-api'; - -@Component({ - templateUrl: './metadata-dialog-adapter.component.html', - encapsulation: ViewEncapsulation.None -}) -export class MetadataDialogAdapterComponent { - contentEntry: Node; - displayEmptyMetadata = false; - - constructor(@Inject(MAT_DIALOG_DATA) data: any, private containingDialog?: MatDialogRef) { - this.contentEntry = data.contentEntry; - this.displayEmptyMetadata = data.displayEmptyMetadata; - } - - close() { - this.containingDialog.close(); - } -} diff --git a/e2e/content-services/components/permissions-component.e2e.ts b/e2e/content-services/components/permissions-component.e2e.ts deleted file mode 100644 index 211e2d47598..00000000000 --- a/e2e/content-services/components/permissions-component.e2e.ts +++ /dev/null @@ -1,413 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { PermissionsPage } from '../../content-services/pages/permissions.page'; -import { ContentServicesPage } from '../../core/pages/content-services.page'; -import { FileModel } from '../../models/ACS/file.model'; -import { - createApiService, - BrowserActions, Logger, - LoginPage, - PermissionActions, - SearchService, - StringUtil, - UploadActions, - UserModel, - UsersActions, - ViewerPage, - SnackbarPage -} from '@alfresco/adf-testing'; -import { browser } from 'protractor'; -import { FolderModel } from '../../models/ACS/folder.model'; -import { MetadataViewPage } from '../../core/pages/metadata-view.page'; -import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; -import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page'; -import { GroupsApi, NodeEntry } from '@alfresco/js-api'; - -describe('Permissions Component', () => { - - const apiService = createApiService(); - const loginPage = new LoginPage(); - const contentServicesPage = new ContentServicesPage(); - const permissionsPage = new PermissionsPage(); - const navigationBarPage = new NavigationBarPage(); - const uploadActions = new UploadActions(apiService); - const usersActions = new UsersActions(apiService); - const snackbarPage = new SnackbarPage(); - const searchService = new SearchService(apiService); - const permissionActions = new PermissionActions(apiService); - const groupsApi = new GroupsApi(apiService.getInstance()); - - const contentList = contentServicesPage.getDocumentList(); - const viewerPage = new ViewerPage(); - const metadataViewPage = new MetadataViewPage(); - const uploadDialog = new UploadDialogPage(); - let file; - const fileModel = 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 fileLocation = browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_location; - - const testFileModel = new FileModel({ - name: browser.params.resources.Files.ADF_DOCUMENTS.TEST.file_name, - location: browser.params.resources.Files.ADF_DOCUMENTS.TEST.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 groupBody = { - id: `GROUP_${StringUtil.generateRandomString()}`, - displayName: StringUtil.generateRandomString() - }; - - const fileOwnerUser = new UserModel(); - const filePermissionUser = new UserModel(); - - const roleConsumerFolderModel = new FolderModel({ name: 'roleConsumer' + StringUtil.generateRandomString() }); - const roleCoordinatorFolderModel = new FolderModel({ name: 'roleCoordinator' + StringUtil.generateRandomString() }); - const roleCollaboratorFolderModel = new FolderModel({ name: 'roleCollaborator' + StringUtil.generateRandomString() }); - const roleContributorFolderModel = new FolderModel({ name: 'roleContributor' + StringUtil.generateRandomString() }); - const roleEditorFolderModel = new FolderModel({ name: 'roleEditor' + StringUtil.generateRandomString() }); - - let roleConsumerFolder: NodeEntry; - let roleCoordinatorFolder: NodeEntry; - let roleContributorFolder: NodeEntry; - let roleCollaboratorFolder: NodeEntry; - let roleEditorFolder: NodeEntry; - - beforeAll(async () => { - try { - await apiService.loginWithProfile('admin'); - await usersActions.createUser(fileOwnerUser); - await usersActions.createUser(filePermissionUser); - await groupsApi.createGroup(groupBody); - - await apiService.login(fileOwnerUser.username, fileOwnerUser.password); - roleConsumerFolder = await uploadActions.createFolder(roleConsumerFolderModel.name, '-my-'); - roleCoordinatorFolder = await uploadActions.createFolder(roleCoordinatorFolderModel.name, '-my-'); - roleContributorFolder = await uploadActions.createFolder(roleContributorFolderModel.name, '-my-'); - roleCollaboratorFolder = await uploadActions.createFolder(roleCollaboratorFolderModel.name, '-my-'); - roleEditorFolder = await uploadActions.createFolder(roleEditorFolderModel.name, '-my-'); - - await uploadActions.uploadFile(fileModel.location, 'RoleConsumer' + fileModel.name, roleConsumerFolder.entry.id); - await uploadActions.uploadFile(fileModel.location, 'RoleContributor' + fileModel.name, roleContributorFolder.entry.id); - await uploadActions.uploadFile(fileModel.location, 'RoleCoordinator' + fileModel.name, roleCoordinatorFolder.entry.id); - await uploadActions.uploadFile(fileModel.location, 'RoleCollaborator' + fileModel.name, roleCollaboratorFolder.entry.id); - await uploadActions.uploadFile(fileModel.location, 'RoleEditor' + fileModel.name, roleEditorFolder.entry.id); - - await permissionActions.addRoleForUser(filePermissionUser.username, 'Consumer', roleConsumerFolder); - await permissionActions.addRoleForUser(filePermissionUser.username, 'Collaborator', roleCollaboratorFolder); - await permissionActions.addRoleForUser(filePermissionUser.username, 'Coordinator', roleCoordinatorFolder); - await permissionActions.addRoleForUser(filePermissionUser.username, 'Contributor', roleContributorFolder); - await permissionActions.addRoleForUser(filePermissionUser.username, 'Editor', roleEditorFolder); - - // to sync user in acs - try { - await searchService.isUserSearchable(filePermissionUser); - } catch (e) { - Logger.error(`*****\n Failed to sync user \n*****`); - } - await browser.sleep(browser.params.testConfig.timeouts.index_search); // wait search index previous file/folder uploaded - } catch (e) { - fail('Failed to set up permission : \n' + JSON.stringify(e, null, 2)); - } - }); - - describe('Inherit and assigning permissions', () => { - - beforeEach(async () => { - await apiService.login(fileOwnerUser.username, fileOwnerUser.password); - file = await uploadActions.uploadFile(fileModel.location, fileModel.name, '-my-'); - - await loginPage.login(fileOwnerUser.username, fileOwnerUser.password); - - await contentServicesPage.goToDocumentList(); - await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded(); - await contentServicesPage.checkContentIsDisplayed(fileModel.name); - - await contentList.rightClickOnRow(fileModel.name); - await contentServicesPage.pressContextMenuActionNamed('Permission'); - await permissionsPage.checkPermissionManagerDisplayed(); - }); - - afterEach(async () => { - await BrowserActions.closeMenuAndDialogs(); - try { - await uploadActions.deleteFileOrFolder(file.entry.id); - } catch (error) { - } - await navigationBarPage.clickLogoutButton(); - }); - - it('[C286272] Should be able to see results when searching for a user', async () => { - await permissionsPage.addPermissionButton.waitVisible(); - await permissionsPage.addPermissionsDialog.clickAddPermissionButton(); - await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed(); - await permissionsPage.addPermissionsDialog.searchUserOrGroup('a'); - await permissionsPage.addPermissionsDialog.checkResultListIsDisplayed(); - }); - - it('[C276979] Should be able to give permissions to a group of people', async () => { - await permissionsPage.addPermissionButton.waitVisible(); - await permissionsPage.addPermissionsDialog.clickAddPermissionButton(); - await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed(); - await permissionsPage.addPermissionsDialog.searchUserOrGroup(groupBody.id); - await permissionsPage.addPermissionsDialog.clickUserOrGroup(groupBody.displayName); - await permissionsPage.addPermissionsDialog.selectRole(groupBody.displayName, 'Consumer'); - await expect(await permissionsPage.addPermissionsDialog.addButtonIsEnabled()).toBe(true, 'button should be enabled'); - await permissionsPage.addPermissionsDialog.clickAddButton(); - await expect(await snackbarPage.getSnackBarMessage()).toEqual('Added 0 user(s) 1 group(s)'); - await permissionsPage.checkUserIsAdded(groupBody.id); - }); - - it('[C277100] Should display EVERYONE group in the search result set', async () => { - await permissionsPage.addPermissionButton.waitVisible(); - await permissionsPage.addPermissionsDialog.clickAddPermissionButton(); - await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed(); - await permissionsPage.addPermissionsDialog.searchUserOrGroup(filePermissionUser.username); - await permissionsPage.addPermissionsDialog.checkResultListIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkUserOrGroupIsDisplayed('EVERYONE'); - await permissionsPage.addPermissionsDialog.searchUserOrGroup('somerandomtext'); - await permissionsPage.addPermissionsDialog.checkResultListIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkUserOrGroupIsDisplayed('EVERYONE'); - }); - - it('should be able to toggle the inherited permission', async () => { - await permissionsPage.checkPermissionListDisplayed(); - await expect(await permissionsPage.isInherited()).toBe(true, 'Inherited permission should be on'); - await permissionsPage.toggleInheritPermission(); - await expect(await snackbarPage.getSnackBarMessage()).toContain('Disabled inherited permission', 'Disabled notification not shown'); - await snackbarPage.waitForSnackBarToClose(); - await expect(await permissionsPage.isInherited()).toBe(false, 'Inherited permission should be off'); - }); - }); - - describe('Changing and duplicate Permissions', () => { - - beforeEach(async () => { - await apiService.login(fileOwnerUser.username, fileOwnerUser.password); - file = await uploadActions.uploadFile(fileModel.location, fileModel.name, '-my-'); - await loginPage.login(fileOwnerUser.username, fileOwnerUser.password); - await contentServicesPage.goToDocumentList(); - await contentServicesPage.checkContentIsDisplayed(fileModel.name); - await contentServicesPage.checkSelectedSiteIsDisplayed('My files'); - await contentList.rightClickOnRow(fileModel.name); - await contentServicesPage.pressContextMenuActionNamed('Permission'); - await permissionsPage.checkPermissionManagerDisplayed(); - await permissionsPage.addPermissionButton.waitVisible(); - await permissionsPage.addPermissionsDialog.clickAddPermissionButton(); - await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed(); - await permissionsPage.addPermissionsDialog.searchUserOrGroup(filePermissionUser.firstName); - await permissionsPage.addPermissionsDialog.checkResultListIsDisplayed(); - await permissionsPage.addPermissionsDialog.clickUserOrGroup(filePermissionUser.firstName); - await permissionsPage.addPermissionsDialog.selectRole(filePermissionUser.fullName, 'Contributor'); - await expect(await permissionsPage.addPermissionsDialog.addButtonIsEnabled()).toBe(true, 'button should be enabled'); - await permissionsPage.addPermissionsDialog.clickAddButton(); - await expect(await snackbarPage.getSnackBarMessage()).toEqual('Added 1 user(s) 0 group(s)'); - await snackbarPage.waitForSnackBarToClose(); - await permissionsPage.checkUserIsAdded(filePermissionUser.username); - }); - - afterEach(async () => { - await uploadActions.deleteFileOrFolder(file.entry.id); - await navigationBarPage.clickLogoutButton(); - }); - - it('[C274691] Should be able to add a new User with permission to the file and also change locally set permissions', async () => { - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Contributor'); - await permissionsPage.clickRoleDropdownByUserOrGroupName(filePermissionUser.username); - const roleDropdownOptions = permissionsPage.addPermissionsDialog.getRoleDropdownOptions(); - await expect(await roleDropdownOptions.count()).toBe(5); - - await expect(await BrowserActions.getText(roleDropdownOptions.get(0))).toBe('Contributor'); - await expect(await BrowserActions.getText(roleDropdownOptions.get(1))).toBe('Collaborator'); - await expect(await BrowserActions.getText(roleDropdownOptions.get(2))).toBe('Coordinator'); - await expect(await BrowserActions.getText(roleDropdownOptions.get(3))).toBe('Editor'); - await expect(await BrowserActions.getText(roleDropdownOptions.get(4))).toBe('Consumer'); - - await BrowserActions.closeMenuAndDialogs(); - await permissionsPage.changePermission(filePermissionUser.username, 'Collaborator'); - await snackbarPage.waitForSnackBarToClose(); - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Collaborator'); - - await permissionsPage.changePermission(filePermissionUser.username, 'Coordinator'); - await snackbarPage.waitForSnackBarToClose(); - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Coordinator'); - - await permissionsPage.changePermission(filePermissionUser.username, 'Editor'); - await snackbarPage.waitForSnackBarToClose(); - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Editor'); - - await permissionsPage.changePermission(filePermissionUser.username, 'Consumer'); - await snackbarPage.waitForSnackBarToClose(); - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Consumer'); - }); - - it('[C276980] Should not be able to duplicate User or Group to the locally set permissions', async () => { - await expect(await permissionsPage.addPermissionsDialog.getRoleCellValue(filePermissionUser.username)).toEqual('Contributor'); - await permissionsPage.addPermissionsDialog.clickAddPermissionButton(); - await permissionsPage.addPermissionsDialog.checkAddPermissionDialogIsDisplayed(); - await permissionsPage.addPermissionsDialog.checkSearchUserInputIsDisplayed(); - await permissionsPage.addPermissionsDialog.searchUserOrGroup(filePermissionUser.firstName); - await permissionsPage.addPermissionsDialog.clickUserOrGroup(filePermissionUser.firstName); - await expect(await permissionsPage.addPermissionsDialog.getRoleCellValue(filePermissionUser.fullName)).toEqual('Contributor'); - await expect(await permissionsPage.addPermissionsDialog.addButtonIsEnabled()).toBe(false, 'button should not be enabled'); - }); - - it('[C276982] Should be able to remove User or Group from the locally set permissions', async () => { - await expect(await permissionsPage.getRoleCellValue(filePermissionUser.username)).toEqual('Contributor'); - await permissionsPage.clickDeletePermissionButton(filePermissionUser.username); - await permissionsPage.checkUserIsDeleted(filePermissionUser.username); - await expect(await snackbarPage.getSnackBarMessage()).toEqual('User/Group deleted'); - }); - }); - - describe('Role: Consumer, Contributor, Coordinator, Collaborator, Editor, No Permissions', () => { - - afterEach(async () => { - await navigationBarPage.clickLogoutButton(); - }); - - it('[C276993] Role Consumer', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleConsumerFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleConsumer' + fileModel.name); - await contentList.doubleClickRow('RoleConsumer' + fileModel.name); - await viewerPage.checkFileIsLoaded(); - await viewerPage.clickCloseButton(); - await contentList.waitForTableBody(); - await contentServicesPage.checkDeleteIsDisabled('RoleConsumer' + fileModel.name); - await BrowserActions.closeMenuAndDialogs(); - await contentList.checkActionMenuIsNotDisplayed(); - await contentServicesPage.metadataContent('RoleConsumer' + fileModel.name); - await expect(await snackbarPage.getSnackBarMessage()).toEqual('You don\'t have access to do this.'); - await browser.sleep(3000); - await contentServicesPage.uploadFile(fileLocation); - await expect(await snackbarPage.getSnackBarMessage()).toEqual('You don\'t have the create permission to upload the content'); - }); - - it('[C276996] Role Contributor', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleContributorFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleContributor' + fileModel.name); - await contentList.doubleClickRow('RoleContributor' + fileModel.name); - await viewerPage.checkFileIsLoaded(); - await viewerPage.clickCloseButton(); - await contentList.waitForTableBody(); - await contentServicesPage.checkDeleteIsDisabled('RoleContributor' + fileModel.name); - await BrowserActions.closeMenuAndDialogs(); - await contentList.checkActionMenuIsNotDisplayed(); - await contentServicesPage.metadataContent('RoleContributor' + fileModel.name); - await contentServicesPage.uploadFile(testFileModel.location); - await contentServicesPage.checkContentIsDisplayed(testFileModel.name); - await uploadDialog.fileIsUploaded(testFileModel.name); - await uploadDialog.clickOnCloseButton(); - await uploadDialog.dialogIsNotDisplayed(); - }); - - it('[C277000] Role Editor', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleEditorFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleEditor' + fileModel.name); - await contentList.doubleClickRow('RoleEditor' + fileModel.name); - await viewerPage.checkFileIsLoaded(); - await viewerPage.clickCloseButton(); - await contentList.waitForTableBody(); - await contentServicesPage.checkDeleteIsDisabled('RoleEditor' + fileModel.name); - await BrowserActions.closeMenuAndDialogs(); - await contentList.checkActionMenuIsNotDisplayed(); - await contentServicesPage.metadataContent('RoleEditor' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); - await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); - await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle1'); - await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle1'); - await metadataViewPage.clickCloseButton(); - await contentServicesPage.uploadFile(fileLocation); - }); - - it('[C277003] Role Collaborator', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleCollaboratorFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleCollaborator' + fileModel.name); - await contentList.doubleClickRow('RoleCollaborator' + fileModel.name); - await viewerPage.checkFileIsLoaded(); - await viewerPage.clickCloseButton(); - await contentList.waitForTableBody(); - await contentServicesPage.checkDeleteIsDisabled('RoleCollaborator' + fileModel.name); - await BrowserActions.closeMenuAndDialogs(); - await contentList.checkActionMenuIsNotDisplayed(); - await contentServicesPage.metadataContent('RoleCollaborator' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); - await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); - await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle2'); - await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle2'); - await metadataViewPage.clickCloseButton(); - await contentServicesPage.uploadFile(testFileModel.location); - await contentServicesPage.checkContentIsDisplayed(testFileModel.name); - await uploadDialog.fileIsUploaded(testFileModel.name); - await uploadDialog.clickOnCloseButton(); - await uploadDialog.dialogIsNotDisplayed(); - }); - - it('[C277004] Role Coordinator', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleCoordinatorFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleCoordinator' + fileModel.name); - await contentList.doubleClickRow('RoleCoordinator' + fileModel.name); - await viewerPage.checkFileIsLoaded(); - await viewerPage.clickCloseButton(); - await contentList.waitForTableBody(); - await contentServicesPage.metadataContent('RoleCoordinator' + fileModel.name); - await metadataViewPage.editIconIsDisplayed(); - await metadataViewPage.editIconClick(); - await metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); - await metadataViewPage.enterPropertyText('properties.cm:title', 'newTitle3'); - await expect(await metadataViewPage.getPropertyText('properties.cm:title')).toEqual('newTitle3'); - await metadataViewPage.clickCloseButton(); - await contentServicesPage.uploadFile(pngFileModel.location); - await contentServicesPage.checkContentIsDisplayed(pngFileModel.name); - await uploadDialog.fileIsUploaded(pngFileModel.name); - await uploadDialog.clickOnCloseButton(); - await uploadDialog.dialogIsNotDisplayed(); - await contentServicesPage.checkContentIsDisplayed('RoleCoordinator' + fileModel.name); - await contentServicesPage.deleteContent('RoleCoordinator' + fileModel.name); - await contentServicesPage.checkContentIsNotDisplayed('RoleCoordinator' + fileModel.name); - }); - - it('[C279881] No Permission User', async () => { - await loginPage.login(filePermissionUser.username, filePermissionUser.password); - await navigationBarPage.openContentServicesFolder(roleConsumerFolder.entry.id); - await contentServicesPage.checkContentIsDisplayed('RoleConsumer' + fileModel.name); - await contentServicesPage.checkSelectedSiteIsDisplayed('My files'); - await contentList.rightClickOnRow('RoleConsumer' + fileModel.name); - await contentServicesPage.pressContextMenuActionNamed('Permission'); - await permissionsPage.checkPermissionManagerDisplayed(); - await permissionsPage.errorElement.waitPresent(); - await expect(await permissionsPage.noPermissionContent()).toContain('This item no longer exists or you don\'t have permission to view it.'); - }); - }); -}); diff --git a/e2e/content-services/metadata/aspect-oriented-config.e2e.ts b/e2e/content-services/metadata/aspect-oriented-config.e2e.ts deleted file mode 100644 index 4b1cdc92a5a..00000000000 --- a/e2e/content-services/metadata/aspect-oriented-config.e2e.ts +++ /dev/null @@ -1,320 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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, - LocalStorageUtil, - LoginPage, - 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 { ContentServicesPage } from '../../core/pages/content-services.page'; -import { CustomModelApi, NodesApi } from '@alfresco/js-api'; - -describe('Aspect oriented config', () => { - - const loginPage = new LoginPage(); - const viewerPage = new ViewerPage(); - const metadataViewPage = new MetadataViewPage(); - const navigationBarPage = new NavigationBarPage(); - const contentServicesPage = new ContentServicesPage(); - const modelOneName = 'modelOne'; const emptyAspectName = 'emptyAspect'; - const defaultModel = 'cm'; const defaultEmptyPropertiesAspect = 'taggable'; const aspectName = 'Taggable'; - - const apiService = createApiService(); - const usersActions = new UsersActions(apiService); - const nodesApi = new NodesApi(apiService.getInstance()); - const customModelApi = new CustomModelApi(apiService.getInstance()); - - 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 - }); - let uploadActions; - - beforeAll(async () => { - uploadActions = new UploadActions(apiService); - - await apiService.loginWithProfile('admin'); - - try { - await customModelApi.createCustomModel('ACTIVE', modelOneName, modelOneName, modelOneName, modelOneName); - } catch (e) { - } - - try { - await customModelApi.createCustomAspect(modelOneName, emptyAspectName, null, emptyAspectName, emptyAspectName); - } catch (e) { - } - - acsUser = await usersActions.createUser(); - - await apiService.login(acsUser.username, acsUser.password); - - const uploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, '-my-'); - - await loginPage.login(acsUser.username, acsUser.password); - - const aspects = await nodesApi.getNode(uploadedFile.entry.id); - - aspects.entry.aspectNames.push(modelOneName.concat(':', emptyAspectName)); - - aspects.entry.aspectNames.push(defaultModel.concat(':', defaultEmptyPropertiesAspect)); - - await nodesApi.updateNode(uploadedFile.entry.id, { aspectNames: aspects.entry.aspectNames }); - }); - - afterAll(async () => { - await navigationBarPage.clickLogoutButton(); - }); - - afterEach(async () => { - await viewerPage.clickCloseButton(); - await contentServicesPage.checkAcsContainer(); - }); - - it('[C261117] Should be possible restrict the display properties of one an aspect', async () => { - await LocalStorageUtil.setConfigField('content-metadata', JSON.stringify({ - presets: { - default: [ - { - title: 'IMAGE', - items: [ - { - aspect: 'exif:exif', - properties: [ - 'exif:pixelXDimension', - 'exif:pixelYDimension', - 'exif:isoSpeedRatings' - ] - } - ] - } - ] - } - })); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.clickMetadataGroup('IMAGE'); - await metadataViewPage.checkPropertyIsVisible('properties.exif:pixelXDimension', 'textitem'); - await metadataViewPage.checkPropertyIsVisible('properties.exif:pixelYDimension', 'textitem'); - await metadataViewPage.checkPropertyIsNotVisible('properties.exif:isoSpeedRatings', 'textitem'); - - await metadataViewPage.editIconClick(); - - await metadataViewPage.checkPropertyIsVisible('properties.exif:isoSpeedRatings', 'textitem'); - }); - - it('[C260185] Should ignore not existing aspect when present in the configuration', async () => { - await LocalStorageUtil.setConfigField('content-metadata', JSON.stringify({ - presets: { - default: { - 'exif:exif': '*', - 'cm:versionable': '*', - 'not:exists': '*' - } - } - })); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); - await metadataViewPage.checkMetadataGroupIsPresent('properties'); - await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); - await metadataViewPage.checkMetadataGroupIsNotPresent('exists'); - }); - - it('[C260183] Should show all the aspect if the content-metadata configuration is NOT provided', async () => { - await LocalStorageUtil.setConfigField('content-metadata', '{}'); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); - await metadataViewPage.checkMetadataGroupIsPresent('properties'); - await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); - }); - - it('[C260182] Should show all the aspects if the default configuration contains the star symbol', async () => { - await LocalStorageUtil.setConfigField('content-metadata', JSON.stringify({ - presets: { - default: '*' - } - })); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsPresent('EXIF'); - await metadataViewPage.checkMetadataGroupIsPresent('properties'); - await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); - }); - - it('[C268899] Should be possible use a Translation key as Title of a metadata group', async () => { - await LocalStorageUtil.setConfigField('content-metadata', '{' + - ' "presets": {' + - ' "default": [' + - ' {' + - ' "title": "GROUP-TITLE1-TRANSLATION-KEY",' + - ' "items": [' + - ' {' + - ' "aspect": "exif:exif",' + - ' "properties": "*"' + - ' }' + - ' ]' + - ' },' + - ' {' + - ' "title": "GROUP-TITLE2-TRANSLATION-KEY",' + - ' "items": [' + - ' {' + - ' "aspect": "exif:exif",' + - ' "properties": "*"' + - ' }' + - ' ]' + - ' }' + - ' ]' + - ' }' + - '}'); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsPresent('GROUP-TITLE1-TRANSLATION-KEY'); - await metadataViewPage.checkMetadataGroupIsPresent('GROUP-TITLE2-TRANSLATION-KEY'); - - await expect(await metadataViewPage.getMetadataGroupTitle('GROUP-TITLE1-TRANSLATION-KEY')).toBe('CUSTOM TITLE TRANSLATION ONE'); - await expect(await metadataViewPage.getMetadataGroupTitle('GROUP-TITLE2-TRANSLATION-KEY')).toBe('CUSTOM TITLE TRANSLATION TWO'); - }); - - it('[C279968] Should be possible use a custom preset', async () => { - await LocalStorageUtil.setConfigField('content-metadata', '{' + - ' "presets": {' + - ' "custom-preset": {' + - ' "exif:exif": "*",' + - ' "cm:versionable": "*"' + - ' }' + - ' }' + - '}'); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - - await CheckboxPage.check(metadataViewPage.presetSwitch); - - await metadataViewPage.enterPresetText('custom-preset'); - - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsPresent('properties'); - await metadataViewPage.checkMetadataGroupIsPresent('Versionable'); - }); - - it('[C299186] The aspect without properties is not displayed', async () => { - await LocalStorageUtil.setConfigField('content-metadata', '{' + - ' "presets": { "' + modelOneName + - ' ": { "' + modelOneName + ':' + emptyAspectName + - ' ":"*"' + - ' }' + - ' }' + - '}'); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsNotPresent(emptyAspectName); - }); - - it('[C299187] The aspect with empty properties is displayed when edit', async () => { - await LocalStorageUtil.setConfigField('content-metadata', '{' + - ' "presets": { "' + defaultModel + - ' ": { "' + defaultModel + ':' + defaultEmptyPropertiesAspect + - ' ":"*"' + - ' }' + - ' }' + - '}'); - - await navigationBarPage.navigateToContentServices(); - - await viewerPage.viewFile(pngFileModel.name); - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await metadataViewPage.clickOnPropertiesTab(); - - await metadataViewPage.informationButtonIsDisplayed(); - await metadataViewPage.clickOnInformationButton(); - - await metadataViewPage.checkMetadataGroupIsNotPresent(aspectName); - - await metadataViewPage.editIconClick(); - - await metadataViewPage.checkMetadataGroupIsPresent(aspectName); - }); -}); diff --git a/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts b/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts index 04dcb68ff53..a8586adaf69 100644 --- a/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts +++ b/e2e/content-services/metadata/metadata-smoke-tests.e2e.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import { createApiService, +import { + createApiService, BrowserActions, LocalStorageUtil, LoginPage, - StringUtil, UploadActions, UserModel, UsersActions, @@ -33,7 +33,6 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { format } from 'date-fns'; describe('Metadata component', () => { - const METADATA = { DATA_FORMAT: 'PP', TITLE: 'Details', @@ -55,8 +54,6 @@ describe('Metadata component', () => { let acsUser: UserModel; - const folderName = StringUtil.generateRandomString(); - const pngFileModel = new FileModel({ name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name, location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path @@ -80,13 +77,16 @@ describe('Metadata component', () => { await loginPage.login(acsUser.username, acsUser.password); await navigationBarPage.navigateToContentServices(); await contentServicesPage.waitForTableBody(); - await LocalStorageUtil.setConfigField('content-metadata', JSON.stringify({ - presets: { - default: { - 'exif:exif': '*' + await LocalStorageUtil.setConfigField( + 'content-metadata', + JSON.stringify({ + presets: { + default: { + 'exif:exif': '*' + } } - } - })); + }) + ); }); afterAll(async () => { @@ -103,7 +103,7 @@ describe('Metadata component', () => { await contentServicesPage.waitForTableBody(); }); - it('[C245652] Should be possible to display a file\'s properties', async () => { + it("[C245652] Should be possible to display a file's properties", async () => { await viewerPage.clickInfoButton(); await viewerPage.checkInfoSideBarIsDisplayed(); await metadataViewPage.clickOnPropertiesTab(); @@ -188,7 +188,9 @@ describe('Metadata component', () => { await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText'); await metadataViewPage.clickResetMetadata(); - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); + await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual( + browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name + ); await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText.png'); await metadataViewPage.enterPropertyText('properties.cm:title', 'example title'); @@ -214,7 +216,9 @@ describe('Metadata component', () => { await metadataViewPage.editIconClick(); await metadataViewPage.enterPropertyText('properties.cm:name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); + await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual( + browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name + ); await metadataViewPage.clickSaveMetadata(); }); @@ -243,48 +247,6 @@ describe('Metadata component', () => { }); }); - describe('Folder metadata', () => { - - beforeAll(async () => { - await apiService.login(acsUser.username, acsUser.password); - await loginPage.login(acsUser.username, acsUser.password); - - await uploadActions.createFolder(folderName, '-my-'); - await navigationBarPage.navigateToContentServices(); - await contentServicesPage.waitForTableBody(); - }); - - afterAll(async () => { - await navigationBarPage.clickLogoutButton(); - }); - - it('[C261157] Should be possible use the metadata component When the node is a Folder', async () => { - await contentServicesPage.metadataContent(folderName); - - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(folderName); - await expect(await metadataViewPage.getPropertyText('createdByUser.displayName')).toEqual(`${acsUser.firstName} ${acsUser.lastName}`); - await BrowserActions.closeMenuAndDialogs(); - }); - - it('[C261158] Should be possible edit the metadata When the node is a Folder', async () => { - await contentServicesPage.metadataContent(folderName); - - await metadataViewPage.editIconClick(); - - await metadataViewPage.enterPropertyText('properties.cm:name', 'newnameFolder'); - await metadataViewPage.clickResetButton(); - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(folderName); - - await metadataViewPage.enterPropertyText('properties.cm:name', 'newnameFolder'); - await metadataViewPage.clickSaveMetadata(); - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual('newnameFolder'); - - await metadataViewPage.enterPropertyText('properties.cm:name', folderName); - await metadataViewPage.clickSaveMetadata(); - await expect(await metadataViewPage.getPropertyText('properties.cm:name')).toEqual(folderName); - }); - }); - it('[C279960] Should show the last username modifier when modify a File', async () => { await loginPage.loginWithProfile('admin'); diff --git a/e2e/content-services/pages/permissions.page.ts b/e2e/content-services/pages/permissions.page.ts deleted file mode 100644 index 7c5fd4725c5..00000000000 --- a/e2e/content-services/pages/permissions.page.ts +++ /dev/null @@ -1,97 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { - AddPermissionsDialogPage, - BrowserActions, - DataTableComponentPage, - DropdownPage, - TestElement -} from '@alfresco/adf-testing'; -import { browser } from 'protractor'; - -export class PermissionsPage { - - dataTableComponentPage = new DataTableComponentPage(); - addPermissionsDialog = new AddPermissionsDialogPage(); - - rootElement = 'adf-permission-manager-card'; - inheritedButton = '[data-automation-id="adf-inherit-toggle-button"]'; - errorElement = TestElement.byId('adf-permission-manager-error'); - localPermissionList = TestElement.byCss('[data-automation-id="adf-locally-set-permission"]'); - addPermissionButton = TestElement.byCss('button[data-automation-id=\'adf-add-permission-button\']'); - - async changePermission(name: string, role: string): Promise { - await browser.sleep(1000); - await this.clickRoleDropdownByUserOrGroupName(name); - await new DropdownPage().selectOption(role); - await this.dataTableComponentPage.checkRowByContentIsNotSelected(name); - } - - async checkUserIsAdded(id: string) { - const userOrGroupName = TestElement.byCss('div[data-automation-id="' + id + '"]'); - await userOrGroupName.waitPresent(); - } - - async getRoleCellValue(username: string): Promise { - const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Users and Groups', username, 'Role'); - return BrowserActions.getText(locator); - } - - async clickRoleDropdownByUserOrGroupName(name: string): Promise { - const row = this.dataTableComponentPage.getRow('Users and Groups', name); - await row.click(); - await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger')); - await TestElement.byCss('.mat-select-panel').waitVisible(); - } - - async clickDeletePermissionButton(username: string): Promise { - const userOrGroupName = TestElement.byCss(`[data-automation-id="adf-delete-permission-button-${username}"]`); - await userOrGroupName.waitPresent(); - await userOrGroupName.click(); - } - - async checkUserIsDeleted(username: string): Promise { - const userOrGroupName = TestElement.byCss('div[data-automation-id="' + username + '"]'); - await userOrGroupName.waitNotPresent(); - } - - async noPermissionContent(): Promise { - const noPermission = TestElement.byCss('.adf-no-permission__template--text'); - return noPermission.getText(); - } - - async checkPermissionManagerDisplayed(): Promise { - await TestElement.byId(this.rootElement).waitVisible(); - } - - async checkPermissionListDisplayed(): Promise { - await browser.sleep(500); - await this.localPermissionList.waitVisible(); - } - - async isInherited(): Promise { - const inheritButton = TestElement.byCss(this.inheritedButton); - await inheritButton.waitVisible(); - return (await inheritButton.getAttribute('class')).indexOf('mat-checked') !== -1; - } - - async toggleInheritPermission(): Promise { - const inheritButton = TestElement.byCss(`${this.inheritedButton} label`); - await inheritButton.click(); - } -} diff --git a/e2e/core/pages/content-services.page.ts b/e2e/core/pages/content-services.page.ts index 4cd1703cec3..13c71383637 100644 --- a/e2e/core/pages/content-services.page.ts +++ b/e2e/core/pages/content-services.page.ts @@ -59,10 +59,6 @@ export class ContentServicesPage { selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]'); siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`)); - async pressContextMenuActionNamed(actionName: string): Promise { - await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`); - } - async isContextActionEnabled(actionName: string): Promise { const actionButton = $(`button[data-automation-id="context-${actionName}"`); await BrowserVisibility.waitUntilElementIsVisible(actionButton); @@ -73,12 +69,6 @@ export class ContentServicesPage { return this.contentList; } - async checkDeleteIsDisabled(content: string): Promise { - await this.contentList.clickOnActionMenu(content); - const disabledDelete = $(`button[data-automation-id='Delete'][disabled='true']`); - await BrowserVisibility.waitUntilElementIsVisible(disabledDelete); - } - async deleteContent(content: string): Promise { await this.contentList.clickOnActionMenu(content); await BrowserActions.click(this.deleteContentElement); diff --git a/e2e/core/pages/metadata-view.page.ts b/e2e/core/pages/metadata-view.page.ts index 058d7ed65b1..7edf5cc0f22 100644 --- a/e2e/core/pages/metadata-view.page.ts +++ b/e2e/core/pages/metadata-view.page.ts @@ -38,7 +38,6 @@ export class MetadataViewPage { displayEmptySwitch = $(`#adf-metadata-empty`); readonlySwitch = $(`#adf-metadata-readonly`); multiSwitch = $(`#adf-metadata-multi`); - presetSwitch = $('#adf-toggle-custom-preset'); defaultPropertiesSwitch = $('#adf-metadata-default-properties'); closeButton = element(by.cssContainingText('button.mat-button span', 'Close')); displayAspect = $(`input[data-placeholder='Display Aspect']`); @@ -143,25 +142,12 @@ export class MetadataViewPage { await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon); } - async clickResetButton(): Promise { - const clearPropertyIcon = $('button[data-automation-id="reset-metadata"]'); - await BrowserActions.click(clearPropertyIcon); - } - async enterPropertyText(propertyName: string, text: string | number): Promise { const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]'); await BrowserActions.clearSendKeys(textField, text.toString()); await textField.sendKeys(protractor.Key.ENTER); } - async enterPresetText(text: string): Promise { - const presetField = $('input[data-automation-id="adf-text-custom-preset"]'); - await BrowserActions.clearSendKeys(presetField, text.toString()); - await presetField.sendKeys(protractor.Key.ENTER); - const applyButton = $('button[id="adf-metadata-aplly"]'); - await BrowserActions.click(applyButton); - } - async enterDescriptionText(text: string): Promise { const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]'); await BrowserActions.clearSendKeys(textField, text); @@ -205,13 +191,6 @@ export class MetadataViewPage { await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded'); } - async getMetadataGroupTitle(groupName: string): Promise { - const group = $( - 'mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title' - ); - return BrowserActions.getText(group); - } - async checkPropertyIsVisible(propertyName: string, type: string): Promise { const property = $('[data-automation-id="card-' + type + '-label-' + propertyName + '"]'); await BrowserVisibility.waitUntilElementIsVisible(property); @@ -292,10 +271,6 @@ export class MetadataViewPage { await TestElement.byCss('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]').waitNotVisible(); } - async clickCloseButton(): Promise { - await BrowserActions.click(this.closeButton); - } - async typeAspectName(aspectName): Promise { await BrowserActions.clearSendKeys(this.displayAspect, aspectName); } diff --git a/lib/testing/src/lib/protractor/content-services/actions/permission.actions.ts b/lib/testing/src/lib/protractor/content-services/actions/permission.actions.ts deleted file mode 100644 index 106030e769a..00000000000 --- a/lib/testing/src/lib/protractor/content-services/actions/permission.actions.ts +++ /dev/null @@ -1,49 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { NodeEntry, NodeBodyUpdate, NodesApi } from '@alfresco/js-api'; -import { ApiService } from '../../../shared/api/api.service'; - -export class PermissionActions { - api: ApiService; - nodesApi: NodesApi; - - constructor(apiService: ApiService) { - this.api = apiService; - this.nodesApi = new NodesApi(apiService.getInstance()); - } - - addRoleForUser(userName: string, role: string, nodeToUpdate: NodeEntry): Promise { - const payload: NodeBodyUpdate = { - permissions: { - locallySet: [ - { - accessStatus: 'ALLOWED', - name: role, - authorityId: userName - } - ] - } - }; - return this.nodesApi.updateNode(nodeToUpdate.entry.id, payload); - } - - disableInheritedPermissionsForNode(nodeId: string): Promise { - const nodeBody = { permissions: { isInheritanceEnabled: false } }; - return this.nodesApi.updateNode(nodeId, nodeBody, { include: ['permissions'] }); - } -} diff --git a/lib/testing/src/lib/protractor/content-services/actions/public-api.ts b/lib/testing/src/lib/protractor/content-services/actions/public-api.ts index 6b40791f835..7d38516d60c 100644 --- a/lib/testing/src/lib/protractor/content-services/actions/public-api.ts +++ b/lib/testing/src/lib/protractor/content-services/actions/public-api.ts @@ -16,5 +16,4 @@ */ export * from './upload.actions'; -export * from './permission.actions'; export * from './model.actions'; diff --git a/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts b/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts deleted file mode 100644 index 36509d1d66b..00000000000 --- a/lib/testing/src/lib/protractor/content-services/dialog/add-permissions-dialog.page.ts +++ /dev/null @@ -1,99 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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, $$ } from 'protractor'; -import { BrowserActions } from '../../core/utils/browser-actions'; -import { DataTableComponentPage } from '../../core/pages/data-table-component.page'; -import { BrowserVisibility } from '../../core/utils/browser-visibility'; -import { DropdownPage } from '../../core/pages/material/dropdown.page'; -import { TestElement } from '../../core/test-element'; - -const column = { - role: 'Role' -}; - -export class AddPermissionsDialogPage { - - dataTableComponentPage: DataTableComponentPage = new DataTableComponentPage(); - userRoleDataTableComponentPage: DataTableComponentPage = new DataTableComponentPage($('[data-automation-id="adf-user-role-selection-table"]')); - - addPermissionDialog = $('adf-add-permission-dialog'); - searchUserInput = $('#searchInput'); - searchResults = $('#adf-add-permission-authority-results #adf-search-results-content'); - addButton = $('[data-automation-id="add-permission-dialog-confirm-button"]'); - closeButton = $('#add-permission-dialog-close-button'); - - getRoleDropdownOptions() { - return $$('.mat-option-text'); - } - - async clickAddPermissionButton(): Promise { - await BrowserActions.clickExecuteScript('button[data-automation-id="adf-add-permission-button"]'); - } - - async checkAddPermissionDialogIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionDialog); - } - - async checkSearchUserInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.searchUserInput); - } - - async searchUserOrGroup(name: string): Promise { - await BrowserActions.clearSendKeys(this.searchUserInput, name); - await this.dataTableComponentPage.waitTillContentLoaded(); - } - - async checkResultListIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.searchResults); - } - - async clickUserOrGroup(name: string): Promise { - const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name)); - await BrowserActions.click(userOrGroupName); - await BrowserActions.click(this.addButton); - } - - async getRoleCellValue(rowName: string): Promise { - const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Users and Groups', rowName, column.role); - return BrowserActions.getText(locator); - } - - async selectOption(name: string): Promise { - await new DropdownPage().selectOption(name); - } - - async checkUserOrGroupIsDisplayed(name: string): Promise { - const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name)); - await BrowserVisibility.waitUntilElementIsVisible(userOrGroupName); - } - - async addButtonIsEnabled(): Promise { - return this.addButton.isEnabled(); - } - - async clickAddButton(): Promise { - await BrowserActions.click(this.addButton); - } - - async selectRole(name: string, role: string) { - const row = this.userRoleDataTableComponentPage.getRow('Users and Groups', name); - await BrowserActions.click(row.$('[id="adf-select-role-permission"] .mat-select-trigger')); - await TestElement.byCss('.mat-select-panel').waitVisible(); - await this.selectOption(role); - } -} diff --git a/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts b/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts index f8d68bd9cb4..ca4d2840dba 100644 --- a/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts +++ b/lib/testing/src/lib/protractor/content-services/dialog/public-api.ts @@ -16,4 +16,3 @@ */ export * from './content-node-selector-dialog.page'; -export * from './add-permissions-dialog.page'; diff --git a/lib/testing/src/lib/protractor/core/actions/search.service.ts b/lib/testing/src/lib/protractor/core/actions/search.service.ts index f1acfb729e2..e8f366bb5dd 100644 --- a/lib/testing/src/lib/protractor/core/actions/search.service.ts +++ b/lib/testing/src/lib/protractor/core/actions/search.service.ts @@ -19,7 +19,6 @@ import { ApiService } from '../../../shared/api/api.service'; import { ResultSetPaging, SearchApi } from '@alfresco/js-api'; import { Logger } from '../utils/logger'; import { ApiUtil } from '../../../shared/api/api.util'; -import { UserModel } from '../models/user.model'; export class SearchService { apiService: ApiService; @@ -50,45 +49,12 @@ export class SearchService { return ApiUtil.waitForApi(apiCall, predicate); } - async isUserSearchable(user: UserModel): Promise { - const query = this.createUserSearchQuery(user); - - const predicate = (result: ResultSetPaging) => result.list && result.list.entries.length > 0 && !!result.list.entries.find(({ entry }) => entry.properties['cm:email'] === user.email); - - return this.performSearch(query, predicate, 'Failed to search user'); - } - - private createUserSearchQuery(user: UserModel) { - return { - query: { - query: `email:*${user.email}* OR firstName:*${user.firstName}* OR lastName:*${user.lastName}*` - }, - include: [ - 'aspectNames', - 'properties' - ], - paging: { - maxItems: 1, - skipCount: 0 - }, - filterQueries: [ - { - query: `TYPE:'cm:authority'` - } - ] - }; - } - private createSearchQuery(name: string) { return { query: { query: `${name}*` }, - include: [ - 'path', - 'allowableOperations', - 'properties' - ], + include: ['path', 'allowableOperations', 'properties'], paging: { maxItems: 20, skipCount: 0 @@ -102,9 +68,7 @@ export class SearchService { } ], scope: { - locations: [ - 'nodes' - ] + locations: ['nodes'] } }; } From e9dba2fe8ba5c1e06d9d94504bae96cae5c67469 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 16:01:19 +0100 Subject: [PATCH 02/23] [ci:force] cleanup insights test --- e2e/insights/analytics-component.e2e.ts | 61 ------------------------- 1 file changed, 61 deletions(-) delete mode 100644 e2e/insights/analytics-component.e2e.ts diff --git a/e2e/insights/analytics-component.e2e.ts b/e2e/insights/analytics-component.e2e.ts deleted file mode 100644 index fdb809fb9af..00000000000 --- a/e2e/insights/analytics-component.e2e.ts +++ /dev/null @@ -1,61 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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, UserModel, UsersActions } from '@alfresco/adf-testing'; -import { NavigationBarPage } from '../core/pages/navigation-bar.page'; -import { AnalyticsPage } from '../process-services/pages/analytics.page'; -import { ProcessServicesPage } from '../process-services/pages/process-services.page'; -import { ProcessServiceTabBarPage } from '../process-services/pages/process-service-tab-bar.page'; - -describe('Analytics Smoke Test', () => { - - const loginPage = new LoginPage(); - const navigationBarPage = new NavigationBarPage(); - const processServiceTabBarPage = new ProcessServiceTabBarPage(); - const analyticsPage = new AnalyticsPage(); - const processServicesPage = new ProcessServicesPage(); - - const reportTitle = 'New Title'; - let procUserModel: UserModel; - - const apiService = createApiService(); - const usersActions = new UsersActions(apiService); - - beforeAll(async () => { - await apiService.loginWithProfile('admin'); - - procUserModel = await usersActions.createUser(); - - await loginPage.login(procUserModel.username, procUserModel.password); - }); - - afterAll(async () => { - await apiService.loginWithProfile('admin'); - await usersActions.deleteTenant(procUserModel.tenantId); - }); - - it('[C260346] Should be able to change title of a report', async () => { - await navigationBarPage.navigateToProcessServicesPage(); - await processServicesPage.checkApsContainer(); - await processServicesPage.goToApp('Task App'); - await processServiceTabBarPage.clickReportsButton(); - await analyticsPage.checkNoReportMessage(); - await analyticsPage.getReport('Process definition heat map'); - await analyticsPage.changeReportTitle(reportTitle); - await expect(await analyticsPage.getReportTitle()).toEqual(reportTitle); - }); -}); From 323b716f71ae402f93bf26967e3c695fe1b2ce32 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 16:04:41 +0100 Subject: [PATCH 03/23] [ci:force] cleanup dead demo shell e2e --- demo-shell/e2e/app.e2e-spec.e2e.ts | 31 ------------------------------ demo-shell/e2e/app.po.ts | 28 --------------------------- demo-shell/e2e/tsconfig.e2e.json | 9 --------- 3 files changed, 68 deletions(-) delete mode 100644 demo-shell/e2e/app.e2e-spec.e2e.ts delete mode 100644 demo-shell/e2e/app.po.ts delete mode 100644 demo-shell/e2e/tsconfig.e2e.json diff --git a/demo-shell/e2e/app.e2e-spec.e2e.ts b/demo-shell/e2e/app.e2e-spec.e2e.ts deleted file mode 100644 index e411de897b9..00000000000 --- a/demo-shell/e2e/app.e2e-spec.e2e.ts +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { MyAppPage } from './app.po'; - -describe('MyApp App', () => { - let page: MyAppPage; - - beforeEach(() => { - page = new MyAppPage(); - }); - - it('should display toolbar', () => { - page.navigateTo(); - expect(page.getToolbar()).toBeDefined(); - }); -}); diff --git a/demo-shell/e2e/app.po.ts b/demo-shell/e2e/app.po.ts deleted file mode 100644 index c6b0a2e2139..00000000000 --- a/demo-shell/e2e/app.po.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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, element, by } from 'protractor'; - -export class MyAppPage { - navigateTo() { - return browser.get('/'); - } - - getToolbar() { - return element(by.tagName('adf-toolbar')); - } -} diff --git a/demo-shell/e2e/tsconfig.e2e.json b/demo-shell/e2e/tsconfig.e2e.json deleted file mode 100644 index 8ad53b9929f..00000000000 --- a/demo-shell/e2e/tsconfig.e2e.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types": ["jasmine", "jasminewd2", "node"] - } -} From 3679ffd5f41f6ca0b5f7b064087f965cdfc69627 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 16:15:03 +0100 Subject: [PATCH 04/23] [ci:force] cleanup e2e --- .../document-list-permissions.e2e.ts | 62 ------------------- e2e/core/pages/content-services.page.ts | 9 --- e2e/models/ACS/created-by-model.ts | 5 -- e2e/models/ACS/file.model.ts | 38 ------------ e2e/models/ACS/folder.model.ts | 14 ----- 5 files changed, 128 deletions(-) delete mode 100644 e2e/content-services/document-list/document-list-permissions.e2e.ts diff --git a/e2e/content-services/document-list/document-list-permissions.e2e.ts b/e2e/content-services/document-list/document-list-permissions.e2e.ts deleted file mode 100644 index 0a84c09183b..00000000000 --- a/e2e/content-services/document-list/document-list-permissions.e2e.ts +++ /dev/null @@ -1,62 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { createApiService, BrowserActions, ErrorPage, LoginPage, StringUtil, UsersActions } from '@alfresco/adf-testing'; -import { SiteEntry, SitesApi } from '@alfresco/js-api'; - -describe('Document List Component', () => { - const loginPage = new LoginPage(); - const errorPage = new ErrorPage(); - const navigationBarPage = new NavigationBarPage(); - const apiService = createApiService(); - const usersActions = new UsersActions(apiService); - - let privateSite: SiteEntry; - let acsUser = null; - - describe('Permission Message', () => { - beforeAll(async () => { - const siteName = `PRIVATE_TEST_SITE_${StringUtil.generateRandomString(5)}`; - const privateSiteBody = { visibility: 'PRIVATE', title: siteName }; - - await apiService.loginWithProfile('admin'); - - acsUser = await usersActions.createUser(); - - const sitesApi = new SitesApi(apiService.getInstance()); - privateSite = await sitesApi.createSite(privateSiteBody); - - await loginPage.login(acsUser.username, acsUser.password); - }); - - afterAll(async () => { - await apiService.loginWithProfile('admin'); - await navigationBarPage.clickLogoutButton(); - - const sitesApi = new SitesApi(apiService.getInstance()); - await sitesApi.deleteSite(privateSite.entry.id, { permanent: true }); - }); - - it('[C217334] Should display a message when accessing file without permissions', async () => { - await BrowserActions.getUrl(browser.baseUrl + '/files/' + privateSite.entry.guid); - await expect(await errorPage.getErrorCode()).toBe('403'); - await expect(await errorPage.getErrorDescription()).toBe("You're not allowed access to this resource on the server."); - }); - }); -}); diff --git a/e2e/core/pages/content-services.page.ts b/e2e/core/pages/content-services.page.ts index 13c71383637..d4f42a89426 100644 --- a/e2e/core/pages/content-services.page.ts +++ b/e2e/core/pages/content-services.page.ts @@ -75,11 +75,6 @@ export class ContentServicesPage { await this.checkContentIsNotDisplayed(content); } - async metadataContent(content: string): Promise { - await this.contentList.clickOnActionMenu(content); - await BrowserActions.click(this.metadataAction); - } - async versionManagerContent(content: string): Promise { await this.contentList.clickOnActionMenu(content); await BrowserActions.click(this.versionManagerAction); @@ -341,10 +336,6 @@ export class ContentServicesPage { return BrowserActions.getText(elementSize); } - async checkSelectedSiteIsDisplayed(siteName: string): Promise { - await this.siteListDropdown.checkOptionIsSelected(siteName); - } - async clickDownloadButton(): Promise { await BrowserActions.closeMenuAndDialogs(); await BrowserActions.click(this.downloadButton); diff --git a/e2e/models/ACS/created-by-model.ts b/e2e/models/ACS/created-by-model.ts index 32286addd43..6113d8b6e68 100644 --- a/e2e/models/ACS/created-by-model.ts +++ b/e2e/models/ACS/created-by-model.ts @@ -28,9 +28,4 @@ export class CreatedByModel { getId() { return this.id; } - - getDisplayName() { - return this.displayName; - } - } diff --git a/e2e/models/ACS/file.model.ts b/e2e/models/ACS/file.model.ts index fe5572ea7bb..7cfaca09b00 100644 --- a/e2e/models/ACS/file.model.ts +++ b/e2e/models/ACS/file.model.ts @@ -22,7 +22,6 @@ import { CreatedByModel } from './created-by-model'; import { StringUtil } from '@alfresco/adf-testing'; export class FileModel { - id = StringUtil.generateRandomString(); name = StringUtil.generateRandomString(); shortName = this.name; @@ -30,7 +29,6 @@ export class FileModel { 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; @@ -58,54 +56,18 @@ export class FileModel { 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), diff --git a/e2e/models/ACS/folder.model.ts b/e2e/models/ACS/folder.model.ts index 7766f292786..c20b4f3ad46 100644 --- a/e2e/models/ACS/folder.model.ts +++ b/e2e/models/ACS/folder.model.ts @@ -18,7 +18,6 @@ import { StringUtil } from '@alfresco/adf-testing'; export class FolderModel { - id = StringUtil.generateRandomString(); name = StringUtil.generateRandomString(); shortName = this.name; @@ -34,20 +33,7 @@ export class FolderModel { return this.name; } - getShortName() { - return this.shortName; - } - - getTooltip() { - return this.tooltip; - } - getId() { return this.id; } - - getLocation() { - return this.location; - } - } From 7fc97ab32c9a9d49a1837d7f10e0a05d023a1576 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 16:55:23 +0100 Subject: [PATCH 05/23] [ci:force] cleanup e2e --- .../protractor/core/actions/users.actions.ts | 30 ++---------- .../lib/protractor/core/pages/error.page.ts | 43 ----------------- .../protractor/core/pages/info-drawer.page.ts | 48 +++---------------- .../lib/protractor/core/pages/public-api.ts | 1 - 4 files changed, 9 insertions(+), 113 deletions(-) delete mode 100644 lib/testing/src/lib/protractor/core/pages/error.page.ts diff --git a/lib/testing/src/lib/protractor/core/actions/users.actions.ts b/lib/testing/src/lib/protractor/core/actions/users.actions.ts index 3e851d1a36b..d4e60cb58d7 100644 --- a/lib/testing/src/lib/protractor/core/actions/users.actions.ts +++ b/lib/testing/src/lib/protractor/core/actions/users.actions.ts @@ -15,18 +15,8 @@ * limitations under the License. */ -import * as path from 'path'; -import * as fs from 'fs'; - import { browser } from 'protractor'; -import { - UserProfileApi, - AdminUsersApi, - AdminTenantsApi, - PeopleApi, - ImageUploadRepresentation, - UserRepresentation -} from '@alfresco/js-api'; +import { UserProfileApi, AdminUsersApi, AdminTenantsApi, PeopleApi, UserRepresentation } from '@alfresco/js-api'; import { IdentityService } from './identity/identity.service'; import { UserModel } from '../models/user.model'; import { ApiService } from '../../../shared/api/api.service'; @@ -34,7 +24,6 @@ import { Logger } from '../utils/logger'; import { Tenant } from '../models/tenant'; export class UsersActions { - api: ApiService; identityService: IdentityService; peopleApi: PeopleApi; @@ -61,7 +50,7 @@ export class UsersActions { const user = new UserModel({ ...(userModel ? userModel : {}) }); try { - if (this.api.apiService.isEcmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) { + if (this.api.apiService.isEcmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) { Logger.log(`Create user ECM ${user.email}`); await this.peopleApi.createPerson({ id: user.username, @@ -80,7 +69,7 @@ export class UsersActions { } try { - if (this.api.apiService.isBpmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) { + if (this.api.apiService.isBpmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) { Logger.log('Create user BPM'); if (user.tenantId) { const apsUser = await this.createApsUser(user.tenantId, user.email, user.firstName, user.lastName, user.password); @@ -117,11 +106,6 @@ export class UsersActions { return user; } - async createUserWithName(firstName: string, lastName: string): Promise { - const user = new UserModel({ firstName, lastName }); - return this.createUser(user); - } - async createTenantAndUser(email?: string, firstName?: string, lastName?: string, password?: string): Promise { const newTenant = await this.adminTenantsApi.createTenant(new Tenant()); @@ -137,7 +121,6 @@ export class UsersActions { } async createApsUser(tenantId?: number, email?: string, firstName?: string, lastName?: string, password?: string): Promise { - const user = new UserModel({ tenantId, email, @@ -149,13 +132,6 @@ export class UsersActions { return this.adminUsersApi.createNewUser(user.getAPSModel()); } - async changeProfilePictureAps(fileLocation: string): Promise { - const pathFile = path.join(browser.params.testConfig.main.rootPath + fileLocation); - const file = fs.createReadStream(pathFile); - - return this.userProfileApi.uploadProfilePicture(file); - } - async deleteTenant(tenantId: number) { await this.adminTenantsApi.deleteTenant(tenantId); } diff --git a/lib/testing/src/lib/protractor/core/pages/error.page.ts b/lib/testing/src/lib/protractor/core/pages/error.page.ts deleted file mode 100644 index b7d31c7bdb8..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/error.page.ts +++ /dev/null @@ -1,43 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 } from '../utils/browser-visibility'; -import { $ } from 'protractor'; -import { BrowserActions } from '../utils/browser-actions'; - -export class ErrorPage { - - errorPageCode = $('adf-error-content .adf-error-content-code'); - errorPageTitle = $('adf-error-content .adf-error-content-title'); - errorPageDescription = $('adf-error-content .adf-error-content-description'); - - async checkErrorCode(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode); - } - - async getErrorCode(): Promise { - return BrowserActions.getText(this.errorPageCode); - } - - async getErrorTitle(): Promise { - return BrowserActions.getText(this.errorPageTitle); - } - - async getErrorDescription(): Promise { - return BrowserActions.getText(this.errorPageDescription); - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts b/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts index 02427e00ae8..d5181070377 100644 --- a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts @@ -17,59 +17,23 @@ import { ElementFinder, $ } from 'protractor'; import { BrowserVisibility } from './../utils/browser-visibility'; -import { TabsPage } from './material/tabs.page'; +// TODO: cleanup once https://github.com/Alfresco/hxp-frontend-apps/pull/6582 is merged export class InfoDrawerPage { - rootElement: ElementFinder; - infoDrawerHeader = ('adf-info-drawer-layout-header'); - tabsPage: TabsPage = new TabsPage(); - constructor(classLocator: string = 'adf-info-drawer') { - this.rootElement = $(`adf-info-drawer[class*='${classLocator}']`); + constructor() { + this.rootElement = $(`adf-info-drawer[class*='adf-info-drawer']`); } + // used in APA async isInfoDrawerDisplayed(): Promise { try { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement); - return true; - } catch (error) { - return false; - } - } - - async isInfoDrawerNotDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement); - return true; - } catch (error) { - return false; - } - } - - async isInfoDrawerHeaderDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.infoDrawerHeader)); + const infoDrawerElement = $(`adf-info-drawer[class*='adf-info-drawer']`); + await BrowserVisibility.waitUntilElementIsVisible(infoDrawerElement); return true; } catch (error) { return false; } } - - async isInfoDrawerHeaderNotDisplayed(): Promise { - try { - await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.$(this.infoDrawerHeader)); - return true; - } catch (error) { - return false; - } - } - - async getNoOfTabs(): Promise { - return this.tabsPage.getNoOfTabs(); - } - - async getTabsLabels(): Promise { - return this.tabsPage.getTabsLabels(); - } } diff --git a/lib/testing/src/lib/protractor/core/pages/public-api.ts b/lib/testing/src/lib/protractor/core/pages/public-api.ts index 0d19ad15525..4f198d6c484 100644 --- a/lib/testing/src/lib/protractor/core/pages/public-api.ts +++ b/lib/testing/src/lib/protractor/core/pages/public-api.ts @@ -25,7 +25,6 @@ export { LoginPage as LoginSSOPage } from './login.page'; export * from './data-table-component.page'; export * from './pagination.page'; -export * from './error.page'; export * from './form/public-api'; export * from './material/public-api'; export * from './card-view/public-api'; From 95ec663f210bbf47da6ea0570ab221b560520a34 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 17:30:44 +0100 Subject: [PATCH 06/23] cleanup files component --- .../src/app/components/files/files.component.html | 14 -------------- .../src/app/components/files/files.component.ts | 9 --------- 2 files changed, 23 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 975fcf96924..d4776f42f45 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -30,16 +30,7 @@ - -
- - - - - - - - - - - - - - - - - - - - - @@ -169,230 +112,14 @@

My custom toolbar

- - - - - -

- - Url File - -

- -

- - - - - -

- -

- - Show Toolbar - -

- -

- - Allow GoBack - -

- -

- - Open With - -

- -

- - More Actions - -

- -

- - More Actions Menu - -

- -

- - Allow Download - -

- -

- - Allow Print - -

- -

- - Allow Right Sidebar - -

- -

- - Allow Left Sidebar - -

- -

- - Custom Toolbar - -

- -

- - Show tab with icon - -

- -

- - Show tab with icon and label - -

- -

- -

- -

- -

- -
- - - - - - -
-
- - - -

My custom toolbar

-
- - - - - - - - - - - - - - - - - - - - -
diff --git a/demo-shell/src/app/components/file-view/file-view.component.ts b/demo-shell/src/app/components/file-view/file-view.component.ts index 4da84b4ca71..4e5c144c970 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.ts +++ b/demo-shell/src/app/components/file-view/file-view.component.ts @@ -17,16 +17,8 @@ import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router'; -import { - NotificationService -} from '@alfresco/adf-core'; -import { - ContentService, - AllowableOperationsEnum, - PermissionsEnum, - NodesApiService, - FileUploadErrorEvent -} from '@alfresco/adf-content-services'; +import { NotificationService } from '@alfresco/adf-core'; +import { ContentService, AllowableOperationsEnum, PermissionsEnum, NodesApiService, FileUploadErrorEvent } from '@alfresco/adf-content-services'; import { PreviewService } from '../../services/preview.service'; @Component({ @@ -36,7 +28,6 @@ import { PreviewService } from '../../services/preview.service'; encapsulation: ViewEncapsulation.None }) export class FileViewComponent implements OnInit { - nodeId: string = null; versionId: string = null; displayEmptyMetadata = false; @@ -46,36 +37,21 @@ export class FileViewComponent implements OnInit { isPreset = false; customPreset: string = null; displayDefaultProperties = true; - showToolbar = true; - urlFile = null; - allowGoBack = true; - openWith = false; - allowDownload = true; - allowPrint = true; - allowRightSidebar = true; - allowLeftSidebar = true; - moreActions = true; - moreActionsMenu = false; - fileUrlSwitch = false; - showLeftSidebar = null; - showRightSidebar = false; - customToolbar = false; isCommentEnabled = false; - showTabWithIcon = false; - showTabWithIconAndLabel = false; desiredAspect: string = null; showAspect: string = null; name: string; fileName: string; blobFile: Blob; - constructor(private router: Router, - private route: ActivatedRoute, - private nodeApiService: NodesApiService, - private contentServices: ContentService, - private preview: PreviewService, - private notificationService: NotificationService) { - } + constructor( + private router: Router, + private route: ActivatedRoute, + private nodeApiService: NodesApiService, + private contentServices: ContentService, + private preview: PreviewService, + private notificationService: NotificationService + ) {} ngOnInit() { this.route.params.subscribe((params) => { @@ -85,7 +61,8 @@ export class FileViewComponent implements OnInit { this.nodeApiService.getNode(id).subscribe( (node) => { if (node?.isFile) { - this.isCommentEnabled = this.contentServices.hasPermissions(node, PermissionsEnum.NOT_CONSUMER) || + this.isCommentEnabled = + this.contentServices.hasPermissions(node, PermissionsEnum.NOT_CONSUMER) || this.contentServices.hasAllowableOperations(node, AllowableOperationsEnum.UPDATE); this.nodeId = id; return; @@ -131,66 +108,6 @@ export class FileViewComponent implements OnInit { this.displayDefaultProperties = !this.displayDefaultProperties; } - toggleShowToolbar() { - this.showToolbar = !this.showToolbar; - } - - toggleAllowGoBack() { - this.allowGoBack = !this.allowGoBack; - } - - toggleOpenWith() { - this.openWith = !this.openWith; - } - - toggleAllowDownload() { - this.allowDownload = !this.allowDownload; - } - - toggleAllowPrint() { - this.allowPrint = !this.allowPrint; - } - - toggleOpenMoreActions() { - this.moreActions = !this.moreActions; - } - - toggleMoreActionsMenu() { - this.moreActionsMenu = !this.moreActionsMenu; - } - - toggleShowRightSidebar() { - this.showRightSidebar = !this.showRightSidebar; - } - - hideLeftSidebar() { - this.showLeftSidebar = false; - } - - toggleAllowRightSidebar() { - this.allowRightSidebar = !this.allowRightSidebar; - } - - toggleAllowLeftSidebar() { - this.allowLeftSidebar = !this.allowLeftSidebar; - } - - toggleShowTabWithIcon() { - this.showTabWithIcon = !this.showTabWithIcon; - } - - toggleShowTabWithIconAndLabel() { - this.showTabWithIconAndLabel = !this.showTabWithIconAndLabel; - } - - toggleFileUrl() { - this.fileUrlSwitch = !this.fileUrlSwitch; - - if (!this.fileUrlSwitch) { - this.urlFile = null; - } - } - togglePreset() { this.isPreset = !this.isPreset; if (!this.isPreset) { @@ -198,10 +115,6 @@ export class FileViewComponent implements OnInit { } } - toggleToolbar() { - this.customToolbar = !this.customToolbar; - } - applyCustomPreset() { this.isPreset = false; setTimeout(() => { diff --git a/e2e/core/viewer/viewer-content-services-component.e2e.ts b/e2e/core/viewer/viewer-content-services-component.e2e.ts index f0aadfd7fb8..d3d24a9c21d 100644 --- a/e2e/core/viewer/viewer-content-services-component.e2e.ts +++ b/e2e/core/viewer/viewer-content-services-component.e2e.ts @@ -16,14 +16,7 @@ */ import { browser, by, element, protractor } from 'protractor'; -import { createApiService, - BrowserActions, - LoginPage, - UploadActions, - UserModel, - UsersActions, - ViewerPage -} from '@alfresco/adf-testing'; +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'; @@ -271,19 +264,6 @@ describe('Content Services Viewer', () => { await viewerPage.clickCloseButton(); }); - it('[C291903] Should display the buttons in order in the adf viewer toolbar', async () => { - await contentServicesPage.doubleClickRow(pdfFile.name); - await viewerPage.waitTillContentLoaded(); - - await viewerPage.checkLeftSideBarIsNotDisplayed(); - await viewerPage.clickLeftSidebarButton(); - await viewerPage.checkLeftSideBarIsDisplayed(); - await viewerPage.enableMoreActionsMenu(); - await viewerPage.checkToolbarIsDisplayed(); - await expect(await viewerPage.getLastButtonTitle()).toEqual(await viewerPage.getMoreActionsMenuTitle()); - 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(); @@ -318,7 +298,7 @@ describe('Content Services Viewer', () => { await viewerPage.checkZoomInButtonIsNotDisplayed(); await viewerPage.checkUnknownFormatIsDisplayed(); - await expect(await viewerPage.getUnknownFormatMessage()).toBe('Couldn\'t load preview. Unknown format.'); + await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format."); await viewerPage.clickCloseButton(); }); @@ -434,7 +414,7 @@ describe('Content Services Viewer', () => { await contentServicesPage.doubleClickRow(unsupportedFileName); await viewerPage.waitTillContentLoaded(); await viewerPage.checkUnknownFormatIsDisplayed(); - await expect(await viewerPage.getUnknownFormatMessage()).toBe('Couldn\'t load preview. Unknown format.'); + await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format."); await viewerPage.clickCloseButton(); } diff --git a/e2e/core/viewer/viewer-custom-toolbar-info-drawer.e2e.ts b/e2e/core/viewer/viewer-custom-toolbar-info-drawer.e2e.ts deleted file mode 100644 index 083a3d419db..00000000000 --- a/e2e/core/viewer/viewer-custom-toolbar-info-drawer.e2e.ts +++ /dev/null @@ -1,114 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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('[C260096] Should the Viewer able to accept a customToolbar', async () => { - await viewerPage.clickLeftSidebarButton(); - await viewerPage.checkLeftSideBarIsDisplayed(); - await viewerPage.checkToolbarIsDisplayed(); - await viewerPage.enableCustomToolbar(); - await viewerPage.checkCustomToolbarIsDisplayed(); - await viewerPage.disableCustomToolbar(); - }); - - it('[C260097] Should the viewer able to show a custom info-drawer when the sidebarTemplate is set', async () => { - await viewerPage.clickInfoButton(); - await viewerPage.checkInfoSideBarIsDisplayed(); - await viewerPage.clickOnTab('Comments'); - await viewerPage.checkTabIsActive('Comments'); - await viewerPage.clickOnTab('Properties'); - await viewerPage.checkTabIsActive('Properties'); - await viewerPage.clickOnTab('Versions'); - await viewerPage.checkTabIsActive('Versions'); - }); - - 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); - }); -}); diff --git a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts b/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts deleted file mode 100644 index d5181070377..00000000000 --- a/lib/testing/src/lib/protractor/core/pages/info-drawer.page.ts +++ /dev/null @@ -1,39 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { ElementFinder, $ } from 'protractor'; -import { BrowserVisibility } from './../utils/browser-visibility'; - -// TODO: cleanup once https://github.com/Alfresco/hxp-frontend-apps/pull/6582 is merged -export class InfoDrawerPage { - rootElement: ElementFinder; - - constructor() { - this.rootElement = $(`adf-info-drawer[class*='adf-info-drawer']`); - } - - // used in APA - async isInfoDrawerDisplayed(): Promise { - try { - const infoDrawerElement = $(`adf-info-drawer[class*='adf-info-drawer']`); - await BrowserVisibility.waitUntilElementIsVisible(infoDrawerElement); - return true; - } catch (error) { - return false; - } - } -} diff --git a/lib/testing/src/lib/protractor/core/pages/public-api.ts b/lib/testing/src/lib/protractor/core/pages/public-api.ts index 4f198d6c484..2cdbcc890b6 100644 --- a/lib/testing/src/lib/protractor/core/pages/public-api.ts +++ b/lib/testing/src/lib/protractor/core/pages/public-api.ts @@ -33,4 +33,3 @@ export * from './config-editor-page'; export * from './snackbar.page'; export * from './data-table/public-api'; export * from './context-menu.page'; -export * from './info-drawer.page'; diff --git a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts b/lib/testing/src/lib/protractor/core/pages/viewer.page.ts index d0ee2407aa9..27c01ca1d50 100644 --- a/lib/testing/src/lib/protractor/core/pages/viewer.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/viewer.page.ts @@ -17,7 +17,6 @@ import { BrowserActions } from '../utils/browser-actions'; import { TabsPage } from './material/tabs.page'; -import { TogglePage } from './material/toggle.page'; import { BrowserVisibility } from '../utils/browser-visibility'; import { element, by, browser, protractor, $, $$ } from 'protractor'; import { Logger } from '../utils/logger'; @@ -26,12 +25,9 @@ const MAX_LOADING_TIME = 120000; export class ViewerPage { tabsPage = new TabsPage(); - togglePage = new TogglePage(); - closeButton = $('button[data-automation-id="adf-toolbar-back"]'); fileName = $('#adf-viewer-display-name'); infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]'); - leftSideBarButton = $('button[data-automation-id="adf-toolbar-left-sidebar"]'); previousPageButton = $('#viewer-previous-page-button'); nextPageButton = $('#viewer-next-page-button'); zoomInButton = $('#viewer-zoom-in-button'); @@ -49,51 +45,15 @@ export class ViewerPage { thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]'); secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"]'); lastThumbnailDisplayed = $$('adf-pdf-thumb').last(); - passwordDialog = $('adf-pdf-viewer-password-dialog'); - passwordSubmit = $('button[data-automation-id="adf-password-dialog-submit"]'); - passwordDialogClose = $('button[data-automation-id="adf-password-dialog-close"]'); - passwordSubmitDisabled = $('button[data-automation-id="adf-password-dialog-submit"][disabled]'); - passwordInput = $('input[data-automation-id="adf-password-dialog-input"]'); - passwordError = $('mat-error[data-automation-id="adf-password-dialog-error"]'); infoSideBar = $('#adf-right-sidebar'); - leftSideBar = $('#adf-left-sidebar'); viewer = $('adf-viewer'); imgViewer = $('adf-img-viewer'); activeTab = $('div[class*="mat-tab-label-active"]'); - toolbarSwitch = $('#adf-switch-toolbar'); toolbar = $('#adf-viewer-toolbar'); - lastButton = $$('#adf-viewer-toolbar mat-toolbar > button[data-automation-id*="adf-toolbar-"]').last(); - goBackSwitch = $('#adf-switch-goback'); canvasLayer = $$('.canvasWrapper > canvas').first(); - openWithSwitch = $('#adf-switch-openwith'); - openWith = $('#adf-viewer-openwith'); - - moreActionsMenuSwitch = $('#adf-switch-moreactionsmenu'); - moreActionsMenu = $('button[data-automation-id="adf-toolbar-more-actions"]'); - - customToolbarToggle = $('#adf-toggle-custom-toolbar'); - customToolbar = $('adf-viewer-toolbar[data-automation-id="adf-viewer-custom-toolbar"]'); - - showRightSidebarSwitch = $('#adf-switch-showrightsidebar'); - showLeftSidebarSwitch = $('#adf-switch-showleftsidebar'); - - moreActionsSwitch = $('#adf-switch-moreactions'); pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer'); - - downloadSwitch = $('#adf-switch-download'); downloadButton = $('#adf-alfresco-viewer-download'); - - printSwitch = $('#adf-switch-print'); - printButton = $('#adf-alfresco-viewer-print'); - - allowSidebarSwitch = $('#adf-switch-allowsidebar'); - allowLeftSidebarSwitch = $('#adf-switch-allowLeftSidebar'); - - uploadButton = $('#adf-viewer-upload'); - timeButton = $('#adf-viewer-time'); - bugButton = $('#adf-viewer-bug'); - unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`); async viewFile(fileName: string): Promise { @@ -114,8 +74,7 @@ export class ViewerPage { Logger.log('wait spinner is present'); await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner'))); await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME); - } catch (error) { - } + } catch (error) {} } } @@ -145,41 +104,19 @@ export class ViewerPage { await browser.executeScript(jsCode); } - async enterPassword(password: string): Promise { - await BrowserActions.clearSendKeys(this.passwordInput, password); - } - async checkFileIsLoaded(fileName?: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.pdfPageLoaded, 60000, `${fileName} not loaded`); } - async clickClosePasswordDialog(): Promise { - await BrowserActions.click(this.passwordDialogClose); - } - async checkImgViewerIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.imgViewer); } - async checkPasswordErrorIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.passwordError); - } - - async checkPasswordInputIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.passwordInput); - } - - async checkPasswordSubmitDisabledIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.passwordSubmitDisabled); - } - - async checkPasswordDialogIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.passwordDialog); - } - async checkAllThumbnailsDisplayed(nbPages): Promise { const defaultThumbnailHeight = 143; - await expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual('height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);'); + await expect(await BrowserActions.getAttribute(this.thumbnailsContent, 'style')).toEqual( + 'height: ' + nbPages * defaultThumbnailHeight + 'px; transform: translate(-50%, 0px);' + ); } async checkCurrentThumbnailIsSelected(): Promise { @@ -213,14 +150,6 @@ export class ViewerPage { await BrowserVisibility.waitUntilElementIsVisible(this.closeButton); } - async getLastButtonTitle(): Promise { - return BrowserActions.getAttribute(this.lastButton, 'title'); - } - - async getMoreActionsMenuTitle(): Promise { - return BrowserActions.getAttribute(this.moreActionsMenu, 'title'); - } - async checkDownloadButtonIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.downloadButton); } @@ -229,10 +158,6 @@ export class ViewerPage { await BrowserVisibility.waitUntilElementIsVisible(this.infoButton); } - async checkInfoButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.infoButton); - } - async checkFileThumbnailIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.fileThumbnail); } @@ -318,14 +243,6 @@ export class ViewerPage { await BrowserVisibility.waitUntilElementIsVisible(this.infoSideBar); } - async checkLeftSideBarButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBarButton); - } - - async checkLeftSideBarButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBarButton); - } - async clickInfoButton(): Promise { await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]')); } @@ -335,26 +252,12 @@ export class ViewerPage { } async checkTabIsActive(tabName: string): Promise { - const tab = element(by.cssContainingText('.adf-info-drawer-layout-content div.mat-tab-labels div.mat-tab-label-active .mat-tab-label-content', tabName)); + const tab = element( + by.cssContainingText('.adf-info-drawer-layout-content div.mat-tab-labels div.mat-tab-label-active .mat-tab-label-content', tabName) + ); await BrowserVisibility.waitUntilElementIsVisible(tab); } - async clickLeftSidebarButton(): Promise { - await BrowserActions.click(this.leftSideBarButton); - } - - async checkLeftSideBarIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBar); - } - - async checkLeftSideBarIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBar); - } - - async clickPasswordSubmit(): Promise { - await BrowserActions.click(this.passwordSubmit); - } - async clickSecondThumbnail(): Promise { await BrowserActions.click(this.secondThumbnail); } @@ -411,159 +314,10 @@ export class ViewerPage { await this.tabsPage.clickTabByTitle('Comments'); } - async disableToolbar(): Promise { - await this.togglePage.disableToggle(this.toolbarSwitch); - } - - async enableToolbar(): Promise { - await this.togglePage.enableToggle(this.toolbarSwitch); - } - async checkToolbarIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.toolbar); } - async checkToolbarIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.toolbar); - } - - async disableGoBack(): Promise { - await this.togglePage.disableToggle(this.goBackSwitch); - } - - async enableGoBack(): Promise { - await this.togglePage.enableToggle(this.goBackSwitch); - } - - async checkGoBackIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.closeButton); - } - - async checkGoBackIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.closeButton); - } - - async disableToolbarOptions(): Promise { - await this.togglePage.disableToggle(this.openWithSwitch); - } - - async enableToolbarOptions() { - await this.togglePage.enableToggle(this.openWithSwitch); - } - - async checkToolbarOptionsIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.openWith); - } - - async checkToolbarOptionsIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.openWith); - } - - async disableDownload(): Promise { - await this.togglePage.disableToggle(this.downloadSwitch); - } - - async enableDownload(): Promise { - await this.togglePage.enableToggle(this.openWithSwitch); - } - - async checkDownloadButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.downloadButton); - } - - async disablePrint(): Promise { - await this.togglePage.disableToggle(this.printSwitch); - } - - async enablePrint(): Promise { - await this.togglePage.enableToggle(this.printSwitch); - } - - async checkPrintButtonIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.printButton); - } - - async checkPrintButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.printButton); - } - - async disableAllowSidebar(): Promise { - await this.togglePage.disableToggle(this.allowSidebarSwitch); - } - - async disableAllowLeftSidebar(): Promise { - await browser.executeScript('arguments[0].scrollIntoView()', this.allowLeftSidebarSwitch); - await this.togglePage.disableToggle(this.allowLeftSidebarSwitch); - } - - async checkMoreActionsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.bugButton); - await BrowserVisibility.waitUntilElementIsVisible(this.timeButton); - await BrowserVisibility.waitUntilElementIsVisible(this.uploadButton); - } - - async checkMoreActionsIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.bugButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.timeButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton); - } - - async checkPreviewFileDefaultOptionsAreDisplayed(): Promise { - await this.checkToolbarIsDisplayed(); - await this.checkMoreActionsDisplayed(); - await this.checkPrintButtonIsDisplayed(); - await this.checkDownloadButtonIsDisplayed(); - await this.checkFullScreenButtonIsDisplayed(); - await this.checkLeftSideBarButtonIsDisplayed(); - await this.checkInfoButtonIsDisplayed(); - } - - async disableMoreActions(): Promise { - await this.togglePage.disableToggle(this.moreActionsSwitch); - } - - async enableMoreActions(): Promise { - await this.togglePage.enableToggle(this.moreActionsSwitch); - } - - async enableMoreActionsMenu(): Promise { - await this.togglePage.enableToggle(this.moreActionsMenuSwitch); - } - - async disableCustomToolbar(): Promise { - await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle); - await this.togglePage.disableToggle(this.customToolbarToggle); - } - - async enableCustomToolbar(): Promise { - await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle); - await this.togglePage.enableToggle(this.customToolbarToggle); - } - - async checkCustomToolbarIsDisplayed() { - await BrowserVisibility.waitUntilElementIsVisible(this.customToolbar); - } - - async clickToggleRightSidebar(): Promise { - await BrowserActions.click(this.showRightSidebarSwitch); - } - - async clickToggleLeftSidebar(): Promise { - await BrowserActions.click(this.showLeftSidebarSwitch); - } - - async disableOverlay(): Promise { - await this.togglePage.disableToggle($('#adf-viewer-overlay')); - } - - async checkOverlayViewerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-overlay-container"]')); - } - - async checkInlineViewerIsDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-inline-container"]')); - } - async checkUnknownFormatIsDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.unknownFormat); } From 4531921ab829bc55ddb334d1a9f03011ad2d1c96 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 19:15:50 +0100 Subject: [PATCH 12/23] [ci:force] cleanup viewer in demo shell --- .../file-view/file-view.component.html | 24 +++++++++---------- .../file-view/file-view.component.scss | 12 ---------- .../file-view/file-view.component.ts | 1 - 3 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 demo-shell/src/app/components/file-view/file-view.component.scss diff --git a/demo-shell/src/app/components/file-view/file-view.component.html b/demo-shell/src/app/components/file-view/file-view.component.html index 3eb00b28ced..ebb5ce43695 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.html +++ b/demo-shell/src/app/components/file-view/file-view.component.html @@ -5,11 +5,21 @@ [versionId]="versionId" [showToolbar]="true" [allowRightSidebar]="true" - [showRightSidebar]="true" [sidebarRightTemplate]="sidebarRightTemplate"> + + + + + @@ -111,15 +121,3 @@ - - - - - diff --git a/demo-shell/src/app/components/file-view/file-view.component.scss b/demo-shell/src/app/components/file-view/file-view.component.scss deleted file mode 100644 index c2b9bd70c0f..00000000000 --- a/demo-shell/src/app/components/file-view/file-view.component.scss +++ /dev/null @@ -1,12 +0,0 @@ -.app-viewer__sidebar { - width: 380px !important; -} - -/* stylelint-disable */ -.monaco-scrollable-element { - width: 600px; -} - -app-preview-extension { - width: 600px; -} diff --git a/demo-shell/src/app/components/file-view/file-view.component.ts b/demo-shell/src/app/components/file-view/file-view.component.ts index 4e5c144c970..fbba5a72151 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.ts +++ b/demo-shell/src/app/components/file-view/file-view.component.ts @@ -24,7 +24,6 @@ import { PreviewService } from '../../services/preview.service'; @Component({ selector: 'app-file-view', templateUrl: './file-view.component.html', - styleUrls: ['./file-view.component.scss'], encapsulation: ViewEncapsulation.None }) export class FileViewComponent implements OnInit { From 8b0982929a00f261d43763e8246860fc484c19d0 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 19:19:54 +0100 Subject: [PATCH 13/23] [ci:force] rollback model changes --- e2e/models/ACS/created-by-model.ts | 5 ++++ e2e/models/ACS/file.model.ts | 38 ++++++++++++++++++++++++++++++ e2e/models/ACS/folder.model.ts | 14 +++++++++++ 3 files changed, 57 insertions(+) diff --git a/e2e/models/ACS/created-by-model.ts b/e2e/models/ACS/created-by-model.ts index 6113d8b6e68..32286addd43 100644 --- a/e2e/models/ACS/created-by-model.ts +++ b/e2e/models/ACS/created-by-model.ts @@ -28,4 +28,9 @@ export class CreatedByModel { getId() { return this.id; } + + getDisplayName() { + return this.displayName; + } + } diff --git a/e2e/models/ACS/file.model.ts b/e2e/models/ACS/file.model.ts index 7cfaca09b00..fe5572ea7bb 100644 --- a/e2e/models/ACS/file.model.ts +++ b/e2e/models/ACS/file.model.ts @@ -22,6 +22,7 @@ import { CreatedByModel } from './created-by-model'; import { StringUtil } from '@alfresco/adf-testing'; export class FileModel { + id = StringUtil.generateRandomString(); name = StringUtil.generateRandomString(); shortName = this.name; @@ -29,6 +30,7 @@ export class FileModel { 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; @@ -56,18 +58,54 @@ export class FileModel { 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), diff --git a/e2e/models/ACS/folder.model.ts b/e2e/models/ACS/folder.model.ts index c20b4f3ad46..7766f292786 100644 --- a/e2e/models/ACS/folder.model.ts +++ b/e2e/models/ACS/folder.model.ts @@ -18,6 +18,7 @@ import { StringUtil } from '@alfresco/adf-testing'; export class FolderModel { + id = StringUtil.generateRandomString(); name = StringUtil.generateRandomString(); shortName = this.name; @@ -33,7 +34,20 @@ export class FolderModel { return this.name; } + getShortName() { + return this.shortName; + } + + getTooltip() { + return this.tooltip; + } + getId() { return this.id; } + + getLocation() { + return this.location; + } + } From 928872961c70cfafa2f238965be0ef403d8ee3ac Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 19:24:18 +0100 Subject: [PATCH 14/23] [ci:force] remove site picker from content demo --- .../src/app/components/files/files.component.html | 5 ----- .../src/app/components/files/files.component.scss | 7 ------- .../src/app/components/files/files.component.ts | 12 +----------- .../search/search-filter-chips.component.html | 2 -- .../components/search/search-result.component.html | 2 -- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index d4776f42f45..fa801ad2b3a 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -1,9 +1,4 @@
-
- - -
-
diff --git a/demo-shell/src/app/components/files/files.component.scss b/demo-shell/src/app/components/files/files.component.scss index 3d85ae9c4d3..7c799a7502e 100644 --- a/demo-shell/src/app/components/files/files.component.scss +++ b/demo-shell/src/app/components/files/files.component.scss @@ -64,13 +64,6 @@ position: absolute; } -.app-site-container-style { - margin-top: 10px; - margin-bottom: 10px; - width: 100%; - min-width: 200px; -} - .app-content-service-settings { padding: 16px; } diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 1eefbba22df..60b981c8e5e 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -30,7 +30,7 @@ import { } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { ActivatedRoute, Params, Router } from '@angular/router'; -import { NodeEntry, NodePaging, Pagination, Node, SiteEntry, SearchEntry } from '@alfresco/js-api'; +import { NodeEntry, NodePaging, Pagination, Node, SearchEntry } from '@alfresco/js-api'; import { NotificationService, DataRow, @@ -98,12 +98,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { @Input() sortingMode: 'server' | 'client' = 'server'; - @Input() - showRecentFiles = true; - - @Input() - showSitePicker = true; - @Input() showSettingsPanel = true; @@ -418,10 +412,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { }); } - onSiteChange(site: SiteEntry) { - this.currentFolderId = site.entry.guid; - } - hasSelection(selection: Array): boolean { return selection && selection.length > 0; } diff --git a/demo-shell/src/app/components/search/search-filter-chips.component.html b/demo-shell/src/app/components/search/search-filter-chips.component.html index 2bb8461a9f3..9b5de08a00a 100644 --- a/demo-shell/src/app/components/search/search-filter-chips.component.html +++ b/demo-shell/src/app/components/search/search-filter-chips.component.html @@ -20,8 +20,6 @@ [showHeader]="showHeader" [sorting]="sorting" [sortingMode]="'server'" - [showRecentFiles]="false" - [showSitePicker]="false" [showSettingsPanel]="false" [currentFolderId]="null" [nodeResult]="$any(data)" diff --git a/demo-shell/src/app/components/search/search-result.component.html b/demo-shell/src/app/components/search/search-result.component.html index 19d32193cbb..3b036e75a71 100644 --- a/demo-shell/src/app/components/search/search-result.component.html +++ b/demo-shell/src/app/components/search/search-result.component.html @@ -18,8 +18,6 @@ [showHeader]="showHeader" [sorting]="sorting" [sortingMode]="'server'" - [showRecentFiles]="false" - [showSitePicker]="false" [showSettingsPanel]="false" [currentFolderId]="null" [nodeResult]="$any(data)" From c30f3acfa7d9e69405ae3dd1bc3913b2a72a63b4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 20:14:45 +0100 Subject: [PATCH 15/23] [ci:force] cleanup files demo shell component --- .../app/components/files/files.component.html | 41 ++------------- .../app/components/files/files.component.ts | 50 +------------------ .../sso-download-directive-component.e2e.ts | 27 ++++------ .../upload/uploader-component.e2e.ts | 21 +------- e2e/core/pages/content-services.page.ts | 17 ------- 5 files changed, 17 insertions(+), 139 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index fa801ad2b3a..c05ee60a551 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -9,7 +9,6 @@ [versioning]="versioning" [adf-check-allowable-operation]="'create'" [adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []" - (beginUpload)="onBeginUpload($event)" (updateFileVersion)="onUploadNewVersion($event)">
diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 60b981c8e5e..5f9a333580d 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -38,18 +38,14 @@ import { PaginationComponent, DisplayMode, ShowHeaderMode, - InfinitePaginationComponent, FormRenderingService } from '@alfresco/adf-core'; - import { ContentService, FolderCreatedEvent, UploadService, DocumentListComponent, PermissionStyleModel, - UploadFilesEvent, - ConfirmDialogComponent, ContentMetadataService, FilterSearch, DialogAspectListService, @@ -122,9 +118,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { @Input() maxSizeShow = false; - @Input() - showVersionComments = true; - @Input() versioning = false; @@ -194,14 +187,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { @ViewChild('standardPagination') standardPagination: PaginationComponent; - @ViewChild(InfinitePaginationComponent, { static: true }) - infinitePaginationComponent: InfinitePaginationComponent; - permissionsStyle: PermissionStyleModel[] = []; - infiniteScrolling: boolean; stickyHeader: boolean; - warnOnMultipleUploads = false; - thumbnails = false; enableMediumTimeFormat = false; displayEmptyMetadata = false; hyperlinkNavigation = false; @@ -227,11 +214,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { } } - toggleThumbnails() { - this.thumbnails = !this.thumbnails; - this.documentList.reload(); - } - ngOnInit() { if (!this.pagination) { this.pagination = { @@ -390,7 +372,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { onManageVersions(event: any) { const contentEntry = event.value.entry; - const showComments = this.showVersionComments; + const showComments = true; const allowDownload = this.allowVersionDownload; if (this.contentService.hasAllowableOperations(contentEntry, 'update')) { @@ -476,37 +458,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { this.turnedPreviousPage.emit(event); } - onInfiniteScrolling(): void { - this.infiniteScrolling = !this.infiniteScrolling; - this.infinitePaginationComponent.reset(); - } - - onBeginUpload(event: UploadFilesEvent) { - if (this.warnOnMultipleUploads && event) { - const files = event.files || []; - if (files.length > 1) { - event.pauseUpload(); - - const dialogRef = this.dialog.open(ConfirmDialogComponent, { - data: { - title: 'Upload', - message: `Are you sure you want to upload ${files.length} file(s)?` - }, - minWidth: '250px' - }); - - dialogRef.afterClosed().subscribe((result) => { - if (result === true) { - event.resumeUpload(); - } - }); - } - } - } - onUploadNewVersion(ev) { const contentEntry = ev.detail.data.node.entry; - const showComments = this.showVersionComments; + const showComments = true; const allowDownload = this.allowVersionDownload; const newFileVersion = ev.detail.files[0].file; diff --git a/e2e/content-services/directives/sso-download-directive-component.e2e.ts b/e2e/content-services/directives/sso-download-directive-component.e2e.ts index c8375cb478f..4774686cd46 100644 --- a/e2e/content-services/directives/sso-download-directive-component.e2e.ts +++ b/e2e/content-services/directives/sso-download-directive-component.e2e.ts @@ -18,7 +18,8 @@ import { ContentServicesPage } from '../../core/pages/content-services.page'; import { browser } from 'protractor'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; -import { createApiService, +import { + createApiService, FileBrowserUtil, IdentityService, LoginPage, @@ -33,7 +34,6 @@ 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(); @@ -74,9 +74,14 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id); pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id); - await settingsPage.setProviderEcmSso(browser.params.testConfig.appConfig.ecmHost, + 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.identityHost, + false, + true, + browser.params.testConfig.appConfig.oauth2.clientId + ); await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password); @@ -91,15 +96,13 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList await apiService.loginWithProfile('admin'); await uploadActions.deleteFileOrFolder(folder.entry.id); await identityService.deleteIdentityUser(acsUser.email); - } catch (error) { - } + } 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(); @@ -136,15 +139,5 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList await contentServicesPage.clickDownloadButton(); await FileBrowserUtil.isFileDownloaded('archive.zip'); }); - - it('[C291940] Should be able to view thumbnails when enabled', async () => { - await contentServicesPage.enableThumbnails(); - await contentServicesPage.checkAcsContainer(); - await contentListPage.waitForTableBody(); - const filePdfIconUrl = await contentServicesPage.getRowIconImageUrl(firstPdfFileModel.name); - await expect(filePdfIconUrl).toContain(`/versions/1/nodes/${pdfUploadedFile.entry.id}/renditions`); - const filePngIconUrl = await contentServicesPage.getRowIconImageUrl(pngFileModel.name); - await expect(filePngIconUrl).toContain(`/versions/1/nodes/${pngUploadedFile.entry.id}/renditions`); - }); }); }); diff --git a/e2e/content-services/upload/uploader-component.e2e.ts b/e2e/content-services/upload/uploader-component.e2e.ts index f61a66d915a..8cb8d80332e 100644 --- a/e2e/content-services/upload/uploader-component.e2e.ts +++ b/e2e/content-services/upload/uploader-component.e2e.ts @@ -17,14 +17,7 @@ import { browser, by, element } from 'protractor'; -import { createApiService, - DropActions, - LoginPage, - StringUtil, - UploadActions, - UserModel, - UsersActions -} from '@alfresco/adf-testing'; +import { createApiService, DropActions, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing'; import { ContentServicesPage } from '../../core/pages/content-services.page'; import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page'; import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.page'; @@ -32,7 +25,6 @@ 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(); @@ -93,8 +85,7 @@ describe('Upload component', () => { for (const node of nodeList) { try { await uploadActions.deleteFileOrFolder(node); - } catch (error) { - } + } catch (error) {} } }); @@ -226,14 +217,6 @@ describe('Upload component', () => { await uploadDialog.dialogIsNotDisplayed(); await contentServicesPage.checkContentIsDisplayed(fileWithSpecificSize.name); }); - - it('[C91318] Should Enable/Disable upload button when change the disable property', async () => { - await uploadToggles.clickCheckboxDisableUpload(); - await expect(await contentServicesPage.uploadButtonIsEnabled()).toBe(false, 'Upload button is enabled'); - - await uploadToggles.clickCheckboxDisableUpload(); - await expect(await contentServicesPage.uploadButtonIsEnabled()).toBe(true, 'Upload button not enabled'); - }); }); it('[C260171] Should upload only the extension filter allowed when Enable extension filter is enabled', async () => { diff --git a/e2e/core/pages/content-services.page.ts b/e2e/core/pages/content-services.page.ts index d4f42a89426..c519f050fa0 100644 --- a/e2e/core/pages/content-services.page.ts +++ b/e2e/core/pages/content-services.page.ts @@ -51,13 +51,11 @@ export class ContentServicesPage { createdByColumnHeader = 'createdByUser.displayName'; createdColumnHeader = 'createdAt'; deleteContentElement = $('button[data-automation-id="Delete"]'); - metadataAction = $('button[data-automation-id="Info"]'); versionManagerAction = $('button[data-automation-id="Manage versions"]'); downloadContent = $('button[data-automation-id="Download"]'); downloadButton = $('button[title="Download"]'); multiSelectToggle = $('[data-automation-id="multiSelectToggle"]'); selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]'); - siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`)); async isContextActionEnabled(actionName: string): Promise { const actionButton = $(`button[data-automation-id="context-${actionName}"`); @@ -256,21 +254,11 @@ export class ContentServicesPage { return this.uploadFileButton.isEnabled(); } - async enableInfiniteScrolling(): Promise { - const infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling')); - await BrowserActions.click(infiniteScrollButton); - } - async enableMediumTimeFormat(): Promise { const mediumTimeFormat = $('#enableMediumTimeFormat'); await BrowserActions.click(mediumTimeFormat); } - async enableThumbnails(): Promise { - const thumbnailSlide = $('#adf-thumbnails-upload-switch'); - await BrowserActions.click(thumbnailSlide); - } - async checkPaginationIsNotDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination); } @@ -324,11 +312,6 @@ export class ContentServicesPage { await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url); } - async getRowIconImageUrl(fileName: string): Promise { - const iconRow = $(`.app-document-list-container div.adf-datatable-cell[data-automation-id="${fileName}"] img`); - return BrowserActions.getAttribute(iconRow, 'src'); - } - async getAttributeValueForElement(elementName: string, propertyName: string): Promise { const elementSize = $( `.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span` From b9bad5f949f6687a7a7f4d5e4e9b442c84eb05b6 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 20:39:38 +0100 Subject: [PATCH 16/23] [ci:force] cleanup e2e and dead code --- .../app/components/files/files.component.html | 42 ++++--------------- .../app/components/files/files.component.ts | 12 ------ .../document-list-component.e2e.ts | 29 +------------ e2e/core/pages/content-services.page.ts | 21 +--------- e2e/core/pages/dialog/upload-toggles.page.ts | 5 --- .../lib/protractor/core/utils/form.util.ts | 14 ------- .../core/utils/local-storage.util.ts | 38 +++-------------- 7 files changed, 15 insertions(+), 146 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index c05ee60a551..0c29a253285 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -126,40 +126,26 @@ - - - - - + [sortable]="false"> + class="adf-expand-cell-5"> + class="adf-ellipsis-cell"> + class="adf-expand-cell-3">
@@ -178,7 +164,7 @@ key="lock" [focus]="false" [sortable]="false" - class="app-desktop-only adf-ellipsis-cell"> + class="adf-ellipsis-cell">
-
- - Show Name Column - -
- -
- - Hyperlink navigation - -
-
Multiselect (with checkboxes) diff --git a/demo-shell/src/app/components/files/files.component.ts b/demo-shell/src/app/components/files/files.component.ts index 5f9a333580d..8b3ad4810df 100644 --- a/demo-shell/src/app/components/files/files.component.ts +++ b/demo-shell/src/app/components/files/files.component.ts @@ -33,7 +33,6 @@ import { ActivatedRoute, Params, Router } from '@angular/router'; import { NodeEntry, NodePaging, Pagination, Node, SearchEntry } from '@alfresco/js-api'; import { NotificationService, - DataRow, UserPreferencesService, PaginationComponent, DisplayMode, @@ -142,9 +141,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { @Input() disableDragArea = false; - @Input() - showNameColumn = true; - @Input() searchTerm = ''; @@ -191,7 +187,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { stickyHeader: boolean; enableMediumTimeFormat = false; displayEmptyMetadata = false; - hyperlinkNavigation = false; constructor( private notificationService: NotificationService, @@ -408,13 +403,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy { return this.contentService.hasAllowableOperations(selection[0].entry, 'update'); } - getNodeNameTooltip(row: DataRow): string { - if (row) { - return row.getValue('name'); - } - return null; - } - canEditFolder(selection: Array): boolean { if (selection && selection.length === 1) { const entry = selection[0].entry; diff --git a/e2e/content-services/document-list/document-list-component.e2e.ts b/e2e/content-services/document-list/document-list-component.e2e.ts index e366fdb5002..971922a472d 100644 --- a/e2e/content-services/document-list/document-list-component.e2e.ts +++ b/e2e/content-services/document-list/document-list-component.e2e.ts @@ -17,7 +17,7 @@ import { ContentServicesPage } from '../../core/pages/content-services.page'; import { browser } from 'protractor'; -import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing'; +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'; @@ -345,31 +345,4 @@ describe('Document List Component', () => { await contentServicesPage.checkListIsSortedByNameColumn('asc'); }); }); - - describe('Column Template', () => { - const file0BytesModel = new FileModel({ - name: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_name, - location: browser.params.resources.Files.ADF_DOCUMENTS.TXT_0B.file_path - }); - - let file: NodeEntry; - const viewer = new ViewerPage(); - - beforeAll(async () => { - await apiService.loginWithProfile('admin'); - acsUser = await usersActions.createUser(); - await apiService.login(acsUser.username, acsUser.password); - file = await uploadActions.uploadFile(file0BytesModel.location, file0BytesModel.name, '-my-'); - - await loginPage.login(acsUser.username, acsUser.password); - await contentServicesPage.goToDocumentList(); - }); - - it('[C291843] Should be able to navigate using nodes hyperlink when activated', async () => { - await contentServicesPage.clickHyperlinkNavigationToggle(); - await contentServicesPage.checkFileHyperlinkIsEnabled(file.entry.name); - await contentServicesPage.clickFileHyperlink(file.entry.name); - await viewer.checkFileIsLoaded(); - }); - }); }); diff --git a/e2e/core/pages/content-services.page.ts b/e2e/core/pages/content-services.page.ts index c519f050fa0..a8d3425ed2f 100644 --- a/e2e/core/pages/content-services.page.ts +++ b/e2e/core/pages/content-services.page.ts @@ -16,7 +16,7 @@ */ import { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger } from '@alfresco/adf-testing'; -import { $$, browser, by, element, protractor, $ } from 'protractor'; +import { $$, browser, protractor, $ } from 'protractor'; import { FolderDialogPage } from './dialog/folder-dialog.page'; import { NavigationBarPage } from './navigation-bar.page'; import * as path from 'path'; @@ -78,21 +78,6 @@ export class ContentServicesPage { await BrowserActions.click(this.versionManagerAction); } - async clickFileHyperlink(fileName: string): Promise { - const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName); - await BrowserActions.click(hyperlink); - } - - async checkFileHyperlinkIsEnabled(fileName: string): Promise { - const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName); - await BrowserVisibility.waitUntilElementIsVisible(hyperlink); - } - - async clickHyperlinkNavigationToggle(): Promise { - const hyperlinkToggle = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation')); - await BrowserActions.click(hyperlinkToggle); - } - async getElementsDisplayedId() { return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId); } @@ -250,10 +235,6 @@ export class ContentServicesPage { await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton); } - async uploadButtonIsEnabled(): Promise { - return this.uploadFileButton.isEnabled(); - } - async enableMediumTimeFormat(): Promise { const mediumTimeFormat = $('#enableMediumTimeFormat'); await BrowserActions.click(mediumTimeFormat); diff --git a/e2e/core/pages/dialog/upload-toggles.page.ts b/e2e/core/pages/dialog/upload-toggles.page.ts index 7a7e52ffcd8..b4916c6928c 100644 --- a/e2e/core/pages/dialog/upload-toggles.page.ts +++ b/e2e/core/pages/dialog/upload-toggles.page.ts @@ -27,7 +27,6 @@ export class UploadTogglesPage { versioningToggle = $('#adf-version-upload-switch'); extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]'); maxSizeField = $('input[data-automation-id="max-files-size"]'); - disableUploadCheckbox = $('[id="adf-disable-upload"]'); async enableMultipleFileUpload(): Promise { await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle); @@ -79,10 +78,6 @@ export class UploadTogglesPage { await this.togglePage.disableToggle(this.versioningToggle); } - async clickCheckboxDisableUpload(): Promise { - await BrowserActions.click(this.disableUploadCheckbox); - } - async addExtension(extension: string): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField); await this.extensionAcceptedField.sendKeys(',' + extension); diff --git a/lib/testing/src/lib/protractor/core/utils/form.util.ts b/lib/testing/src/lib/protractor/core/utils/form.util.ts index 137f72c85f9..2cf29ff71df 100644 --- a/lib/testing/src/lib/protractor/core/utils/form.util.ts +++ b/lib/testing/src/lib/protractor/core/utils/form.util.ts @@ -15,12 +15,10 @@ * limitations under the License. */ -import { browser } from 'protractor'; import { ApiService } from '../../../shared/api/api.service'; import { FormModelsApi, FormRepresentation } from '@alfresco/js-api'; export class FormUtil { - api: ApiService; editorApi: FormModelsApi; @@ -31,18 +29,6 @@ export class FormUtil { } } - static async setForm(value: string): Promise { - await browser.executeScript( - 'window.adf.setFormInEditor(`' + value + '`);' - ); - } - - static async setCloudForm(value: string): Promise { - await browser.executeScript( - 'window.adf.setCloudFormInEditor(`' + value + '`);' - ); - } - async getFormByName(name: string): Promise { const forms: any = await this.editorApi.getForms(undefined); diff --git a/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts b/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts index ea42556638b..5f92a0e497a 100644 --- a/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts +++ b/lib/testing/src/lib/protractor/core/utils/local-storage.util.ts @@ -18,53 +18,27 @@ import { browser } from 'protractor'; export class LocalStorageUtil { - static async getConfigField(field: string): Promise { - return browser.executeScript( - 'return window.adf ? window.adf.getConfigField(`' + field + '`) : null;' - ); + return browser.executeScript('return window.adf ? window.adf.getConfigField(`' + field + '`) : null;'); } static async setConfigField(field: string, value: string): Promise { - await browser.executeScript( - 'window.adf.setConfigField(`' + field + '`, `' + value + '`);' - ); + await browser.executeScript('window.adf.setConfigField(`' + field + '`, `' + value + '`);'); } static async setStorageItem(field: string, value: string): Promise { - await browser.executeScript( - 'window.adf.setStorageItem(`' + field + '`, `' + value + '`);' - ); - } - - static async removeStorageItem(field: string): Promise { - await browser.executeScript( - 'window.adf.removeStorageItem(`' + field + '`);' - ); - } - - static async getStorageItem(field: string): Promise { - return browser.executeScript( - 'return window.adf ? window.adf.getStorageItem(`' + field + '`) : null;' - ); + await browser.executeScript('window.adf.setStorageItem(`' + field + '`, `' + value + '`);'); } static async setUserPreference(field: string, value: any): Promise { - await browser.executeScript( - 'window.adf.setUserPreference(`' + field + '`, `' + value + '`);' - ); + await browser.executeScript('window.adf.setUserPreference(`' + field + '`, `' + value + '`);'); } static async clearStorage(): Promise { - await browser.executeScript( - 'window.adf.clearStorage();' - ); + await browser.executeScript('window.adf.clearStorage();'); } static async apiReset(): Promise { - await browser.executeScript( - `window.adf.apiReset();` - ); + await browser.executeScript(`window.adf.apiReset();`); } - } From f02eef6be5a914f7eed2556ed1f63f09b91f3b23 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 20:41:44 +0100 Subject: [PATCH 17/23] [ci:force] cleanup dead code --- e2e/core/pages/infinite-pagination.page.ts | 41 --------------- e2e/process-services/pages/analytics.page.ts | 54 -------------------- 2 files changed, 95 deletions(-) delete mode 100644 e2e/core/pages/infinite-pagination.page.ts delete mode 100644 e2e/process-services/pages/analytics.page.ts diff --git a/e2e/core/pages/infinite-pagination.page.ts b/e2e/core/pages/infinite-pagination.page.ts deleted file mode 100644 index 0225f96c95d..00000000000 --- a/e2e/core/pages/infinite-pagination.page.ts +++ /dev/null @@ -1,41 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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 { ElementFinder, $, $$ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; - -export class InfinitePaginationPage { - - rootElement: ElementFinder; - loadMoreButton: ElementFinder; - loading = $('[data-automation-id="adf-infinite-pagination-spinner"]'); - - constructor(rootElement = $$('adf-infinite-pagination').first()) { - this.rootElement = rootElement; - this.loadMoreButton = this.rootElement.$('button[data-automation-id="adf-infinite-pagination-button"]'); - } - - async clickLoadMoreButton(): Promise { - await BrowserActions.click(this.loadMoreButton); - await BrowserVisibility.waitUntilElementIsNotVisible(this.loading); - } - - async checkLoadMoreButtonIsNotDisplayed(): Promise { - await BrowserVisibility.waitUntilElementIsNotVisible(this.loadMoreButton); - } - -} diff --git a/e2e/process-services/pages/analytics.page.ts b/e2e/process-services/pages/analytics.page.ts deleted file mode 100644 index c77d2af0c87..00000000000 --- a/e2e/process-services/pages/analytics.page.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * @license - * Copyright © 2005-2023 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, protractor, $ } from 'protractor'; -import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing'; - -export class AnalyticsPage { - - toolbarTitleInput = $('input[data-automation-id="reportName"]'); - toolbarTitleContainer = $('adf-toolbar-title'); - toolbarTitle = element(by.xpath('//mat-toolbar/adf-toolbar-title/div/h4')); - reportMessage = $('div[class="ng-star-inserted"] span'); - - async getReport(title: string): Promise { - const reportTitle = $(`mat-icon[data-automation-id="${title}_filter"]`); - await BrowserActions.click(reportTitle); - } - - async changeReportTitle(title): Promise { - await BrowserActions.click(this.toolbarTitleContainer); - await BrowserActions.click(this.toolbarTitleInput); - await this.clearReportTitle(); - await this.toolbarTitleInput.sendKeys(title); - await this.toolbarTitleInput.sendKeys(protractor.Key.ENTER); - } - - async clearReportTitle(): Promise { - await BrowserActions.clearSendKeys(this.toolbarTitleInput, ''); - await BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput); - } - - async getReportTitle(): Promise { - return BrowserActions.getText(this.toolbarTitle); - } - - async checkNoReportMessage(): Promise { - await BrowserVisibility.waitUntilElementIsVisible(this.reportMessage); - } - -} From dfb319201942fd7081cdf05b0d3c81de257c0c88 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 21:14:25 +0100 Subject: [PATCH 18/23] [ci:force] fix linting --- .../directives/sso-download-directive-component.e2e.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/e2e/content-services/directives/sso-download-directive-component.e2e.ts b/e2e/content-services/directives/sso-download-directive-component.e2e.ts index 4774686cd46..ccaa457ab92 100644 --- a/e2e/content-services/directives/sso-download-directive-component.e2e.ts +++ b/e2e/content-services/directives/sso-download-directive-component.e2e.ts @@ -56,8 +56,6 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path }); - let pdfUploadedFile: NodeEntry; - let pngUploadedFile: NodeEntry; let folder: NodeEntry; let acsUser: UserModel; const folderName = StringUtil.generateRandomString(5); @@ -71,8 +69,8 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList folder = await uploadActions.createFolder(folderName, '-my-'); - pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id); - pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id); + 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, From d623bc6f8df6821ab805eee7484850af650290a1 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 21:23:38 +0100 Subject: [PATCH 19/23] [ci:force] standalone home component --- demo-shell/src/app/app.module.ts | 2 -- demo-shell/src/app/components/home/home.component.html | 2 -- demo-shell/src/app/components/home/home.component.ts | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 787e8869394..d911d172ddf 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -28,7 +28,6 @@ import { AppComponent } from './app.component'; import { MaterialModule } from './material.module'; import { LogoutComponent } from './components/logout/logout.component'; import { AppLayoutComponent } from './components/app-layout/app-layout.component'; -import { HomeComponent } from './components/home/home.component'; import { SearchBarComponent } from './components/search/search-bar.component'; import { SearchResultComponent } from './components/search/search-result.component'; import { FormComponent } from './components/form/form.component'; @@ -95,7 +94,6 @@ import { UserInfoComponent } from './components/app-layout/user-info/user-info.c LogoutComponent, AppLayoutComponent, UserInfoComponent, - HomeComponent, SearchBarComponent, SearchResultComponent, ProcessServiceComponent, diff --git a/demo-shell/src/app/components/home/home.component.html b/demo-shell/src/app/components/home/home.component.html index c94433b2b79..d8f542b749a 100644 --- a/demo-shell/src/app/components/home/home.component.html +++ b/demo-shell/src/app/components/home/home.component.html @@ -3,6 +3,4 @@

ADF

Angular components for Alfresco

- -
Documentation
diff --git a/demo-shell/src/app/components/home/home.component.ts b/demo-shell/src/app/components/home/home.component.ts index 1dd40f00480..f43dbf845bc 100644 --- a/demo-shell/src/app/components/home/home.component.ts +++ b/demo-shell/src/app/components/home/home.component.ts @@ -18,6 +18,7 @@ import { Component, ViewEncapsulation } from '@angular/core'; @Component({ + standalone: true, selector: 'app-home-view', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], From 3996f2c1db87f36d74418a9c388221eb6254c26b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 21:42:43 +0100 Subject: [PATCH 20/23] [ci:force] cleanup demo shell app layout --- demo-shell/src/app/app.component.scss | 4 ---- .../app-layout/app-layout.component.html | 8 +++---- .../app-layout/app-layout.component.scss | 22 ------------------- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/demo-shell/src/app/app.component.scss b/demo-shell/src/app/app.component.scss index 126f79efe93..76701d62c91 100644 --- a/demo-shell/src/app/app.component.scss +++ b/demo-shell/src/app/app.component.scss @@ -11,7 +11,3 @@ router-outlet[name='overlay'] + * { height: 100%; width: 100%; } - -[dir='rtl'] .mat-icon { - transform: scale(-1, 1); -} diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.html b/demo-shell/src/app/components/app-layout/app-layout.component.html index 9f2303604a5..325756cc0ce 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.html +++ b/demo-shell/src/app/components/app-layout/app-layout.component.html @@ -23,13 +23,13 @@ - + {{link.icon}} - {{link.title | translate }} + {{link.title | translate }} arrow_right @@ -41,14 +41,14 @@ routerLinkActive="app-sidenav-link--active" [routerLinkActiveOptions]="{ exact: true }" [attr.data-automation-id]="link.title | translate" class="app-sidenav-link"> {{link.icon}} - {{link.title | translate }} + {{link.title | translate }} exit_to_app - Logout + Logout diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.scss b/demo-shell/src/app/components/app-layout/app-layout.component.scss index 999b399ca67..6bccce0418c 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.scss +++ b/demo-shell/src/app/components/app-layout/app-layout.component.scss @@ -1,7 +1,3 @@ -adf-file-uploading-dialog { - z-index: 1100; -} - .app-layout { display: flex; flex: 1; @@ -12,25 +8,7 @@ adf-file-uploading-dialog { color: var(--theme-primary-color); } - .app-sidenav-link { - .mat-list-text { - font-size: 14px; - white-space: nowrap; - min-width: 120px; - padding: 0 10px; - } - } - &-menu-spacer { flex: 1 1 auto; } } - -mat-sidenav-content > div { - display: flex; - height: 100%; - - > div { - flex: auto; - } -} From dc547543449ce471d36563e47efffe848675ec21 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 21:45:45 +0100 Subject: [PATCH 21/23] [ci:force] cleanup css --- .../app/components/files/files.component.scss | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/demo-shell/src/app/components/files/files.component.scss b/demo-shell/src/app/components/files/files.component.scss index 7c799a7502e..90080aa61bb 100644 --- a/demo-shell/src/app/components/files/files.component.scss +++ b/demo-shell/src/app/components/files/files.component.scss @@ -2,16 +2,6 @@ margin: 10px !important; } -@media screen and (max-width: 599px) { - .app-container { - margin: 0; - } - - .app-show-versions-button.mat-icon-button { - display: none; - } -} - .app-error-message { text-align: left; } @@ -37,18 +27,6 @@ .app-document-action-buttons { flex: 0 0 auto; } - - @media screen and (max-width: 600px) { - adf-breadcrumb, .app-document-action-buttons { - display: none; - } - } - - @media screen and (min-width: 600px) { - adf-dropdown-breadcrumb, .app-toolbar-divider-before-more-menu, .app-toolbar-more-menu-button { - display: none; - } - } } &:not(.app-document-list-container-in-upload-drag-area) { From d51354fdcb5a13b46847a2bc1942473d5fe0512d Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Tue, 24 Oct 2023 21:52:34 +0100 Subject: [PATCH 22/23] [ci:force] cleanup demo shell logout --- .../src/app/components/logout/logout.component.html | 10 +++------- .../src/app/components/logout/logout.component.scss | 10 +--------- e2e/core/pages/navigation-bar.page.ts | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/demo-shell/src/app/components/logout/logout.component.html b/demo-shell/src/app/components/logout/logout.component.html index 71b22c099c6..384db29bf92 100644 --- a/demo-shell/src/app/components/logout/logout.component.html +++ b/demo-shell/src/app/components/logout/logout.component.html @@ -1,15 +1,11 @@ -
+

Logout Page

You are now logged out

- -
- Home -
+ Login + Home
diff --git a/demo-shell/src/app/components/logout/logout.component.scss b/demo-shell/src/app/components/logout/logout.component.scss index b1d677177f2..be914c1c72d 100644 --- a/demo-shell/src/app/components/logout/logout.component.scss +++ b/demo-shell/src/app/components/logout/logout.component.scss @@ -4,10 +4,6 @@ align-items: center; } -.app-logout-header-background { - overflow: hidden; -} - .app-logout-section { text-align: center; padding-top: 60px; @@ -24,9 +20,5 @@ } .app-logout-docs-button { - margin: 30px; -} - -.app-logout-login { - float: left; + margin: 8px; } diff --git a/e2e/core/pages/navigation-bar.page.ts b/e2e/core/pages/navigation-bar.page.ts index e0876a21d16..e19839442b9 100644 --- a/e2e/core/pages/navigation-bar.page.ts +++ b/e2e/core/pages/navigation-bar.page.ts @@ -24,7 +24,7 @@ export class NavigationBarPage { 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 = $('div[data-automation-id="adf-logout-section"]'); + logoutSection = $('[data-automation-id="adf-logout-section"]'); personalFiles = $('div [title="Personal Files"]'); getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`); From 54138690b62a131121714e029b3d979cb3ded6cd Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 27 Oct 2023 09:51:59 -0400 Subject: [PATCH 23/23] Update demo-shell/src/app/components/app-layout/app-layout.component.html Co-authored-by: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com> --- .../src/app/components/app-layout/app-layout.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.html b/demo-shell/src/app/components/app-layout/app-layout.component.html index 325756cc0ce..30b7d1de977 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.html +++ b/demo-shell/src/app/components/app-layout/app-layout.component.html @@ -29,7 +29,7 @@ {{link.icon}} - {{link.title | translate }} + {{ link.title | translate }} arrow_right