Protractor cleanup for demo shell (#9019)

* [ci:force] cleanup protractor tests

* [ci:force] cleanup insights test

* [ci:force] cleanup dead demo shell e2e

* [ci:force] cleanup e2e

* [ci:force] cleanup e2e

* cleanup files component

* [ci:force] cleanup e2e

* [ci:force] remove user info SSO protractor e2e

* [ci:force] remove viewer e2e already covered by other tests

* [ci:force] remove custom font from demo shell

* [ci:force] demo shell viewer cleanup

* [ci:force] cleanup viewer in demo shell

* [ci:force] rollback model changes

* [ci:force] remove site picker from content demo

* [ci:force] cleanup files demo shell component

* [ci:force] cleanup e2e and dead code

* [ci:force] cleanup dead code

* [ci:force] fix linting

* [ci:force] standalone home component

* [ci:force] cleanup demo shell app layout

* [ci:force] cleanup css

* [ci:force] cleanup demo shell logout

* 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>

---------

Co-authored-by: Mykyta Maliarchuk <84377976+nikita-web-ua@users.noreply.github.com>
This commit is contained in:
Denys Vuika
2023-10-27 16:56:53 +01:00
committed by GitHub
parent 1f94c592da
commit 620911cf70
70 changed files with 102 additions and 3343 deletions

View File

@@ -108,7 +108,6 @@
} }
], ],
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -306,7 +305,6 @@
"configDir": "lib/core/.storybook", "configDir": "lib/core/.storybook",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -332,7 +330,6 @@
"outputDir": "dist/storybook/core", "outputDir": "dist/storybook/core",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -454,7 +451,6 @@
"configDir": "lib/content-services/.storybook", "configDir": "lib/content-services/.storybook",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -480,7 +476,6 @@
"outputDir": "dist/storybook/content-services", "outputDir": "dist/storybook/content-services",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -648,7 +643,6 @@
"configDir": "lib/process-services-cloud/.storybook", "configDir": "lib/process-services-cloud/.storybook",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -674,7 +668,6 @@
"outputDir": "dist/storybook/process-services-cloud", "outputDir": "dist/storybook/process-services-cloud",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -1117,7 +1110,6 @@
] ]
}, },
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",
@@ -1138,7 +1130,6 @@
"outputDir": "dist/storybook/stories", "outputDir": "dist/storybook/stories",
"compodoc": false, "compodoc": false,
"styles": [ "styles": [
"demo-shell/src/assets/fonts/muli/muli.css",
"demo-shell/src/styles.scss", "demo-shell/src/styles.scss",
"demo-shell/src/custom-style-dev.scss", "demo-shell/src/custom-style-dev.scss",
"node_modules/cropperjs/dist/cropper.min.css", "node_modules/cropperjs/dist/cropper.min.css",

View File

@@ -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();
});
});

View File

@@ -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'));
}
}

View File

@@ -1,9 +0,0 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": ["jasmine", "jasminewd2", "node"]
}
}

View File

@@ -11,7 +11,3 @@ router-outlet[name='overlay'] + * {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
[dir='rtl'] .mat-icon {
transform: scale(-1, 1);
}

View File

@@ -22,20 +22,12 @@ import { NgChartsModule } from 'ng2-charts';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { import { AppConfigService, DebugAppConfigService, CoreModule, CoreAutomationService, AuthModule, provideTranslations } from '@alfresco/adf-core';
AppConfigService,
DebugAppConfigService,
CoreModule,
CoreAutomationService,
AuthModule,
provideTranslations
} from '@alfresco/adf-core';
import { ExtensionsModule } from '@alfresco/adf-extensions'; import { ExtensionsModule } from '@alfresco/adf-extensions';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { MaterialModule } from './material.module'; import { MaterialModule } from './material.module';
import { LogoutComponent } from './components/logout/logout.component'; import { LogoutComponent } from './components/logout/logout.component';
import { AppLayoutComponent } from './components/app-layout/app-layout.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 { SearchBarComponent } from './components/search/search-bar.component';
import { SearchResultComponent } from './components/search/search-result.component'; import { SearchResultComponent } from './components/search/search-result.component';
import { FormComponent } from './components/form/form.component'; import { FormComponent } from './components/form/form.component';
@@ -46,7 +38,6 @@ import { FormNodeViewerComponent } from './components/process-service/form-node-
import { AppsViewComponent } from './components/process-service/apps-view.component'; import { AppsViewComponent } from './components/process-service/apps-view.component';
import { FilesComponent } from './components/files/files.component'; import { FilesComponent } from './components/files/files.component';
import { VersionManagerDialogAdapterComponent } from './components/files/version-manager-dialog-adapter.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 { appRoutes } from './app.routes';
import { TaskAttachmentsComponent } from './components/process-service/task-attachments.component'; import { TaskAttachmentsComponent } from './components/process-service/task-attachments.component';
import { ProcessAttachmentsComponent } from './components/process-service/process-attachments.component'; import { ProcessAttachmentsComponent } from './components/process-service/process-attachments.component';
@@ -103,7 +94,6 @@ import { UserInfoComponent } from './components/app-layout/user-info/user-info.c
LogoutComponent, LogoutComponent,
AppLayoutComponent, AppLayoutComponent,
UserInfoComponent, UserInfoComponent,
HomeComponent,
SearchBarComponent, SearchBarComponent,
SearchResultComponent, SearchResultComponent,
ProcessServiceComponent, ProcessServiceComponent,
@@ -114,7 +104,6 @@ import { UserInfoComponent } from './components/app-layout/user-info/user-info.c
FilesComponent, FilesComponent,
FormComponent, FormComponent,
VersionManagerDialogAdapterComponent, VersionManagerDialogAdapterComponent,
MetadataDialogAdapterComponent,
TaskAttachmentsComponent, TaskAttachmentsComponent,
ProcessAttachmentsComponent, ProcessAttachmentsComponent,
DemoPermissionComponent, DemoPermissionComponent,

View File

@@ -23,13 +23,13 @@
</adf-sidenav-layout-header> </adf-sidenav-layout-header>
<adf-sidenav-layout-navigation> <adf-sidenav-layout-navigation>
<ng-template let-isMenuMinimized="isMenuMinimized"> <ng-template>
<mat-nav-list class="app-sidenav-linklist"> <mat-nav-list class="app-sidenav-linklist">
<ng-container *ngFor="let link of links"> <ng-container *ngFor="let link of links">
<ng-container *ngIf="link.children"> <ng-container *ngIf="link.children">
<mat-list-item (click)="trigger.openMenu()" [attr.data-automation-id]="link.title | translate" class="app-sidenav-link"> <mat-list-item (click)="trigger.openMenu()" [attr.data-automation-id]="link.title | translate" class="app-sidenav-link">
<mat-icon matListIcon>{{link.icon}}</mat-icon> <mat-icon matListIcon>{{link.icon}}</mat-icon>
<span matLine *ngIf="!isMenuMinimized()">{{link.title | translate }}</span> <span matLine>{{ link.title | translate }}</span>
<mat-icon class="app-sidenav-link__expand-button" [matMenuTriggerData]="{links: link.children}" <mat-icon class="app-sidenav-link__expand-button" [matMenuTriggerData]="{links: link.children}"
rippleTrigger mat-icon-button #trigger="matMenuTrigger" rippleTrigger mat-icon-button #trigger="matMenuTrigger"
[matMenuTriggerFor]="nestedMenu">arrow_right</mat-icon> [matMenuTriggerFor]="nestedMenu">arrow_right</mat-icon>
@@ -41,14 +41,14 @@
routerLinkActive="app-sidenav-link--active" [routerLinkActiveOptions]="{ exact: true }" routerLinkActive="app-sidenav-link--active" [routerLinkActiveOptions]="{ exact: true }"
[attr.data-automation-id]="link.title | translate" class="app-sidenav-link"> [attr.data-automation-id]="link.title | translate" class="app-sidenav-link">
<mat-icon matListIcon >{{link.icon}}</mat-icon> <mat-icon matListIcon >{{link.icon}}</mat-icon>
<span matLine *ngIf="!isMenuMinimized()">{{link.title | translate }}</span> <span matLine>{{link.title | translate }}</span>
</mat-list-item> </mat-list-item>
</ng-container> </ng-container>
</ng-container> </ng-container>
<mat-list-item adf-logout [enableRedirect]="enableRedirect" redirectUri="/logout" class="app-sidenav-link" data-automation-id="Logout" > <mat-list-item adf-logout [enableRedirect]="enableRedirect" redirectUri="/logout" class="app-sidenav-link" data-automation-id="Logout" >
<mat-icon matListIcon>exit_to_app</mat-icon> <mat-icon matListIcon>exit_to_app</mat-icon>
<span matLine *ngIf="!isMenuMinimized()">Logout</span> <span matLine>Logout</span>
</mat-list-item> </mat-list-item>
</mat-nav-list> </mat-nav-list>

View File

@@ -1,7 +1,3 @@
adf-file-uploading-dialog {
z-index: 1100;
}
.app-layout { .app-layout {
display: flex; display: flex;
flex: 1; flex: 1;
@@ -12,25 +8,7 @@ adf-file-uploading-dialog {
color: var(--theme-primary-color); 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 { &-menu-spacer {
flex: 1 1 auto; flex: 1 1 auto;
} }
} }
mat-sidenav-content > div {
display: flex;
height: 100%;
> div {
flex: auto;
}
}

View File

@@ -1,71 +1,24 @@
<ng-container *ngIf="nodeId"> <ng-container *ngIf="nodeId">
<adf-alfresco-viewer <adf-alfresco-viewer
(showViewerChange)="onViewerClosed()" (showViewerChange)="onViewerClosed()"
[nodeId]="nodeId" [nodeId]="nodeId"
[versionId]="versionId" [versionId]="versionId"
[showRightSidebar]="showRightSidebar" [showToolbar]="true"
[showLeftSidebar]="showLeftSidebar" [allowRightSidebar]="true"
[allowGoBack]="allowGoBack"
[showToolbar]="showToolbar"
[allowPrint]="allowPrint"
[allowDownload]="allowDownload"
[allowRightSidebar]="allowRightSidebar"
[allowLeftSidebar]="allowLeftSidebar"
[sidebarLeftTemplate]="sidebarLeftTemplate"
[sidebarRightTemplate]="sidebarRightTemplate"> [sidebarRightTemplate]="sidebarRightTemplate">
<adf-viewer-toolbar *ngIf="customToolbar" data-automation-id="adf-viewer-custom-toolbar">
<h1>My custom toolbar</h1>
</adf-viewer-toolbar>
<adf-viewer-toolbar-actions *ngIf="moreActions">
<button mat-icon-button id="adf-viewer-time">
<mat-icon>alarm</mat-icon>
</button>
<button mat-icon-button id="adf-viewer-upload">
<mat-icon>backup</mat-icon>
</button>
<button mat-icon-button id="adf-viewer-bug">
<mat-icon>bug_report</mat-icon>
</button>
</adf-viewer-toolbar-actions>
<adf-viewer-more-actions *ngIf="moreActionsMenu">
<button mat-menu-item id="adf-viewer-more-menu-alarm">
<mat-icon>alarm</mat-icon>
<span>Alarm</span>
</button>
<button mat-menu-item id="adf-viewer-more-menu-backup">
<mat-icon>backup</mat-icon>
<span>Backup</span>
</button>
<button mat-menu-item id="adf-viewer-more-menu-bug">
<mat-icon>bug_report</mat-icon>
<span>Bug report</span>
</button>
</adf-viewer-more-actions>
<ng-container *ngIf="openWith">
<adf-viewer-open-with>
<button mat-menu-item>
<mat-icon>dialpad</mat-icon>
<span>Option 1</span>
</button>
<button mat-menu-item disabled>
<mat-icon>voicemail</mat-icon>
<span>Option 2</span>
</button>
<button mat-menu-item>
<mat-icon>notifications_off</mat-icon>
<span>Option 3</span>
</button>
</adf-viewer-open-with>
</ng-container>
</adf-alfresco-viewer> </adf-alfresco-viewer>
</ng-container> </ng-container>
<ng-container *ngIf="blobFile">
<adf-viewer
[blobFile]="blobFile"
[fileName]="fileName"
[showToolbar]="true"
[allowRightSidebar]="true"
(showViewerChange)="onViewerClosed()"
[sidebarRightTemplate]="sidebarRightTemplate">
</adf-viewer>
</ng-container>
<ng-template let-node="node" #sidebarRightTemplate> <ng-template let-node="node" #sidebarRightTemplate>
<adf-info-drawer title="Details"> <adf-info-drawer title="Details">
@@ -168,231 +121,3 @@
</adf-info-drawer-tab> </adf-info-drawer-tab>
</adf-info-drawer> </adf-info-drawer>
</ng-template> </ng-template>
<ng-template #sidebarLeftTemplate>
<adf-info-drawer [title]="'Viewer Options'">
<adf-info-drawer-tab label="Settings">
<p class="toggle">
<mat-slide-toggle
id="adf-switch-fileurl"
(change)="toggleFileUrl()"
[checked]="fileUrlSwitch">
Url File
</mat-slide-toggle>
</p>
<p class="toggle">
<ng-container *ngIf="fileUrlSwitch">
<mat-form-field floatPlaceholder="float">
<input matInput
placeholder="Url File"
[(ngModel)]="urlFile"
data-automation-id="adf-text-file-url">
</mat-form-field>
</ng-container>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-toolbar"
(change)="toggleShowToolbar()"
[checked]="showToolbar">
Show Toolbar
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-goback"
(change)="toggleAllowGoBack()"
[checked]="allowGoBack">
Allow GoBack
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-openwith"
(change)="toggleOpenWith()"
[checked]="openWith">
Open With
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-moreactions"
(change)="toggleOpenMoreActions()"
[checked]="moreActions">
More Actions
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-moreactionsmenu"
(change)="toggleMoreActionsMenu()"
[checked]="moreActionsMenu">
More Actions Menu
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-download"
(change)="toggleAllowDownload()"
[checked]="allowDownload">
Allow Download
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-print"
(change)="toggleAllowPrint()"
[checked]="allowPrint">
Allow Print
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-allowsidebar"
(change)="toggleAllowRightSidebar()"
[checked]="allowRightSidebar">
Allow Right Sidebar
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-switch-allowLeftSidebar"
(change)="toggleAllowLeftSidebar()"
[checked]="allowLeftSidebar">
Allow Left Sidebar
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-toggle-custom-toolbar"
(change)="toggleToolbar()"
[checked]="customToolbar">
Custom Toolbar
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-tab-with-icon"
(change)="toggleShowTabWithIcon()"
[checked]="showTabWithIcon">
Show tab with icon
</mat-slide-toggle>
</p>
<p class="toggle">
<mat-slide-toggle
id="adf-icon-and-label-tab"
(change)="toggleShowTabWithIconAndLabel()"
[checked]="showTabWithIconAndLabel">
Show tab with icon and label
</mat-slide-toggle>
</p>
<p class="toggle">
<button mat-raised-button id="adf-switch-showrightsidebar" (click)="toggleShowRightSidebar()">
Toggle Right Sidebar
</button>
</p>
<p class="toggle">
<button mat-raised-button id="adf-switch-showleftsidebar" (click)="hideLeftSidebar()">
Hide Left Sidebar
</button>
</p>
</adf-info-drawer-tab>
<adf-info-drawer-tab
*ngIf="showTabWithIcon"
[label]=""
[icon]="'face'"
data-automation-id="adf-settings-tab">
</adf-info-drawer-tab>
<adf-info-drawer-tab
*ngIf="showTabWithIconAndLabel"
[label]="'Comments'"
[icon]="'comment'"
data-automation-id="adf-settings-tab">
</adf-info-drawer-tab>
</adf-info-drawer>
</ng-template>
<ng-container *ngIf="blobFile">
<adf-viewer
[blobFile]="blobFile"
[fileName]="fileName"
[showRightSidebar]="showRightSidebar"
[showLeftSidebar]="showLeftSidebar"
[allowGoBack]="allowGoBack"
[showToolbar]="showToolbar"
[allowRightSidebar]="allowRightSidebar"
[allowLeftSidebar]="allowLeftSidebar"
(showViewerChange)="onViewerClosed()"
[sidebarLeftTemplate]="sidebarLeftTemplate"
[sidebarRightTemplate]="sidebarRightTemplate">
<adf-viewer-toolbar *ngIf="customToolbar" data-automation-id="adf-viewer-custom-toolbar">
<h1>My custom toolbar</h1>
</adf-viewer-toolbar>
<adf-viewer-toolbar-actions *ngIf="moreActions">
<button mat-icon-button id="adf-viewer-time">
<mat-icon>alarm</mat-icon>
</button>
<button mat-icon-button id="adf-viewer-upload">
<mat-icon>backup</mat-icon>
</button>
<button mat-icon-button id="adf-viewer-bug">
<mat-icon>bug_report</mat-icon>
</button>
</adf-viewer-toolbar-actions>
<adf-viewer-more-actions *ngIf="moreActionsMenu">
<button mat-menu-item id="adf-viewer-more-menu-alarm">
<mat-icon>alarm</mat-icon>
<span>Alarm</span>
</button>
<button mat-menu-item id="adf-viewer-more-menu-backup">
<mat-icon>backup</mat-icon>
<span>Backup</span>
</button>
<button mat-menu-item id="adf-viewer-more-menu-bug">
<mat-icon>bug_report</mat-icon>
<span>Bug report</span>
</button>
</adf-viewer-more-actions>
<ng-container *ngIf="openWith">
<adf-viewer-open-with>
<button mat-menu-item>
<mat-icon>dialpad</mat-icon>
<span>Option 1</span>
</button>
<button mat-menu-item disabled>
<mat-icon>voicemail</mat-icon>
<span>Option 2</span>
</button>
<button mat-menu-item>
<mat-icon>notifications_off</mat-icon>
<span>Option 3</span>
</button>
</adf-viewer-open-with>
</ng-container>
</adf-viewer>
</ng-container>

View File

@@ -1,12 +0,0 @@
.app-viewer__sidebar {
width: 380px !important;
}
/* stylelint-disable */
.monaco-scrollable-element {
width: 600px;
}
app-preview-extension {
width: 600px;
}

View File

@@ -17,26 +17,16 @@
import { Component, OnInit, ViewEncapsulation } from '@angular/core'; import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router'; import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router';
import { import { NotificationService } from '@alfresco/adf-core';
NotificationService import { ContentService, AllowableOperationsEnum, PermissionsEnum, NodesApiService, FileUploadErrorEvent } from '@alfresco/adf-content-services';
} from '@alfresco/adf-core';
import {
ContentService,
AllowableOperationsEnum,
PermissionsEnum,
NodesApiService,
FileUploadErrorEvent
} from '@alfresco/adf-content-services';
import { PreviewService } from '../../services/preview.service'; import { PreviewService } from '../../services/preview.service';
@Component({ @Component({
selector: 'app-file-view', selector: 'app-file-view',
templateUrl: './file-view.component.html', templateUrl: './file-view.component.html',
styleUrls: ['./file-view.component.scss'],
encapsulation: ViewEncapsulation.None encapsulation: ViewEncapsulation.None
}) })
export class FileViewComponent implements OnInit { export class FileViewComponent implements OnInit {
nodeId: string = null; nodeId: string = null;
versionId: string = null; versionId: string = null;
displayEmptyMetadata = false; displayEmptyMetadata = false;
@@ -46,36 +36,21 @@ export class FileViewComponent implements OnInit {
isPreset = false; isPreset = false;
customPreset: string = null; customPreset: string = null;
displayDefaultProperties = true; 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; isCommentEnabled = false;
showTabWithIcon = false;
showTabWithIconAndLabel = false;
desiredAspect: string = null; desiredAspect: string = null;
showAspect: string = null; showAspect: string = null;
name: string; name: string;
fileName: string; fileName: string;
blobFile: Blob; blobFile: Blob;
constructor(private router: Router, constructor(
private route: ActivatedRoute, private router: Router,
private nodeApiService: NodesApiService, private route: ActivatedRoute,
private contentServices: ContentService, private nodeApiService: NodesApiService,
private preview: PreviewService, private contentServices: ContentService,
private notificationService: NotificationService) { private preview: PreviewService,
} private notificationService: NotificationService
) {}
ngOnInit() { ngOnInit() {
this.route.params.subscribe((params) => { this.route.params.subscribe((params) => {
@@ -85,7 +60,8 @@ export class FileViewComponent implements OnInit {
this.nodeApiService.getNode(id).subscribe( this.nodeApiService.getNode(id).subscribe(
(node) => { (node) => {
if (node?.isFile) { 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.contentServices.hasAllowableOperations(node, AllowableOperationsEnum.UPDATE);
this.nodeId = id; this.nodeId = id;
return; return;
@@ -131,66 +107,6 @@ export class FileViewComponent implements OnInit {
this.displayDefaultProperties = !this.displayDefaultProperties; 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() { togglePreset() {
this.isPreset = !this.isPreset; this.isPreset = !this.isPreset;
if (!this.isPreset) { if (!this.isPreset) {
@@ -198,10 +114,6 @@ export class FileViewComponent implements OnInit {
} }
} }
toggleToolbar() {
this.customToolbar = !this.customToolbar;
}
applyCustomPreset() { applyCustomPreset() {
this.isPreset = false; this.isPreset = false;
setTimeout(() => { setTimeout(() => {

View File

@@ -1,9 +1,4 @@
<div class="app-container"> <div class="app-container">
<div *ngIf="showSitePicker" class="app-site-container-style" id="site-container">
<adf-sites-dropdown (change)="onSiteChange($event)" [hideMyFiles]="false" [relations]="'members'">
</adf-sites-dropdown>
</div>
<div <div
id="document-list-container" id="document-list-container"
class="app-document-list-container"> class="app-document-list-container">
@@ -14,7 +9,6 @@
[versioning]="versioning" [versioning]="versioning"
[adf-check-allowable-operation]="'create'" [adf-check-allowable-operation]="'create'"
[adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []" [adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []"
(beginUpload)="onBeginUpload($event)"
(updateFileVersion)="onUploadNewVersion($event)"> (updateFileVersion)="onUploadNewVersion($event)">
<div *ngIf="errorMessage" class="app-error-message"> <div *ngIf="errorMessage" class="app-error-message">
<button (click)="resetError()" mat-icon-button> <button (click)="resetError()" mat-icon-button>
@@ -30,16 +24,7 @@
</adf-dropdown-breadcrumb> </adf-dropdown-breadcrumb>
</adf-toolbar-title> </adf-toolbar-title>
<adf-toolbar-divider></adf-toolbar-divider>
<div class="app-document-action-buttons"> <div class="app-document-action-buttons">
<button
mat-icon-button
data-automation-id="document-list-grid-view"
title="Toggle display mode"
(click)="toggleGalleryView()">
<mat-icon>list</mat-icon>
</button>
<button <button
data-automation-id="create-new-folder" data-automation-id="create-new-folder"
mat-icon-button mat-icon-button
@@ -79,11 +64,6 @@
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-menu #menu="matMenu"> <mat-menu #menu="matMenu">
<button mat-menu-item (click)="toggleGalleryView()">
<mat-icon *ngIf="displayMode === 'list'">view_comfy</mat-icon>
<mat-icon *ngIf="displayMode === 'gallery'">list</mat-icon>
<span>Card view mode</span>
</button>
<button mat-menu-item <button mat-menu-item
(error)="openSnackMessageError($event)" (error)="openSnackMessageError($event)"
[adf-create-folder]="currentFolderId"> [adf-create-folder]="currentFolderId">
@@ -125,7 +105,6 @@
[sorting]="sorting" [sorting]="sorting"
[sortingMode]="sortingMode" [sortingMode]="sortingMode"
[showHeader]="showHeader" [showHeader]="showHeader"
[thumbnails]="thumbnails"
[stickyHeader]="stickyHeader" [stickyHeader]="stickyHeader"
[headerFilters]="headerFilters" [headerFilters]="headerFilters"
[filterValue]="paramValues" [filterValue]="paramValues"
@@ -147,41 +126,26 @@
<data-column <data-column
key="$thumbnail" key="$thumbnail"
type="image" type="image"
[sortable]="false" [sortable]="false">
class="app-image-table-cell"
[class.adf-cell-thumbnail]="thumbnails">
</data-column> </data-column>
<data-column <data-column
*ngIf="showNameColumn && hyperlinkNavigation"
key="name"
sortingKey="name"
class="app-ellipsis-cell"
title="Display name"
[formatTooltip]="getNodeNameTooltip">
<ng-template let-context>
<adf-name-column key="name" [context]="context"></adf-name-column>
</ng-template>
</data-column>
<data-column
*ngIf="showNameColumn && !hyperlinkNavigation"
key="name" key="name"
sortingKey="name" sortingKey="name"
title="Display name" title="Display name"
[formatTooltip]="getNodeNameTooltip" class="adf-expand-cell-5">
class="app-ellipsis-cell adf-expand-cell-5">
</data-column> </data-column>
<data-column <data-column
key="content.sizeInBytes" key="content.sizeInBytes"
title="Size" title="Size"
type="fileSize" type="fileSize"
sortingKey="sizeInBytes" sortingKey="sizeInBytes"
class="app-desktop-only adf-ellipsis-cell"> class="adf-ellipsis-cell">
</data-column> </data-column>
<data-column <data-column
*ngIf="searchTerm" *ngIf="searchTerm"
key="search" key="search"
title="Search" title="Search"
class="app-desktop-only adf-expand-cell-3"> class="adf-expand-cell-3">
<ng-template let-entry="$implicit"> <ng-template let-entry="$implicit">
<div [innerHTML]="searchResultsHighlight(entry.row.node.entry.search) | highlight:searchTerm"> <div [innerHTML]="searchResultsHighlight(entry.row.node.entry.search) | highlight:searchTerm">
</div> </div>
@@ -200,7 +164,7 @@
key="lock" key="lock"
[focus]="false" [focus]="false"
[sortable]="false" [sortable]="false"
class="app-desktop-only adf-ellipsis-cell"> class="adf-ellipsis-cell">
<ng-template let-entry="$implicit"> <ng-template let-entry="$implicit">
<button mat-icon-button [adf-node-lock]="entry.row.node.entry" class="app-lock-button"> <button mat-icon-button [adf-node-lock]="entry.row.node.entry" class="app-lock-button">
<mat-icon *ngIf="entry.row.getValue('isLocked')">lock</mat-icon> <mat-icon *ngIf="entry.row.getValue('isLocked')">lock</mat-icon>
@@ -212,7 +176,7 @@
title="Created by" title="Created by"
key="createdByUser.displayName" key="createdByUser.displayName"
sortingKey="createdByUser" sortingKey="createdByUser"
class="app-desktop-only adf-ellipsis-cell"> class="adf-ellipsis-cell">
</data-column> </data-column>
<data-column <data-column
title="Created" title="Created"
@@ -220,7 +184,7 @@
sortingKey="createdAt" sortingKey="createdAt"
type="date" type="date"
[format]="enableMediumTimeFormat ? 'medium' : 'timeAgo'" [format]="enableMediumTimeFormat ? 'medium' : 'timeAgo'"
class="app-desktop-only adf-ellipsis-cell"> class="adf-ellipsis-cell">
</data-column> </data-column>
</data-columns> </data-columns>
@@ -240,11 +204,6 @@
(success)="onDeleteActionSuccess($event)" (success)="onDeleteActionSuccess($event)"
handler="delete"> handler="delete">
</content-action> </content-action>
<content-action
icon="info"
title="Info"
(execute)="onManageMetadata($event)">
</content-action>
<content-action <content-action
icon="supervisor_account" icon="supervisor_account"
title="Permission" title="Permission"
@@ -269,21 +228,12 @@
</adf-document-list> </adf-document-list>
</div> </div>
<adf-pagination <adf-pagination
#standardPagination
*ngIf="!infiniteScrolling"
class="app-documentlist-pagination"
[target]="documentList" [target]="documentList"
(changePageSize)="onChangePageSize($event)" (changePageSize)="onChangePageSize($event)"
(changePageNumber)="onChangePageNumber($event)" (changePageNumber)="onChangePageNumber($event)"
(nextPage)="onNextPage($event)" (nextPage)="onNextPage($event)"
(prevPage)="onPrevPage($event)"> (prevPage)="onPrevPage($event)">
</adf-pagination> </adf-pagination>
<adf-infinite-pagination
[hidden]="!infiniteScrolling"
[target]="documentList"
[loading]="documentList.loading">
{{ 'ADF-DOCUMENT-LIST.LAYOUT.LOAD_MORE' | translate }}
</adf-infinite-pagination>
</adf-upload-drag-area> </adf-upload-drag-area>
<adf-info-drawer-layout *ngIf="showVersions" class="app-manage-versions-sidebar"> <adf-info-drawer-layout *ngIf="showVersions" class="app-manage-versions-sidebar">
@@ -301,7 +251,7 @@
<ng-container *ngIf="userHasPermissionToManageVersions(); else no_permission_to_versions"> <ng-container *ngIf="userHasPermissionToManageVersions(); else no_permission_to_versions">
<adf-version-manager <adf-version-manager
[node]="documentList.selection[0].entry" [node]="documentList.selection[0].entry"
[showComments]="showVersionComments" [showComments]="true"
[allowDownload]="allowVersionDownload"> [allowDownload]="allowVersionDownload">
</adf-version-manager> </adf-version-manager>
</ng-container> </ng-container>
@@ -338,18 +288,6 @@
</div> </div>
<div class="app-container"> <div class="app-container">
<section>
<mat-slide-toggle [(ngModel)]="showNameColumn">
Show Name Column
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle [(ngModel)]="hyperlinkNavigation">
Hyperlink navigation
</mat-slide-toggle>
</section>
<section> <section>
<mat-slide-toggle data-automation-id="multiSelectToggle" [(ngModel)]="multiselect"> <mat-slide-toggle data-automation-id="multiSelectToggle" [(ngModel)]="multiselect">
Multiselect (with checkboxes) Multiselect (with checkboxes)
@@ -380,42 +318,18 @@
</mat-slide-toggle> </mat-slide-toggle>
</section> </section>
<section>
<mat-slide-toggle id="adf-thumbnails-upload-switch" (click)="toggleThumbnails()">
Enable Thumbnails
</mat-slide-toggle>
</section>
<section> <section>
<mat-slide-toggle id="adf-version-upload-switch" [(ngModel)]="versioning"> <mat-slide-toggle id="adf-version-upload-switch" [(ngModel)]="versioning">
Enable versioning Enable versioning
</mat-slide-toggle> </mat-slide-toggle>
</section> </section>
<section>
<mat-slide-toggle (click)="onInfiniteScrolling()">
Enable Infinite Scrolling
</mat-slide-toggle>
</section>
<section>
<mat-slide-toggle [(ngModel)]="showVersionComments">
Show comments on versions
</mat-slide-toggle>
</section>
<section> <section>
<mat-slide-toggle [(ngModel)]="allowVersionDownload"> <mat-slide-toggle [(ngModel)]="allowVersionDownload">
Enable version download Enable version download
</mat-slide-toggle> </mat-slide-toggle>
</section> </section>
<section>
<mat-slide-toggle [(ngModel)]="warnOnMultipleUploads">
Display warning for multiple uploads
</mat-slide-toggle>
</section>
<section> <section>
<mat-slide-toggle [(ngModel)]="enableMediumTimeFormat" id="enableMediumTimeFormat"> <mat-slide-toggle [(ngModel)]="enableMediumTimeFormat" id="enableMediumTimeFormat">
Enable medium time format for document list Enable medium time format for document list
@@ -461,8 +375,7 @@
[versioning]="versioning" [versioning]="versioning"
[adf-check-allowable-operation]="'create'" [adf-check-allowable-operation]="'create'"
[adf-nodes]="enableUpload ? getCurrentDocumentListNode() : []" [adf-nodes]="enableUpload ? getCurrentDocumentListNode() : []"
(permissionEvent)="handlePermissionError($event)" (permissionEvent)="handlePermissionError($event)">
(beginUpload)="onBeginUpload($event)">
</adf-upload-button> </adf-upload-button>
</div> </div>
<div *ngIf="acceptedFilesTypeShow"> <div *ngIf="acceptedFilesTypeShow">

View File

@@ -2,16 +2,6 @@
margin: 10px !important; 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 { .app-error-message {
text-align: left; text-align: left;
} }
@@ -37,18 +27,6 @@
.app-document-action-buttons { .app-document-action-buttons {
flex: 0 0 auto; 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) { &:not(.app-document-list-container-in-upload-drag-area) {
@@ -64,13 +42,6 @@
position: absolute; position: absolute;
} }
.app-site-container-style {
margin-top: 10px;
margin-bottom: 10px;
width: 100%;
min-width: 200px;
}
.app-content-service-settings { .app-content-service-settings {
padding: 16px; padding: 16px;
} }

View File

@@ -28,29 +28,23 @@ import {
Output, Output,
ViewEncapsulation ViewEncapsulation
} from '@angular/core'; } from '@angular/core';
import { Location } from '@angular/common';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Params, Router } from '@angular/router'; 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 { import {
NotificationService, NotificationService,
DataRow,
UserPreferencesService, UserPreferencesService,
PaginationComponent, PaginationComponent,
DisplayMode, DisplayMode,
ShowHeaderMode, ShowHeaderMode,
InfinitePaginationComponent,
FormRenderingService FormRenderingService
} from '@alfresco/adf-core'; } from '@alfresco/adf-core';
import { import {
ContentService, ContentService,
FolderCreatedEvent, FolderCreatedEvent,
UploadService, UploadService,
DocumentListComponent, DocumentListComponent,
PermissionStyleModel, PermissionStyleModel,
UploadFilesEvent,
ConfirmDialogComponent,
ContentMetadataService, ContentMetadataService,
FilterSearch, FilterSearch,
DialogAspectListService, DialogAspectListService,
@@ -59,7 +53,6 @@ import {
} from '@alfresco/adf-content-services'; } from '@alfresco/adf-content-services';
import { ProcessFormRenderingService } from '@alfresco/adf-process-services'; import { ProcessFormRenderingService } from '@alfresco/adf-process-services';
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component'; import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
import { MetadataDialogAdapterComponent } from './metadata-dialog-adapter.component';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { PreviewService } from '../../services/preview.service'; import { PreviewService } from '../../services/preview.service';
import { takeUntil, debounceTime, scan } from 'rxjs/operators'; import { takeUntil, debounceTime, scan } from 'rxjs/operators';
@@ -100,12 +93,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
sortingMode: 'server' | 'client' = 'server'; sortingMode: 'server' | 'client' = 'server';
@Input()
showRecentFiles = true;
@Input()
showSitePicker = true;
@Input() @Input()
showSettingsPanel = true; showSettingsPanel = true;
@@ -130,9 +117,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
maxSizeShow = false; maxSizeShow = false;
@Input()
showVersionComments = true;
@Input() @Input()
versioning = false; versioning = false;
@@ -157,9 +141,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
disableDragArea = false; disableDragArea = false;
@Input()
showNameColumn = true;
@Input() @Input()
searchTerm = ''; searchTerm = '';
@@ -202,24 +183,16 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
@ViewChild('standardPagination') @ViewChild('standardPagination')
standardPagination: PaginationComponent; standardPagination: PaginationComponent;
@ViewChild(InfinitePaginationComponent, { static: true })
infinitePaginationComponent: InfinitePaginationComponent;
permissionsStyle: PermissionStyleModel[] = []; permissionsStyle: PermissionStyleModel[] = [];
infiniteScrolling: boolean;
stickyHeader: boolean; stickyHeader: boolean;
warnOnMultipleUploads = false;
thumbnails = false;
enableMediumTimeFormat = false; enableMediumTimeFormat = false;
displayEmptyMetadata = false; displayEmptyMetadata = false;
hyperlinkNavigation = false;
constructor( constructor(
private notificationService: NotificationService, private notificationService: NotificationService,
private uploadService: UploadService, private uploadService: UploadService,
private contentService: ContentService, private contentService: ContentService,
private dialog: MatDialog, private dialog: MatDialog,
private location: Location,
private router: Router, private router: Router,
private preference: UserPreferencesService, private preference: UserPreferencesService,
private preview: PreviewService, private preview: PreviewService,
@@ -236,11 +209,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
} }
} }
toggleThumbnails() {
this.thumbnails = !this.thumbnails;
this.documentList.reload();
}
ngOnInit() { ngOnInit() {
if (!this.pagination) { if (!this.pagination) {
this.pagination = { this.pagination = {
@@ -399,7 +367,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
onManageVersions(event: any) { onManageVersions(event: any) {
const contentEntry = event.value.entry; const contentEntry = event.value.entry;
const showComments = this.showVersionComments; const showComments = true;
const allowDownload = this.allowVersionDownload; const allowDownload = this.allowVersionDownload;
if (this.contentService.hasAllowableOperations(contentEntry, 'update')) { if (this.contentService.hasAllowableOperations(contentEntry, 'update')) {
@@ -421,28 +389,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
}); });
} }
onManageMetadata(event: any) {
const contentEntry = event.value.entry;
const displayEmptyMetadata = this.displayEmptyMetadata;
if (this.contentService.hasAllowableOperations(contentEntry, 'update')) {
this.dialog.open(MetadataDialogAdapterComponent, {
data: {
contentEntry,
displayEmptyMetadata
},
panelClass: 'adf-metadata-manager-dialog',
width: '630px'
});
} else {
this.openSnackMessageError('OPERATION.ERROR.PERMISSION');
}
}
onSiteChange(site: SiteEntry) {
this.currentFolderId = site.entry.guid;
}
hasSelection(selection: Array<any>): boolean { hasSelection(selection: Array<any>): boolean {
return selection && selection.length > 0; return selection && selection.length > 0;
} }
@@ -457,13 +403,6 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
return this.contentService.hasAllowableOperations(selection[0].entry, 'update'); return this.contentService.hasAllowableOperations(selection[0].entry, 'update');
} }
getNodeNameTooltip(row: DataRow): string {
if (row) {
return row.getValue('name');
}
return null;
}
canEditFolder(selection: Array<NodeEntry>): boolean { canEditFolder(selection: Array<NodeEntry>): boolean {
if (selection && selection.length === 1) { if (selection && selection.length === 1) {
const entry = selection[0].entry; const entry = selection[0].entry;
@@ -507,44 +446,9 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.turnedPreviousPage.emit(event); this.turnedPreviousPage.emit(event);
} }
toggleGalleryView(): void {
this.displayMode = this.displayMode === DisplayMode.List ? DisplayMode.Gallery : DisplayMode.List;
const url = this.router.createUrlTree(['/files', this.currentFolderId, 'display', this.displayMode]).toString();
this.location.go(url);
}
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) { onUploadNewVersion(ev) {
const contentEntry = ev.detail.data.node.entry; const contentEntry = ev.detail.data.node.entry;
const showComments = this.showVersionComments; const showComments = true;
const allowDownload = this.allowVersionDownload; const allowDownload = this.allowVersionDownload;
const newFileVersion = ev.detail.files[0].file; const newFileVersion = ev.detail.files[0].file;

View File

@@ -1,10 +0,0 @@
<header mat-dialog-title>Metadata</header>
<section mat-dialog-content>
<adf-content-metadata-card
[node]="contentEntry"
[displayEmpty]="displayEmptyMetadata">
</adf-content-metadata-card>
</section>
<footer mat-dialog-actions>
<button mat-button (click)="close()">Close</button>
</footer>

View File

@@ -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<MetadataDialogAdapterComponent>) {
this.contentEntry = data.contentEntry;
this.displayEmptyMetadata = data.displayEmptyMetadata;
}
close() {
this.containingDialog.close();
}
}

View File

@@ -3,6 +3,4 @@
<h1>ADF</h1> <h1>ADF</h1>
<h2>Angular components for Alfresco</h2> <h2>Angular components for Alfresco</h2>
</div> </div>
<a mat-raised-button href="https://github.com/Alfresco/alfresco-ng2-components/tree/master/docs">Documentation</a>
</div> </div>

View File

@@ -18,6 +18,7 @@
import { Component, ViewEncapsulation } from '@angular/core'; import { Component, ViewEncapsulation } from '@angular/core';
@Component({ @Component({
standalone: true,
selector: 'app-home-view', selector: 'app-home-view',
templateUrl: './home.component.html', templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'], styleUrls: ['./home.component.scss'],

View File

@@ -1,15 +1,11 @@
<header class="app-logout-background"> <header>
<div class="app-logout-section" data-automation-id="adf-logout-section"> <div class="app-logout-section" data-automation-id="adf-logout-section">
<div class="app-logout-headline"> <div class="app-logout-headline">
<h1 class="mat-h1">Logout Page</h1> <h1 class="mat-h1">Logout Page</h1>
<h2 class="mat-h2">You are now logged out</h2> <h2 class="mat-h2">You are now logged out</h2>
</div> </div>
<div class="app-logout-login"> <a mat-raised-button class="app-logout-docs-button" href="#/login">Login</a>
<a mat-raised-button class="app-logout-docs-button" href="#/login">Login}</a> <a mat-raised-button class="app-logout-docs-button" href="/">Home</a>
</div>
<div class="app-logout-home">
<a mat-raised-button class="app-logout-docs-button" href="/">Home</a>
</div>
</div> </div>
</header> </header>

View File

@@ -4,10 +4,6 @@
align-items: center; align-items: center;
} }
.app-logout-header-background {
overflow: hidden;
}
.app-logout-section { .app-logout-section {
text-align: center; text-align: center;
padding-top: 60px; padding-top: 60px;
@@ -24,9 +20,5 @@
} }
.app-logout-docs-button { .app-logout-docs-button {
margin: 30px; margin: 8px;
}
.app-logout-login {
float: left;
} }

View File

@@ -20,8 +20,6 @@
[showHeader]="showHeader" [showHeader]="showHeader"
[sorting]="sorting" [sorting]="sorting"
[sortingMode]="'server'" [sortingMode]="'server'"
[showRecentFiles]="false"
[showSitePicker]="false"
[showSettingsPanel]="false" [showSettingsPanel]="false"
[currentFolderId]="null" [currentFolderId]="null"
[nodeResult]="$any(data)" [nodeResult]="$any(data)"

View File

@@ -18,8 +18,6 @@
[showHeader]="showHeader" [showHeader]="showHeader"
[sorting]="sorting" [sorting]="sorting"
[sortingMode]="'server'" [sortingMode]="'server'"
[showRecentFiles]="false"
[showSitePicker]="false"
[showSettingsPanel]="false" [showSettingsPanel]="false"
[currentFolderId]="null" [currentFolderId]="null"
[nodeResult]="$any(data)" [nodeResult]="$any(data)"

View File

@@ -1,93 +0,0 @@
Copyright (c) 2016 The Muli Project Authors (contact@sansoxygen.com)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -1,63 +0,0 @@
/* vietnamese */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 400;
src: local('Muli Regular'),
local('Muli-Regular'),
url(Muli-Regular.ttf) format('truetype');
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 400;
src: local('Muli Regular'),
local('Muli-Regular'),
url(Muli-Regular.ttf) format('truetype');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 400;
src: local('Muli Regular'),
local('Muli-Regular'),
url(Muli-Regular.ttf) format('truetype');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
/* vietnamese */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 100;
src: local('Muli Light'),
local('Muli-Light'),
url(Muli-Light.ttf) format('truetype');
unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 100;
src: local('Muli Light'),
local('Muli-Light'),
url(Muli-Light.ttf) format('truetype');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Muli';
font-style: normal;
font-weight: 100;
src: local('Muli Light'),
local('Muli-Light'),
url(Muli-Light.ttf) format('truetype');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}

View File

@@ -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.');
});
});
});

View File

@@ -18,7 +18,8 @@
import { ContentServicesPage } from '../../core/pages/content-services.page'; import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { createApiService, import {
createApiService,
FileBrowserUtil, FileBrowserUtil,
IdentityService, IdentityService,
LoginPage, LoginPage,
@@ -33,7 +34,6 @@ import { FileModel } from '../../models/ACS/file.model';
import { NodeEntry } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList, implicitFlow true', () => { describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList, implicitFlow true', () => {
const settingsPage = new SettingsPage(); const settingsPage = new SettingsPage();
const navigationBarPage = new NavigationBarPage(); const navigationBarPage = new NavigationBarPage();
const contentServicesPage = new ContentServicesPage(); const contentServicesPage = new ContentServicesPage();
@@ -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 location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
}); });
let pdfUploadedFile: NodeEntry;
let pngUploadedFile: NodeEntry;
let folder: NodeEntry; let folder: NodeEntry;
let acsUser: UserModel; let acsUser: UserModel;
const folderName = StringUtil.generateRandomString(5); const folderName = StringUtil.generateRandomString(5);
@@ -71,12 +69,17 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList
folder = await uploadActions.createFolder(folderName, '-my-'); folder = await uploadActions.createFolder(folderName, '-my-');
pdfUploadedFile = await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id); await uploadActions.uploadFile(firstPdfFileModel.location, firstPdfFileModel.name, folder.entry.id);
pngUploadedFile = await uploadActions.uploadFile(pngFileModel.location, pngFileModel.name, folder.entry.id); 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.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); await loginSsoPage.loginSSOIdentityService(acsUser.username, acsUser.password);
@@ -91,15 +94,13 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList
await apiService.loginWithProfile('admin'); await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(folder.entry.id); await uploadActions.deleteFileOrFolder(folder.entry.id);
await identityService.deleteIdentityUser(acsUser.email); await identityService.deleteIdentityUser(acsUser.email);
} catch (error) { } catch (error) {}
}
await apiService.getInstance().logout(); await apiService.getInstance().logout();
await browser.executeScript('window.sessionStorage.clear();'); await browser.executeScript('window.sessionStorage.clear();');
await browser.executeScript('window.localStorage.clear();'); await browser.executeScript('window.localStorage.clear();');
}); });
describe('SSO in ADF using ACS and AIS, implicit flow set', () => { describe('SSO in ADF using ACS and AIS, implicit flow set', () => {
afterEach(async () => { afterEach(async () => {
await browser.refresh(); await browser.refresh();
await contentListPage.waitForTableBody(); await contentListPage.waitForTableBody();
@@ -136,15 +137,5 @@ describe('SSO in ADF using ACS and AIS, Download Directive, Viewer, DocumentList
await contentServicesPage.clickDownloadButton(); await contentServicesPage.clickDownloadButton();
await FileBrowserUtil.isFileDownloaded('archive.zip'); 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`);
});
}); });
}); });

View File

@@ -17,7 +17,7 @@
import { ContentServicesPage } from '../../core/pages/content-services.page'; import { ContentServicesPage } from '../../core/pages/content-services.page';
import { browser } from 'protractor'; 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 { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api'; import { NodeEntry } from '@alfresco/js-api';
@@ -345,31 +345,4 @@ describe('Document List Component', () => {
await contentServicesPage.checkListIsSortedByNameColumn('asc'); 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();
});
});
}); });

View File

@@ -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.");
});
});
});

View File

@@ -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);
});
});

View File

@@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
import { createApiService, import {
createApiService,
BrowserActions, BrowserActions,
LocalStorageUtil, LocalStorageUtil,
LoginPage, LoginPage,
StringUtil,
UploadActions, UploadActions,
UserModel, UserModel,
UsersActions, UsersActions,
@@ -33,7 +33,6 @@ import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { format } from 'date-fns'; import { format } from 'date-fns';
describe('Metadata component', () => { describe('Metadata component', () => {
const METADATA = { const METADATA = {
DATA_FORMAT: 'PP', DATA_FORMAT: 'PP',
TITLE: 'Details', TITLE: 'Details',
@@ -55,8 +54,6 @@ describe('Metadata component', () => {
let acsUser: UserModel; let acsUser: UserModel;
const folderName = StringUtil.generateRandomString();
const pngFileModel = new FileModel({ const pngFileModel = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name, name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path 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 loginPage.login(acsUser.username, acsUser.password);
await navigationBarPage.navigateToContentServices(); await navigationBarPage.navigateToContentServices();
await contentServicesPage.waitForTableBody(); await contentServicesPage.waitForTableBody();
await LocalStorageUtil.setConfigField('content-metadata', JSON.stringify({ await LocalStorageUtil.setConfigField(
presets: { 'content-metadata',
default: { JSON.stringify({
'exif:exif': '*' presets: {
default: {
'exif:exif': '*'
}
} }
} })
})); );
}); });
afterAll(async () => { afterAll(async () => {
@@ -103,7 +103,7 @@ describe('Metadata component', () => {
await contentServicesPage.waitForTableBody(); 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.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed(); await viewerPage.checkInfoSideBarIsDisplayed();
await metadataViewPage.clickOnPropertiesTab(); await metadataViewPage.clickOnPropertiesTab();
@@ -188,7 +188,9 @@ describe('Metadata component', () => {
await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText'); await metadataViewPage.enterPropertyText('properties.cm:name', 'exampleText');
await metadataViewPage.clickResetMetadata(); 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:name', 'exampleText.png');
await metadataViewPage.enterPropertyText('properties.cm:title', 'example title'); await metadataViewPage.enterPropertyText('properties.cm:title', 'example title');
@@ -214,7 +216,9 @@ describe('Metadata component', () => {
await metadataViewPage.editIconClick(); await metadataViewPage.editIconClick();
await metadataViewPage.enterPropertyText('properties.cm:name', browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name); 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(); 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 () => { it('[C279960] Should show the last username modifier when modify a File', async () => {
await loginPage.loginWithProfile('admin'); await loginPage.loginWithProfile('admin');

View File

@@ -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<void> {
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<string> {
const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Users and Groups', username, 'Role');
return BrowserActions.getText(locator);
}
async clickRoleDropdownByUserOrGroupName(name: string): Promise<void> {
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<void> {
const userOrGroupName = TestElement.byCss(`[data-automation-id="adf-delete-permission-button-${username}"]`);
await userOrGroupName.waitPresent();
await userOrGroupName.click();
}
async checkUserIsDeleted(username: string): Promise<void> {
const userOrGroupName = TestElement.byCss('div[data-automation-id="' + username + '"]');
await userOrGroupName.waitNotPresent();
}
async noPermissionContent(): Promise<string> {
const noPermission = TestElement.byCss('.adf-no-permission__template--text');
return noPermission.getText();
}
async checkPermissionManagerDisplayed(): Promise<void> {
await TestElement.byId(this.rootElement).waitVisible();
}
async checkPermissionListDisplayed(): Promise<void> {
await browser.sleep(500);
await this.localPermissionList.waitVisible();
}
async isInherited(): Promise<boolean> {
const inheritButton = TestElement.byCss(this.inheritedButton);
await inheritButton.waitVisible();
return (await inheritButton.getAttribute('class')).indexOf('mat-checked') !== -1;
}
async toggleInheritPermission(): Promise<void> {
const inheritButton = TestElement.byCss(`${this.inheritedButton} label`);
await inheritButton.click();
}
}

View File

@@ -17,14 +17,7 @@
import { browser, by, element } from 'protractor'; import { browser, by, element } from 'protractor';
import { createApiService, import { createApiService, DropActions, LoginPage, StringUtil, UploadActions, UserModel, UsersActions } from '@alfresco/adf-testing';
DropActions,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page'; import { ContentServicesPage } from '../../core/pages/content-services.page';
import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page'; import { UploadDialogPage } from '../../core/pages/dialog/upload-dialog.page';
import { UploadTogglesPage } from '../../core/pages/dialog/upload-toggles.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'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
describe('Upload component', () => { describe('Upload component', () => {
const contentServicesPage = new ContentServicesPage(); const contentServicesPage = new ContentServicesPage();
const uploadDialog = new UploadDialogPage(); const uploadDialog = new UploadDialogPage();
const uploadToggles = new UploadTogglesPage(); const uploadToggles = new UploadTogglesPage();
@@ -93,8 +85,7 @@ describe('Upload component', () => {
for (const node of nodeList) { for (const node of nodeList) {
try { try {
await uploadActions.deleteFileOrFolder(node); await uploadActions.deleteFileOrFolder(node);
} catch (error) { } catch (error) {}
}
} }
}); });
@@ -226,14 +217,6 @@ describe('Upload component', () => {
await uploadDialog.dialogIsNotDisplayed(); await uploadDialog.dialogIsNotDisplayed();
await contentServicesPage.checkContentIsDisplayed(fileWithSpecificSize.name); 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 () => { it('[C260171] Should upload only the extension filter allowed when Enable extension filter is enabled', async () => {

View File

@@ -1,119 +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,
LocalStorageUtil,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions
} from '@alfresco/adf-testing';
import { FolderModel } from '../models/ACS/folder.model';
import { ContentServicesPage } from './pages/content-services.page';
import { InfinitePaginationPage } from './pages/infinite-pagination.page';
import { NavigationBarPage } from './pages/navigation-bar.page';
import { NodeEntry } from '@alfresco/js-api';
describe('Enable infinite scrolling', () => {
const loginPage = new LoginPage();
const contentServicesPage = new ContentServicesPage();
const infinitePaginationPage = new InfinitePaginationPage();
const navigationBarPage = new NavigationBarPage();
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const acsUser = new UserModel();
const folderModel = new FolderModel({ name: 'folderOne' });
let fileNames = [];
const nrOfFiles = 30;
let deleteFileNames = [];
const nrOfDeletedFiles = 22;
let deleteUploaded: NodeEntry;
const pageSize = 20;
let emptyFolderModel: NodeEntry;
const files = {
base: 'newFile',
extension: '.txt'
};
beforeAll(async () => {
const uploadActions = new UploadActions(apiService);
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await loginPage.login(acsUser.username, acsUser.password);
fileNames = StringUtil.generateFilesNames(1, nrOfFiles, files.base, files.extension);
deleteFileNames = StringUtil.generateFilesNames(1, nrOfDeletedFiles, files.base, files.extension);
await apiService.login(acsUser.username, acsUser.password);
const folderUploadedModel = await uploadActions.createFolder(folderModel.name, '-my-');
emptyFolderModel = await uploadActions.createFolder('emptyFolder', '-my-');
await uploadActions.createEmptyFiles(fileNames, folderUploadedModel.entry.id);
deleteUploaded = await uploadActions.createFolder('deleteFolder', '-my-');
await uploadActions.createEmptyFiles(deleteFileNames, deleteUploaded.entry.id);
});
afterAll(async () => {
await navigationBarPage.clickLogoutButton();
});
beforeEach(async () => {
await navigationBarPage.navigateToContentServices();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoaded();
});
it('[C299201] Should use default pagination settings for infinite pagination', async () => {
await contentServicesPage.openFolder(folderModel.name);
await contentServicesPage.enableInfiniteScrolling();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(pageSize);
await infinitePaginationPage.clickLoadMoreButton();
await contentServicesPage.contentList.dataTablePage().waitTillContentLoadedInfinitePagination();
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
});
it('[C299202] Should not display load more button when all the files are already displayed', async () => {
await LocalStorageUtil.setUserPreference('paginationSize', '30');
await contentServicesPage.openFolder(folderModel.name);
await contentServicesPage.enableInfiniteScrolling();
await expect(await contentServicesPage.numberOfResultsDisplayed()).toBe(nrOfFiles);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
});
it('[C299203] Should not display load more button when a folder is empty', async () => {
await contentServicesPage.openFolder(emptyFolderModel.entry.name);
await infinitePaginationPage.checkLoadMoreButtonIsNotDisplayed();
});
});

View File

@@ -16,7 +16,7 @@
*/ */
import { DropActions, BrowserActions, BrowserVisibility, DocumentListPage, DropdownPage, Logger } from '@alfresco/adf-testing'; 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 { FolderDialogPage } from './dialog/folder-dialog.page';
import { NavigationBarPage } from './navigation-bar.page'; import { NavigationBarPage } from './navigation-bar.page';
import * as path from 'path'; import * as path from 'path';
@@ -51,17 +51,11 @@ export class ContentServicesPage {
createdByColumnHeader = 'createdByUser.displayName'; createdByColumnHeader = 'createdByUser.displayName';
createdColumnHeader = 'createdAt'; createdColumnHeader = 'createdAt';
deleteContentElement = $('button[data-automation-id="Delete"]'); deleteContentElement = $('button[data-automation-id="Delete"]');
metadataAction = $('button[data-automation-id="Info"]');
versionManagerAction = $('button[data-automation-id="Manage versions"]'); versionManagerAction = $('button[data-automation-id="Manage versions"]');
downloadContent = $('button[data-automation-id="Download"]'); downloadContent = $('button[data-automation-id="Download"]');
downloadButton = $('button[title="Download"]'); downloadButton = $('button[title="Download"]');
multiSelectToggle = $('[data-automation-id="multiSelectToggle"]'); multiSelectToggle = $('[data-automation-id="multiSelectToggle"]');
selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]'); selectionModeDropdown = $('.mat-select[placeholder="Selection Mode"]');
siteListDropdown = new DropdownPage($(`mat-select[data-automation-id='site-my-files-option']`));
async pressContextMenuActionNamed(actionName: string): Promise<void> {
await BrowserActions.clickExecuteScript(`button[data-automation-id="context-${actionName}"]`);
}
async isContextActionEnabled(actionName: string): Promise<boolean> { async isContextActionEnabled(actionName: string): Promise<boolean> {
const actionButton = $(`button[data-automation-id="context-${actionName}"`); const actionButton = $(`button[data-automation-id="context-${actionName}"`);
@@ -73,43 +67,17 @@ export class ContentServicesPage {
return this.contentList; return this.contentList;
} }
async checkDeleteIsDisabled(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
const disabledDelete = $(`button[data-automation-id='Delete'][disabled='true']`);
await BrowserVisibility.waitUntilElementIsVisible(disabledDelete);
}
async deleteContent(content: string): Promise<void> { async deleteContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content); await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.deleteContentElement); await BrowserActions.click(this.deleteContentElement);
await this.checkContentIsNotDisplayed(content); await this.checkContentIsNotDisplayed(content);
} }
async metadataContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.metadataAction);
}
async versionManagerContent(content: string): Promise<void> { async versionManagerContent(content: string): Promise<void> {
await this.contentList.clickOnActionMenu(content); await this.contentList.clickOnActionMenu(content);
await BrowserActions.click(this.versionManagerAction); await BrowserActions.click(this.versionManagerAction);
} }
async clickFileHyperlink(fileName: string): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserActions.click(hyperlink);
}
async checkFileHyperlinkIsEnabled(fileName: string): Promise<void> {
const hyperlink = this.contentList.dataTablePage().getFileHyperlink(fileName);
await BrowserVisibility.waitUntilElementIsVisible(hyperlink);
}
async clickHyperlinkNavigationToggle(): Promise<void> {
const hyperlinkToggle = element(by.cssContainingText('.mat-slide-toggle-content', 'Hyperlink navigation'));
await BrowserActions.click(hyperlinkToggle);
}
async getElementsDisplayedId() { async getElementsDisplayedId() {
return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId); return this.contentList.dataTablePage().getAllRowsColumnValues(this.columns.nodeId);
} }
@@ -267,25 +235,11 @@ export class ContentServicesPage {
await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton); await BrowserVisibility.waitUntilElementIsClickable(this.uploadFileButton);
} }
async uploadButtonIsEnabled(): Promise<boolean> {
return this.uploadFileButton.isEnabled();
}
async enableInfiniteScrolling(): Promise<void> {
const infiniteScrollButton = element(by.cssContainingText('.mat-slide-toggle-content', 'Enable Infinite Scrolling'));
await BrowserActions.click(infiniteScrollButton);
}
async enableMediumTimeFormat(): Promise<void> { async enableMediumTimeFormat(): Promise<void> {
const mediumTimeFormat = $('#enableMediumTimeFormat'); const mediumTimeFormat = $('#enableMediumTimeFormat');
await BrowserActions.click(mediumTimeFormat); await BrowserActions.click(mediumTimeFormat);
} }
async enableThumbnails(): Promise<void> {
const thumbnailSlide = $('#adf-thumbnails-upload-switch');
await BrowserActions.click(thumbnailSlide);
}
async checkPaginationIsNotDisplayed(): Promise<void> { async checkPaginationIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination); await BrowserVisibility.waitUntilElementIsVisible(this.emptyPagination);
} }
@@ -339,11 +293,6 @@ export class ContentServicesPage {
await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url); await expect(await BrowserActions.getAttribute(this.emptyFolderImage, 'src')).toContain(url);
} }
async getRowIconImageUrl(fileName: string): Promise<string> {
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<string> { async getAttributeValueForElement(elementName: string, propertyName: string): Promise<string> {
const elementSize = $( const elementSize = $(
`.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span` `.app-document-list-container div.adf-datatable-cell[data-automation-id="${elementName}"][title="${propertyName}"] span`
@@ -351,10 +300,6 @@ export class ContentServicesPage {
return BrowserActions.getText(elementSize); return BrowserActions.getText(elementSize);
} }
async checkSelectedSiteIsDisplayed(siteName: string): Promise<void> {
await this.siteListDropdown.checkOptionIsSelected(siteName);
}
async clickDownloadButton(): Promise<void> { async clickDownloadButton(): Promise<void> {
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
await BrowserActions.click(this.downloadButton); await BrowserActions.click(this.downloadButton);

View File

@@ -27,7 +27,6 @@ export class UploadTogglesPage {
versioningToggle = $('#adf-version-upload-switch'); versioningToggle = $('#adf-version-upload-switch');
extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]'); extensionAcceptedField = $('input[data-automation-id="accepted-files-type"]');
maxSizeField = $('input[data-automation-id="max-files-size"]'); maxSizeField = $('input[data-automation-id="max-files-size"]');
disableUploadCheckbox = $('[id="adf-disable-upload"]');
async enableMultipleFileUpload(): Promise<void> { async enableMultipleFileUpload(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle); await browser.executeScript('arguments[0].scrollIntoView()', this.multipleFileUploadToggle);
@@ -79,10 +78,6 @@ export class UploadTogglesPage {
await this.togglePage.disableToggle(this.versioningToggle); await this.togglePage.disableToggle(this.versioningToggle);
} }
async clickCheckboxDisableUpload(): Promise<void> {
await BrowserActions.click(this.disableUploadCheckbox);
}
async addExtension(extension: string): Promise<void> { async addExtension(extension: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField); await BrowserVisibility.waitUntilElementIsVisible(this.extensionAcceptedField);
await this.extensionAcceptedField.sendKeys(',' + extension); await this.extensionAcceptedField.sendKeys(',' + extension);

View File

@@ -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<void> {
await BrowserActions.click(this.loadMoreButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.loading);
}
async checkLoadMoreButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.loadMoreButton);
}
}

View File

@@ -38,7 +38,6 @@ export class MetadataViewPage {
displayEmptySwitch = $(`#adf-metadata-empty`); displayEmptySwitch = $(`#adf-metadata-empty`);
readonlySwitch = $(`#adf-metadata-readonly`); readonlySwitch = $(`#adf-metadata-readonly`);
multiSwitch = $(`#adf-metadata-multi`); multiSwitch = $(`#adf-metadata-multi`);
presetSwitch = $('#adf-toggle-custom-preset');
defaultPropertiesSwitch = $('#adf-metadata-default-properties'); defaultPropertiesSwitch = $('#adf-metadata-default-properties');
closeButton = element(by.cssContainingText('button.mat-button span', 'Close')); closeButton = element(by.cssContainingText('button.mat-button span', 'Close'));
displayAspect = $(`input[data-placeholder='Display Aspect']`); displayAspect = $(`input[data-placeholder='Display Aspect']`);
@@ -143,25 +142,12 @@ export class MetadataViewPage {
await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon); await BrowserVisibility.waitUntilElementIsPresent(editPropertyIcon);
} }
async clickResetButton(): Promise<void> {
const clearPropertyIcon = $('button[data-automation-id="reset-metadata"]');
await BrowserActions.click(clearPropertyIcon);
}
async enterPropertyText(propertyName: string, text: string | number): Promise<void> { async enterPropertyText(propertyName: string, text: string | number): Promise<void> {
const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]'); const textField = $('input[data-automation-id="card-textitem-value-' + propertyName + '"]');
await BrowserActions.clearSendKeys(textField, text.toString()); await BrowserActions.clearSendKeys(textField, text.toString());
await textField.sendKeys(protractor.Key.ENTER); await textField.sendKeys(protractor.Key.ENTER);
} }
async enterPresetText(text: string): Promise<void> {
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<void> { async enterDescriptionText(text: string): Promise<void> {
const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]'); const textField = $('textarea[data-automation-id="card-textitem-value-properties.cm:description"]');
await BrowserActions.clearSendKeys(textField, text); await BrowserActions.clearSendKeys(textField, text);
@@ -205,13 +191,6 @@ export class MetadataViewPage {
await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded'); await expect(await BrowserActions.getAttribute(group, 'class')).not.toContain('mat-expanded');
} }
async getMetadataGroupTitle(groupName: string): Promise<string> {
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<void> { async checkPropertyIsVisible(propertyName: string, type: string): Promise<void> {
const property = $('[data-automation-id="card-' + type + '-label-' + propertyName + '"]'); const property = $('[data-automation-id="card-' + type + '-label-' + propertyName + '"]');
await BrowserVisibility.waitUntilElementIsVisible(property); await BrowserVisibility.waitUntilElementIsVisible(property);
@@ -292,10 +271,6 @@ export class MetadataViewPage {
await TestElement.byCss('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]').waitNotVisible(); await TestElement.byCss('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]').waitNotVisible();
} }
async clickCloseButton(): Promise<void> {
await BrowserActions.click(this.closeButton);
}
async typeAspectName(aspectName): Promise<void> { async typeAspectName(aspectName): Promise<void> {
await BrowserActions.clearSendKeys(this.displayAspect, aspectName); await BrowserActions.clearSendKeys(this.displayAspect, aspectName);
} }

View File

@@ -24,7 +24,7 @@ export class NavigationBarPage {
processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]'); processServicesNestedButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="App"]');
processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]'); processServicesCloudHomeButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Home"]');
formButton = this.linkMenuChildrenContainer.$('.app-sidenav-link[data-automation-id="Form"]'); 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"]'); personalFiles = $('div [title="Personal Files"]');
getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`); getMenuItemLocator = (title: string) => $(`.app-sidenav-link[data-automation-id="${title}"]`);

View File

@@ -1,56 +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, SettingsPage, UserInfoPage, UserModel, UsersActions } from '@alfresco/adf-testing';
import { browser } from 'protractor';
describe('User Info - SSO', () => {
const settingsPage = new SettingsPage();
const loginSSOPage = new LoginPage();
const userInfoPage = new UserInfoPage();
const apiService = createApiService({ authType: 'OAUTH', provider: 'ECM' });
const usersActions = new UsersActions(apiService);
let identityUser: UserModel;
beforeAll(async () => {
await apiService.login(browser.params.testConfig.users.admin.username, browser.params.testConfig.users.admin.password);
identityUser = await usersActions.createUser();
await settingsPage.setProviderEcmSso(
browser.params.testConfig.appConfig.ecmHost,
browser.params.testConfig.appConfig.oauth2.host,
browser.params.testConfig.appConfig.identityHost,
false,
true,
browser.params.testConfig.appConfig.oauth2.clientId
);
await loginSSOPage.loginSSOIdentityService(identityUser.username, identityUser.password);
});
it('[C290066] Should display UserInfo when login using SSO', async () => {
await userInfoPage.clickUserProfile();
await expect(await userInfoPage.getSsoHeaderTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName);
await expect(await userInfoPage.getSsoTitle()).toEqual(identityUser.firstName + ' ' + identityUser.lastName);
await expect(await userInfoPage.getSsoEmail()).toEqual(identityUser.email);
await userInfoPage.closeUserProfile();
await userInfoPage.dialogIsNotDisplayed();
});
});

View File

@@ -16,14 +16,7 @@
*/ */
import { browser, by, element, protractor } from 'protractor'; import { browser, by, element, protractor } from 'protractor';
import { createApiService, import { createApiService, BrowserActions, LoginPage, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
BrowserActions,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page'; import { ContentServicesPage } from '../../core/pages/content-services.page';
import { FileModel } from '../../models/ACS/file.model'; import { FileModel } from '../../models/ACS/file.model';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page'; import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -271,19 +264,6 @@ describe('Content Services Viewer', () => {
await viewerPage.clickCloseButton(); 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 () => { it('[C260053] Should display first page, toolbar and pagination when opening a .docx file', async () => {
await contentServicesPage.doubleClickRow(docxFile.name); await contentServicesPage.doubleClickRow(docxFile.name);
await viewerPage.waitTillContentLoaded(); await viewerPage.waitTillContentLoaded();
@@ -318,7 +298,7 @@ describe('Content Services Viewer', () => {
await viewerPage.checkZoomInButtonIsNotDisplayed(); await viewerPage.checkZoomInButtonIsNotDisplayed();
await viewerPage.checkUnknownFormatIsDisplayed(); 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(); await viewerPage.clickCloseButton();
}); });
@@ -434,7 +414,7 @@ describe('Content Services Viewer', () => {
await contentServicesPage.doubleClickRow(unsupportedFileName); await contentServicesPage.doubleClickRow(unsupportedFileName);
await viewerPage.waitTillContentLoaded(); await viewerPage.waitTillContentLoaded();
await viewerPage.checkUnknownFormatIsDisplayed(); 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(); await viewerPage.clickCloseButton();
} }

View File

@@ -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);
});
});

View File

@@ -1,170 +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,
LoginPage,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
import { FileModel } from '../../models/ACS/file.model';
describe('Viewer', () => {
const acsUser = new UserModel();
const viewerPage = new ViewerPage();
const contentServicesPage = new ContentServicesPage();
const loginPage = new LoginPage();
const navigationBarPage = new NavigationBarPage();
const pngFile = new FileModel({
name: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_name,
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const fileForOverlay = new FileModel({
name: 'fileForOverlay.png',
location: browser.params.resources.Files.ADF_DOCUMENTS.PNG.file_path
});
const apiService = createApiService();
const usersActions = new UsersActions(apiService);
const uploadActions = new UploadActions(apiService);
beforeAll(async () => {
await apiService.loginWithProfile('admin');
await usersActions.createUser(acsUser);
await apiService.login(acsUser.username, acsUser.password);
let pngFileUploaded = await uploadActions.uploadFile(pngFile.location, pngFile.name, '-my-');
Object.assign(pngFile, pngFileUploaded.entry);
pngFileUploaded = await uploadActions.uploadFile(fileForOverlay.location, fileForOverlay.name, '-my-');
Object.assign(fileForOverlay, pngFileUploaded.entry);
await loginPage.login(acsUser.username, acsUser.password);
await contentServicesPage.goToDocumentList();
});
afterAll(async () => {
await apiService.loginWithProfile('admin');
await uploadActions.deleteFileOrFolder(pngFile.getId());
await navigationBarPage.clickLogoutButton();
});
describe('properties', () => {
beforeAll(async () => {
await viewerPage.viewFile(pngFile.name);
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
});
afterAll(async () => {
await viewerPage.clickCloseButton();
});
it('[C260066] Should Show/Hide viewer toolbar when showToolbar is true/false', async () => {
await viewerPage.checkToolbarIsDisplayed();
await viewerPage.disableToolbar();
await viewerPage.checkToolbarIsNotDisplayed();
await viewerPage.enableToolbar();
});
it('[C260076] Should Show/Hide back button when allowGoBack is true/false', async () => {
await viewerPage.checkGoBackIsDisplayed();
await viewerPage.disableGoBack();
await viewerPage.checkGoBackIsNotDisplayed();
await viewerPage.enableGoBack();
});
it('[C260077] Should Show toolbar options dropdown when adf-viewer-open-with directive is used', async () => {
await viewerPage.checkToolbarOptionsIsNotDisplayed();
await viewerPage.enableToolbarOptions();
await viewerPage.checkToolbarOptionsIsDisplayed();
await viewerPage.disableToolbarOptions();
});
it('[C260079] Should Show/Hide download button when allowDownload is true/false', async () => {
await viewerPage.checkDownloadButtonIsDisplayed();
await viewerPage.disableDownload();
await viewerPage.checkDownloadButtonIsNotDisplayed();
await viewerPage.enableDownload();
});
it('[C260082] Should Show/Hide print button when allowPrint is true/false', async () => {
await viewerPage.checkPrintButtonIsDisplayed();
await viewerPage.disablePrint();
await viewerPage.checkPrintButtonIsNotDisplayed();
await viewerPage.enablePrint();
});
it('[C260092] Should show adf-viewer-toolbar-actions directive buttons when adf-viewer-toolbar-actions is used', async () => {
await viewerPage.checkMoreActionsDisplayed();
await viewerPage.disableMoreActions();
await viewerPage.checkMoreActionsIsNotDisplayed();
await viewerPage.enableMoreActions();
});
it('[C260090] Should showSidebar allow right info-drawer to be shown', async () => {
await viewerPage.clickToggleRightSidebar();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.clickToggleRightSidebar();
await viewerPage.checkInfoSideBarIsNotDisplayed();
});
it('[C286442] Should showLeftSidebar allow left info-drawer to be shown', async () => {
await viewerPage.clickToggleLeftSidebar();
await viewerPage.checkLeftSideBarIsNotDisplayed();
await viewerPage.clickLeftSidebarButton();
await viewerPage.checkLeftSideBarIsDisplayed();
});
it('[C260089] Should Show/Hide info-drawer if allowSidebar true/false', async () => {
await viewerPage.clickInfoButton();
await viewerPage.checkInfoSideBarIsDisplayed();
await viewerPage.checkInfoButtonIsDisplayed();
await viewerPage.disableAllowSidebar();
await viewerPage.checkInfoButtonIsNotDisplayed();
await viewerPage.checkInfoSideBarIsNotDisplayed();
});
it('[C286596] Should Show/Hide left info-drawer if allowLeftSidebar true/false', async () => {
await viewerPage.checkLeftSideBarIsDisplayed();
await viewerPage.checkLeftSideBarButtonIsDisplayed();
await viewerPage.disableAllowLeftSidebar();
await viewerPage.checkLeftSideBarButtonIsNotDisplayed();
await viewerPage.checkLeftSideBarIsNotDisplayed();
});
});
});

View File

@@ -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);
});
});

View File

@@ -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<void> {
const reportTitle = $(`mat-icon[data-automation-id="${title}_filter"]`);
await BrowserActions.click(reportTitle);
}
async changeReportTitle(title): Promise<void> {
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<void> {
await BrowserActions.clearSendKeys(this.toolbarTitleInput, '');
await BrowserVisibility.waitUntilElementIsVisible(this.toolbarTitleInput);
}
async getReportTitle(): Promise<string> {
return BrowserActions.getText(this.toolbarTitle);
}
async checkNoReportMessage(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.reportMessage);
}
}

View File

@@ -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<NodeEntry> {
const payload: NodeBodyUpdate = {
permissions: {
locallySet: [
{
accessStatus: 'ALLOWED',
name: role,
authorityId: userName
}
]
}
};
return this.nodesApi.updateNode(nodeToUpdate.entry.id, payload);
}
disableInheritedPermissionsForNode(nodeId: string): Promise<NodeEntry> {
const nodeBody = { permissions: { isInheritanceEnabled: false } };
return this.nodesApi.updateNode(nodeId, nodeBody, { include: ['permissions'] });
}
}

View File

@@ -16,5 +16,4 @@
*/ */
export * from './upload.actions'; export * from './upload.actions';
export * from './permission.actions';
export * from './model.actions'; export * from './model.actions';

View File

@@ -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<void> {
await BrowserActions.clickExecuteScript('button[data-automation-id="adf-add-permission-button"]');
}
async checkAddPermissionDialogIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.addPermissionDialog);
}
async checkSearchUserInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchUserInput);
}
async searchUserOrGroup(name: string): Promise<void> {
await BrowserActions.clearSendKeys(this.searchUserInput, name);
await this.dataTableComponentPage.waitTillContentLoaded();
}
async checkResultListIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.searchResults);
}
async clickUserOrGroup(name: string): Promise<void> {
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<string> {
const locator = this.dataTableComponentPage.getCellByRowContentAndColumn('Users and Groups', rowName, column.role);
return BrowserActions.getText(locator);
}
async selectOption(name: string): Promise<void> {
await new DropdownPage().selectOption(name);
}
async checkUserOrGroupIsDisplayed(name: string): Promise<void> {
const userOrGroupName = element(by.cssContainingText('mat-list-option .mat-list-text', name));
await BrowserVisibility.waitUntilElementIsVisible(userOrGroupName);
}
async addButtonIsEnabled(): Promise<boolean> {
return this.addButton.isEnabled();
}
async clickAddButton(): Promise<void> {
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);
}
}

View File

@@ -16,4 +16,3 @@
*/ */
export * from './content-node-selector-dialog.page'; export * from './content-node-selector-dialog.page';
export * from './add-permissions-dialog.page';

View File

@@ -19,7 +19,6 @@ import { ApiService } from '../../../shared/api/api.service';
import { ResultSetPaging, SearchApi } from '@alfresco/js-api'; import { ResultSetPaging, SearchApi } from '@alfresco/js-api';
import { Logger } from '../utils/logger'; import { Logger } from '../utils/logger';
import { ApiUtil } from '../../../shared/api/api.util'; import { ApiUtil } from '../../../shared/api/api.util';
import { UserModel } from '../models/user.model';
export class SearchService { export class SearchService {
apiService: ApiService; apiService: ApiService;
@@ -50,45 +49,12 @@ export class SearchService {
return ApiUtil.waitForApi(apiCall, predicate); return ApiUtil.waitForApi(apiCall, predicate);
} }
async isUserSearchable(user: UserModel): Promise<any> {
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) { private createSearchQuery(name: string) {
return { return {
query: { query: {
query: `${name}*` query: `${name}*`
}, },
include: [ include: ['path', 'allowableOperations', 'properties'],
'path',
'allowableOperations',
'properties'
],
paging: { paging: {
maxItems: 20, maxItems: 20,
skipCount: 0 skipCount: 0
@@ -102,9 +68,7 @@ export class SearchService {
} }
], ],
scope: { scope: {
locations: [ locations: ['nodes']
'nodes'
]
} }
}; };
} }

View File

@@ -15,18 +15,8 @@
* limitations under the License. * limitations under the License.
*/ */
import * as path from 'path';
import * as fs from 'fs';
import { browser } from 'protractor'; import { browser } from 'protractor';
import { import { UserProfileApi, AdminUsersApi, AdminTenantsApi, PeopleApi, UserRepresentation } from '@alfresco/js-api';
UserProfileApi,
AdminUsersApi,
AdminTenantsApi,
PeopleApi,
ImageUploadRepresentation,
UserRepresentation
} from '@alfresco/js-api';
import { IdentityService } from './identity/identity.service'; import { IdentityService } from './identity/identity.service';
import { UserModel } from '../models/user.model'; import { UserModel } from '../models/user.model';
import { ApiService } from '../../../shared/api/api.service'; import { ApiService } from '../../../shared/api/api.service';
@@ -34,7 +24,6 @@ import { Logger } from '../utils/logger';
import { Tenant } from '../models/tenant'; import { Tenant } from '../models/tenant';
export class UsersActions { export class UsersActions {
api: ApiService; api: ApiService;
identityService: IdentityService; identityService: IdentityService;
peopleApi: PeopleApi; peopleApi: PeopleApi;
@@ -61,7 +50,7 @@ export class UsersActions {
const user = new UserModel({ ...(userModel ? userModel : {}) }); const user = new UserModel({ ...(userModel ? userModel : {}) });
try { 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}`); Logger.log(`Create user ECM ${user.email}`);
await this.peopleApi.createPerson({ await this.peopleApi.createPerson({
id: user.username, id: user.username,
@@ -80,7 +69,7 @@ export class UsersActions {
} }
try { try {
if (this.api.apiService.isBpmConfiguration() || (this.api.apiService.isEcmBpmConfiguration())) { if (this.api.apiService.isBpmConfiguration() || this.api.apiService.isEcmBpmConfiguration()) {
Logger.log('Create user BPM'); Logger.log('Create user BPM');
if (user.tenantId) { if (user.tenantId) {
const apsUser = await this.createApsUser(user.tenantId, user.email, user.firstName, user.lastName, user.password); const apsUser = await this.createApsUser(user.tenantId, user.email, user.firstName, user.lastName, user.password);
@@ -117,11 +106,6 @@ export class UsersActions {
return user; return user;
} }
async createUserWithName(firstName: string, lastName: string): Promise<UserModel> {
const user = new UserModel({ firstName, lastName });
return this.createUser(user);
}
async createTenantAndUser(email?: string, firstName?: string, lastName?: string, password?: string): Promise<UserRepresentation> { async createTenantAndUser(email?: string, firstName?: string, lastName?: string, password?: string): Promise<UserRepresentation> {
const newTenant = await this.adminTenantsApi.createTenant(new Tenant()); 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<UserRepresentation> { async createApsUser(tenantId?: number, email?: string, firstName?: string, lastName?: string, password?: string): Promise<UserRepresentation> {
const user = new UserModel({ const user = new UserModel({
tenantId, tenantId,
email, email,
@@ -149,13 +132,6 @@ export class UsersActions {
return this.adminUsersApi.createNewUser(user.getAPSModel()); return this.adminUsersApi.createNewUser(user.getAPSModel());
} }
async changeProfilePictureAps(fileLocation: string): Promise<ImageUploadRepresentation> {
const pathFile = path.join(browser.params.testConfig.main.rootPath + fileLocation);
const file = fs.createReadStream(pathFile);
return this.userProfileApi.uploadProfilePicture(file);
}
async deleteTenant(tenantId: number) { async deleteTenant(tenantId: number) {
await this.adminTenantsApi.deleteTenant(tenantId); await this.adminTenantsApi.deleteTenant(tenantId);
} }

View File

@@ -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<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.errorPageCode);
}
async getErrorCode(): Promise<string> {
return BrowserActions.getText(this.errorPageCode);
}
async getErrorTitle(): Promise<string> {
return BrowserActions.getText(this.errorPageTitle);
}
async getErrorDescription(): Promise<string> {
return BrowserActions.getText(this.errorPageDescription);
}
}

View File

@@ -1,75 +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';
import { TabsPage } from './material/tabs.page';
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}']`);
}
async isInfoDrawerDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement);
return true;
} catch (error) {
return false;
}
}
async isInfoDrawerNotDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement);
return true;
} catch (error) {
return false;
}
}
async isInfoDrawerHeaderDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsVisible(this.rootElement.$(this.infoDrawerHeader));
return true;
} catch (error) {
return false;
}
}
async isInfoDrawerHeaderNotDisplayed(): Promise<boolean> {
try {
await BrowserVisibility.waitUntilElementIsNotVisible(this.rootElement.$(this.infoDrawerHeader));
return true;
} catch (error) {
return false;
}
}
async getNoOfTabs(): Promise<number> {
return this.tabsPage.getNoOfTabs();
}
async getTabsLabels(): Promise<string> {
return this.tabsPage.getTabsLabels();
}
}

View File

@@ -25,7 +25,6 @@ export { LoginPage as LoginSSOPage } from './login.page';
export * from './data-table-component.page'; export * from './data-table-component.page';
export * from './pagination.page'; export * from './pagination.page';
export * from './error.page';
export * from './form/public-api'; export * from './form/public-api';
export * from './material/public-api'; export * from './material/public-api';
export * from './card-view/public-api'; export * from './card-view/public-api';
@@ -34,4 +33,3 @@ export * from './config-editor-page';
export * from './snackbar.page'; export * from './snackbar.page';
export * from './data-table/public-api'; export * from './data-table/public-api';
export * from './context-menu.page'; export * from './context-menu.page';
export * from './info-drawer.page';

View File

@@ -17,7 +17,6 @@
import { BrowserActions } from '../utils/browser-actions'; import { BrowserActions } from '../utils/browser-actions';
import { TabsPage } from './material/tabs.page'; import { TabsPage } from './material/tabs.page';
import { TogglePage } from './material/toggle.page';
import { BrowserVisibility } from '../utils/browser-visibility'; import { BrowserVisibility } from '../utils/browser-visibility';
import { element, by, browser, protractor, $, $$ } from 'protractor'; import { element, by, browser, protractor, $, $$ } from 'protractor';
import { Logger } from '../utils/logger'; import { Logger } from '../utils/logger';
@@ -26,12 +25,9 @@ const MAX_LOADING_TIME = 120000;
export class ViewerPage { export class ViewerPage {
tabsPage = new TabsPage(); tabsPage = new TabsPage();
togglePage = new TogglePage();
closeButton = $('button[data-automation-id="adf-toolbar-back"]'); closeButton = $('button[data-automation-id="adf-toolbar-back"]');
fileName = $('#adf-viewer-display-name'); fileName = $('#adf-viewer-display-name');
infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]'); infoButton = $('button[data-automation-id="adf-toolbar-sidebar"]');
leftSideBarButton = $('button[data-automation-id="adf-toolbar-left-sidebar"]');
previousPageButton = $('#viewer-previous-page-button'); previousPageButton = $('#viewer-previous-page-button');
nextPageButton = $('#viewer-next-page-button'); nextPageButton = $('#viewer-next-page-button');
zoomInButton = $('#viewer-zoom-in-button'); zoomInButton = $('#viewer-zoom-in-button');
@@ -49,51 +45,15 @@ export class ViewerPage {
thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]'); thumbnailsClose = $('button[data-automation-id="adf-thumbnails-close"]');
secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"]'); secondThumbnail = $('adf-pdf-thumb > img[title="Page 2"]');
lastThumbnailDisplayed = $$('adf-pdf-thumb').last(); 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'); infoSideBar = $('#adf-right-sidebar');
leftSideBar = $('#adf-left-sidebar');
viewer = $('adf-viewer'); viewer = $('adf-viewer');
imgViewer = $('adf-img-viewer'); imgViewer = $('adf-img-viewer');
activeTab = $('div[class*="mat-tab-label-active"]'); activeTab = $('div[class*="mat-tab-label-active"]');
toolbarSwitch = $('#adf-switch-toolbar');
toolbar = $('#adf-viewer-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(); 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'); pdfPageLoaded = $('[data-page-number="1"][data-loaded="true"], adf-img-viewer, adf-txt-viewer');
downloadSwitch = $('#adf-switch-download');
downloadButton = $('#adf-alfresco-viewer-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`); unknownFormat = $(`adf-viewer-unknown-format .adf-viewer__unknown-format-view`);
async viewFile(fileName: string): Promise<void> { async viewFile(fileName: string): Promise<void> {
@@ -114,8 +74,7 @@ export class ViewerPage {
Logger.log('wait spinner is present'); Logger.log('wait spinner is present');
await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner'))); await BrowserVisibility.waitUntilElementIsVisible(element(by.tagName('mat-progress-spinner')));
await BrowserVisibility.waitUntilElementIsNotVisible(element(by.tagName('mat-progress-spinner')), MAX_LOADING_TIME); 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); await browser.executeScript(jsCode);
} }
async enterPassword(password: string): Promise<void> {
await BrowserActions.clearSendKeys(this.passwordInput, password);
}
async checkFileIsLoaded(fileName?: string): Promise<void> { async checkFileIsLoaded(fileName?: string): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.pdfPageLoaded, 60000, `${fileName} not loaded`); await BrowserVisibility.waitUntilElementIsVisible(this.pdfPageLoaded, 60000, `${fileName} not loaded`);
} }
async clickClosePasswordDialog(): Promise<void> {
await BrowserActions.click(this.passwordDialogClose);
}
async checkImgViewerIsDisplayed(): Promise<void> { async checkImgViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.imgViewer); await BrowserVisibility.waitUntilElementIsVisible(this.imgViewer);
} }
async checkPasswordErrorIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordError);
}
async checkPasswordInputIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordInput);
}
async checkPasswordSubmitDisabledIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordSubmitDisabled);
}
async checkPasswordDialogIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.passwordDialog);
}
async checkAllThumbnailsDisplayed(nbPages): Promise<void> { async checkAllThumbnailsDisplayed(nbPages): Promise<void> {
const defaultThumbnailHeight = 143; 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<void> { async checkCurrentThumbnailIsSelected(): Promise<void> {
@@ -213,14 +150,6 @@ export class ViewerPage {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton); await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
} }
async getLastButtonTitle(): Promise<string> {
return BrowserActions.getAttribute(this.lastButton, 'title');
}
async getMoreActionsMenuTitle(): Promise<string> {
return BrowserActions.getAttribute(this.moreActionsMenu, 'title');
}
async checkDownloadButtonIsDisplayed(): Promise<void> { async checkDownloadButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.downloadButton); await BrowserVisibility.waitUntilElementIsVisible(this.downloadButton);
} }
@@ -229,10 +158,6 @@ export class ViewerPage {
await BrowserVisibility.waitUntilElementIsVisible(this.infoButton); await BrowserVisibility.waitUntilElementIsVisible(this.infoButton);
} }
async checkInfoButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.infoButton);
}
async checkFileThumbnailIsDisplayed(): Promise<void> { async checkFileThumbnailIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.fileThumbnail); await BrowserVisibility.waitUntilElementIsVisible(this.fileThumbnail);
} }
@@ -318,14 +243,6 @@ export class ViewerPage {
await BrowserVisibility.waitUntilElementIsVisible(this.infoSideBar); await BrowserVisibility.waitUntilElementIsVisible(this.infoSideBar);
} }
async checkLeftSideBarButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBarButton);
}
async checkLeftSideBarButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBarButton);
}
async clickInfoButton(): Promise<void> { async clickInfoButton(): Promise<void> {
await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]')); await BrowserActions.click($('button[data-automation-id="adf-toolbar-sidebar"]'));
} }
@@ -335,26 +252,12 @@ export class ViewerPage {
} }
async checkTabIsActive(tabName: string): Promise<void> { async checkTabIsActive(tabName: string): Promise<void> {
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); await BrowserVisibility.waitUntilElementIsVisible(tab);
} }
async clickLeftSidebarButton(): Promise<void> {
await BrowserActions.click(this.leftSideBarButton);
}
async checkLeftSideBarIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.leftSideBar);
}
async checkLeftSideBarIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.leftSideBar);
}
async clickPasswordSubmit(): Promise<void> {
await BrowserActions.click(this.passwordSubmit);
}
async clickSecondThumbnail(): Promise<void> { async clickSecondThumbnail(): Promise<void> {
await BrowserActions.click(this.secondThumbnail); await BrowserActions.click(this.secondThumbnail);
} }
@@ -411,159 +314,10 @@ export class ViewerPage {
await this.tabsPage.clickTabByTitle('Comments'); await this.tabsPage.clickTabByTitle('Comments');
} }
async disableToolbar(): Promise<void> {
await this.togglePage.disableToggle(this.toolbarSwitch);
}
async enableToolbar(): Promise<void> {
await this.togglePage.enableToggle(this.toolbarSwitch);
}
async checkToolbarIsDisplayed(): Promise<void> { async checkToolbarIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.toolbar); await BrowserVisibility.waitUntilElementIsVisible(this.toolbar);
} }
async checkToolbarIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.toolbar);
}
async disableGoBack(): Promise<void> {
await this.togglePage.disableToggle(this.goBackSwitch);
}
async enableGoBack(): Promise<void> {
await this.togglePage.enableToggle(this.goBackSwitch);
}
async checkGoBackIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.closeButton);
}
async checkGoBackIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.closeButton);
}
async disableToolbarOptions(): Promise<void> {
await this.togglePage.disableToggle(this.openWithSwitch);
}
async enableToolbarOptions() {
await this.togglePage.enableToggle(this.openWithSwitch);
}
async checkToolbarOptionsIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.openWith);
}
async checkToolbarOptionsIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.openWith);
}
async disableDownload(): Promise<void> {
await this.togglePage.disableToggle(this.downloadSwitch);
}
async enableDownload(): Promise<void> {
await this.togglePage.enableToggle(this.openWithSwitch);
}
async checkDownloadButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.downloadButton);
}
async disablePrint(): Promise<void> {
await this.togglePage.disableToggle(this.printSwitch);
}
async enablePrint(): Promise<void> {
await this.togglePage.enableToggle(this.printSwitch);
}
async checkPrintButtonIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.printButton);
}
async checkPrintButtonIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.printButton);
}
async disableAllowSidebar(): Promise<void> {
await this.togglePage.disableToggle(this.allowSidebarSwitch);
}
async disableAllowLeftSidebar(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.allowLeftSidebarSwitch);
await this.togglePage.disableToggle(this.allowLeftSidebarSwitch);
}
async checkMoreActionsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.bugButton);
await BrowserVisibility.waitUntilElementIsVisible(this.timeButton);
await BrowserVisibility.waitUntilElementIsVisible(this.uploadButton);
}
async checkMoreActionsIsNotDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsNotVisible(this.bugButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.timeButton);
await BrowserVisibility.waitUntilElementIsNotVisible(this.uploadButton);
}
async checkPreviewFileDefaultOptionsAreDisplayed(): Promise<void> {
await this.checkToolbarIsDisplayed();
await this.checkMoreActionsDisplayed();
await this.checkPrintButtonIsDisplayed();
await this.checkDownloadButtonIsDisplayed();
await this.checkFullScreenButtonIsDisplayed();
await this.checkLeftSideBarButtonIsDisplayed();
await this.checkInfoButtonIsDisplayed();
}
async disableMoreActions(): Promise<void> {
await this.togglePage.disableToggle(this.moreActionsSwitch);
}
async enableMoreActions(): Promise<void> {
await this.togglePage.enableToggle(this.moreActionsSwitch);
}
async enableMoreActionsMenu(): Promise<void> {
await this.togglePage.enableToggle(this.moreActionsMenuSwitch);
}
async disableCustomToolbar(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle);
await this.togglePage.disableToggle(this.customToolbarToggle);
}
async enableCustomToolbar(): Promise<void> {
await browser.executeScript('arguments[0].scrollIntoView()', this.customToolbarToggle);
await this.togglePage.enableToggle(this.customToolbarToggle);
}
async checkCustomToolbarIsDisplayed() {
await BrowserVisibility.waitUntilElementIsVisible(this.customToolbar);
}
async clickToggleRightSidebar(): Promise<void> {
await BrowserActions.click(this.showRightSidebarSwitch);
}
async clickToggleLeftSidebar(): Promise<void> {
await BrowserActions.click(this.showLeftSidebarSwitch);
}
async disableOverlay(): Promise<void> {
await this.togglePage.disableToggle($('#adf-viewer-overlay'));
}
async checkOverlayViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-overlay-container"]'));
}
async checkInlineViewerIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible($('div[class*="adf-viewer-inline-container"]'));
}
async checkUnknownFormatIsDisplayed(): Promise<void> { async checkUnknownFormatIsDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.unknownFormat); await BrowserVisibility.waitUntilElementIsVisible(this.unknownFormat);
} }

View File

@@ -15,12 +15,10 @@
* limitations under the License. * limitations under the License.
*/ */
import { browser } from 'protractor';
import { ApiService } from '../../../shared/api/api.service'; import { ApiService } from '../../../shared/api/api.service';
import { FormModelsApi, FormRepresentation } from '@alfresco/js-api'; import { FormModelsApi, FormRepresentation } from '@alfresco/js-api';
export class FormUtil { export class FormUtil {
api: ApiService; api: ApiService;
editorApi: FormModelsApi; editorApi: FormModelsApi;
@@ -31,18 +29,6 @@ export class FormUtil {
} }
} }
static async setForm(value: string): Promise<void> {
await browser.executeScript(
'window.adf.setFormInEditor(`' + value + '`);'
);
}
static async setCloudForm(value: string): Promise<void> {
await browser.executeScript(
'window.adf.setCloudFormInEditor(`' + value + '`);'
);
}
async getFormByName(name: string): Promise<FormRepresentation> { async getFormByName(name: string): Promise<FormRepresentation> {
const forms: any = await this.editorApi.getForms(undefined); const forms: any = await this.editorApi.getForms(undefined);

View File

@@ -18,53 +18,27 @@
import { browser } from 'protractor'; import { browser } from 'protractor';
export class LocalStorageUtil { export class LocalStorageUtil {
static async getConfigField(field: string): Promise<any> { static async getConfigField(field: string): Promise<any> {
return browser.executeScript( return browser.executeScript('return window.adf ? window.adf.getConfigField(`' + field + '`) : null;');
'return window.adf ? window.adf.getConfigField(`' + field + '`) : null;'
);
} }
static async setConfigField(field: string, value: string): Promise<void> { static async setConfigField(field: string, value: string): Promise<void> {
await browser.executeScript( await browser.executeScript('window.adf.setConfigField(`' + field + '`, `' + value + '`);');
'window.adf.setConfigField(`' + field + '`, `' + value + '`);'
);
} }
static async setStorageItem(field: string, value: string): Promise<void> { static async setStorageItem(field: string, value: string): Promise<void> {
await browser.executeScript( await browser.executeScript('window.adf.setStorageItem(`' + field + '`, `' + value + '`);');
'window.adf.setStorageItem(`' + field + '`, `' + value + '`);'
);
}
static async removeStorageItem(field: string): Promise<void> {
await browser.executeScript(
'window.adf.removeStorageItem(`' + field + '`);'
);
}
static async getStorageItem(field: string): Promise<any> {
return browser.executeScript(
'return window.adf ? window.adf.getStorageItem(`' + field + '`) : null;'
);
} }
static async setUserPreference(field: string, value: any): Promise<void> { static async setUserPreference(field: string, value: any): Promise<void> {
await browser.executeScript( await browser.executeScript('window.adf.setUserPreference(`' + field + '`, `' + value + '`);');
'window.adf.setUserPreference(`' + field + '`, `' + value + '`);'
);
} }
static async clearStorage(): Promise<void> { static async clearStorage(): Promise<void> {
await browser.executeScript( await browser.executeScript('window.adf.clearStorage();');
'window.adf.clearStorage();'
);
} }
static async apiReset(): Promise<void> { static async apiReset(): Promise<void> {
await browser.executeScript( await browser.executeScript(`window.adf.apiReset();`);
`window.adf.apiReset();`
);
} }
} }