From b2cb93468d4991f869345ce371628cb48a9c9d09 Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Mon, 23 Jul 2018 14:11:54 +0100 Subject: [PATCH] [ADF-3259] [ADF-3363] e2e login and card metadata (#3612) * remember me * add login component e2e test * add success route test * add change logo check * redirect url after logout e2e * move redirection test in a separate file * login component tslint * cardview e2e * fix login test * add test case number * move version test in a separate file * clean unused elements * metadata part 1 * tslint fix * fix metadata test * remove fit * fix formatting file viewerPage * multi propety test * metadata and login improvements * fix data automation fix * metadata permission e2e * fix tslint problems * improve selector * stabilize search component test * stabilize test step 1 * fix tag test add config timeout * tentative * delay after download * change meatdata test * stabilize metadata * use smaller file for not extension related test * stabilize test step 2 * exclude failing test * timeout fix * split in multiple task e2e * trick travis * trigger build * fix command issue * fix save screenshot * fix run subfolder * test timeout increase --- .angular-cli.json | 10 + .travis.yml | 8 +- demo-shell/resources/i18n/en.json | 12 +- demo-shell/src/app/app.module.ts | 8 +- demo-shell/src/app/app.routes.ts | 11 + .../app-layout/app-layout.component.html | 2 +- .../app-layout/app-layout.component.ts | 1 + .../card-view/card-view.component.html | 14 + .../card-view/card-view.component.ts | 67 ++- .../config-editor.component.html | 9 + .../config-editor.component.scss | 3 + .../config-editor/config-editor.component.ts | 65 +++ .../file-view/file-view.component.html | 65 ++- .../file-view/file-view.component.ts | 31 ++ .../app/components/files/files.component.html | 18 +- .../app/components/files/files.component.ts | 16 +- .../app/components/login/login.component.html | 57 ++- .../app/components/login/login.component.ts | 25 +- .../content-metadata.component.md | 2 +- e2e/actions/APS/apps.actions.ts | 6 +- e2e/actions/APS/models.actions.ts | 8 +- e2e/card-view-component.e2e.ts | 103 ----- e2e/card-view-smoke-tests.e2e.ts | 139 ------- .../document_list_component.e2e.ts | 23 +- .../document_list_pagination.e2e.ts | 18 +- .../search_component.e2e.ts | 146 +++---- .../search_page_component.e2e.ts | 24 +- .../tag_component.e2e.ts | 24 +- .../trashcan_pagination.e2e.ts | 18 +- .../upload/excluded_file.e2e.ts | 28 +- .../upload/uploader_component.e2e.ts | 22 +- .../upload/user_permission.e2e.ts | 27 +- .../version/version-smoke-tests.e2e.ts | 82 ++++ e2e/{ => content-services}/z-finish.e2e.ts | 11 +- .../card-view/aspect-oriented-config.e2e.ts | 305 ++++++++++++++ e2e/core/card-view/card-view-component.e2e.ts | 313 ++++++++++++++ e2e/core/card-view/metadata-properties.e2e.ts | 158 +++++++ .../card-view/metadata-smoke-tests.e2e.ts | 330 +++++++++++++++ e2e/core/card-view/permissions.e2e.ts | 163 ++++++++ .../data-table-component-selection.e2e.ts | 8 +- .../datatable/data-table-component.e2e.ts | 8 +- e2e/{ => core}/infinite_scrolling.e2e.ts | 14 +- e2e/core/login/login_component.e2e.ts | 250 +++++++++++ e2e/core/login/redirection.e2e.ts | 135 ++++++ e2e/core/login/remember_me.e2e.ts | 39 ++ .../pagination_empty_current_page.e2e.ts | 16 +- e2e/{ => core}/theming_component.e2e.ts | 10 +- e2e/{ => core}/user_info_component.e2e.ts | 22 +- .../viewer_content_services_component.e2e.ts | 23 +- e2e/core/z-finish.e2e.ts | 77 ++++ e2e/{ => insights}/analytics-component.e2e.ts | 16 +- e2e/insights/z-finish.e2e.ts | 77 ++++ e2e/login_component.e2e.ts | 156 ------- e2e/models/ACS/contentModel.js | 6 +- e2e/pages/adf/cardViewPage.js | 188 --------- e2e/pages/adf/cardViewPageComponent.js | 197 +++++++-- e2e/pages/adf/configEditorPage.ts | 43 ++ e2e/pages/adf/contentServicesPage.js | 3 +- e2e/pages/adf/dialog/contentList.js | 16 +- e2e/pages/adf/dialog/searchDialog.js | 55 +-- e2e/pages/adf/documentListPage.js | 44 +- e2e/pages/adf/filePreviewPage.js | 6 +- e2e/pages/adf/loginPage.js | 148 ++++++- e2e/pages/adf/metadataViewPage.js | 392 ++++++++++++++++++ e2e/pages/adf/navigationBarPage.js | 55 ++- .../process_services/attachmentListPage.ts | 27 +- e2e/pages/adf/tagPage.js | 9 +- e2e/pages/adf/viewerPage.js | 144 ++++--- .../apps-section.e2e.ts | 30 +- .../attach-file-widget.e2e.ts | 22 +- .../attachment-list-process.e2e.ts | 36 +- .../empty_process_list_component.e2e.ts | 20 +- .../form_widgets_component.e2e.ts | 24 +- ...ination_processlist_addingProcesses.e2e.ts | 18 +- .../pagination_tasklist_addingTasks.e2e.ts | 18 +- .../process_attachmentList_actionMenu.e2e.ts | 86 ++-- .../process_filters_component.e2e.ts | 27 +- .../processlist_pagination.e2e.ts | 22 +- .../sort_tasklist_pagination.e2e.ts | 22 +- .../start_process_component.e2e.ts | 34 +- .../start_task_custom_app.e2e.ts | 41 +- .../start_task_task_app.e2e.ts | 28 +- .../task_attachmentList_actionMenu.e2e.ts | 101 ++--- .../task_list_pagination.e2e.ts | 20 +- e2e/process-services/z-finish.e2e.ts | 77 ++++ e2e/restAPI/ACS/RequestUtil/RequestCoreAPI.js | 3 +- e2e/restAPI/APIUtil.js | 6 +- e2e/test.config.js | 3 + e2e/util/constants.js | 14 - e2e/util/util.js | 31 +- .../content-metadata-card.component.html | 8 +- .../content-metadata-card.component.spec.ts | 14 +- .../content-metadata.component.html | 6 +- .../content-metadata.component.ts | 2 +- .../node-permission-dialog.service.spec.ts | 2 +- .../tag/tag-actions.component.html | 4 +- .../tag/tag-actions.component.spec.ts | 14 +- .../tag/tag-node-list.component.html | 2 +- .../tag/tag-node-list.component.spec.ts | 8 +- .../card-view-boolitem.component.html | 3 +- .../card-view-dateitem.component.html | 6 +- ...card-view-keyvaluepairsitem.component.html | 4 +- .../card-view-mapitem.component.html | 2 +- .../card-view-selectitem.component.html | 2 +- .../card-view-textitem.component.html | 4 +- lib/core/form/components/form.component.html | 5 +- .../login/components/login.component.html | 2 +- .../components/user-info.component.html | 4 +- .../components/user-info.component.ts | 2 + package-lock.json | 97 +++-- package.json | 1 + protractor.conf.js | 3 +- scripts/README.md | 1 + scripts/test-e2e-lib.sh | 15 +- tsconfig.json | 1 + tslint.json | 4 +- 116 files changed, 3936 insertions(+), 1519 deletions(-) create mode 100644 demo-shell/src/app/components/config-editor/config-editor.component.html create mode 100644 demo-shell/src/app/components/config-editor/config-editor.component.scss create mode 100644 demo-shell/src/app/components/config-editor/config-editor.component.ts delete mode 100644 e2e/card-view-component.e2e.ts delete mode 100644 e2e/card-view-smoke-tests.e2e.ts rename e2e/{ => content-services}/document_list_component.e2e.ts (91%) rename e2e/{ => content-services}/document_list_pagination.e2e.ts (97%) rename e2e/{ => content-services}/search_component.e2e.ts (61%) rename e2e/{ => content-services}/search_page_component.e2e.ts (94%) rename e2e/{ => content-services}/tag_component.e2e.ts (88%) rename e2e/{ => content-services}/trashcan_pagination.e2e.ts (91%) rename e2e/{ => content-services}/upload/excluded_file.e2e.ts (77%) rename e2e/{ => content-services}/upload/uploader_component.e2e.ts (96%) rename e2e/{ => content-services}/upload/user_permission.e2e.ts (90%) create mode 100644 e2e/content-services/version/version-smoke-tests.e2e.ts rename e2e/{ => content-services}/z-finish.e2e.ts (86%) create mode 100644 e2e/core/card-view/aspect-oriented-config.e2e.ts create mode 100644 e2e/core/card-view/card-view-component.e2e.ts create mode 100644 e2e/core/card-view/metadata-properties.e2e.ts create mode 100644 e2e/core/card-view/metadata-smoke-tests.e2e.ts create mode 100644 e2e/core/card-view/permissions.e2e.ts rename e2e/{ => core}/datatable/data-table-component-selection.e2e.ts (93%) rename e2e/{ => core}/datatable/data-table-component.e2e.ts (90%) rename e2e/{ => core}/infinite_scrolling.e2e.ts (85%) create mode 100644 e2e/core/login/login_component.e2e.ts create mode 100644 e2e/core/login/redirection.e2e.ts create mode 100644 e2e/core/login/remember_me.e2e.ts rename e2e/{ => core}/pagination_empty_current_page.e2e.ts (89%) rename e2e/{ => core}/theming_component.e2e.ts (89%) rename e2e/{ => core}/user_info_component.e2e.ts (92%) rename e2e/{ => core}/viewer_content_services_component.e2e.ts (95%) create mode 100644 e2e/core/z-finish.e2e.ts rename e2e/{ => insights}/analytics-component.e2e.ts (81%) create mode 100644 e2e/insights/z-finish.e2e.ts delete mode 100644 e2e/login_component.e2e.ts delete mode 100644 e2e/pages/adf/cardViewPage.js create mode 100644 e2e/pages/adf/configEditorPage.ts create mode 100644 e2e/pages/adf/metadataViewPage.js rename e2e/{ => process-services}/apps-section.e2e.ts (87%) rename e2e/{ => process-services}/attach-file-widget.e2e.ts (82%) rename e2e/{ => process-services}/attachment-list-process.e2e.ts (72%) rename e2e/{ => process-services}/empty_process_list_component.e2e.ts (83%) rename e2e/{ => process-services}/form_widgets_component.e2e.ts (93%) rename e2e/{ => process-services}/pagination_processlist_addingProcesses.e2e.ts (86%) rename e2e/{ => process-services}/pagination_tasklist_addingTasks.e2e.ts (86%) rename e2e/{ => process-services}/process_attachmentList_actionMenu.e2e.ts (66%) rename e2e/{ => process-services}/process_filters_component.e2e.ts (83%) rename e2e/{ => process-services}/processlist_pagination.e2e.ts (95%) rename e2e/{ => process-services}/sort_tasklist_pagination.e2e.ts (81%) rename e2e/{ => process-services}/start_process_component.e2e.ts (93%) rename e2e/{ => process-services}/start_task_custom_app.e2e.ts (90%) rename e2e/{ => process-services}/start_task_task_app.e2e.ts (92%) rename e2e/{ => process-services}/task_attachmentList_actionMenu.e2e.ts (62%) rename e2e/{ => process-services}/task_list_pagination.e2e.ts (93%) create mode 100644 e2e/process-services/z-finish.e2e.ts diff --git a/.angular-cli.json b/.angular-cli.json index 33e28149de..a27e42ee73 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -52,6 +52,11 @@ "glob": "pdf.worker.js", "input": "../../node_modules/pdfjs-dist/build", "output": "./" + }, + { + "glob": "**/*", + "input": "../../node_modules/ngx-monaco-editor/assets/monaco", + "output": "./assets/monaco/" } ], "index": "index.html", @@ -159,6 +164,11 @@ "glob": "pdf.worker.js", "input": "../../node_modules/pdfjs-dist/build", "output": "./" + }, + { + "glob": "**/*", + "input": "../../node_modules/ngx-monaco-editor/assets/monaco", + "output": "./assets/monaco/" } ], "index": "index.html", diff --git a/.travis.yml b/.travis.yml index 3514157460..ff2b16bef8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,7 +87,13 @@ jobs: if: tag =~ .*beta.* script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -n alfresco-modeler-app - stage: e2e Test - script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev + script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev -timeout 40000 --folder core + - # Test process-services + script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev -timeout 40000 --folder process-services + - # Test content-services + script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev -timeout 40000 --folder content-services + - # Test insights + script: ./scripts/test-e2e-lib.sh -host localhost:4200 -proxy $E2E_HOST -u $E2E_USERNAME -p $E2E_PASSWORD -e $E2E_EMAIL -b -save -dev -timeout 40000 --folder insights - stage: Deploy PR script: node ./scripts/pr-deploy.js -n $TRAVIS_BUILD_NUMBER -u $RANCHER_TOKEN -p $RANCHER_SECRET -s $REPO_RANCHER --image "docker:$REPO_DOCKER/adf/demo-shell:$TRAVIS_BUILD_NUMBER" --env $ENVIRONMENT_NAME -r $ENVIRONMENT_URL || exit 1 diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index ef357baaf8..7613e086cc 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -73,6 +73,7 @@ "TRASHCAN": "Trashcan", "SOCIAL": "Social", "SETTINGS": "Settings", + "CONFIG-EDITOR": "Config editor", "OVERLAY_VIEWER": "Overlay Viewer", "ABOUT": "About", "SEARCH": "Extended Search", @@ -96,7 +97,7 @@ }, "DOCUMENT_LIST": { "MULTISELECT_CHECKBOXES": "Multiselect (with checkboxes)", - "THUMBNAILS" :"Enable Thumbnails", + "THUMBNAILS": "Enable Thumbnails", "MULTIPLE_FILE_UPLOAD": "Multiple File Upload", "FOLDER_UPLOAD": "Folder upload", "CUSTOM_FILTER": "Custom extensions filter", @@ -189,7 +190,10 @@ "LOGIN": { "CONTENT_SERVICES": "Content Services", "PROCESS_SERVICES": "Process Services", - "LOGIN_FOOTER": "Login footer" + "LOGIN_FOOTER": "Login footer", + "SHOW_REMEMBERME": "Show Remember me", + "SHOW_SUCCESS_ROUTE": "Show success route", + "CUSTOM_LOGO": "Custom Logo" }, "SEARCH": { "RESULTS": "Search results", @@ -215,5 +219,7 @@ "PROCESS_LIST_DEMO": { "APP_ID_REQUIRED_ERROR": "Insert App Id", "APP_ID_TYPE_ERROR": "App Id must be a number" - } + }, + "GROUP-TITLE1-TRANSLATION-KEY": "CUSTOM TITLE TRANSLATION ONE", + "GROUP-TITLE2-TRANSLATION-KEY": "CUSTOM TITLE TRANSLATION TWO" } diff --git a/demo-shell/src/app/app.module.ts b/demo-shell/src/app/app.module.ts index 8501665ed1..d7b0a23487 100644 --- a/demo-shell/src/app/app.module.ts +++ b/demo-shell/src/app/app.module.ts @@ -59,7 +59,9 @@ import { NotificationsComponent } from './components/notifications/notifications import { ReportIssueComponent } from './components/report-issue/report-issue.component'; import { CardViewComponent } from './components/card-view/card-view.component'; import { HeaderDataComponent } from './components/header-data/header-data.component'; +import { ConfigEditorComponent } from './components/config-editor/config-editor.component'; import { HeaderDataService } from './components/header-data/header-data.service'; +import { MonacoEditorModule } from 'ngx-monaco-editor'; @NgModule({ imports: [ @@ -73,7 +75,8 @@ import { HeaderDataService } from './components/header-data/header-data.service' FlexLayoutModule, ChartsModule, HttpClientModule, - AdfModule + AdfModule, + MonacoEditorModule.forRoot() ], declarations: [ AppComponent, @@ -119,7 +122,8 @@ import { HeaderDataService } from './components/header-data/header-data.service' ReportIssueComponent, TaskListDemoComponent, ProcessListDemoComponent, - HeaderDataComponent + HeaderDataComponent, + ConfigEditorComponent ], providers: [ { provide: AppConfigService, useClass: DebugAppConfigService }, // not use this service in production diff --git a/demo-shell/src/app/app.routes.ts b/demo-shell/src/app/app.routes.ts index e387aebfa3..babc45e831 100644 --- a/demo-shell/src/app/app.routes.ts +++ b/demo-shell/src/app/app.routes.ts @@ -56,6 +56,7 @@ import { CardViewComponent } from './components/card-view/card-view.component'; import { ContentNodeSelectorComponent } from './components/content-node-selector/content-node-selector.component'; import { ReportIssueComponent } from './components/report-issue/report-issue.component'; import { HeaderDataComponent } from './components/header-data/header-data.component'; +import { ConfigEditorComponent } from './components/config-editor/config-editor.component'; export const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, @@ -79,6 +80,16 @@ export const appRoutes: Routes = [ } ] }, + { + path: 'config-editor', + component: AppLayoutComponent , + children: [ + { + path: '', + component: ConfigEditorComponent + } + ] + }, { path: 'card-view', component: AppLayoutComponent , diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.html b/demo-shell/src/app/components/app-layout/app-layout.component.html index 6846640d64..4a879e9692 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.html +++ b/demo-shell/src/app/components/app-layout/app-layout.component.html @@ -2,7 +2,7 @@ - +
diff --git a/demo-shell/src/app/components/app-layout/app-layout.component.ts b/demo-shell/src/app/components/app-layout/app-layout.component.ts index d049127f13..b66797c1f6 100644 --- a/demo-shell/src/app/components/app-layout/app-layout.component.ts +++ b/demo-shell/src/app/components/app-layout/app-layout.component.ts @@ -54,6 +54,7 @@ export class AppLayoutComponent implements OnInit { { href: '/tag', icon: 'local_offer', title: 'APP_LAYOUT.TAG' }, { href: '/social', icon: 'thumb_up', title: 'APP_LAYOUT.SOCIAL' }, { href: '/settings-layout', icon: 'settings', title: 'APP_LAYOUT.SETTINGS' }, + { href: '/config-editor', icon: 'code', title: 'APP_LAYOUT.CONFIG-EDITOR' }, { href: '/extendedSearch', icon: 'search', title: 'APP_LAYOUT.SEARCH' }, { href: '/overlay-viewer', icon: 'pageview', title: 'APP_LAYOUT.OVERLAY_VIEWER' }, { href: '/about', icon: 'info_outline', title: 'APP_LAYOUT.ABOUT' } diff --git a/demo-shell/src/app/components/card-view/card-view.component.html b/demo-shell/src/app/components/card-view/card-view.component.html index 253a467f2c..8e88131013 100644 --- a/demo-shell/src/app/components/card-view/card-view.component.html +++ b/demo-shell/src/app/components/card-view/card-view.component.html @@ -14,3 +14,17 @@ + +

+ + Editable + +

+ + + +
diff --git a/demo-shell/src/app/components/card-view/card-view.component.ts b/demo-shell/src/app/components/card-view/card-view.component.ts index 810129d334..ef572432b8 100644 --- a/demo-shell/src/app/components/card-view/card-view.component.ts +++ b/demo-shell/src/app/components/card-view/card-view.component.ts @@ -26,6 +26,7 @@ import { CardViewKeyValuePairsItemModel, CardViewSelectItemModel, CardViewUpdateService, + CardViewMapItemModel, UpdateNotification } from '@alfresco/adf-core'; import { of } from 'rxjs/observable/of'; @@ -38,78 +39,89 @@ export class CardViewComponent implements OnInit { @ViewChild('console') console: ElementRef; + isEditable = true; properties: any; logs: string[]; constructor(private cardViewUpdateService: CardViewUpdateService) { this.logs = []; + this.createCard(); + } + + ngOnInit() { + this.cardViewUpdateService.itemUpdated$.subscribe(this.onItemChange.bind(this)); + } + + createCard() { this.properties = [ new CardViewTextItemModel({ label: 'CardView Text Item', value: 'Spock', key: 'name', - default: 'default bar' , + default: 'default bar', multiline: false, icon: 'icon', - editable: true + editable: this.isEditable }), new CardViewDateItemModel({ label: 'CardView Date Item', - value: new Date(), - key: 'date-of-birth', - default: new Date(), + value: new Date(1983, 11, 24, 10, 0, 30), + key: 'date', + default: new Date(1983, 11, 24, 10, 0, 30), format: 'DD.MM.YYYY', - editable: true + editable: this.isEditable }), new CardViewDatetimeItemModel({ label: 'CardView Datetime Item', - value: new Date(), - key: 'datetime-of-birth', - default: new Date(), + value: new Date(1983, 11, 24, 10, 0, 0), + key: 'datetime', + default: new Date(1983, 11, 24, 10, 0, 0), format: 'DD.MM.YYYY', - editable: true + editable: this.isEditable }), new CardViewBoolItemModel({ label: 'CardView Boolean Item', value: true, - key: 'vulcanian', + key: 'boolean', default: false, - editable: true + editable: this.isEditable }), new CardViewIntItemModel({ label: 'CardView Int Item', value: 213, - key: 'intelligence', + key: 'int', default: 1, - editable: true + editable: this.isEditable }), new CardViewFloatItemModel({ label: 'CardView Float Item', value: 9.9, - key: 'mental-stability', + key: 'float', default: 0.0, - editable: true + editable: this.isEditable }), new CardViewKeyValuePairsItemModel({ label: 'CardView Key-Value Pairs Item', value: [], key: 'key-value-pairs', - editable: true + editable: this.isEditable }), new CardViewSelectItemModel({ label: 'CardView Select Item', value: 'one', options$: of([{ key: 'one', label: 'One' }, { key: 'two', label: 'Two' }]), key: 'select', - editable: true + editable: this.isEditable + }), + new CardViewMapItemModel({ + label: 'My map', + value: new Map([['999', 'My Value']]), + key: 'map', + default: 'default map value' }) ]; } - ngOnInit() { - this.cardViewUpdateService.itemUpdated$.subscribe(this.onItemChange.bind(this)); - } - onItemChange(notification: UpdateNotification) { let value = notification.changed[notification.target.key]; @@ -120,4 +132,15 @@ export class CardViewComponent implements OnInit { this.logs.push(`[${notification.target.label}] - ${value}`); this.console.nativeElement.scrollTop = this.console.nativeElement.scrollHeight; } + + toggleEditable() { + this.isEditable = !this.isEditable; + this.createCard(); + } + + reset() { + this.isEditable = true; + this.createCard(); + this.logs = []; + } } diff --git a/demo-shell/src/app/components/config-editor/config-editor.component.html b/demo-shell/src/app/components/config-editor/config-editor.component.html new file mode 100644 index 0000000000..e39b4ad581 --- /dev/null +++ b/demo-shell/src/app/components/config-editor/config-editor.component.html @@ -0,0 +1,9 @@ + +

Metadata App config editor

+ + + + + + +
diff --git a/demo-shell/src/app/components/config-editor/config-editor.component.scss b/demo-shell/src/app/components/config-editor/config-editor.component.scss new file mode 100644 index 0000000000..096ca654cb --- /dev/null +++ b/demo-shell/src/app/components/config-editor/config-editor.component.scss @@ -0,0 +1,3 @@ +.adf-metadata-editor { + height: 300px; +} diff --git a/demo-shell/src/app/components/config-editor/config-editor.component.ts b/demo-shell/src/app/components/config-editor/config-editor.component.ts new file mode 100644 index 0000000000..c73514121e --- /dev/null +++ b/demo-shell/src/app/components/config-editor/config-editor.component.ts @@ -0,0 +1,65 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component } from '@angular/core'; +import { AppConfigService, NotificationService } from '@alfresco/adf-core'; + +@Component({ + selector: 'app-config-editor', + templateUrl: 'config-editor.component.html', + styleUrls: ['./config-editor.component.scss'] +}) +export class ConfigEditorComponent { + + editor: any; + + editorOptions = { + theme: 'vs-dark', + language: 'json', + autoIndent: true, + formatOnPaste: true, + formatOnType: true + }; + + metadataConf: string; + + onInitMetadata(editor) { + this.editor = editor; + setTimeout(() => { + this.editor.getAction('editor.action.formatDocument').run(); + }, 1000); + } + + constructor(private appConfig: AppConfigService, private notificationService: NotificationService) { + this.metadataConf = JSON.stringify(appConfig.config['content-metadata']); + } + + onSaveMetadata() { + try { + this.appConfig.config['content-metadata'] = JSON.parse(this.editor.getValue()); + } catch (error) { + this.notificationService.openSnackMessage( + 'Wrong metadata configuration', + 4000 + ); + } + } + + onClearMetadata() { + this.metadataConf = ''; + } +} diff --git a/demo-shell/src/app/components/file-view/file-view.component.html b/demo-shell/src/app/components/file-view/file-view.component.html index 1c3feb0e14..91997892c5 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.html +++ b/demo-shell/src/app/components/file-view/file-view.component.html @@ -7,7 +7,70 @@ - + + + + +

+ + Display Empty Metadata + +

+ +

+ + multi accordion + +

+ +

+ + Editable + +

+ +

+ + Custom preset + +

+

+ + + + + + + + +

+
diff --git a/demo-shell/src/app/components/file-view/file-view.component.ts b/demo-shell/src/app/components/file-view/file-view.component.ts index 1d31827592..88e451661f 100644 --- a/demo-shell/src/app/components/file-view/file-view.component.ts +++ b/demo-shell/src/app/components/file-view/file-view.component.ts @@ -29,6 +29,11 @@ import { MatSnackBar } from '@angular/material'; export class FileViewComponent implements OnInit { nodeId: string = null; + displayEmptyMetadata = false; + multi = false; + isReadOnly = false; + isPreset = false; + customPreset: string = null; constructor(private router: Router, private route: ActivatedRoute, @@ -58,4 +63,30 @@ export class FileViewComponent implements OnInit { onUploadError(errorMessage: string) { this.snackBar.open(errorMessage, '', { duration: 4000 }); } + + toggleEmptyMetadata() { + this.displayEmptyMetadata = !this.displayEmptyMetadata; + } + + toggleMulti() { + this.multi = !this.multi; + } + + toggleReadOnly() { + this.isReadOnly = !this.isReadOnly; + } + + togglePreset() { + this.isPreset = !this.isPreset; + if (!this.isPreset) { + this.customPreset = null; + } + } + + applyCustomPreset() { + this.isPreset = false; + setTimeout(() => { + this.isPreset = true; + }, 100); + } } diff --git a/demo-shell/src/app/components/files/files.component.html b/demo-shell/src/app/components/files/files.component.html index 2506dac4ae..e7b4ed4433 100644 --- a/demo-shell/src/app/components/files/files.component.html +++ b/demo-shell/src/app/components/files/files.component.html @@ -33,7 +33,7 @@ -
+
+ + - - { this.supportedPages = pages; }); + + this.alfrescoApiService.nodeUpdated.subscribe(() => { + this.documentList.reload(); + }); } showFile(event) { diff --git a/demo-shell/src/app/components/login/login.component.html b/demo-shell/src/app/components/login/login.component.html index c35993cc39..721ad9cd9a 100644 --- a/demo-shell/src/app/components/login/login.component.html +++ b/demo-shell/src/app/components/login/login.component.html @@ -19,6 +19,55 @@ {{ 'LOGIN.LOGIN_FOOTER'| translate }}

+

+ + {{ 'LOGIN.SHOW_REMEMBERME'| translate }} + +

+

+ + {{ 'LOGIN.SHOW_SUCCESS_ROUTE'| translate }} + +

+

+ + + + + +

+ +

+ +

+

+ + + + + +

+
@@ -29,10 +78,12 @@

- +
diff --git a/demo-shell/src/app/components/login/login.component.ts b/demo-shell/src/app/components/login/login.component.ts index 909cacdc99..c8cbbbd0a1 100644 --- a/demo-shell/src/app/components/login/login.component.ts +++ b/demo-shell/src/app/components/login/login.component.ts @@ -31,9 +31,14 @@ export class LoginComponent implements OnInit { alfrescologin: any; customValidation: any; + customSuccessRouteURI = ''; + customLogoImageURL = './assets/images/alfresco-logo.svg'; disableCsrf = false; showFooter = true; + showRememberMe = true; + customSuccessRoute = false; + customLogoImage = false; customMinLength = 2; constructor(private router: Router, @@ -46,7 +51,7 @@ export class LoginComponent implements OnInit { ngOnInit() { this.alfrescologin.addCustomValidationError('username', 'required', 'LOGIN.MESSAGES.USERNAME-REQUIRED'); - this.alfrescologin.addCustomValidationError('username', 'minlength', 'LOGIN.MESSAGES.USERNAME-MIN', {minLength: this.customMinLength}); + this.alfrescologin.addCustomValidationError('username', 'minlength', 'LOGIN.MESSAGES.USERNAME-MIN', { minLength: this.customMinLength }); this.alfrescologin.addCustomValidationError('password', 'required', 'LOGIN.MESSAGES.PASSWORD-REQUIRED'); } @@ -66,6 +71,24 @@ export class LoginComponent implements OnInit { this.showFooter = !this.showFooter; } + toggleRemamberme() { + this.showRememberMe = !this.showRememberMe; + } + + toggleSuccessRoute() { + this.customSuccessRoute = !this.customSuccessRoute; + if (!this.customSuccessRoute) { + this.customSuccessRouteURI = null; + } + } + + toggleLogo() { + this.customLogoImage = !this.customLogoImage; + if (!this.customLogoImage) { + this.customLogoImageURL = null; + } + } + checkForm(event: any) { const values = event.values; this.logService.log(values); diff --git a/docs/content-services/content-metadata.component.md b/docs/content-services/content-metadata.component.md index 211bb979ce..04d593dd1f 100644 --- a/docs/content-services/content-metadata.component.md +++ b/docs/content-services/content-metadata.component.md @@ -29,7 +29,7 @@ Displays and edits metadata related to a node. | displayEmpty | `boolean` | false | Toggles whether to display empty values in the card view | | editable | `boolean` | false | Toggles whether the edit button should be shown | | expanded | `boolean` | false | Toggles between expanded (ie, full information) and collapsed (ie, reduced information) in the display | -| multi | `boolean` | false | The multi parameter of the underlying material expansion panel | +| multi | `boolean` | false | The multi parameter of the underlying material expansion panel, set to true to allow multi accordion to be expanded at the same time | | node | [`MinimalNodeEntryEntity`](../content-services/document-library.model.md) | | (required) The node entity to fetch metadata about | | preset | `string` | | Name of the metadata preset, which defines aspects and their properties | diff --git a/e2e/actions/APS/apps.actions.ts b/e2e/actions/APS/apps.actions.ts index 60fba5cf1d..be66a2b308 100644 --- a/e2e/actions/APS/apps.actions.ts +++ b/e2e/actions/APS/apps.actions.ts @@ -14,7 +14,7 @@ export class AppsActions { let publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish()); - let published = await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); + await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); return appCreated; } @@ -23,7 +23,7 @@ export class AppsActions { let publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appId, new AppPublish()); - let published = await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); + await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); return publishApp; } @@ -37,7 +37,7 @@ export class AppsActions { let publishApp = await alfrescoJsApi.activiti.appsApi.publishAppDefinition(appCreated.id, new AppPublish()); - let published = await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); + await alfrescoJsApi.activiti.appsApi.deployAppDefinitions({ appDefinitions: [{ id: publishApp.appDefinition.id }] }); return appCreated; } diff --git a/e2e/actions/APS/models.actions.ts b/e2e/actions/APS/models.actions.ts index f7b9a1b937..221db10156 100644 --- a/e2e/actions/APS/models.actions.ts +++ b/e2e/actions/APS/models.actions.ts @@ -5,16 +5,12 @@ export class ModelsActions { async deleteVersionModel(alfrescoJsApi, modelId) { - let versionModelDeleted = await alfrescoJsApi.activiti.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp : true }); - - return versionModelDeleted; + return await alfrescoJsApi.activiti.modelsApi.deleteModel(modelId, { cascade: false, deleteRuntimeApp : true }); } async deleteEntireModel(alfrescoJsApi, modelId) { - let modelDeleted = await alfrescoJsApi.activiti.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp : true }); - - return modelDeleted; + return await alfrescoJsApi.activiti.modelsApi.deleteModel(modelId, { cascade: true, deleteRuntimeApp : true }); } } diff --git a/e2e/card-view-component.e2e.ts b/e2e/card-view-component.e2e.ts deleted file mode 100644 index 1b83518bd5..0000000000 --- a/e2e/card-view-component.e2e.ts +++ /dev/null @@ -1,103 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - import LoginPage = require('./pages/adf/loginPage'); - import NavigationBarPage = require('./pages/adf/navigationBarPage'); - import TestConfig = require('./test.config'); - import resources = require('./util/resources'); - import AlfrescoApi = require('alfresco-js-api-node'); - import { UsersActions } from './actions/users.actions'; - import { AppsActions } from './actions/APS/apps.actions'; - import CardViewPageComponent = require('./pages/adf/cardViewPageComponent'); - import Util = require('./util/util'); - - describe('CardView Component', () => { - const loginPage = new LoginPage(); - const navigationBarPage = new NavigationBarPage(); - const cardViewPageComponent = new CardViewPageComponent(); - const app = resources.Files.APP_WITH_PROCESSES; - - beforeAll(async (done) => { - const apps = new AppsActions(); - const users = new UsersActions(); - - this.alfrescoJsApi = new AlfrescoApi({ - provider: 'BPM', - hostBpm: TestConfig.adf.url - }); - - await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); - - let user = await users.createTenantAndUser(this.alfrescoJsApi); - - await this.alfrescoJsApi.login(user.email, user.password); - - await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); - - loginPage.loginToProcessServicesUsingUserModel(user); - - done(); - }); - - beforeEach(() => { - Util.refreshBrowser(); - }); - - it('[C279898] Register pairs values', () => { - navigationBarPage.clickCardViewButton(); - cardViewPageComponent.clickOnAddButton(); - cardViewPageComponent.setName('testName'); - cardViewPageComponent.setValue('testValue'); - cardViewPageComponent.clickOnAddButton(); - cardViewPageComponent.waitForOutput(); - expect(cardViewPageComponent.getOutputText(0)) - .toBe('[CardView Key-Value Pairs Item] - [{"name":"testName","value":"testValue"}]'); - - }); - - it('[C279898] Delete pairs values', () => { - navigationBarPage.clickCardViewButton(); - cardViewPageComponent.clickOnAddButton(); - cardViewPageComponent.setName('testName'); - cardViewPageComponent.setValue('testValue'); - cardViewPageComponent.clickOnAddButton(); - cardViewPageComponent.waitForOutput(); - expect(cardViewPageComponent.getOutputText(0)) - .toBe('[CardView Key-Value Pairs Item] - [{"name":"testName","value":"testValue"}]'); - cardViewPageComponent.deletePairsValues(); - expect(cardViewPageComponent.getOutputText(1)) - .toBe('[CardView Key-Value Pairs Item] - []'); - cardViewPageComponent.checkNameAndValueVisibility(0); - }); - - it('[C279899] Check default value ', () => { - navigationBarPage.clickCardViewButton(); - cardViewPageComponent.clickComboBox(); - expect(cardViewPageComponent.getSelectionValue()).toBe('One'); - - }); - - it('[C279899] Select combobox values', () => { - navigationBarPage.clickCardViewButton(); - cardViewPageComponent.clickComboBox(); - cardViewPageComponent.selectValueFromComboBox(1); - expect(cardViewPageComponent.getOutputText(0)) - .toBe('[CardView Select Item] - two'); - - }); - - }); diff --git a/e2e/card-view-smoke-tests.e2e.ts b/e2e/card-view-smoke-tests.e2e.ts deleted file mode 100644 index c41774b3ea..0000000000 --- a/e2e/card-view-smoke-tests.e2e.ts +++ /dev/null @@ -1,139 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import AdfViewerPage = require('./pages/adf/viewerPage'); - -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FileModel = require('./models/ACS/fileModel'); - -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import dateFormat = require('dateformat'); -import CONSTANTS = require('./util/constants'); - -import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; - -describe('Metadata component', () => { - - let loginPage = new LoginPage(); - let contentServicesPage = new ContentServicesPage(); - let adfViewerPage = new AdfViewerPage(); - let cardViewPage; - - let acsUser = new AcsUserModel(); - - let pdfFileModel = new FileModel({ - 'name': resources.Files.ADF_DOCUMENTS.PDF_ALL.file_name, - 'location': resources.Files.ADF_DOCUMENTS.PDF_ALL.file_location - }); - - beforeAll(async (done) => { - - let uploadActions = new UploadActions(); - - this.alfrescoJsApi = new AlfrescoApi({ - provider: 'ECM', - hostEcm: TestConfig.adf.url - }); - - await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); - - await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser); - - await this.alfrescoJsApi.login(acsUser.id, acsUser.password); - - let pdfUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFileModel.location, pdfFileModel.name, '-my-'); - - Object.assign(pdfFileModel, pdfUploadedFile.entry); - - pdfFileModel.update( pdfUploadedFile.entry); - - loginPage.loginToContentServicesUsingUserModel(acsUser); - - done(); - }); - - it('Properties', () => { - contentServicesPage.navigateToDocumentList(); - adfViewerPage.viewFile(pdfFileModel.name); - - cardViewPage = adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsDisplayed(); - cardViewPage.clickOnPropertiesTab(); - - expect(cardViewPage.getTitle()).toEqual(CONSTANTS.METADATA.TITLE); - expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.PROPERTY_TAB); - expect(cardViewPage.getExpandedAspectName()).toEqual(CONSTANTS.METADATA.DEFAULT_ASPECT); - expect(cardViewPage.getName()).toEqual(pdfFileModel.name); - expect(cardViewPage.getCreator()).toEqual(pdfFileModel.getCreatedByUser().displayName); - expect(cardViewPage.getCreatedDate()).toEqual(dateFormat(pdfFileModel.createdAt, CONSTANTS.METADATA.DATAFORMAT)); - expect(cardViewPage.getModifier()).toEqual(pdfFileModel.getCreatedByUser().displayName); - expect(cardViewPage.getModifiedDate()).toEqual(dateFormat(pdfFileModel.createdAt, CONSTANTS.METADATA.DATAFORMAT)); - expect(cardViewPage.getMimetypeName()).toEqual(pdfFileModel.getContent().mimeTypeName); - expect(cardViewPage.getSize()).toEqual(pdfFileModel.getContent().getSizeInBytes()); - expect(cardViewPage.getAuthor()).toEqual(pdfFileModel.properties['cm:author']); - - cardViewPage.editIconIsDisplayed(); - cardViewPage.informationButtonIsDisplayed(); - expect(cardViewPage.getInformationButtonText()).toEqual(CONSTANTS.METADATA.MORE_INFO_BUTTON); - expect(cardViewPage.getInformationIconText()).toEqual(CONSTANTS.METADATA.ARROW_DOWN); - }); - - it('Information button', () => { - contentServicesPage.navigateToDocumentList(); - adfViewerPage.viewFile(pdfFileModel.name); - cardViewPage = adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsDisplayed(); - cardViewPage.clickOnPropertiesTab(); - cardViewPage.informationButtonIsDisplayed(); - cardViewPage.clickOnInformationButton(); - expect(cardViewPage.getInformationButtonText()).toEqual(CONSTANTS.METADATA.LESS_INFO_BUTTON); - expect(cardViewPage.getInformationIconText()).toEqual(CONSTANTS.METADATA.ARROW_UP); - }); - - it('Versions', () => { - contentServicesPage.navigateToDocumentList(); - adfViewerPage.viewFile(pdfFileModel.name); - cardViewPage = adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsDisplayed(); - cardViewPage.clickOnVersionsTab().checkUploadVersionsButtonIsDisplayed(); - expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.VERSIONS_TAB); - cardViewPage.checkVersionIsDisplayed(pdfFileModel.name); - }); - - it('Info icon', () => { - contentServicesPage.navigateToDocumentList(); - adfViewerPage.viewFile(pdfFileModel.name); - cardViewPage = adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsDisplayed(); - cardViewPage.clickOnVersionsTab().checkUploadVersionsButtonIsDisplayed(); - expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.VERSIONS_TAB); - cardViewPage.clickOnPropertiesTab().informationButtonIsDisplayed(); - adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsNotDisplayed(); - adfViewerPage.clickInfoButton(); - adfViewerPage.checkInfoSideBarIsDisplayed(); - expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.COMMENTS_TAB); - cardViewPage.clickOnPropertiesTab(); - expect(cardViewPage.getActiveTab()).toEqual(CONSTANTS.METADATA.PROPERTY_TAB); - expect(cardViewPage.getEditIconTooltip()).toEqual(CONSTANTS.METADATA.EDIT_BUTTON_TOOLTIP); - }); - -}); diff --git a/e2e/document_list_component.e2e.ts b/e2e/content-services/document_list_component.e2e.ts similarity index 91% rename from e2e/document_list_component.e2e.ts rename to e2e/content-services/document_list_component.e2e.ts index 1a7f737d48..a3d3485cf2 100644 --- a/e2e/document_list_component.e2e.ts +++ b/e2e/content-services/document_list_component.e2e.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FileModel = require('./models/ACS/fileModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FileModel = require('../models/ACS/fileModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('DocumentList component', () => { @@ -48,7 +48,7 @@ describe('DocumentList component', () => { let folderTwoModel = new FolderModel({ 'name': 'folderTwo' + Util.generateRandomString() }); let uploadedFolder; - let rootFolder = 'APP.PERSONAL-FILES', userHomes = 'User Homes', rootFolderName = 'Personal Files'; + let rootFolder = 'APP.PERSONAL-FILES', rootFolderName = 'Personal Files'; let fileNames = [], adminFileNames = [], nrOfFiles = 15, adminNrOfFiles = 5; let files = { @@ -159,7 +159,8 @@ describe('DocumentList component', () => { expect(contentServicesPage.getCurrentFolderID()).toContain(uploadedFolder.entry.id); - Util.refreshBrowser(); + browser.refresh(); + expect(contentServicesPage.getActiveBreadcrumb()).toEqual(uploadedFolder.entry.name); expect(contentServicesPage.getCurrentFolderID()).toContain(uploadedFolder.entry.id); }); diff --git a/e2e/document_list_pagination.e2e.ts b/e2e/content-services/document_list_pagination.e2e.ts similarity index 97% rename from e2e/document_list_pagination.e2e.ts rename to e2e/content-services/document_list_pagination.e2e.ts index c327e7c5da..390243fe5c 100644 --- a/e2e/document_list_pagination.e2e.ts +++ b/e2e/content-services/document_list_pagination.e2e.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import PaginationPage = require('./pages/adf/paginationPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); +import PaginationPage = require('../pages/adf/paginationPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Document List - Pagination', function () { let pagination = { diff --git a/e2e/search_component.e2e.ts b/e2e/content-services/search_component.e2e.ts similarity index 61% rename from e2e/search_component.e2e.ts rename to e2e/content-services/search_component.e2e.ts index 8cf325193c..7377d8731d 100644 --- a/e2e/search_component.e2e.ts +++ b/e2e/content-services/search_component.e2e.ts @@ -15,22 +15,22 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import SearchDialog = require('./pages/adf/dialog/searchDialog'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import filePreviewPage = require('./pages/adf/filePreviewPage'); -import SearchResultPage = require('./pages/adf/searchResultsPage'); +import LoginPage = require('../pages/adf/loginPage'); +import SearchDialog = require('../pages/adf/dialog/searchDialog'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); +import filePreviewPage = require('../pages/adf/filePreviewPage'); +import SearchResultPage = require('../pages/adf/searchResultsPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FileModel = require('./models/ACS/fileModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FileModel = require('../models/ACS/fileModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Search component - Search Bar', () => { @@ -39,11 +39,7 @@ describe('Search component - Search Bar', () => { firstChar: 'x', secondChar: 'y', thirdChar: 'z', - name: Util.generateRandomString() - }, - active: { - base: 'newFile', - extension: '.txt' + name: 'impossible-name-folder' + Util.generateRandomString(8) } }; @@ -53,16 +49,25 @@ describe('Search component - Search Bar', () => { let searchResultPage = new SearchResultPage(); let acsUser = new AcsUserModel(); + + let filename = Util.generateRandomString(16); + let firstFolderName = Util.generateRandomString(16); + let secondFolderName = Util.generateRandomString(16); + let thirdFolderName = Util.generateRandomString(16); + let firstFileModel = new FileModel({ - 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name, - 'shortName': resources.Files.ADF_DOCUMENTS.PDF.short_file_name + 'name': filename, 'shortName': filename.substring(0, 8) }); - let randomPrefix = Util.generateRandomString(); - - let firstFolderModel = new FolderModel({ 'name': randomPrefix + 'folderOne', 'shortName': randomPrefix }); - let secondFolder = new FolderModel({ 'name': 'nameFolderOne', 'shortName': 'name' }); - let thirdFolder = new FolderModel({ 'name': 'nameFolderTwo' }); + let firstFolderModel = new FolderModel({ + 'name': firstFolderName, 'shortName': firstFolderName.substring(0, 8) + }); + let secondFolder = new FolderModel({ + 'name': secondFolderName, 'shortName': secondFolderName.substring(0, 8) + }); + let thirdFolder = new FolderModel({ + 'name': thirdFolderName, 'shortName': thirdFolderName.substring(0, 8) + }); beforeAll(async (done) => { let uploadActions = new UploadActions(); @@ -85,6 +90,8 @@ describe('Search component - Search Bar', () => { await uploadActions.uploadFolder(this.alfrescoJsApi, secondFolder.name, '-my-'); await uploadActions.uploadFolder(this.alfrescoJsApi, thirdFolder.name, '-my-'); + await browser.driver.sleep(5000); // wait search index previous file/folder uploaded + loginPage.loginToContentServicesUsingUserModel(acsUser); contentServicesPage.goToDocumentList(); @@ -125,29 +132,21 @@ describe('Search component - Search Bar', () => { searchDialog.resultTableContainsRow(firstFolderModel.name); - searchDialog.getSpecificRowsHighlightName(firstFolderModel.name).then((text) => { - expect(text).toEqual(firstFolderModel.shortName); - }); - searchDialog.getSpecificRowsAuthor(firstFolderModel.name).then((text) => { - expect(text).toEqual(acsUser.firstName + ' ' + acsUser.lastName); - }); - searchDialog.getSpecificRowsCompleteName(firstFolderModel.name).then((text) => { - expect(text).toEqual(firstFolderModel.name); - }); + expect(searchDialog.getSpecificRowsHighlightName(firstFolderModel.name)).toEqual(firstFolderModel.shortName); + expect(searchDialog.getSpecificRowsAuthor(firstFolderModel.name)).toEqual(acsUser.firstName + ' ' + acsUser.lastName); + expect(searchDialog.getSpecificRowsCompleteName(firstFolderModel.name)).toEqual(firstFolderModel.name); + searchDialog.clearText(); searchDialog.checkSearchBarIsNotVisible(); searchDialog.clickOnSearchIcon().enterText(firstFileModel.shortName); searchDialog.resultTableContainsRow(firstFileModel.name); - searchDialog.getSpecificRowsHighlightName(firstFileModel.name).then((text) => { - expect(text).toEqual(firstFileModel.shortName); - }); - searchDialog.getSpecificRowsAuthor(firstFileModel.name).then((text) => { - expect(text).toEqual(acsUser.firstName + ' ' + acsUser.lastName); - }); - searchDialog.getSpecificRowsCompleteName(firstFileModel.name).then((text) => { - expect(text).toEqual(firstFileModel.name); - }); + + expect(searchDialog.getSpecificRowsHighlightName(firstFileModel.name)).toEqual(firstFileModel.shortName); + expect(searchDialog.getSpecificRowsAuthor(firstFileModel.name)).toEqual(acsUser.firstName + ' ' + acsUser.lastName); + + expect(searchDialog.getSpecificRowsCompleteName(firstFileModel.name)).toEqual(firstFileModel.name); + searchDialog.clearText(); searchDialog.checkSearchBarIsNotVisible(); }); @@ -156,29 +155,20 @@ describe('Search component - Search Bar', () => { contentServicesPage.goToDocumentList(); searchDialog.clickOnSearchIcon().checkSearchBarIsVisible().enterText(firstFolderModel.name); searchDialog.resultTableContainsRow(firstFolderModel.name); - searchDialog.getSpecificRowsHighlightName(firstFolderModel.name).then((text) => { - expect(text).toEqual(firstFolderModel.name); - }); - searchDialog.getSpecificRowsAuthor(firstFolderModel.name).then((text) => { - expect(text).toEqual(acsUser.firstName + ' ' + acsUser.lastName); - }); - searchDialog.getSpecificRowsCompleteName(firstFolderModel.name).then((text) => { - expect(text).toEqual(firstFolderModel.name); - }); + + expect(searchDialog.getSpecificRowsHighlightName(firstFolderModel.name)).toEqual(firstFolderModel.name); + expect(searchDialog.getSpecificRowsAuthor(firstFolderModel.name)).toEqual(acsUser.firstName + ' ' + acsUser.lastName); + expect(searchDialog.getSpecificRowsCompleteName(firstFolderModel.name)).toEqual(firstFolderModel.name); + searchDialog.clearText(); searchDialog.checkSearchBarIsNotVisible(); searchDialog.clickOnSearchIcon().enterText(firstFileModel.name); searchDialog.resultTableContainsRow(firstFileModel.name); - searchDialog.getSpecificRowsHighlightName(firstFileModel.name).then((text) => { - expect(text).toEqual(firstFileModel.name); - }); - searchDialog.getSpecificRowsAuthor(firstFileModel.name).then((text) => { - expect(text).toEqual(acsUser.firstName + ' ' + acsUser.lastName); - }); - searchDialog.getSpecificRowsCompleteName(firstFileModel.name).then((text) => { - expect(text).toEqual(firstFileModel.name); - }); + + expect(searchDialog.getSpecificRowsHighlightName(firstFileModel.name)).toEqual(firstFileModel.name); + expect(searchDialog.getSpecificRowsAuthor(firstFileModel.name)).toEqual(acsUser.firstName + ' ' + acsUser.lastName); + expect(searchDialog.getSpecificRowsCompleteName(firstFileModel.name)).toEqual(firstFileModel.name); searchDialog.clearText(); searchDialog.checkSearchBarIsNotVisible(); @@ -189,17 +179,16 @@ describe('Search component - Search Bar', () => { searchDialog.resultTableContainsRow(firstFolderModel.name); searchDialog.clickOnSpecificRow(firstFolderModel.name); contentServicesPage.checkAcsContainer().waitForTableBody(); - contentServicesPage.currentFolderName().then((result) => { - expect(result).toEqual(firstFolderModel.name); - }); + + expect(contentServicesPage.currentFolderName()).toEqual(firstFolderModel.name); + contentServicesPage.goToDocumentList(); searchDialog.checkSearchIconIsVisible().clickOnSearchIcon().checkSearchBarIsVisible(); searchDialog.enterText(firstFileModel.name).resultTableContainsRow(firstFileModel.name); searchDialog.clickOnSpecificRow(firstFileModel.name); - filePreviewPage.getPDFTitleFromSearch().then((title) => { - expect(title).toEqual(firstFileModel.name); - }); + expect(filePreviewPage.getPDFTitleFromSearch()).toEqual(firstFileModel.name); + filePreviewPage.closePreviewWithButton(); }); @@ -223,29 +212,26 @@ describe('Search component - Search Bar', () => { searchResultPage.checkContentIsDisplayed(firstFileModel.name); }); - it('10. A folder is selected from search bar using arrows', () => { + xit('10. A folder is selected from search bar using arrows', () => { contentServicesPage.goToDocumentList(); - searchDialog.clickOnSearchIcon().enterText(secondFolder.shortName); - searchDialog.resultTableContainsRow(secondFolder.name).resultTableContainsRow(thirdFolder.name); - - let names = []; - searchDialog.getAllRowsValues().then((array) => { - names = array; - }); - Util.pressDownArrowAndEnter(); + searchDialog + .clickOnSearchIcon() + .enterText(secondFolder.shortName) + .pressDownArrowAndEnter(); contentServicesPage.checkAcsContainer(); - contentServicesPage.currentFolderName().then((result) => { - expect(result).toEqual(names[0]); - }); + expect(contentServicesPage.currentFolderName()).toEqual(secondFolder.name); }); xit('11. The search bar gets closed when clicking on another browser tab', () => { contentServicesPage.goToDocumentList(); - searchDialog.clickOnSearchIcon().enterText(secondFolder.shortName); - searchDialog.resultTableContainsRow(secondFolder.name).resultTableContainsRow(thirdFolder.name); + searchDialog + .clickOnSearchIcon() + .enterText(secondFolder.shortName); + + searchDialog.resultTableContainsRow(secondFolder.name); Util.openNewTabInBrowser(); Util.switchToWindowHandler(0); diff --git a/e2e/search_page_component.e2e.ts b/e2e/content-services/search_page_component.e2e.ts similarity index 94% rename from e2e/search_page_component.e2e.ts rename to e2e/content-services/search_page_component.e2e.ts index 55efa39e82..2c644916cd 100644 --- a/e2e/search_page_component.e2e.ts +++ b/e2e/content-services/search_page_component.e2e.ts @@ -15,22 +15,22 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import SearchDialog = require('./pages/adf/dialog/searchDialog'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import SearchResultPage = require('./pages/adf/searchResultsPage'); -import filePreviewPage = require('./pages/adf/filePreviewPage'); +import LoginPage = require('../pages/adf/loginPage'); +import SearchDialog = require('../pages/adf/dialog/searchDialog'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); +import SearchResultPage = require('../pages/adf/searchResultsPage'); +import filePreviewPage = require('../pages/adf/filePreviewPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FolderModel = require('./models/ACS/folderModel'); -import FileModel = require('./models/ACS/fileModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FolderModel = require('../models/ACS/folderModel'); +import FileModel = require('../models/ACS/fileModel'); -import TestConfig = require('./test.config'); -import Util = require('./util/util'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import Util = require('../util/util'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Search component - Search Page', () => { let search = { diff --git a/e2e/tag_component.e2e.ts b/e2e/content-services/tag_component.e2e.ts similarity index 88% rename from e2e/tag_component.e2e.ts rename to e2e/content-services/tag_component.e2e.ts index 736b35bd1c..5772ed7e4b 100644 --- a/e2e/tag_component.e2e.ts +++ b/e2e/content-services/tag_component.e2e.ts @@ -15,18 +15,20 @@ * limitations under the License. */ -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FileModel = require('./models/ACS/fileModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FileModel = require('../models/ACS/fileModel'); -import LoginPage = require('./pages/adf/loginPage'); -import TagPage = require('./pages/adf/tagPage'); +import LoginPage = require('../pages/adf/loginPage'); +import TagPage = require('../pages/adf/tagPage'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; + +import Util = require('../util/util'); describe('Tag component', () => { @@ -35,7 +37,7 @@ describe('Tag component', () => { let acsUser = new AcsUserModel(); let pdfFileModel = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name }); - let deleteFile = new FileModel({ 'name': 'deleteFile.id' }); + let deleteFile = new FileModel({ 'name': Util.generateRandomString() }); let sameTag = Util.generateRandomStringToLowerCase(); let tagList = [Util.generateRandomStringToLowerCase(), Util.generateRandomStringToLowerCase()]; let uppercaseTag = Util.generateRandomStringToUpperCase(); @@ -143,7 +145,7 @@ describe('Tag component', () => { tagPage.checkTagIsDisplayedInTagList(deleteTag.toLowerCase()); tagPage.checkTagIsDisplayedInTagListByNodeId(deleteTag.toLowerCase()); - tagPage.deleteTagFromTagListByNodeId(); + tagPage.deleteTagFromTagListByNodeId(deleteTag.toLowerCase()); tagPage.checkTagIsNotDisplayedInTagList(deleteTag.toLowerCase()); tagPage.checkTagIsNotDisplayedInTagListByNodeId(deleteTag.toLowerCase()); @@ -155,7 +157,7 @@ describe('Tag component', () => { tagPage.checkTagIsDisplayedInTagList(deleteTag.toLowerCase()); tagPage.checkTagIsDisplayedInTagListByNodeId(deleteTag.toLowerCase()); - tagPage.deleteTagFromTagList(); + tagPage.deleteTagFromTagList(deleteTag.toLowerCase()); tagPage.checkTagIsNotDisplayedInTagList(deleteTag.toLowerCase()); tagPage.checkTagIsNotDisplayedInTagListByNodeId(deleteTag.toLowerCase()); diff --git a/e2e/trashcan_pagination.e2e.ts b/e2e/content-services/trashcan_pagination.e2e.ts similarity index 91% rename from e2e/trashcan_pagination.e2e.ts rename to e2e/content-services/trashcan_pagination.e2e.ts index c0fb978d12..c32a1c15e3 100644 --- a/e2e/trashcan_pagination.e2e.ts +++ b/e2e/content-services/trashcan_pagination.e2e.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import TrashcanPage = require('./pages/adf/trashcanPage'); -import PaginationPage = require('./pages/adf/paginationPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import TrashcanPage = require('../pages/adf/trashcanPage'); +import PaginationPage = require('../pages/adf/paginationPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Trashcan - Pagination', () => { let pagination = { diff --git a/e2e/upload/excluded_file.e2e.ts b/e2e/content-services/upload/excluded_file.e2e.ts similarity index 77% rename from e2e/upload/excluded_file.e2e.ts rename to e2e/content-services/upload/excluded_file.e2e.ts index ad21aeea84..97735da793 100644 --- a/e2e/upload/excluded_file.e2e.ts +++ b/e2e/content-services/upload/excluded_file.e2e.ts @@ -15,21 +15,20 @@ * limitations under the License. */ -import LoginPage = require('../pages/adf/loginPage'); -import ContentServicesPage = require('../pages/adf/contentServicesPage'); -import UploadDialog = require('../pages/adf/dialog/uploadDialog'); -import UploadToggles = require('../pages/adf/dialog/uploadToggles'); +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import UploadDialog = require('../../pages/adf/dialog/uploadDialog'); +import UploadToggles = require('../../pages/adf/dialog/uploadToggles'); -import AcsUserModel = require('../models/ACS/acsUserModel'); -import FileModel = require('../models/ACS/fileModel'); -import FolderModel = require('../models/ACS/folderModel'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); +import FolderModel = require('../../models/ACS/folderModel'); -import TestConfig = require('../test.config'); -import resources = require('../util/resources'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from '../actions/ACS/upload.actions'; -import { DropActions } from '../actions/drop.actions'; +import { DropActions } from '../../actions/drop.actions'; import path = require('path'); @@ -51,14 +50,7 @@ describe('Upload component - Excluded Files', () => { 'location': resources.Files.ADF_DOCUMENTS.FOLDER_EXCLUDED.folder_location }); - let emptyFile = new FileModel({ - 'name': resources.Files.ADF_DOCUMENTS.TXT_0B.file_name, - 'location': resources.Files.ADF_DOCUMENTS.TXT_0B.file_location - }); - beforeAll(async (done) => { - let uploadActions = new UploadActions(); - this.alfrescoJsApi = new AlfrescoApi({ provider: 'ECM', hostEcm: TestConfig.adf.url diff --git a/e2e/upload/uploader_component.e2e.ts b/e2e/content-services/upload/uploader_component.e2e.ts similarity index 96% rename from e2e/upload/uploader_component.e2e.ts rename to e2e/content-services/upload/uploader_component.e2e.ts index e291209e9d..0a40cf28f9 100644 --- a/e2e/upload/uploader_component.e2e.ts +++ b/e2e/content-services/upload/uploader_component.e2e.ts @@ -15,21 +15,21 @@ * limitations under the License. */ -import LoginPage = require('../pages/adf/loginPage'); -import ContentServicesPage = require('../pages/adf/contentServicesPage'); -import UploadDialog = require('../pages/adf/dialog/uploadDialog'); -import UploadToggles = require('../pages/adf/dialog/uploadToggles'); +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import UploadDialog = require('../../pages/adf/dialog/uploadDialog'); +import UploadToggles = require('../../pages/adf/dialog/uploadToggles'); -import AcsUserModel = require('../models/ACS/acsUserModel'); -import FileModel = require('../models/ACS/fileModel'); -import FolderModel = require('../models/ACS/folderModel'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); +import FolderModel = require('../../models/ACS/folderModel'); -import TestConfig = require('../test.config'); -import resources = require('../util/resources'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from '../actions/ACS/upload.actions'; -import { DropActions } from '../actions/drop.actions'; +import { UploadActions } from '../../actions/ACS/upload.actions'; +import { DropActions } from '../../actions/drop.actions'; describe('Upload component', () => { diff --git a/e2e/upload/user_permission.e2e.ts b/e2e/content-services/upload/user_permission.e2e.ts similarity index 90% rename from e2e/upload/user_permission.e2e.ts rename to e2e/content-services/upload/user_permission.e2e.ts index ec487ee7cd..988579c1af 100644 --- a/e2e/upload/user_permission.e2e.ts +++ b/e2e/content-services/upload/user_permission.e2e.ts @@ -15,23 +15,22 @@ * limitations under the License. */ -import LoginPage = require('../pages/adf/loginPage'); -import ContentServicesPage = require('../pages/adf/contentServicesPage'); -import UploadDialog = require('../pages/adf/dialog/uploadDialog'); -import UploadToggles = require('../pages/adf/dialog/uploadToggles'); -import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import NotificationPage = require('../pages/adf/notificationPage'); +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import UploadDialog = require('../../pages/adf/dialog/uploadDialog'); +import UploadToggles = require('../../pages/adf/dialog/uploadToggles'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); +import NotificationPage = require('../../pages/adf/notificationPage'); -import AcsUserModel = require('../models/ACS/acsUserModel'); -import FileModel = require('../models/ACS/fileModel'); -import FolderModel = require('../models/ACS/folderModel'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); +import FolderModel = require('../../models/ACS/folderModel'); -import TestConfig = require('../test.config'); -import resources = require('../util/resources'); +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from '../actions/ACS/upload.actions'; -import { DropActions } from '../actions/drop.actions'; +import { DropActions } from '../../actions/drop.actions'; import path = require('path'); @@ -67,8 +66,6 @@ describe('Upload - User permission', () => { }); beforeAll(() => { - let uploadActions = new UploadActions(); - this.alfrescoJsApi = new AlfrescoApi({ provider: 'ECM', hostEcm: TestConfig.adf.url diff --git a/e2e/content-services/version/version-smoke-tests.e2e.ts b/e2e/content-services/version/version-smoke-tests.e2e.ts new file mode 100644 index 0000000000..fafed09b2a --- /dev/null +++ b/e2e/content-services/version/version-smoke-tests.e2e.ts @@ -0,0 +1,82 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ViewerPage = require('../../pages/adf/viewerPage'); + +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import dateFormat = require('dateformat'); + +import AlfrescoApi = require('alfresco-js-api-node'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +describe('Version component', () => { + + let loginPage = new LoginPage(); + let contentServicesPage = new ContentServicesPage(); + let viewerPage = new ViewerPage(); + let cardViewPage; + + let acsUser = new AcsUserModel(); + + let pdfFileModel = new FileModel({ + 'name': resources.Files.ADF_DOCUMENTS.PDF_ALL.file_name, + 'location': resources.Files.ADF_DOCUMENTS.PDF_ALL.file_location + }); + + beforeAll(async (done) => { + + let uploadActions = new UploadActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser); + + await this.alfrescoJsApi.login(acsUser.id, acsUser.password); + + let pdfUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pdfFileModel.location, pdfFileModel.name, '-my-'); + + Object.assign(pdfFileModel, pdfUploadedFile.entry); + + pdfFileModel.update(pdfUploadedFile.entry); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + done(); + }); + + it('[C272768] Versions', () => { + contentServicesPage.navigateToDocumentList(); + viewerPage.viewFile(pdfFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + viewerPage.clickOnVersionsTab().checkUploadVersionsButtonIsDisplayed(); + expect(viewerPage.getActiveTab()).toEqual('VERSIONS'); + viewerPage.checkVersionIsDisplayed(pdfFileModel.name); + }); + +}); diff --git a/e2e/z-finish.e2e.ts b/e2e/content-services/z-finish.e2e.ts similarity index 86% rename from e2e/z-finish.e2e.ts rename to e2e/content-services/z-finish.e2e.ts index 1c799d700f..4a6b60c096 100644 --- a/e2e/z-finish.e2e.ts +++ b/e2e/content-services/z-finish.e2e.ts @@ -16,8 +16,7 @@ */ import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; -import TestConfig = require('./test.config'); +import TestConfig = require('../test.config'); import fs = require('fs'); import path = require('path'); @@ -28,7 +27,6 @@ let saveScreenshot = process.env.SAVE_SCREENSHOT; describe('Save screenshot at the end', () => { beforeAll(async (done) => { - let uploadActions = new UploadActions(); if (saveScreenshot === 'true') { if (!buildNumber) { @@ -40,19 +38,20 @@ describe('Save screenshot at the end', () => { hostEcm: TestConfig.adf.url }); - let files = fs.readdirSync(path.join(__dirname, '../e2e-output/screenshots')); + let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots')); if (files && files.length > 0) { alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); let folder = await alfrescoJsApi.nodes.addNode('-my-', { - 'name': 'Screenshot-e2e-' + buildNumber, + 'name': 'contetn-services', + 'relativePath': 'Buiild-screenshot/Screenshot-e2e-' + buildNumber, 'nodeType': 'cm:folder' }, {}, {}); for (const fileName of files) { - let pathFile = path.join(__dirname, '../e2e-output/screenshots', fileName); + let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName); let file = fs.createReadStream(pathFile); await alfrescoJsApi.upload.uploadFile( diff --git a/e2e/core/card-view/aspect-oriented-config.e2e.ts b/e2e/core/card-view/aspect-oriented-config.e2e.ts new file mode 100644 index 0000000000..91c111f365 --- /dev/null +++ b/e2e/core/card-view/aspect-oriented-config.e2e.ts @@ -0,0 +1,305 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ViewerPage = require('../../pages/adf/viewerPage'); +import CardViewPage = require('../../pages/adf/metadataViewPage'); +import ContentListPage = require('../../pages/adf/dialog/contentList'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); +import { ConfigEditorPage } from '../../pages/adf/configEditorPage'; + +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import dateFormat = require('dateformat'); + +import AlfrescoApi = require('alfresco-js-api-node'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +describe('Aspect oriented config', () => { + + const METADATA = { + DATAFORMAT: 'mmm dd yyyy', + TITLE: 'Details', + COMMENTS_TAB: 'COMMENTS', + PROPERTY_TAB: 'PROPERTIES', + DEFAULT_ASPECT: 'Properties', + MORE_INFO_BUTTON: 'More information', + LESS_INFO_BUTTON: 'Less information', + ARROW_DOWN: 'keyboard_arrow_down', + ARROW_UP: 'keyboard_arrow_up', + EDIT_BUTTON_TOOLTIP: 'Edit' + }; + + const loginPage = new LoginPage(); + const contentServicesPage = new ContentServicesPage(); + const viewerPage = new ViewerPage(); + const metadataViewPage = new CardViewPage(); + const contentListPage = new ContentListPage(); + const navigationBarPage = new NavigationBarPage(); + const configEditorPage = new ConfigEditorPage(); + + let acsUser = new AcsUserModel(); + + let pngFileModel = new FileModel({ + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name, + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location + }); + + beforeAll(async (done) => { + + let uploadActions = new UploadActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser); + + await this.alfrescoJsApi.login(acsUser.id, acsUser.password); + + await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, '-my-'); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + done(); + }); + + afterEach(() => { + viewerPage.clickCloseButton(); + browser.refresh(); + }); + + it('[C261117] Should be possible restrict the display properties of one an aspect', () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration('{ "presets": {' + + ' "default": [{' + + ' "title": "IMAGE",' + + ' "items": [' + + ' {' + + ' "aspect": "exif:exif", "properties": [ "exif:pixelXDimension", "exif:pixelYDimension", "exif:isoSpeedRatings"]' + + ' }' + + ' ]' + + ' }]' + + ' }'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.clickMetadatGroup('IMAGE'); + + metadataViewPage.checkPopertyIsVisible('properties.exif:pixelXDimension', 'textitem'); + metadataViewPage.checkPopertyIsVisible('properties.exif:pixelYDimension', 'textitem'); + metadataViewPage.checkPopertyIsNotVisible('properties.exif:isoSpeedRatings', 'textitem'); + + metadataViewPage.editIconClick(); + + metadataViewPage.checkPopertyIsVisible('properties.exif:isoSpeedRatings', 'textitem'); + }); + + it('[C260185] Should ignore not existing aspect when present in the configuration', () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration(' {' + + ' "presets": {' + + ' "default": {' + + ' "exif:exif": "*",' + + ' "cm:versionable": "*",' + + ' "not:exists": "*"' + + ' }' + + ' }' + + ' }'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); + metadataViewPage.checkkMetadatGroupIsPresent('properties'); + metadataViewPage.checkkMetadatGroupIsPresent('Versionable'); + metadataViewPage.checkkMetadatGroupIsNotPresent('exists'); + }); + + it('[C260183] Should show all the aspect if the content-metadata configuration is NOT provided' , () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration('{ }'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); + metadataViewPage.checkkMetadatGroupIsPresent('properties'); + metadataViewPage.checkkMetadatGroupIsPresent('Versionable'); + metadataViewPage.checkkMetadatGroupIsPresent('Titled'); + metadataViewPage.checkkMetadatGroupIsPresent('Auditable'); + metadataViewPage.checkkMetadatGroupIsPresent('Author'); + metadataViewPage.checkkMetadatGroupIsPresent('Content'); + }); + + it('[C260182] Should show all the aspects if the default configuration contains the * symbol' , () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration('{' + + ' "presets": {' + + ' "default": "*"' + + ' }' + + '}'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); + metadataViewPage.checkkMetadatGroupIsPresent('properties'); + metadataViewPage.checkkMetadatGroupIsPresent('Versionable'); + metadataViewPage.checkkMetadatGroupIsPresent('Titled'); + metadataViewPage.checkkMetadatGroupIsPresent('Auditable'); + metadataViewPage.checkkMetadatGroupIsPresent('Author'); + metadataViewPage.checkkMetadatGroupIsPresent('Content'); + }); + + it('[C268899] Should be possible use a Translation key as Title of a metadata group' , () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration('{' + + ' "presets": {' + + ' "default": [' + + ' {' + + ' "title": "GROUP-TITLE1-TRANSLATION-KEY",' + + ' "items": [' + + ' {' + + ' "aspect": "exif:exif",' + + ' "properties": "*"' + + ' }' + + ' ]' + + ' },' + + ' {' + + ' "title": "GROUP-TITLE2-TRANSLATION-KEY",' + + ' "items": [' + + ' {' + + ' "aspect": "kitten:food",' + + ' "properties": [' + + ' "kitten:favourite-food",' + + ' "kitten:recommended-food"' + + ' ]' + + ' }' + + ' ]' + + ' }' + + ' ]' + + ' }' + + '}'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.checkkMetadatGroupIsPresent('GROUP-TITLE1-TRANSLATION-KEY'); + metadataViewPage.checkkMetadatGroupIsPresent('GROUP-TITLE2-TRANSLATION-KEY'); + + expect(metadataViewPage.getkMetadatGroupTitle('GROUP-TITLE1-TRANSLATION-KEY')).toBe('CUSTOM TITLE TRANSLATION ONE'); + expect(metadataViewPage.getkMetadatGroupTitle('GROUP-TITLE2-TRANSLATION-KEY')).toBe('CUSTOM TITLE TRANSLATION TWO'); + + }); + + it('[C268899] Should be possible use a custom preset' , () => { + navigationBarPage.clickConfigEditorButton(); + + configEditorPage.clickClearMetadataButton(); + + configEditorPage.enterMetadataConfiguration('{' + + ' "presets": {' + + ' "custom-preset": {' + + ' "exif:exif": "*",' + + ' "cm:versionable": "*"' + + ' }' + + ' }' + + '}'); + + configEditorPage.clickSaveMetadataButton(); + + navigationBarPage.clickContentServicesButton(); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.enablePreset(); + metadataViewPage.enterPresetText('custom-preset'); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.checkkMetadatGroupIsPresent('properties'); + metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); + metadataViewPage.checkkMetadatGroupIsPresent('Versionable'); + }); +}); diff --git a/e2e/core/card-view/card-view-component.e2e.ts b/e2e/core/card-view/card-view-component.e2e.ts new file mode 100644 index 0000000000..dd4c43a025 --- /dev/null +++ b/e2e/core/card-view/card-view-component.e2e.ts @@ -0,0 +1,313 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); +import CardViewPage = require('../../pages/adf/metadataViewPage'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import AlfrescoApi = require('alfresco-js-api-node'); +import { UsersActions } from '../../actions/users.actions'; +import { AppsActions } from '../../actions/APS/apps.actions'; +import CardViewPageComponent = require('../../pages/adf/cardViewPageComponent'); +import Util = require('../../util/util'); + +describe('CardView Component', () => { + const loginPage = new LoginPage(); + const navigationBarPage = new NavigationBarPage(); + const cardViewPageComponent = new CardViewPageComponent(); + const metadataViewPage = new CardViewPage(); + + const app = resources.Files.APP_WITH_PROCESSES; + + beforeAll(async (done) => { + const apps = new AppsActions(); + const users = new UsersActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'BPM', + hostBpm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + let user = await users.createTenantAndUser(this.alfrescoJsApi); + + await this.alfrescoJsApi.login(user.email, user.password); + + await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + + loginPage.loginToProcessServicesUsingUserModel(user); + + navigationBarPage.clickCardViewButton(); + + done(); + }); + + afterEach(() => { + cardViewPageComponent.clickOnResetButton(); + }); + + describe('key-value pair ', () => { + + it('[C279937] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-key-value-pairs-label-key-value-pairs"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279898] Should be possible edit key-value pair properties', () => { + cardViewPageComponent.clickOnAddButton(); + cardViewPageComponent.setName('testName'); + cardViewPageComponent.setValue('testValue'); + cardViewPageComponent.clickOnAddButton(); + cardViewPageComponent.waitForOutput(); + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Key-Value Pairs Item] - [{"name":"testName","value":"testValue"}]'); + + cardViewPageComponent.deletePairsValues(); + + expect(cardViewPageComponent.getOutputText(1)).toBe('[CardView Key-Value Pairs Item] - []'); + }); + }); + + describe('Selectbox', () => { + + it('[C279939] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-select-label-select"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279899] Should be possible edit selectbox item', () => { + cardViewPageComponent.clickSelectBox(); + cardViewPageComponent.selectValueFromComboBox(1); + + expect(cardViewPageComponent.getOutputText(0)) + .toBe('[CardView Select Item] - two'); + }); + }); + + describe('Text', () => { + + it('[C279937] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-textitem-label-name"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279943] Should be present a default value', () => { + expect(cardViewPageComponent.getTextFieldText()).toBe('Spock'); + }); + + it('[C279934] Should be possible edit text item', () => { + cardViewPageComponent + .clickOnTextField() + .enterTextField('example') + .clickOnTextSaveIcon(); + + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Text Item] - example'); + }); + + it('[C279944] Should be possible undo text item modify when click on the clear button', () => { + cardViewPageComponent + .clickOnTextField() + .enterTextField('example') + .clickOnTextClearIcon(); + + expect(cardViewPageComponent.getTextFieldText()).toBe('Spock'); + }); + }); + + describe('Int', () => { + + it('[C279940] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-textitem-label-int"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279945] Should be present a default value', () => { + expect(cardViewPageComponent.getIntFieldText()).toBe('213'); + }); + + it('[C279946] Should be possible edit int item', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField('99999') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Int Item] - 99999'); + }); + + it('[C279947] Should not be possible add string value to the int item', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField('string value') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format'); + }); + + it('[C279948] Should not be possible add float value to the int item', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField('0.22') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format'); + }); + + it('[C279949] Should not be possible have an empty value', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField(' ') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format'); + }); + + it('[C279950] Should return an error when the value is > 2147483647', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField('214748367') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Int Item] - 214748367'); + + cardViewPageComponent + .clickOnIntField() + .enterIntField('2147483648') + .clickOnIntSaveIcon(); + + expect(cardViewPageComponent.getErrorInt()).toBe('Use an integer format'); + }); + + it('[C279951] Should be possible undo item modify when click on the clear button', () => { + cardViewPageComponent + .clickOnIntField() + .enterIntField('999') + .clickOnIntClearIcon(); + + expect(cardViewPageComponent.getIntFieldText()).toBe('213'); + }); + }); + + describe('Float', () => { + + it('[C279941] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-textitem-label-float"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279952] Should be present a default value', () => { + expect(cardViewPageComponent.getFloatFieldText()).toBe('9.9'); + }); + + it('[C279953] Should be possible edit float item', () => { + cardViewPageComponent + .clickOnFloatField() + .enterFloatField('77.33') + .clickOnFloatSaveIcon(); + + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Float Item] - 77.33'); + }); + + it('[C279954] Should not be possible add string value to the float item', () => { + cardViewPageComponent + .clickOnFloatField() + .enterFloatField('string value') + .clickOnFloatSaveIcon(); + + expect(cardViewPageComponent.getErrorFloat()).toBe('Use a number format'); + }); + + it('[C279955] Should be possible undo item item modify when click on the clear button', () => { + cardViewPageComponent + .clickOnFloatField() + .enterFloatField('77.33') + .clickOnFloatClearIcon(); + + expect(cardViewPageComponent.getFloatFieldText()).toBe('9.9'); + }); + + it('[C279956] Should not be possible have an empty value', () => { + cardViewPageComponent + .clickOnFloatField() + .enterFloatField(' ') + .clickOnFloatSaveIcon(); + + expect(cardViewPageComponent.getErrorFloat()).toBe('Use a number format'); + }); + + }); + + describe('Boolean', () => { + + it('[C279942] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-boolean-label-boolean"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279957] Should be possible edit the checkbox value when click on it', () => { + cardViewPageComponent.checkboxClick(); + + expect(cardViewPageComponent.getOutputText(0)).toBe('[CardView Boolean Item] - false'); + + cardViewPageComponent.checkboxClick(); + + expect(cardViewPageComponent.getOutputText(1)).toBe('[CardView Boolean Item] - true'); + }); + }); + + describe('Date and DateTime', () => { + + it('[C279961] Should the label be present', () => { + let label = element(by.xpath('div[data-automation-id="card-dateitem-label-date"]')); + + Util.waitUntilElementIsPresent(label); + + let label = element(by.xpath('div[data-automation-id="card-dateitem-label-datetime"]')); + + Util.waitUntilElementIsPresent(label); + }); + + it('[C279962] Should be present a default value', () => { + expect(metadataViewPage.getPropertyText('date', 'date')).toEqual('24.12.1983'); + expect(metadataViewPage.getPropertyText('datetime', 'datetime')).toEqual('Dec 24 1983 10:00'); + }); + + }); + + it('[C279936] Should not be possible edit any parameter when editable property is false', () => { + cardViewPageComponent.disableEdit(); + + let editIconText = element(by.xpath('mat-icon[data-automation-id="card-textitem-edit-icon-name"]')); + let editIconInt = element(by.xpath('mat-icon[data-automation-id="card-textitem-edit-icon-int"]')); + let editIconFloat = element(by.xpath('mat-icon[data-automation-id="card-textitem-edit-icon-float"]')); + let editIconKey = element(by.xpath('mat-icon[data-automation-id="card-key-value-pairs-button-key-value-pairs"]')); + let editIconData = element(by.xpath('mat-datetimepicker-toggle')); + + Util.waitUntilElementIsNotVisible(editIconText); + Util.waitUntilElementIsNotVisible(editIconInt); + Util.waitUntilElementIsNotVisible(editIconFloat); + Util.waitUntilElementIsNotVisible(editIconKey); + Util.waitUntilElementIsNotVisible(editIconData); + }); +}); diff --git a/e2e/core/card-view/metadata-properties.e2e.ts b/e2e/core/card-view/metadata-properties.e2e.ts new file mode 100644 index 0000000000..f5d8f801df --- /dev/null +++ b/e2e/core/card-view/metadata-properties.e2e.ts @@ -0,0 +1,158 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ViewerPage = require('../../pages/adf/viewerPage'); +import CardViewPage = require('../../pages/adf/metadataViewPage'); + +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import dateFormat = require('dateformat'); + +import AlfrescoApi = require('alfresco-js-api-node'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +import fs = require('fs'); +import path = require('path'); + +describe('CardView Component - properties', () => { + + let METADATA = { + DATAFORMAT: 'mmm dd yyyy', + TITLE: 'Details', + COMMENTS_TAB: 'COMMENTS', + PROPERTY_TAB: 'PROPERTIES', + DEFAULT_ASPECT: 'Properties', + MORE_INFO_BUTTON: 'More information', + LESS_INFO_BUTTON: 'Less information', + ARROW_DOWN: 'keyboard_arrow_down', + ARROW_UP: 'keyboard_arrow_up', + EDIT_BUTTON_TOOLTIP: 'Edit' + }; + + let loginPage = new LoginPage(); + let contentServicesPage = new ContentServicesPage(); + let viewerPage = new ViewerPage(); + let metadataViewPage = new CardViewPage(); + + let acsUser = new AcsUserModel(); + + let pngFileModel = new FileModel({ + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name, + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location + }); + + beforeAll(async (done) => { + + let uploadActions = new UploadActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser); + + await this.alfrescoJsApi.login(acsUser.id, acsUser.password); + + let pdfUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, '-my-'); + + Object.assign(pngFileModel, pdfUploadedFile.entry); + + pngFileModel.update(pdfUploadedFile.entry); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + contentServicesPage.navigateToDocumentList(); + + done(); + }); + + afterEach(() => { + viewerPage.clickCloseButton(); + }); + + it('[C246516] Should show/hide the empty metadata when the property displayEmpty is true/false', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.clickMetadatGroup('EXIF'); + + metadataViewPage.checkPopertyIsVisible('properties.exif:flash', 'boolean'); + metadataViewPage.checkPopertyIsNotVisible('properties.exif:model', 'textitem'); + + metadataViewPage.enableDisplayEmpty(); + + metadataViewPage.checkPopertyIsVisible('properties.exif:flash', 'boolean'); + metadataViewPage.checkPopertyIsVisible('properties.exif:model', 'textitem'); + }); + + it('[C260179] Should not be possible edit the basic property when readOnly is true', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + metadataViewPage.enableReadonly(); + + metadataViewPage.editIconIsNotDisplayed(); + }); + + it('[C268965] Should multi property allow expand multi accordion at the same time when set', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.chekMetadatGroupIsNotExpand('EXIF'); + metadataViewPage.chekMetadatGroupIsNotExpand('properties'); + + metadataViewPage.clickMetadatGroup('properties'); + + metadataViewPage.chekMetadatGroupIsNotExpand('EXIF'); + metadataViewPage.chekMetadatGroupIsExpand('properties'); + + metadataViewPage.clickMetadatGroup('EXIF'); + + metadataViewPage.chekMetadatGroupIsExpand('EXIF'); + metadataViewPage.chekMetadatGroupIsNotExpand('properties'); + + metadataViewPage.enableMulti(); + + metadataViewPage.clickMetadatGroup('properties'); + + metadataViewPage.chekMetadatGroupIsExpand('EXIF'); + metadataViewPage.chekMetadatGroupIsExpand('properties'); + + }); +}); diff --git a/e2e/core/card-view/metadata-smoke-tests.e2e.ts b/e2e/core/card-view/metadata-smoke-tests.e2e.ts new file mode 100644 index 0000000000..d5a10b8a74 --- /dev/null +++ b/e2e/core/card-view/metadata-smoke-tests.e2e.ts @@ -0,0 +1,330 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ViewerPage = require('../../pages/adf/viewerPage'); +import CardViewPage = require('../../pages/adf/metadataViewPage'); +import ContentListPage = require('../../pages/adf/dialog/contentList'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); + +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import dateFormat = require('dateformat'); + +import AlfrescoApi = require('alfresco-js-api-node'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +import fs = require('fs'); +import path = require('path'); +import Util = require('../../util/util'); + +describe('Metadata component', () => { + + const METADATA = { + DATAFORMAT: 'mmm dd yyyy', + TITLE: 'Details', + COMMENTS_TAB: 'COMMENTS', + PROPERTY_TAB: 'PROPERTIES', + DEFAULT_ASPECT: 'Properties', + MORE_INFO_BUTTON: 'More information', + LESS_INFO_BUTTON: 'Less information', + ARROW_DOWN: 'keyboard_arrow_down', + ARROW_UP: 'keyboard_arrow_up', + EDIT_BUTTON_TOOLTIP: 'Edit' + }; + + const loginPage = new LoginPage(); + const contentServicesPage = new ContentServicesPage(); + const viewerPage = new ViewerPage(); + const metadataViewPage = new CardViewPage(); + const contentListPage = new ContentListPage(); + const navigationBarPage = new NavigationBarPage(); + + let acsUser = new AcsUserModel(); + let consumerUser = new AcsUserModel(); + + let folderName = 'Metadata Folder'; + + let pngFileModel = new FileModel({ + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name, + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location + }); + + beforeAll(async (done) => { + + let uploadActions = new UploadActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser); + + await this.alfrescoJsApi.login(acsUser.id, acsUser.password); + + await uploadActions.uploadFolder(this.alfrescoJsApi, folderName, '-my-'); + + let pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, '-my-'); + + Object.assign(pngFileModel, pngUploadedFile.entry); + + pngFileModel.update(pngUploadedFile.entry); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + contentServicesPage.navigateToDocumentList(); + + done(); + }); + + it('[C245652] Properties', () => { + viewerPage.viewFile(pngFileModel.name); + + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + expect(metadataViewPage.getTitle()).toEqual(METADATA.TITLE); + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + expect(metadataViewPage.getExpandedAspectName()).toEqual(METADATA.DEFAULT_ASPECT); + expect(metadataViewPage.getName()).toEqual(pngFileModel.name); + expect(metadataViewPage.getCreator()).toEqual(pngFileModel.getCreatedByUser().displayName); + expect(metadataViewPage.getCreatedDate()).toEqual(dateFormat(pngFileModel.createdAt, METADATA.DATAFORMAT)); + expect(metadataViewPage.getModifier()).toEqual(pngFileModel.getCreatedByUser().displayName); + expect(metadataViewPage.getModifiedDate()).toEqual(dateFormat(pngFileModel.createdAt, METADATA.DATAFORMAT)); + expect(metadataViewPage.getMimetypeName()).toEqual(pngFileModel.getContent().mimeTypeName); + expect(metadataViewPage.getSize()).toEqual(pngFileModel.getContent().getSizeInBytes()); + + metadataViewPage.editIconIsDisplayed(); + metadataViewPage.informationButtonIsDisplayed(); + expect(metadataViewPage.getInformationButtonText()).toEqual(METADATA.MORE_INFO_BUTTON); + expect(metadataViewPage.getInformationIconText()).toEqual(METADATA.ARROW_DOWN); + + viewerPage.clickCloseButton(); + }); + + it('[C272769] Information button', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.informationButtonIsDisplayed(); + metadataViewPage.clickOnInformationButton(); + expect(metadataViewPage.getInformationButtonText()).toEqual(METADATA.LESS_INFO_BUTTON); + expect(metadataViewPage.getInformationIconText()).toEqual(METADATA.ARROW_UP); + + viewerPage.clickCloseButton(); + }); + + it('[C270952] Info icon', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab().informationButtonIsDisplayed(); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsNotDisplayed(); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + expect(viewerPage.getActiveTab()).toEqual(METADATA.COMMENTS_TAB); + metadataViewPage.clickOnPropertiesTab(); + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + expect(metadataViewPage.getEditIconTooltip()).toEqual(METADATA.EDIT_BUTTON_TOOLTIP); + + viewerPage.clickCloseButton(); + }); + + it('[C245654] Should be possible edit the basic Metadata Info of a Document', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.editIconClick(); + + metadataViewPage.editPropertyIconIsDisplayed('name'); + metadataViewPage.editPropertyIconIsDisplayed('properties.cm:title'); + metadataViewPage.editPropertyIconIsDisplayed('properties.cm:description'); + + expect(metadataViewPage.getPropertyIconTooltip('name', 'edit')).toEqual('Edit'); + expect(metadataViewPage.getPropertyIconTooltip('properties.cm:title', 'edit')).toEqual('Edit'); + expect(metadataViewPage.getPropertyIconTooltip('properties.cm:description', 'edit')).toEqual('Edit'); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.updatePropertyIconIsDisplayed('name'); + metadataViewPage.clearPropertyIconIsDisplayed('name'); + + metadataViewPage.enterPropertyText('name', 'exampleText'); + metadataViewPage.clickClearPropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual(resources.Files.ADF_DOCUMENTS.PNG.file_name); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.enterPropertyText('name', 'exampleText.png'); + metadataViewPage.clickUpdatePropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual('exampleText.png'); + + metadataViewPage.clickEditPropertyIcons('properties.cm:title'); + metadataViewPage.enterPropertyText('properties.cm:title', 'example title'); + metadataViewPage.clickUpdatePropertyIcon('properties.cm:title'); + expect(metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title'); + + metadataViewPage.clickEditPropertyIcons('properties.cm:description'); + metadataViewPage.enterDescriptionText('example description'); + metadataViewPage.clickUpdatePropertyIcon('properties.cm:description'); + expect(metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); + + viewerPage.clickCloseButton(); + + viewerPage.viewFile('exampleText.png'); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(metadataViewPage.getPropertyText('name')).toEqual('exampleText.png'); + expect(metadataViewPage.getPropertyText('properties.cm:title')).toEqual('example title'); + expect(metadataViewPage.getPropertyText('properties.cm:description')).toEqual('example description'); + + metadataViewPage.editIconClick(); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.enterPropertyText('name', resources.Files.ADF_DOCUMENTS.PNG.file_name); + metadataViewPage.clickUpdatePropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual(resources.Files.ADF_DOCUMENTS.PNG.file_name); + + viewerPage.clickCloseButton(); + }); + + it('[C279960] Should show the last username modifier when modify a File', () => { + let fileUrl; + + viewerPage.viewFile(pngFileModel.name); + + browser.getCurrentUrl().then((currentUrl) => { + fileUrl = currentUrl; + }); + + loginPage.loginToContentServices(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + browser.controlFlow().execute(() => { + browser.get(fileUrl); + }); + + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.editIconClick(); + + metadataViewPage.clickEditPropertyIcons('properties.cm:description'); + metadataViewPage.enterDescriptionText('check author example description'); + metadataViewPage.clickUpdatePropertyIcon('properties.cm:description'); + expect(metadataViewPage.getPropertyText('properties.cm:description')).toEqual('check author example description'); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + browser.controlFlow().execute(() => { + browser.get(fileUrl); + }); + + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + + expect(metadataViewPage.getPropertyText('modifiedByUser.displayName')).toEqual('Administrator'); + + loginPage.loginToContentServicesUsingUserModel(acsUser); + + contentServicesPage.navigateToDocumentList(); + }); + + it('[C261157] Should be possible use the metadata component When the node is a Folder', () => { + contentListPage.metadataContent(folderName); + + expect(metadataViewPage.getPropertyText('name')).toEqual(folderName); + expect(metadataViewPage.getPropertyText('createdByUser.displayName')).toEqual(acsUser.firstName + ' ' + acsUser.lastName); + + browser.refresh(); + }); + + it('[C261158] Should be possible edit the metadata When the node is a Folder', () => { + contentListPage.metadataContent(folderName); + + metadataViewPage.editIconClick(); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.enterPropertyText('name', 'newnameFolder'); + metadataViewPage.clickClearPropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual(folderName); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.enterPropertyText('name', 'newnameFolder'); + metadataViewPage.clickUpdatePropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual('newnameFolder'); + + metadataViewPage.clickEditPropertyIcons('name'); + metadataViewPage.enterPropertyText('name', folderName); + metadataViewPage.clickUpdatePropertyIcon('name'); + expect(metadataViewPage.getPropertyText('name')).toEqual(folderName); + + browser.refresh(); + }); + + it('[C260181] Should be possible edit all the metadata aspect', () => { + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.clickMetadatGroup('EXIF'); + + metadataViewPage.editIconClick(); + + metadataViewPage.clickEditPropertyIcons('properties.exif:software'); + metadataViewPage.enterPropertyText('properties.exif:software', 'test custom text software'); + metadataViewPage.clickUpdatePropertyIcon('properties.exif:software'); + expect(metadataViewPage.getPropertyText('properties.exif:software')).toEqual('test custom text software'); + + metadataViewPage.clickEditPropertyIcons('properties.exif:isoSpeedRatings'); + metadataViewPage.enterPropertyText('properties.exif:isoSpeedRatings', 'test custom text isoSpeedRatings'); + metadataViewPage.clickUpdatePropertyIcon('properties.exif:isoSpeedRatings'); + expect(metadataViewPage.getPropertyText('properties.exif:isoSpeedRatings')).toEqual('test custom text isoSpeedRatings'); + + metadataViewPage.clickEditPropertyIcons('properties.exif:fNumber'); + metadataViewPage.enterPropertyText('properties.exif:fNumber', 22); + metadataViewPage.clickUpdatePropertyIcon('properties.exif:fNumber'); + expect(metadataViewPage.getPropertyText('properties.exif:fNumber')).toEqual('22'); + }); + +}); diff --git a/e2e/core/card-view/permissions.e2e.ts b/e2e/core/card-view/permissions.e2e.ts new file mode 100644 index 0000000000..4f8bc166a1 --- /dev/null +++ b/e2e/core/card-view/permissions.e2e.ts @@ -0,0 +1,163 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ViewerPage = require('../../pages/adf/viewerPage'); +import CardViewPage = require('../../pages/adf/metadataViewPage'); +import ContentListPage = require('../../pages/adf/dialog/contentList'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); + +import AcsUserModel = require('../../models/ACS/acsUserModel'); +import FileModel = require('../../models/ACS/fileModel'); + +import TestConfig = require('../../test.config'); +import resources = require('../../util/resources'); +import dateFormat = require('dateformat'); + +import AlfrescoApi = require('alfresco-js-api-node'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +import fs = require('fs'); +import path = require('path'); +import Util = require('../../util/util'); + +describe('permissions', () => { + + const METADATA = { + DATAFORMAT: 'mmm dd yyyy', + TITLE: 'Details', + COMMENTS_TAB: 'COMMENTS', + PROPERTY_TAB: 'PROPERTIES', + DEFAULT_ASPECT: 'Properties', + MORE_INFO_BUTTON: 'More information', + LESS_INFO_BUTTON: 'Less information', + ARROW_DOWN: 'keyboard_arrow_down', + ARROW_UP: 'keyboard_arrow_up', + EDIT_BUTTON_TOOLTIP: 'Edit' + }; + + const loginPage = new LoginPage(); + const contentServicesPage = new ContentServicesPage(); + const viewerPage = new ViewerPage(); + const metadataViewPage = new CardViewPage(); + const contentListPage = new ContentListPage(); + const navigationBarPage = new NavigationBarPage(); + + let acsUser = new AcsUserModel(); + let consumerUser = new AcsUserModel(); + let collaboratorUser = new AcsUserModel(); + let contributorUser = new AcsUserModel(); + let site; + + let pngFileModel = new FileModel({ + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name, + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location + }); + + beforeAll(async (done) => { + + let uploadActions = new UploadActions(); + + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(consumerUser); + await this.alfrescoJsApi.core.peopleApi.addPerson(collaboratorUser); + await this.alfrescoJsApi.core.peopleApi.addPerson(contributorUser); + + site = await this.alfrescoJsApi.core.sitesApi.createSite({ + title: Util.generateRandomString(), + visibility: 'PUBLIC' + }); + + await this.alfrescoJsApi.core.sitesApi.addSiteMember(site.entry.id, { + id: consumerUser.id, + role: 'SiteConsumer' + }); + + await this.alfrescoJsApi.core.sitesApi.addSiteMember(site.entry.id, { + id: collaboratorUser.id, + role: 'SiteCollaborator' + }); + + await this.alfrescoJsApi.core.sitesApi.addSiteMember(site.entry.id, { + id: contributorUser.id, + role: 'SiteContributor' + }); + + await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, site.entry.guid); + + done(); + }); + + it('[C274692] Should not be possible edit metadata properties when the user is a consumer user', () => { + loginPage.loginToContentServicesUsingUserModel(consumerUser); + + navigationBarPage.openContentServicesFolder(site.entry.guid); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsNotDisplayed(); + }); + + it('[C279971] Should be possible edit metadata properties when the user is a collaborator user', () => { + loginPage.loginToContentServicesUsingUserModel(collaboratorUser); + + navigationBarPage.openContentServicesFolder(site.entry.guid); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.clickMetadatGroup('EXIF'); + + metadataViewPage.editIconIsDisplayed(); + }); + + it('[C279972] Should be possible edit metadata properties when the user is a contributor user', () => { + loginPage.loginToContentServicesUsingUserModel(collaboratorUser); + + navigationBarPage.openContentServicesFolder(site.entry.guid); + + viewerPage.viewFile(pngFileModel.name); + viewerPage.clickInfoButton(); + viewerPage.checkInfoSideBarIsDisplayed(); + metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.editIconIsDisplayed(); + + expect(viewerPage.getActiveTab()).toEqual(METADATA.PROPERTY_TAB); + + metadataViewPage.clickOnInformationButton(); + + metadataViewPage.clickMetadatGroup('EXIF'); + + metadataViewPage.editIconIsDisplayed(); + }); +}); diff --git a/e2e/datatable/data-table-component-selection.e2e.ts b/e2e/core/datatable/data-table-component-selection.e2e.ts similarity index 93% rename from e2e/datatable/data-table-component-selection.e2e.ts rename to e2e/core/datatable/data-table-component-selection.e2e.ts index 93cee53a10..fc24bf3507 100644 --- a/e2e/datatable/data-table-component-selection.e2e.ts +++ b/e2e/core/datatable/data-table-component-selection.e2e.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import LoginPage = require('../pages/adf/loginPage'); -import DataTablePage = require('../pages/adf/dataTablePage'); -import TestConfig = require('../test.config'); +import LoginPage = require('../../pages/adf/loginPage'); +import DataTablePage = require('../../pages/adf/dataTablePage'); +import TestConfig = require('../../test.config'); -import AcsUserModel = require('../models/ACS/acsUserModel'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); import AlfrescoApi = require('alfresco-js-api-node'); describe('Datatable component - selection', () => { diff --git a/e2e/datatable/data-table-component.e2e.ts b/e2e/core/datatable/data-table-component.e2e.ts similarity index 90% rename from e2e/datatable/data-table-component.e2e.ts rename to e2e/core/datatable/data-table-component.e2e.ts index bd9a4ea4b5..bfb0e9c58d 100644 --- a/e2e/datatable/data-table-component.e2e.ts +++ b/e2e/core/datatable/data-table-component.e2e.ts @@ -15,10 +15,10 @@ * limitations under the License. */ -import LoginPage = require('../pages/adf/loginPage.js'); -import DataTablePage = require('../pages/adf/dataTablePage.js'); -import AcsUserModel = require('../models/ACS/acsUserModel.js'); -import TestConfig = require('../test.config.js'); +import LoginPage = require('../../pages/adf/loginPage.js'); +import DataTablePage = require('../../pages/adf/dataTablePage.js'); +import AcsUserModel = require('../../models/ACS/acsUserModel.js'); +import TestConfig = require('../../test.config.js'); import AlfrescoApi = require('alfresco-js-api-node'); diff --git a/e2e/infinite_scrolling.e2e.ts b/e2e/core/infinite_scrolling.e2e.ts similarity index 85% rename from e2e/infinite_scrolling.e2e.ts rename to e2e/core/infinite_scrolling.e2e.ts index bb38975d1c..30f726b24e 100644 --- a/e2e/infinite_scrolling.e2e.ts +++ b/e2e/core/infinite_scrolling.e2e.ts @@ -15,17 +15,17 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Enable infinite scrolling', () => { diff --git a/e2e/core/login/login_component.e2e.ts b/e2e/core/login/login_component.e2e.ts new file mode 100644 index 0000000000..83f942b1a8 --- /dev/null +++ b/e2e/core/login/login_component.e2e.ts @@ -0,0 +1,250 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ProcessServicesPage = require('../../pages/adf/process_services/processServicesPage'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); +import UserInfoDialog = require('../../pages/adf/dialog/userInfoDialog'); + +import TestConfig = require('../../test.config'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); + +import AdfSettingsPage = require('../../pages/adf/settingsPage'); +import AlfrescoApi = require('alfresco-js-api-node'); + +import Util = require('../../util/util'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +describe('Login component', () => { + + let adfSettingsPage = new AdfSettingsPage(); + let processServicesPage = new ProcessServicesPage(); + let navigationBarPage = new NavigationBarPage(); + let userInfoDialog = new UserInfoDialog(); + let contentServicesPage = new ContentServicesPage(); + let loginPage = new LoginPage(); + let adminUserModel = new AcsUserModel({ + 'id': TestConfig.adf.adminUser, + 'password': TestConfig.adf.adminPassword + }); + + let userA = new AcsUserModel(); + let userB = new AcsUserModel(); + + let errorMessages = { + username: 'Your username needs to be at least 2 characters.', + invalid_credentials: 'You\'ve entered an unknown username or password', + password: 'Enter your password to sign in', + required: 'Required' + }; + + beforeAll(async (done) => { + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ALL', + hostEcm: TestConfig.adf.url, + hostBpm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + await this.alfrescoJsApi.core.peopleApi.addPerson(userA); + await this.alfrescoJsApi.core.peopleApi.addPerson(userB); + + done(); + }); + + it('[C260036] Username Required', () => { + loginPage.goToLoginPage(); + loginPage.checkUsernameInactive(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterUsername('A'); + loginPage.checkUsernameTooltip(errorMessages.username); + loginPage.clearUsername(); + loginPage.checkUsernameTooltip(errorMessages.required); + loginPage.checkUsernameHighlighted(); + loginPage.checkSignInButtonIsDisabled(); + }); + + it('[C260043] Enter Password to sign in', () => { + loginPage.goToLoginPage(); + loginPage.checkPasswordInactive(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterPassword('A'); + loginPage.checkPasswordTooltipIsNotVisible(); + loginPage.clearPassword(); + loginPage.checkPasswordTooltip(errorMessages.password); + loginPage.checkPasswordHighlighted(); + loginPage.checkSignInButtonIsDisabled(); + }); + + it('[C260044] Username must be at least 2 characters long', () => { + loginPage.goToLoginPage(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterUsername('A'); + loginPage.checkUsernameTooltip(errorMessages.username); + loginPage.enterUsername('AB'); + loginPage.checkUsernameTooltipIsNotVisible(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.clearUsername(); + }); + + it('[C260045] Login button is enabled', () => { + loginPage.goToLoginPage(); + loginPage.enterUsername(adminUserModel.id); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterPassword('a'); + loginPage.checkSignInButtonIsEnabled(); + loginPage.clearUsername(adminUserModel.id); + loginPage.clearPassword(); + }); + + it('[C260046] You have entered an invalid username or password', () => { + loginPage.goToLoginPage(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterUsername('test'); + loginPage.enterPassword('test'); + loginPage.checkSignInButtonIsEnabled(); + loginPage.clickSignInButton(); + loginPage.checkLoginError(errorMessages.invalid_credentials); + loginPage.clearUsername(); + loginPage.clearPassword(); + }); + + it('[C260047] Password field is crypted', () => { + loginPage.goToLoginPage(); + loginPage.checkSignInButtonIsDisabled(); + loginPage.enterPassword('test'); + loginPage.showPassword(); + loginPage.checkPasswordIsShown('test'); + loginPage.hidePassword(); + loginPage.checkPasswordIsHidden(); + loginPage.clearPassword(); + }); + + it('[C260048] Remember Need Help? and Register are displayed and hidden', () => { + loginPage.goToLoginPage(); + loginPage.enableFooter(); + loginPage.checkRememberIsDisplayed(); + loginPage.checkNeedHelpIsDisplayed(); + loginPage.checkRegisterDisplayed(); + loginPage.disableFooter(); + loginPage.checkRememberIsNotDisplayed(); + loginPage.checkNeedHelpIsNotDisplayed(); + loginPage.checkRegisterIsNotDisplayed(); + }); + + it('[C260049] Login to Process Services with Content Services disabled', () => { + loginPage.goToLoginPage(); + loginPage.checkSignInButtonIsDisabled(); + adfSettingsPage.setProviderBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + navigationBarPage.clickProcessServicesButton(); + processServicesPage.checkApsContainer(); + navigationBarPage.clickContentServicesButton(); + loginPage.waitForElements(); + }); + + it('[C260050] Login to Content Services with Process Services disabled', () => { + loginPage.goToLoginPage(); + loginPage.checkSignInButtonIsDisabled(); + adfSettingsPage.setProviderEcm(); + loginPage.login(TestConfig.adf.adminUser, TestConfig.adf.adminPassword); + navigationBarPage.clickContentServicesButton(); + contentServicesPage.checkAcsContainer(); + navigationBarPage.clickProcessServicesButton(); + loginPage.waitForElements(); + }); + + it('[C260051] Able to login to both Content Services and Process Services', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.checkSignInButtonIsDisabled(); + adfSettingsPage.setProviderEcmBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + navigationBarPage.clickProcessServicesButton(); + processServicesPage.checkApsContainer(); + navigationBarPage.clickContentServicesButton(); + contentServicesPage.checkAcsContainer(); + navigationBarPage.clickLoginButton(); + loginPage.waitForElements(); + }); + + it('[C277754] Should the user be redirect to the login page when the Content Service session expire', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + browser.executeScript('window.localStorage.removeItem("ticket-ECM");').then(() => { + browser.get(TestConfig.adf.url + '/files'); + loginPage.waitForElements(); + }); + + }); + + it('[C279932] Should successRoute property change the landing page when the user Login', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.enableSuccessRouteSwitch(); + loginPage.enterSuccessRoute('activiti'); + loginPage.login(adminUserModel.id, adminUserModel.password); + processServicesPage.checkApsContainer(); + }); + + it('[C279931] Should the user be redirect to the login page when the Process Service session expire', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + browser.executeScript('window.localStorage.removeItem("ticket-BPM");').then(() => { + browser.get(TestConfig.adf.url + '/activiti'); + loginPage.waitForElements(); + }); + }); + + it('[C279930] Should a user still be logged-in when open a new tab', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + + Util.openNewTabInBrowser(); + + browser.getAllWindowHandles().then((handles) => { + + browser.ignoreSynchronization = true; + browser.switchTo().window(handles[1]).then(() => { + browser.get(TestConfig.adf.url + '/activiti'); + processServicesPage.checkApsContainer(); + browser.get(TestConfig.adf.url + '/files'); + contentServicesPage.checkAcsContainer(); + }); + }); + }); + + it('[C276746] Login with two different users', () => { + loginPage.loginToContentServicesUsingUserModel(userA); + navigationBarPage.clickUserProfile(); + expect(userInfoDialog.getContentHeaderTitle()).toEqual(userA.firstName + ' ' + userA.lastName); + expect(userInfoDialog.getContentEmail()).toEqual(userA.email); + + loginPage.loginToContentServicesUsingUserModel(userB); + navigationBarPage.clickUserProfile(); + expect(userInfoDialog.getContentHeaderTitle()).toEqual(userB.firstName + ' ' + userB.lastName); + expect(userInfoDialog.getContentEmail()).toEqual(userB.email); + }); + + it('[C279933] Should be possible change the login component logo when logoImageUrl is changed', () => { + adfSettingsPage.setProviderEcmBpm(); + loginPage.enableLogoSwitch(); + loginPage.enterLogo('https://rawgit.com/Alfresco/alfresco-ng2-components/master/assets/angular2.png'); + loginPage.checkLoginImgURL('https://rawgit.com/Alfresco/alfresco-ng2-components/master/assets/angular2.png'); + }); + +}); diff --git a/e2e/core/login/redirection.e2e.ts b/e2e/core/login/redirection.e2e.ts new file mode 100644 index 0000000000..b508ca08f4 --- /dev/null +++ b/e2e/core/login/redirection.e2e.ts @@ -0,0 +1,135 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); +import ProcessServicesPage = require('../../pages/adf/process_services/processServicesPage'); +import NavigationBarPage = require('../../pages/adf/navigationBarPage'); + +import TestConfig = require('../../test.config'); +import AcsUserModel = require('../../models/ACS/acsUserModel'); + +import AdfSettingsPage = require('../../pages/adf/settingsPage'); +import AlfrescoApi = require('alfresco-js-api-node'); + +import Util = require('../../util/util'); +import { UploadActions } from '../../actions/ACS/upload.actions'; + +describe('Login component', () => { + + let adfSettingsPage = new AdfSettingsPage(); + let processServicesPage = new ProcessServicesPage(); + let navigationBarPage = new NavigationBarPage(); + let contentServicesPage = new ContentServicesPage(); + let loginPage = new LoginPage(); + let adminUserModel = new AcsUserModel({ + 'id': TestConfig.adf.adminUser, + 'password': TestConfig.adf.adminPassword + }); + + beforeAll(async (done) => { + this.alfrescoJsApi = new AlfrescoApi({ + provider: 'ALL', + hostEcm: TestConfig.adf.url, + hostBpm: TestConfig.adf.url + }); + + await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + done(); + }); + + it('[C213838] Should after login in CS be redirect to Login page when try to access to PS', () => { + adfSettingsPage.setProviderEcm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + + navigationBarPage.clickContentServicesButton(); + contentServicesPage.checkAcsContainer(); + + navigationBarPage.clickProcessServicesButton(); + + loginPage.waitForElements(); + }); + + it('[C260085] Should after login in PS be redirect to Login page when try to access to CS', () => { + adfSettingsPage.setProviderBpm(); + + loginPage.enableSuccessRouteSwitch(); + loginPage.enterSuccessRoute('activiti'); + + loginPage.login(adminUserModel.id, adminUserModel.password); + + navigationBarPage.clickProcessServicesButton(); + processServicesPage.checkApsContainer(); + + navigationBarPage.clickContentServicesButton(); + + loginPage.waitForElements(); + }); + + it('[C260085] Should after login in BOTH not be redirect to Login page when try to access to CS or PS', () => { + adfSettingsPage.setProviderEcmBpm(); + + loginPage.login(adminUserModel.id, adminUserModel.password); + + navigationBarPage.clickProcessServicesButton(); + processServicesPage.checkApsContainer(); + + navigationBarPage.clickContentServicesButton(); + contentServicesPage.checkAcsContainer(); + }); + + it('[C260088] Sould be re-redirect to the request URL after login when try to access to a protect URL ', () => { + let uploadActions = new UploadActions(); + + let uploadedFolder; + let folderName = Util.generateRandomString(); + + adfSettingsPage.setProviderEcmBpm(); + loginPage.login(adminUserModel.id, adminUserModel.password); + + browser.controlFlow().execute(async () => { + uploadedFolder = await uploadActions.uploadFolder(this.alfrescoJsApi, folderName, '-my-'); + + navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); + + browser.getCurrentUrl().then((actualUrl) => { + expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); + }); + + browser.driver.sleep(1000); + + navigationBarPage.clickLogoutButton(); + + browser.driver.sleep(1000); + + navigationBarPage.openContentServicesFolder(uploadedFolder.entry.id); + + loginPage.waitForElements(); + loginPage.enterUsername(adminUserModel.id); + loginPage.enterPassword(adminUserModel.password); + loginPage.clickSignInButton(); + + browser.driver.sleep(1000); + + browser.getCurrentUrl().then((actualUrl) => { + expect(actualUrl).toEqual(TestConfig.adf.url + '/files/' + uploadedFolder.entry.id); + }); + }); + + }); +}); diff --git a/e2e/core/login/remember_me.e2e.ts b/e2e/core/login/remember_me.e2e.ts new file mode 100644 index 0000000000..c4ffae8e62 --- /dev/null +++ b/e2e/core/login/remember_me.e2e.ts @@ -0,0 +1,39 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import LoginPage = require('../../pages/adf/loginPage'); + +import AcsUserModel = require('../../models/ACS/acsUserModel'); + +import AdfSettingsPage = require('../../pages/adf/settingsPage'); + +describe('Login component - Remember Me', () => { + + let adfSettingsPage = new AdfSettingsPage(); + let loginPage = new LoginPage(); + + beforeAll((done) => { + adfSettingsPage.setProviderEcmBpm(); + done(); + }); + + it('[C260036] Should Remember me checkbox not be present in the login if the property showRememberMe is false', () => { + loginPage.checkRememberIsDisplayed(); + loginPage.disableRememberMe(); + loginPage.checkRememberIsNotDisplayed(); + }); +}); diff --git a/e2e/pagination_empty_current_page.e2e.ts b/e2e/core/pagination_empty_current_page.e2e.ts similarity index 89% rename from e2e/pagination_empty_current_page.e2e.ts rename to e2e/core/pagination_empty_current_page.e2e.ts index f8d3c5f136..5a2c6adc00 100644 --- a/e2e/pagination_empty_current_page.e2e.ts +++ b/e2e/core/pagination_empty_current_page.e2e.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import PaginationPage = require('./pages/adf/paginationPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); +import PaginationPage = require('../pages/adf/paginationPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FolderModel = require('./models/ACS/folderModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FolderModel = require('../models/ACS/folderModel'); -import TestConfig = require('./test.config'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Pagination - returns to previous page when current is empty', () => { diff --git a/e2e/theming_component.e2e.ts b/e2e/core/theming_component.e2e.ts similarity index 89% rename from e2e/theming_component.e2e.ts rename to e2e/core/theming_component.e2e.ts index 15534d69fa..b358717391 100644 --- a/e2e/theming_component.e2e.ts +++ b/e2e/core/theming_component.e2e.ts @@ -15,13 +15,13 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import TestConfig = require('./test.config'); +import TestConfig = require('../test.config'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import CONSTANTS = require('./util/constants'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import CONSTANTS = require('../util/constants'); import AlfrescoApi = require('alfresco-js-api-node'); diff --git a/e2e/user_info_component.e2e.ts b/e2e/core/user_info_component.e2e.ts similarity index 92% rename from e2e/user_info_component.e2e.ts rename to e2e/core/user_info_component.e2e.ts index b40ee94d75..d50df5a80b 100644 --- a/e2e/user_info_component.e2e.ts +++ b/e2e/core/user_info_component.e2e.ts @@ -14,23 +14,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import AdfSettingsPage = require('./pages/adf/settingsPage'); -import LoginPage = require('./pages/adf/loginPage'); -import UserInfoDialog = require('./pages/adf/dialog/userInfoDialog'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import AdfSettingsPage = require('../pages/adf/settingsPage'); +import LoginPage = require('../pages/adf/loginPage'); +import UserInfoDialog = require('../pages/adf/dialog/userInfoDialog'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import AcsUserModel = require('./models/ACS/acsUserModel'); -import FileModel = require('./models/ACS/fileModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); +import FileModel = require('../models/ACS/fileModel'); -import PeopleAPI = require('./restAPI/ACS/PeopleAPI'); +import PeopleAPI = require('../restAPI/ACS/PeopleAPI'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UsersActions } from './actions/users.actions'; +import { UsersActions } from '../actions/users.actions'; -describe('User Info component', () => { +fdescribe('User Info component', () => { let adfSettingsPage = new AdfSettingsPage(); let loginPage = new LoginPage(); diff --git a/e2e/viewer_content_services_component.e2e.ts b/e2e/core/viewer_content_services_component.e2e.ts similarity index 95% rename from e2e/viewer_content_services_component.e2e.ts rename to e2e/core/viewer_content_services_component.e2e.ts index 09c881caa2..26d9b0ee3c 100644 --- a/e2e/viewer_content_services_component.e2e.ts +++ b/e2e/core/viewer_content_services_component.e2e.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import TestConfig = require('./test.config'); +import TestConfig = require('../test.config'); -import LoginPage = require('./pages/adf/loginPage'); -import ContentServicesPage = require('./pages/adf/contentServicesPage'); -import ViewerPage = require('./pages/adf/viewerPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ContentServicesPage = require('../pages/adf/contentServicesPage'); +import ViewerPage = require('../pages/adf/viewerPage'); -import resources = require('./util/resources'); +import resources = require('../util/resources'); -import FileModel = require('./models/ACS/fileModel'); -import AcsUserModel = require('./models/ACS/acsUserModel'); +import FileModel = require('../models/ACS/fileModel'); +import AcsUserModel = require('../models/ACS/acsUserModel'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UploadActions } from './actions/ACS/upload.actions'; +import { UploadActions } from '../actions/ACS/upload.actions'; describe('Content Services Viewer', () => { @@ -139,6 +139,8 @@ describe('Content Services Viewer', () => { viewerPage.viewFile(pdfFile.name); + browser.driver.sleep(3000); //wait open file + viewerPage.checkFileContent('1', pdfFile.firstPageText); viewerPage.checkCloseButtonIsDisplayed(); viewerPage.checkFileNameIsDisplayed(pdfFile.name); @@ -302,6 +304,8 @@ describe('Content Services Viewer', () => { it('[C261123] Should be able to preview all pages and navigate to a page when using thumbnails', () => { viewerPage.viewFile(pdfFile.name); + browser.driver.sleep(3000); //wait open file + viewerPage.checkFileContent('1', pdfFile.firstPageText); viewerPage.checkThumbnailsBtnIsDisplayed(); viewerPage.clickThumbnailsBtn(); @@ -341,6 +345,7 @@ describe('Content Services Viewer', () => { it('[C269109] Should not be able to open thumbnail pane before the pdf is loaded', () => { viewerPage.viewFile(pdfFile.name); + viewerPage.clickThumbnailsBtn(); viewerPage.checkThumbnailsContentIsNotDisplayed(); @@ -350,6 +355,8 @@ describe('Content Services Viewer', () => { it('[C268901] Should need a password when opening a protected file', () => { viewerPage.viewFile(protectedFile.name); + browser.driver.sleep(3000); //wait open file + viewerPage.checkPasswordDialogIsDisplayed(); viewerPage.checkPasswordSubmitDisabledIsDisplayed(); diff --git a/e2e/core/z-finish.e2e.ts b/e2e/core/z-finish.e2e.ts new file mode 100644 index 0000000000..3b4362ee7f --- /dev/null +++ b/e2e/core/z-finish.e2e.ts @@ -0,0 +1,77 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AlfrescoApi = require('alfresco-js-api-node'); +import TestConfig = require('../test.config'); + +import fs = require('fs'); +import path = require('path'); + +let buildNumber = process.env.TRAVIS_BUILD_NUMBER; +let saveScreenshot = process.env.SAVE_SCREENSHOT; + +describe('Save screenshot at the end', () => { + + beforeAll(async (done) => { + + if (saveScreenshot === 'true') { + if (!buildNumber) { + buildNumber = Date.now(); + } + + let alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots')); + + if (files && files.length > 0) { + alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + let folder = await alfrescoJsApi.nodes.addNode('-my-', { + 'name': 'core', + 'relativePath': 'Buiild-screenshot/Screenshot-e2e-' + buildNumber, + 'nodeType': 'cm:folder' + }, {}, {}); + + for (const fileName of files) { + + let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName); + let file = fs.createReadStream(pathFile); + + await alfrescoJsApi.upload.uploadFile( + file, + '', + folder.entry.id, + null, + { + 'name': file.name, + 'nodeType': 'cm:content' + } + ); + } + } + } + + done(); + }); + + it('screenshot need it', () => { + expect(true).toEqual(true); + }); +}); diff --git a/e2e/analytics-component.e2e.ts b/e2e/insights/analytics-component.e2e.ts similarity index 81% rename from e2e/analytics-component.e2e.ts rename to e2e/insights/analytics-component.e2e.ts index 0ef806480b..4aec6dcf3c 100644 --- a/e2e/analytics-component.e2e.ts +++ b/e2e/insights/analytics-component.e2e.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); -import AnalyticsPage = require('./pages/adf/process_services/analyticsPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage'); -import TestConfig = require('./test.config'); -import Tenant = require('./models/APS/Tenant'); -import User = require('./models/APS/User'); +import LoginPage = require('../pages/adf/loginPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); +import AnalyticsPage = require('../pages/adf/process_services/analyticsPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import AppNavigationBarPage = require('../pages/adf/process_services/appNavigationBarPage'); +import TestConfig = require('../test.config'); +import Tenant = require('../models/APS/Tenant'); +import User = require('../models/APS/User'); import AlfrescoApi = require('alfresco-js-api-node'); diff --git a/e2e/insights/z-finish.e2e.ts b/e2e/insights/z-finish.e2e.ts new file mode 100644 index 0000000000..155047e6a9 --- /dev/null +++ b/e2e/insights/z-finish.e2e.ts @@ -0,0 +1,77 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AlfrescoApi = require('alfresco-js-api-node'); +import TestConfig = require('../test.config'); + +import fs = require('fs'); +import path = require('path'); + +let buildNumber = process.env.TRAVIS_BUILD_NUMBER; +let saveScreenshot = process.env.SAVE_SCREENSHOT; + +describe('Save screenshot at the end', () => { + + beforeAll(async (done) => { + + if (saveScreenshot === 'true') { + if (!buildNumber) { + buildNumber = Date.now(); + } + + let alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots')); + + if (files && files.length > 0) { + alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + let folder = await alfrescoJsApi.nodes.addNode('-my-', { + 'name': 'insights', + 'relativePath': 'Buiild-screenshot/Screenshot-e2e-' + buildNumber, + 'nodeType': 'cm:folder' + }, {}, {}); + + for (const fileName of files) { + + let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName); + let file = fs.createReadStream(pathFile); + + await alfrescoJsApi.upload.uploadFile( + file, + '', + folder.entry.id, + null, + { + 'name': file.name, + 'nodeType': 'cm:content' + } + ); + } + } + } + + done(); + }); + + it('screenshot need it', () => { + expect(true).toEqual(true); + }); +}); diff --git a/e2e/login_component.e2e.ts b/e2e/login_component.e2e.ts deleted file mode 100644 index c171fdacdb..0000000000 --- a/e2e/login_component.e2e.ts +++ /dev/null @@ -1,156 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import LoginPage = require('./pages/adf/loginPage'); -import AdfContentServicesPage = require('./pages/adf/contentServicesPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); - -import TestConfig = require('./test.config'); -import AcsUserModel = require('./models/ACS/acsUserModel'); - -import AdfSettingsPage = require('./pages/adf/settingsPage'); - -describe('Login component', () => { - - let adfSettingsPage = new AdfSettingsPage(); - let processServicesPage = new ProcessServicesPage(); - let navigationBarPage = new NavigationBarPage(); - let adfContentServicesPage = new AdfContentServicesPage(); - let loginPage = new LoginPage(); - let adminUserModel = new AcsUserModel({ - 'id': TestConfig.adf.adminUser, - 'password': TestConfig.adf.adminPassword - }); - - let errorMessages = { - username: 'Your username needs to be at least 2 characters.', - invalid_credentials: 'You\'ve entered an unknown username or password', - password: 'Enter your password to sign in', - required: 'Required' - }; - - beforeAll( (done) => { - adfSettingsPage.setProviderEcmBpm(); - done(); - }); - - it('1. Username Required', () => { - loginPage.checkUsernameInactive(); - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterUsername('A'); - loginPage.checkUsernameTooltip(errorMessages.username); - loginPage.clearUsername(); - loginPage.checkUsernameTooltip(errorMessages.required); - loginPage.checkUsernameHighlighted(); - loginPage.checkSignInButtonIsDisabled(); - }); - - it('2. Enter Password to sign in', () => { - loginPage.checkPasswordInactive(); - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterPassword('A'); - loginPage.checkPasswordTooltipIsNotVisible(); - loginPage.clearPassword(); - loginPage.checkPasswordTooltip(errorMessages.password); - loginPage.checkPasswordHighlighted(); - loginPage.checkSignInButtonIsDisabled(); - }); - - it('3. Username must be at least 2 characters long', () => { - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterUsername('A'); - loginPage.checkUsernameTooltip(errorMessages.username); - loginPage.enterUsername('AB'); - loginPage.checkUsernameTooltipIsNotVisible(); - loginPage.checkSignInButtonIsDisabled(); - loginPage.clearUsername(); - }); - - it('4. Login button is enabled', () => { - loginPage.enterUsername(adminUserModel.id); - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterPassword('a'); - loginPage.checkSignInButtonIsEnabled(); - loginPage.clearUsername(adminUserModel.id); - loginPage.clearPassword(); - }); - - it('5. You have entered an invalid username or password', () => { - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterUsername('test'); - loginPage.enterPassword('test'); - loginPage.checkSignInButtonIsEnabled(); - loginPage.clickSignInButton(); - loginPage.checkLoginError(errorMessages.invalid_credentials); - loginPage.clearUsername(); - loginPage.clearPassword(); - }); - - it('6. Password field is crypted', () => { - loginPage.checkSignInButtonIsDisabled(); - loginPage.enterPassword('test'); - loginPage.showPassword(); - loginPage.checkPasswordIsShown('test'); - loginPage.hidePassword(); - loginPage.checkPasswordIsHidden(); - loginPage.clearPassword(); - }); - - it('7. Remember Need Help? and Register are displayed and hidden', () => { - loginPage.enableFooter(); - loginPage.checkRememberIsDisplayed(); - loginPage.checkNeedHelpIsDisplayed(); - loginPage.checkRegisterDisplayed(); - loginPage.disableFooter(); - loginPage.checkRememberIsNotDisplayed(); - loginPage.checkNeedHelpIsNotDisplayed(); - loginPage.checkRegisterIsNotDisplayed(); - }); - - it('8. Login to Process Services with Content Services disabled', () => { - loginPage.checkSignInButtonIsDisabled(); - adfSettingsPage.setProviderBpm(); - loginPage.login(adminUserModel.id, adminUserModel.password); - navigationBarPage.clickProcessServicesButton(); - processServicesPage.checkApsContainer(); - navigationBarPage.clickContentServicesButton(); - loginPage.waitForElements(); - }); - - it('9. Login to Content Services with Process Services disabled', () => { - loginPage.checkSignInButtonIsDisabled(); - adfSettingsPage.setProviderEcm(); - loginPage.login(TestConfig.adf.adminUser, TestConfig.adf.adminPassword); - navigationBarPage.clickContentServicesButton(); - adfContentServicesPage.checkAcsContainer(); - navigationBarPage.clickProcessServicesButton(); - loginPage.waitForElements(); - }); - - it('10. Able to login to both Content Services and Process Services', () => { - loginPage.checkSignInButtonIsDisabled(); - adfSettingsPage.setProviderEcmBpm(); - loginPage.login(adminUserModel.id, adminUserModel.password); - navigationBarPage.clickProcessServicesButton(); - processServicesPage.checkApsContainer(); - navigationBarPage.clickContentServicesButton(); - adfContentServicesPage.checkAcsContainer(); - navigationBarPage.clickLoginButton(); - loginPage.waitForElements(); - }); -}); diff --git a/e2e/models/ACS/contentModel.js b/e2e/models/ACS/contentModel.js index 9cbaddd5cc..db5bf894d9 100644 --- a/e2e/models/ACS/contentModel.js +++ b/e2e/models/ACS/contentModel.js @@ -31,10 +31,8 @@ var ContentModel = function (details) { }; this.getSizeInBytes = function () { - if (this.sizeInBytes>=1024) - { - var bytes=(this.sizeInBytes/1024).toFixed(2)+' KB'; - return bytes; + if (this.sizeInBytes >= 1024) { + return (this.sizeInBytes / 1024).toFixed(2) + ' KB'; } else { return this.sizeInBytes; diff --git a/e2e/pages/adf/cardViewPage.js b/e2e/pages/adf/cardViewPage.js deleted file mode 100644 index 79e672262d..0000000000 --- a/e2e/pages/adf/cardViewPage.js +++ /dev/null @@ -1,188 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -var Util = require('../../util/util'); - -var CardViewPage = function () { - - var title = element(by.css("div[info-drawer-title]")); - var activeTab = element(by.css("div[class*='mat-tab-label-active']")); - var expandedAspect = element(by.css("mat-expansion-panel-header[aria-expanded='true']")); - var aspectTitle = by.css("mat-panel-title"); - var name = element(by.css("span[data-automation-id='card-textitem-value-name'] span")); - var creator = element(by.css("span[data-automation-id='card-textitem-value-createdByUser.displayName'] span")); - var createdDate = element(by.css("span[data-automation-id='card-dateitem-createdAt'] span")); - var modifier = element(by.css("span[data-automation-id='card-textitem-value-modifiedByUser.displayName'] span")); - var modifiedDate = element(by.css("span[data-automation-id='card-dateitem-modifiedAt'] span")); - var mimetypeName = element(by.css("span[data-automation-id='card-textitem-value-content.mimeTypeName']")); - var size = element(by.css("span[data-automation-id='card-textitem-value-content.sizeInBytes']")); - var description = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:description'] span")); - var author = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:author'] span")); - var titleProperty = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:title'] span")); - var editIcon = element(by.css("button[data-automation-id='mata-data-card-toggle-edit']")); - var informationButton = element(by.css("button[data-automation-id='mata-data-card-toggle-expand']")); - var informationSpan = element(by.css("span[data-automation-id='mata-data-card-toggle-expand-label']")); - var informationIcon = element(by.css("span[data-automation-id='mata-data-card-toggle-expand-label'] ~ mat-icon")); - var uploadNewVersionButton = element(by.css("input[data-automation-id='upload-single-file']")); - var rightChevron = element(by.css("div[class*='header-pagination-after']")); - - this.getTitle = function () { - Util.waitUntilElementIsVisible(title); - return title.getText(); - }; - - this.getActiveTab = function () { - Util.waitUntilElementIsVisible(activeTab); - return activeTab.getText(); - }; - - this.getExpandedAspectName = function () { - Util.waitUntilElementIsVisible(expandedAspect); - return expandedAspect.element(aspectTitle).getText(); - }; - - this.getName = function () { - Util.waitUntilElementIsVisible(name); - return name.getText(); - }; - - this.getCreator = function () { - Util.waitUntilElementIsVisible(creator); - return creator.getText(); - }; - - this.getCreatedDate = function () { - Util.waitUntilElementIsVisible(createdDate); - return createdDate.getText(); - }; - - this.getModifier = function () { - Util.waitUntilElementIsVisible(modifier); - return modifier.getText(); - }; - - this.getModifiedDate = function () { - Util.waitUntilElementIsVisible(modifiedDate); - return modifiedDate.getText(); - }; - - this.getMimetypeName = function () { - Util.waitUntilElementIsVisible(mimetypeName); - return mimetypeName.getText(); - }; - - this.getSize = function () { - Util.waitUntilElementIsVisible(size); - return size.getText(); - }; - - this.getDescription = function () { - Util.waitUntilElementIsVisible(description); - return description.getText(); - }; - - this.getAuthor = function () { - Util.waitUntilElementIsVisible(author); - return author.getText(); - }; - - this.getTitleProperty = function () { - Util.waitUntilElementIsVisible(titleProperty); - return titleProperty.getText(); - }; - - this.editIconIsDisplayed = function() { - Util.waitUntilElementIsVisible(editIcon); - return editIcon.getText(); - }; - - this.informationButtonIsDisplayed = function() { - Util.waitUntilElementIsVisible(informationSpan); - return informationSpan.getText(); - }; - - this.clickOnInformationButton = function() { - Util.waitUntilElementIsVisible(informationButton); - Util.waitUntilElementIsClickable(informationButton); - informationButton.click(); - return this; - }; - - this.getInformationButtonText = function() { - Util.waitUntilElementIsVisible(informationSpan); - return informationSpan.getText(); - }; - - this.getInformationIconText = function() { - Util.waitUntilElementIsVisible(informationIcon); - return informationIcon.getText(); - }; - - this.clickOnVersionsTab = function() { - this.clickRightChevronToGetToTab('Versions'); - var versionsTab = element(by.cssContainingText("div[id*='mat-tab-label']", "Versions")); - Util.waitUntilElementIsVisible(versionsTab); - versionsTab.click(); - return this; - }; - - this.clickOnPropertiesTab = function() { - var propertiesTab = element(by.cssContainingText("div[class='mat-tab-labels'] div", "Properties")); - Util.waitUntilElementIsVisible(propertiesTab); - propertiesTab.click(); - return this; - }; - - this.clickRightChevron = function() { - Util.waitUntilElementIsVisible(rightChevron); - rightChevron.click(); - return this; - }; - - this.clickRightChevronToGetToTab = (tabName) => { - element.all(by.css('.mat-tab-label')) - .map((element) => element.getAttribute('innerText')) - .then((texts) => { - for (let text of texts) { - if (text === tabName ) { - break; - } - this.clickRightChevron(); - } - }); - }; - - this.checkUploadVersionsButtonIsDisplayed = function() { - Util.waitUntilElementIsVisible(uploadNewVersionButton); - return this; - }; - - this.checkVersionIsDisplayed = function(version) { - Util.waitUntilElementIsVisible(element(by.cssContainingText("h4[class*='adf-version-list-item-name']", version))); - return this; - }; - - this.getEditIconTooltip = function () { - return editIcon.getAttribute('title'); - }; - - this.getInformationButtonTooltip = function () { - return informationSpan.getAttribute('title'); - }; -}; - -module.exports = CardViewPage; diff --git a/e2e/pages/adf/cardViewPageComponent.js b/e2e/pages/adf/cardViewPageComponent.js index a628a852fa..577208e180 100644 --- a/e2e/pages/adf/cardViewPageComponent.js +++ b/e2e/pages/adf/cardViewPageComponent.js @@ -17,51 +17,174 @@ var Util = require('../../util/util'); -var CardViewComponentPage = function (){ +var CardViewComponentPage = function () { - const addButton = element(by.className('card-view__key-value-pairs__add-btn')); - const keyValueRow = 'card-view__key-value-pairs__row'; - const selectValue = 'mat-option'; - const valueInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Value']")); - const nameInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Name']")); - const consoleLog = element(by.className('console')); - const deleteButton = element(by.className('card-view__key-value-pairs__remove-btn')); - const select = element(by.css('mat-select[data-automation-class="select-box"]')); - const listContent = element(by.className('mat-select-content')); - const selectedValue = element(by.css('.mat-select-value-text span')); + const addButton = element(by.className('card-view__key-value-pairs__add-btn')); + const keyValueRow = 'card-view__key-value-pairs__row'; + const selectValue = 'mat-option'; + const textField = element(by.css("input[data-automation-id='card-textitem-editinput-name']")); + const intField = element(by.css("input[data-automation-id='card-textitem-editinput-int']")); + const floatField = element(by.css("input[data-automation-id='card-textitem-editinput-float']")); + const valueInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Value']")); + const nameInputField = element(by.xpath("//*[contains(@id,'input') and @placeholder='Name']")); + const consoleLog = element(by.className('console')); + const deleteButton = element.all(by.className('card-view__key-value-pairs__remove-btn')).first(); + const select = element(by.css('mat-select[data-automation-class="select-box"]')); + const checkbox = element(by.css("mat-checkbox[data-automation-id='card-boolean-boolean']")); + const resetButton = element(by.css("#adf-reset-card-log")); + const selectedValue = element(by.css('.mat-select-value-text span')); + const listContent = element(by.className('mat-select-content')); + const editableSwitch = element(by.id('adf-toogle-editable')); - this.clickOnAddButton = function() { + this.clickOnAddButton = function () { Util.waitUntilElementIsVisible(addButton); addButton.click(); return this; - }; + }; - this.setName = function(name) { + this.clickOnResetButton= function () { + Util.waitUntilElementIsVisible(resetButton); + resetButton.click(); + return this; + }; + + this.clickOnTextField = function () { + let toggleText = element(by.css("div[data-automation-id='card-textitem-edit-toggle-name']")); + Util.waitUntilElementIsVisible(toggleText); + toggleText.click(); + Util.waitUntilElementIsVisible(textField); + return this; + }; + + this.clickOnTextClearIcon = function () { + let clearIcon = element(by.css("mat-icon[data-automation-id=\"card-textitem-reset-name\"]")); + Util.waitUntilElementIsVisible(clearIcon); + return clearIcon.click(); + }; + + this.clickOnTextSaveIcon = function () { + let saveIcon = element(by.css("mat-icon[data-automation-id=\"card-textitem-update-name\"]")); + Util.waitUntilElementIsVisible(saveIcon); + return saveIcon.click(); + }; + + this.getTextFieldText = function (text) { + var textField = element(by.css("span[data-automation-id='card-textitem-value-name']")); + Util.waitUntilElementIsVisible(textField); + return textField.getText(); + }; + + this.enterTextField = function (text) { + Util.waitUntilElementIsVisible(textField); + textField.sendKeys(''); + textField.clear().sendKeys(text); + return this; + }; + + this.clickOnIntField = function () { + let toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-int"]')); + Util.waitUntilElementIsVisible(toggleText); + toggleText.click(); + Util.waitUntilElementIsVisible(intField); + return this; + }; + + this.clickOnIntClearIcon = function () { + let clearIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-int"]')); + Util.waitUntilElementIsVisible(clearIcon); + return clearIcon.click(); + }; + + this.clickOnIntSaveIcon = function () { + let saveIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-int"]')); + Util.waitUntilElementIsVisible(saveIcon); + return saveIcon.click(); + }; + + this.enterIntField = function (text) { + Util.waitUntilElementIsVisible(intField); + intField.sendKeys(''); + intField.clear().sendKeys(text); + return this; + }; + + this.getIntFieldText = function (text) { + var textField = element(by.css('span[data-automation-id="card-textitem-value-int"]')); + Util.waitUntilElementIsVisible(textField); + return textField.getText(); + }; + + this.getErrorInt = function (text) { + let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-int"]')); + Util.waitUntilElementIsVisible(errorElement); + return errorElement.getText(); + }; + + this.clickOnFloatField = function () { + let toggleText = element(by.css('div[data-automation-id="card-textitem-edit-toggle-float"]')); + Util.waitUntilElementIsVisible(toggleText); + toggleText.click(); + Util.waitUntilElementIsVisible(floatField); + return this; + }; + + this.clickOnFloatClearIcon = function () { + let clearIcon = element(by.css("mat-icon[data-automation-id='card-textitem-reset-float']")); + Util.waitUntilElementIsVisible(clearIcon); + return clearIcon.click(); + }; + + this.clickOnFloatSaveIcon = function () { + let saveIcon = element(by.css("mat-icon[data-automation-id='card-textitem-update-float']")); + Util.waitUntilElementIsVisible(saveIcon); + return saveIcon.click(); + }; + + this.enterFloatField = function (text) { + Util.waitUntilElementIsVisible(floatField); + floatField.sendKeys(''); + floatField.clear().sendKeys(text); + return this; + }; + + this.getFloatFieldText = function (text) { + var textField = element(by.css('span[data-automation-id="card-textitem-value-float"]')); + Util.waitUntilElementIsVisible(textField); + return textField.getText(); + }; + + this.getErrorFloat = function (text) { + let errorElement = element(by.css('mat-error[data-automation-id="card-textitem-error-float"]')); + Util.waitUntilElementIsVisible(errorElement); + return errorElement.getText(); + }; + + this.setName = function (name) { Util.waitUntilElementIsVisible(nameInputField); nameInputField.sendKeys(name); return this; - }; + }; - this.setValue = function(value) { + this.setValue = function (value) { Util.waitUntilElementIsVisible(valueInputField); valueInputField.sendKeys(value); return this; - }; + }; - this.waitForOutput = function(){ + this.waitForOutput = function () { Util.waitUntilElementIsVisible(consoleLog); return this; }; - this.getOutputText = function(index){ - return consoleLog.all(by.css('p')).get(index).getText() + this.getOutputText = function (index) { + return consoleLog.all(by.css('p')).get(index).getText(); }; - this.deletePairsValues = function(){ - Util.waitUntilElementIsVisible(deleteButton); - deleteButton.click(); - return this; + this.deletePairsValues = function () { + Util.waitUntilElementIsVisible(deleteButton); + deleteButton.click(); + return this; }; this.checkNameAndValueVisibility = (index) => { @@ -70,7 +193,7 @@ var CardViewComponentPage = function (){ }; this.getKeyValueRow = (index) => { - return element.all(by.css(keyValueRow)).get(index); + return element.all(by.css(keyValueRow)).get(index); }; @@ -78,20 +201,34 @@ var CardViewComponentPage = function (){ return element.all(by.className(selectValue)).get(index); }; - this.clickComboBox = () => { - select.click(); - Util.waitUntilElementIsVisible(listContent); + this.clickSelectBox = () => { + select.click(); + Util.waitUntilElementIsVisible(listContent); + }; + + this.checkboxClick = () => { + checkbox.click(); }; this.selectValueFromComboBox = (index) => { this.getMatSelectValue(index).click(); Util.waitUntilElementIsVisible(consoleLog); - return this; + return this; }; this.getSelectionValue = () => { return selectedValue.getText(); }; + this.disableEdit = function () { + Util.waitUntilElementIsVisible(editableSwitch); + editableSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + editableSwitch.click(); + expect(editableSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + } -module.exports = CardViewComponentPage; \ No newline at end of file +module.exports = CardViewComponentPage; diff --git a/e2e/pages/adf/configEditorPage.ts b/e2e/pages/adf/configEditorPage.ts new file mode 100644 index 0000000000..ef7c0ec076 --- /dev/null +++ b/e2e/pages/adf/configEditorPage.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Util = require('../../util/util'); +import TestConfig = require('../../test.config'); + +export class ConfigEditorPage { + + enterMetadataConfiguration(text) { + let textField = element(by.css('#adf-metadata-editor > div > div > div.overflow-guard > textarea')); + browser.driver.sleep(1000); + Util.waitUntilElementIsVisible(textField); + textField.sendKeys(''); + textField.clear().sendKeys(text); + return this; + } + + clickSaveMetadataButton() { + let saveButton = element(by.xpath('//*[@id="adf-metadata-save"]')); + Util.waitUntilElementIsVisible(saveButton); + return saveButton.click(); + } + + clickClearMetadataButton() { + let clearButton = element(by.xpath('//*[@id="adf-metadata-clear"]')); + Util.waitUntilElementIsVisible(clearButton); + return clearButton.click(); + } +} diff --git a/e2e/pages/adf/contentServicesPage.js b/e2e/pages/adf/contentServicesPage.js index d44e756e67..05ea63d019 100644 --- a/e2e/pages/adf/contentServicesPage.js +++ b/e2e/pages/adf/contentServicesPage.js @@ -25,7 +25,7 @@ var ContentServicesPage = function () { var contentList = new ContentList(); var createFolderDialog = new CreateFolderDialog(); - var uploadBorder = element(by.css("div[class='document-list-container']")); + var uploadBorder = element(by.css("div[id='document-list-container']")); var tableBody = element.all(by.css("adf-document-list div[class='adf-datatable-body']")).first(); var contentServices = element(by.css("a[data-automation-id='Content Services']")); var currentFolder = element(by.css("div[class*='adf-breadcrumb-item active'] div")); @@ -245,6 +245,7 @@ var ContentServicesPage = function () { this.uploadFile = function (fileLocation) { this.checkUploadButton(); + Util.waitUntilElementIsVisible(uploadFileButton); uploadFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation))); this.checkUploadButton(); return this; diff --git a/e2e/pages/adf/dialog/contentList.js b/e2e/pages/adf/dialog/contentList.js index 8d02a308a8..6bd49003d2 100644 --- a/e2e/pages/adf/dialog/contentList.js +++ b/e2e/pages/adf/dialog/contentList.js @@ -18,26 +18,26 @@ var Util = require('../../../util/util'); var ContentList = function () { - var deleteContent = element(by.css("button[data-automation-id*='DELETE']")); + var metadataAction = element(by.css("button[data-automation-id*='METADATA']")); var moveContent = element(by.css("button[data-automation-id*='MOVE']")); var copyContent = element(by.css("button[data-automation-id*='COPY']")); var downloadContent = element(by.css("button[data-automation-id*='DOWNLOAD']")); var actionMenu = element(by.css("div[role='menu']")); var optionButton = by.css("button[data-automation-id*='action_menu_']"); var rowByRowName = by.xpath("ancestor::div[contains(@class, 'adf-datatable-row')]"); - var nameColumn = by.css("div[class*='document-list-container'] div[class*='adf-datatable-row'] div[class*='--text full-width'] span"); + var nameColumn = by.css("div[id*='document-list-container'] div[class*='adf-datatable-row'] div[class*='--text full-width'] span"); var nameColumnHeader = by.css("div[data-automation-id='auto_id_name']"); var createdByColumn = by.css("div[class*='--text'][title='Created by'] span"); var createdByColumnHeader = by.css("div[data-automation-id*='auto_id_createdByUser']"); var createdColumn = by.css("div[class*='--date'] span"); var createdColumnHeader = by.css("div[data-automation-id*='auto_id_createdAt']"); - var rows = by.css("div[class='document-list-container'] div[class*='adf-datatable-body'] div[class*='adf-datatable-row']"); + var rows = by.css("div[id='document-list-container'] div[class*='adf-datatable-body'] div[class*='adf-datatable-row']"); var emptyFolderMessage = element(by.css("div[class='adf-empty-folder-this-space-is-empty']")); var table = element(by.css("div[class*='upload-border']")); this.getRowsName = function (content) { - var row = element(by.xpath("//div[@class='document-list-container']//span[@title='" + content + "']")); + var row = element.all(by.xpath("//div[@id='document-list-container']//div[@filename='" + content + "']")).first(); Util.waitUntilElementIsVisible(row); return row; }; @@ -81,6 +81,12 @@ var ContentList = function () { deleteContent.click(); }; + this.metadataContent = function (content) { + this.clickOnActionMenu(content); + this.waitForContentOptions(); + metadataAction.click(); + }; + this.moveContent = function (content) { this.clickOnActionMenu(content); moveContent.click(); @@ -277,7 +283,7 @@ var ContentList = function () { }; this.checkContentIsNotDisplayed = function (content) { - Util.waitUntilElementIsNotVisible(element(by.css("adf-document-list span[title='" + content + "']"))); + Util.waitUntilElementIsNotVisible(element.all(by.xpath("//div[@id='document-list-container']//div[@filename='" + content + "']")).first()); return this; }; diff --git a/e2e/pages/adf/dialog/searchDialog.js b/e2e/pages/adf/dialog/searchDialog.js index bd8a86c8f1..69cf4f6f41 100644 --- a/e2e/pages/adf/dialog/searchDialog.js +++ b/e2e/pages/adf/dialog/searchDialog.js @@ -17,7 +17,7 @@ var Util = require('../../../util/util'); - var SearchDialog = function () { +var SearchDialog = function () { var searchIcon = element(by.css("button[class*='adf-search-button']")); var searchBar = element(by.css("adf-search-control div[style*='translateX(0%)'] input")); @@ -29,6 +29,12 @@ var Util = require('../../../util/util'); var searchDialog = element(by.css("mat-list[id*='autocomplete-search-result-list']")); var allRows = element.all(by.css("h4[class*='adf-search-fixed-text']")); + this.pressDownArrowAndEnter = function () { + element(by.css("adf-search-control div[style*='translateX(0%)'] input")).sendKeys(protractor.Key.ARROW_DOWN); + return browser.actions().sendKeys(protractor.Key.ENTER).perform(); + }; + + this.clickOnSearchIcon = function () { Util.waitUntilElementIsVisible(searchIcon); searchIcon.click(); @@ -87,24 +93,7 @@ var Util = require('../../../util/util'); }; this.getRowByRowName = function (name) { - return element(by.css("mat-list-item[data-automation-id='autocomplete_for_" + name +"']")); - }; - - this.getAllRowsValues = function () { - var deferred = protractor.promise.defer(); - var array = [], i =0; - - allRows.map(function(element) { - return element.getText(); - }).then(function (texts) { - texts.forEach(function (text) { - array[i] = text; - i++; - }); - }); - - deferred.fulfill(array); - return deferred.promise; + return element(by.css("mat-list-item[data-automation-id='autocomplete_for_" + name + "']")); }; this.getSpecificRowsHighlightName = function (name) { @@ -139,33 +128,5 @@ var Util = require('../../../util/util'); }); return deferred.promise; }; - - this.resultTableContainsRowWithRetry = function (name, retry) { - - var isPresent = false; - - function run() { - element(by.css("mat-list-item[data-automation-id='autocomplete_for_" + name +"']")).isPresent().then( - function (result) { - if(result === true) { - isPresent = true; - } - else { - retry --; - - if(retry > 0) { - // console.log("Retry: " + retry); - run(); - }; - } - - } - - ); - }; - - run(); - - }; }; module.exports = SearchDialog; diff --git a/e2e/pages/adf/documentListPage.js b/e2e/pages/adf/documentListPage.js index 7cf46ce8bd..da4c911966 100644 --- a/e2e/pages/adf/documentListPage.js +++ b/e2e/pages/adf/documentListPage.js @@ -157,9 +157,9 @@ module.exports = Page.create({ * */ deleteContent: { value: function (contentName) { - var contentName = element(by.css("div[data-automation-id*='text_"+ contentName+"']")); - Util.waitUntilElementIsVisible(contentName); - contentName.click(); + var contentElement = element(by.css("div[data-automation-id*='text_" + contentName + "']")); + Util.waitUntilElementIsVisible(contentElement); + contentElement.click(); deleteContent.click(); } }, @@ -183,7 +183,7 @@ module.exports = Page.create({ goIntoFolder: { value: function (folderName) { this.checkItemInDocList(folderName); - browser.actions().doubleClick(element(by.css("div[data-automation-id*='text_"+ folderName+"']"))).perform(); + browser.actions().doubleClick(element(by.css("div[data-automation-id*='text_" + folderName + "']"))).perform(); } }, @@ -193,7 +193,7 @@ module.exports = Page.create({ * */ goIntoFolderViaBreadcrumbs: { value: function (folderName) { - var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_"+ folderName +"']", folderName)); + var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_" + folderName + "']", folderName)); Util.waitUntilElementIsVisible(breadcrumb); breadcrumb.click(); @@ -202,14 +202,14 @@ module.exports = Page.create({ }, currentFolderName: { - value: function () { - var deferred = protractor.promise.defer(); - Util.waitUntilElementIsVisible(currentFolder); - currentFolder.getText().then(function (result) { - deferred.fulfill(result); - }) - return deferred.promise; - } + value: function () { + var deferred = protractor.promise.defer(); + Util.waitUntilElementIsVisible(currentFolder); + currentFolder.getText().then(function (result) { + deferred.fulfill(result); + }) + return deferred.promise; + } }, /** @@ -218,7 +218,7 @@ module.exports = Page.create({ * */ checkFolderInBreadcrumbs: { value: function (folderName) { - var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_"+ folderName +"']", folderName)); + var breadcrumb = element(by.cssContainingText("a[data-automation-id='breadcrumb_" + folderName + "']", folderName)); Util.waitUntilElementIsVisible(breadcrumb); } @@ -301,7 +301,7 @@ module.exports = Page.create({ var singleUpload = element(by.cssContainingText("div[ng-reflect-klass='file-dialog'] div[class='title'] ", "upload complete")); var multipleUploads = element(by.cssContainingText("div[ng-reflect-klass='file-dialog'] div[class='title'] ", "uploads complete")); - dialogUpload.count().then(function(count) { + dialogUpload.count().then(function (count) { if (count === 1) { Util.waitUntilElementIsVisible(singleUpload); } @@ -338,7 +338,7 @@ module.exports = Page.create({ * */ checkProgressBar: { value: function (fileName) { - Util.waitUntilElementIsVisible(element(by.css("div[data-automation-id='dialog_progress_" + fileName +"']"))); + Util.waitUntilElementIsVisible(element(by.css("div[data-automation-id='dialog_progress_" + fileName + "']"))); } }, @@ -611,9 +611,7 @@ module.exports = Page.create({ var fullFileName = fileName.split("."); var nameWithoutExtension = fullFileName[0]; var extension = fullFileName[1]; - var versionedFileName = nameWithoutExtension + versioningAddition + "." + extension; - - return versionedFileName; + return nameWithoutExtension + versioningAddition + "." + extension; } }, @@ -636,7 +634,7 @@ module.exports = Page.create({ * */ checkFirstFolderName: { value: function (folderName) { - var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + folderName +"'))]")); + var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + folderName + "'))]")); Util.waitUntilElementIsVisible(firstFolder); Util.waitUntilElementIsVisible(this.documentList); @@ -651,7 +649,7 @@ module.exports = Page.create({ * */ checkFirstFilesName: { value: function (fileName) { - var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + fileName +"'))]")); + var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + fileName + "'))]")); Util.waitUntilElementIsVisible(firstFile); Util.waitUntilElementIsVisible(this.documentList); @@ -691,7 +689,7 @@ module.exports = Page.create({ * */ checkFirstFolderCreator: { value: function (folderName, creator) { - var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator +"'))]")); + var firstFolder = element(by.xpath("//img[(contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator + "'))]")); Util.waitUntilElementIsVisible(firstFolder); Util.waitUntilElementIsVisible(this.documentList); @@ -705,7 +703,7 @@ module.exports = Page.create({ * */ checkFirstFilesCreator: { value: function (fileName, creator) { - var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator +"'))]")); + var firstFile = element(by.xpath("//img[not (contains(@src, 'folder.svg'))]/../../../../td/div/div[(contains(@data-automation-id, 'text_" + creator + "'))]")); Util.waitUntilElementIsVisible(firstFile); Util.waitUntilElementIsVisible(this.documentList); diff --git a/e2e/pages/adf/filePreviewPage.js b/e2e/pages/adf/filePreviewPage.js index 5791efb6fb..0e5448f7bb 100644 --- a/e2e/pages/adf/filePreviewPage.js +++ b/e2e/pages/adf/filePreviewPage.js @@ -21,7 +21,7 @@ var documentList = require('./documentListPage'); var pdfTitleFromSearch = element(by.css("span[id='adf-viewer-display-name']")); var textLayer = element.all(by.css("div[class='textLayer']")).first(); -var closeButton = element(by.css("button[class*='adf-viewer-close-button']")); +var closeButton = element(by.css('button[data-automation-id="adf-toolbar-back"]')); /** * Provides the file preview Page. @@ -174,8 +174,8 @@ module.exports = Page.create({ */ checktotalPages: { value: function (totalPages) { - var totalPages = element(by.cssContainingText("div[id='viewer-total-pages']", totalPages)); - Util.waitUntilElementIsVisible(totalPages); + var totalPagesElement = element(by.cssContainingText("div[id='viewer-total-pages']", totalPages)); + Util.waitUntilElementIsVisible(totalPagesElement); } }, diff --git a/e2e/pages/adf/loginPage.js b/e2e/pages/adf/loginPage.js index 2bc56a7778..0969313e3e 100644 --- a/e2e/pages/adf/loginPage.js +++ b/e2e/pages/adf/loginPage.js @@ -24,6 +24,9 @@ var LoginPage = function () { var loginURL = TestConfig.adf.url + TestConfig.adf.port + "/login"; var txtUsername = element(by.css("input[id='username']")); var txtPassword = element(by.css("input[id='password']")); + var logoImg = element(by.css("img[id='adf-login-img-logo']")); + var successRouteTxt = element(by.css("input[data-automation-id='adf-success-route']")); + var logoTxt = element(by.css("input[data-automation-id='adf-url-logo']")); var usernameTooltip = element(by.css("span[data-automation-id='username-error']")); var passwordTooltip = element(by.css("span[data-automation-id='password-required']")); var loginTooltip = element(by.css("span[class='login-error-message']")); @@ -39,10 +42,15 @@ var LoginPage = function () { var needHelp = element(by.css("div[id='adf-login-action-left']")); var register = element(by.css("div[id='adf-login-action-right']")); var footerSwitch = element(by.id("switch4")); + var rememberMeSwitch = element(by.id("adf-toogle-show-rememberme")); + var successRouteSwitch = element(by.id("adf-toogle-show-successRoute")); + var logoSwitch = element(by.id("adf-toogle-logo")); var userPicture = element(by.id("userinfo_container")); + var header = element(by.id("adf-header")); var cardBackground = element(by.css("mat-card[class*='adf-login-card']")); var adfSettingsPage = new AdfSettingsPage(); + /** * Provides the longer wait required * @property waitForElements @@ -71,9 +79,7 @@ var LoginPage = function () { this.enterUsername = function (username) { Util.waitUntilElementIsVisible(txtUsername); txtUsername.sendKeys(''); - txtUsername.clear(); - browser.driver.sleep(500); - txtUsername.sendKeys(username); + return txtUsername.clear().sendKeys(username); }; /** @@ -83,9 +89,7 @@ var LoginPage = function () { */ this.enterPassword = function (password) { Util.waitUntilElementIsVisible(txtPassword); - browser.driver.sleep(500); - txtPassword.clear(); - txtPassword.sendKeys(password); + return txtPassword.clear().sendKeys(password); }; /** @@ -95,7 +99,7 @@ var LoginPage = function () { */ this.clearUsername = function () { Util.waitUntilElementIsVisible(txtUsername); - txtUsername.click().clear(); + return txtUsername.click().clear(); }; /** @@ -140,21 +144,31 @@ var LoginPage = function () { expect(loginTooltip.getText()).toEqual(message); }; + /** + * checks login error tooltips + * @method checkLoginError + * @param {String} message + */ + this.checkLoginImgURL = function (url) { + Util.waitUntilElementIsVisible(logoImg); + expect(logoImg.getAttribute('src')).toEqual(url); + }; + /** * checks username field is inactive * @method checkUsernameInactive */ this.checkUsernameInactive = function () { Util.waitUntilElementIsVisible(usernameInactive); - }, + }; - /** - * checks password field is inactive - * @method checkPasswordInactive - */ - this.checkPasswordInactive = function () { - Util.waitUntilElementIsVisible(passwordInactive); - }; + /** + * checks password field is inactive + * @method checkPasswordInactive + */ + this.checkPasswordInactive = function () { + Util.waitUntilElementIsVisible(passwordInactive); + }; /** * checks username field is highlighted @@ -255,6 +269,7 @@ var LoginPage = function () { */ this.goToLoginPage = function () { browser.driver.get(TestConfig.adf.url + TestConfig.adf.port + '/login'); + this.waitForElements(); }; /** @@ -275,6 +290,14 @@ var LoginPage = function () { signInButton.click(); }; + /** + * clicks the remember me checkbox + */ + this.clickRememberMe = function () { + Util.waitUntilElementIsVisible(rememberMe); + rememberMe.click(); + }; + /** * clicks icon to show password * @method showPassword @@ -421,6 +444,99 @@ var LoginPage = function () { }) }; + /** + * disables RememberMe + */ + this.disableRememberMe = function () { + Util.waitUntilElementIsVisible(rememberMeSwitch); + rememberMeSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + rememberMeSwitch.click(); + expect(rememberMeSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables footer switch + * @method enableFooter + */ + this.enableRememberMe = function () { + Util.waitUntilElementIsVisible(rememberMeSwitch); + rememberMeSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + rememberMeSwitch.click(); + expect(rememberMeSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + /** + * disables successRouteSwitch + */ + this.disableSuccessRouteSwitch = function () { + Util.waitUntilElementIsVisible(successRouteSwitch); + successRouteSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + successRouteSwitch.click(); + expect(successRouteSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables successRouteSwitch + * @method enableFooter + */ + this.enableSuccessRouteSwitch = function () { + Util.waitUntilElementIsVisible(rememberMeSwitch); + successRouteSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + successRouteSwitch.click(); + expect(successRouteSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + /** + * disables successRouteSwitch + */ + this.disableLogowitch = function () { + Util.waitUntilElementIsVisible(logoSwitch); + logoSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + logoSwitch.click(); + expect(logoSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables successRouteSwitch + * @method enableFooter + */ + this.enableLogoSwitch = function () { + Util.waitUntilElementIsVisible(rememberMeSwitch); + logoSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + logoSwitch.click(); + expect(logoSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + this.enterSuccessRoute = function (route) { + Util.waitUntilElementIsVisible(successRouteTxt); + successRouteTxt.sendKeys(''); + return successRouteTxt.clear().sendKeys(route); + }; + + this.enterLogo = function (logo) { + Util.waitUntilElementIsVisible(logoTxt); + logoTxt.sendKeys(''); + return logoTxt.clear().sendKeys(logo); + }; + /** * logs in with a valid user * @method login @@ -431,7 +547,7 @@ var LoginPage = function () { this.enterUsername(username); this.enterPassword(password); this.clickSignInButton(); - Util.waitUntilElementIsVisible(userPicture); + return Util.waitUntilElementIsVisible(header); }; }; diff --git a/e2e/pages/adf/metadataViewPage.js b/e2e/pages/adf/metadataViewPage.js new file mode 100644 index 0000000000..52426f9d3d --- /dev/null +++ b/e2e/pages/adf/metadataViewPage.js @@ -0,0 +1,392 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var Util = require('../../util/util'); + +var MetadataViewPage = function () { + + var title = element(by.css("div[info-drawer-title]")); + var expandedAspect = element(by.css("mat-expansion-panel-header[aria-expanded='true']")); + var aspectTitle = by.css("mat-panel-title"); + var name = element(by.css("span[data-automation-id='card-textitem-value-name'] span")); + var creator = element(by.css("span[data-automation-id='card-textitem-value-createdByUser.displayName'] span")); + var createdDate = element(by.css("span[data-automation-id='card-dateitem-createdAt'] span")); + var modifier = element(by.css("span[data-automation-id='card-textitem-value-modifiedByUser.displayName'] span")); + var modifiedDate = element(by.css("span[data-automation-id='card-dateitem-modifiedAt'] span")); + var mimetypeName = element(by.css("span[data-automation-id='card-textitem-value-content.mimeTypeName']")); + var size = element(by.css("span[data-automation-id='card-textitem-value-content.sizeInBytes']")); + var description = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:description'] span")); + var author = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:author'] span")); + var titleProperty = element(by.css("span[data-automation-id='card-textitem-value-properties.cm:title'] span")); + var editIcon = element(by.css("button[data-automation-id='meta-data-card-toggle-edit']")); + var informationButton = element(by.css("button[data-automation-id='meta-data-card-toggle-expand']")); + var informationSpan = element(by.css("span[data-automation-id='meta-data-card-toggle-expand-label']")); + var informationIcon = element(by.css("span[data-automation-id='meta-data-card-toggle-expand-label'] ~ mat-icon")); + var rightChevron = element(by.css("div[class*='header-pagination-after']")); + var displayEmptySwitch = element(by.id("adf-metadata-empty")); + var readonlySwitch = element(by.id("adf-metadata-readonly")); + var multiSwitch = element(by.id("adf-metadata-multi")); + var presetSwitch = element(by.id('adf-toggle-custom-preset')); + + this.getTitle = function () { + Util.waitUntilElementIsVisible(title); + return title.getText(); + }; + + this.getExpandedAspectName = function () { + Util.waitUntilElementIsVisible(expandedAspect); + return expandedAspect.element(aspectTitle).getText(); + }; + + this.getName = function () { + Util.waitUntilElementIsVisible(name); + return name.getText(); + }; + + this.getCreator = function () { + Util.waitUntilElementIsVisible(creator); + return creator.getText(); + }; + + this.getCreatedDate = function () { + Util.waitUntilElementIsVisible(createdDate); + return createdDate.getText(); + }; + + this.getModifier = function () { + Util.waitUntilElementIsVisible(modifier); + return modifier.getText(); + }; + + this.getModifiedDate = function () { + Util.waitUntilElementIsVisible(modifiedDate); + return modifiedDate.getText(); + }; + + this.getMimetypeName = function () { + Util.waitUntilElementIsVisible(mimetypeName); + return mimetypeName.getText(); + }; + + this.getSize = function () { + Util.waitUntilElementIsVisible(size); + return size.getText(); + }; + + this.getDescription = function () { + Util.waitUntilElementIsVisible(description); + return description.getText(); + }; + + this.getAuthor = function () { + Util.waitUntilElementIsVisible(author); + return author.getText(); + }; + + this.getTitleProperty = function () { + Util.waitUntilElementIsVisible(titleProperty); + return titleProperty.getText(); + }; + + this.editIconIsDisplayed = function () { + return Util.waitUntilElementIsVisible(editIcon); + }; + + this.editIconIsNotDisplayed = function () { + return Util.waitUntilElementIsNotVisible(editIcon); + }; + + this.editIconClick = function () { + Util.waitUntilElementIsVisible(editIcon); + return editIcon.click(); + }; + + this.informationButtonIsDisplayed = function () { + return Util.waitUntilElementIsVisible(informationSpan); + }; + + this.clickOnInformationButton = function () { + Util.waitUntilElementIsVisible(informationSpan); + informationButton.click(); + return this; + }; + + this.getInformationButtonText = function () { + Util.waitUntilElementIsVisible(informationSpan); + return informationSpan.getText(); + }; + + this.getInformationIconText = function () { + Util.waitUntilElementIsVisible(informationIcon); + return informationIcon.getText(); + }; + + this.clickOnPropertiesTab = function () { + var propertiesTab = element(by.cssContainingText("div[class='mat-tab-labels'] div", "Properties")); + Util.waitUntilElementIsVisible(propertiesTab); + propertiesTab.click(); + return this; + }; + + this.clickRightChevron = function () { + Util.waitUntilElementIsVisible(rightChevron); + rightChevron.click(); + return this; + }; + + this.clickRightChevronToGetToTab = (tabName) => { + element.all(by.css('.mat-tab-label')) + .map((element) => element.getAttribute('innerText')) + .then((texts) => { + for (let text of texts) { + if (text === tabName) { + break; + } + this.clickRightChevron(); + } + }); + }; + + this.getEditIconTooltip = function () { + return editIcon.getAttribute('title'); + }; + + this.getInformationButtonTooltip = function () { + return informationSpan.getAttribute('title'); + }; + + this.editPropertyIconIsDisplayed = function (propertyName) { + var editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(editPropertyIcon); + }; + + this.updatePropertyIconIsDisplayed = function (propertyName) { + var updatePropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(updatePropertyIcon); + }; + + this.clickUpdatePropertyIcon = function (propertyName) { + var updatePropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-update-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(updatePropertyIcon); + return updatePropertyIcon.click(); + }; + + this.clickClearPropertyIcon = function (propertyName) { + var clearPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(clearPropertyIcon); + return clearPropertyIcon.click(); + }; + + this.enterPropertyText = function (propertyName, text) { + const textField = element(by.css('input[data-automation-id="card-textitem-editinput-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(textField); + textField.sendKeys(''); + textField.clear().sendKeys(text); + return this; + }; + + this.enterPresetText = function (text) { + const presetField = element(by.css('input[data-automation-id="adf-text-custom-preset"]')); + Util.waitUntilElementIsVisible(presetField); + presetField.sendKeys(''); + presetField.clear().sendKeys(text); + const applyButton = element(by.css('button[id="adf-metadata-aplly"]')); + applyButton.click(); + return this; + }; + + this.enterDescriptionText = function (text) { + const textField = element(by.css('textarea[data-automation-id="card-textitem-edittextarea-properties.cm:description"]')); + Util.waitUntilElementIsVisible(textField); + textField.sendKeys(''); + textField.clear().sendKeys(text); + return this; + }; + + this.getPropertyText = function (propertyName, type) { + let propertyType = !type ? 'textitem' : type; + const textField = element(by.css('span[data-automation-id="card-' + propertyType + '-value-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(textField); + return textField.getText(); + }; + + this.clearPropertyIconIsDisplayed = function (propertyName) { + var clearPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-reset-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(clearPropertyIcon); + }; + + this.clickEditPropertyIcons = function (propertyName) { + var editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(editPropertyIcon); + editPropertyIcon.click(); + }; + + this.getPropertyIconTooltip = function (propertyName, icon) { + var editPropertyIcon = element(by.css('mat-icon[data-automation-id="card-textitem-edit-icon-' + propertyName + '"]')); + return editPropertyIcon.getAttribute('title'); + }; + + this.clickMetadatGroup = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + Util.waitUntilElementIsVisible(group); + group.click(); + }; + + this.checkkMetadatGroupIsPresent = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + return Util.waitUntilElementIsVisible(group); + }; + + this.checkkMetadatGroupIsNotPresent = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"]')); + return Util.waitUntilElementIsNotVisible(group); + }; + + this.chekMetadatGroupIsExpand = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header')); + Util.waitUntilElementIsVisible(group); + expect(group.getAttribute('class')).toContain('mat-expanded') + }; + + this.chekMetadatGroupIsNotExpand = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header')); + Util.waitUntilElementIsVisible(group); + expect(group.getAttribute('class')).not.toContain('mat-expanded') + }; + + this.getkMetadatGroupTitle = function (groupName) { + var group = element(by.css('mat-expansion-panel[data-automation-id="adf-metadata-group-' + groupName + '"] > mat-expansion-panel-header > span > mat-panel-title')); + Util.waitUntilElementIsVisible(group); + return group.getText(); + }; + + /** + * disables displayEmpty + */ + this.disableDisplayEmpty = function () { + Util.waitUntilElementIsVisible(displayEmptySwitch); + displayEmptySwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + displayEmptySwitch.click(); + expect(displayEmptySwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables displayEmpty + */ + this.enableDisplayEmpty = function () { + Util.waitUntilElementIsVisible(displayEmptySwitch); + displayEmptySwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + displayEmptySwitch.click(); + expect(displayEmptySwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + /** + * disables Readonly + */ + this.disableReadonly = function () { + Util.waitUntilElementIsVisible(readonlySwitch); + readonlySwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + readonlySwitch.click(); + expect(readonlySwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables Readonly + */ + this.enableReadonly = function () { + Util.waitUntilElementIsVisible(readonlySwitch); + readonlySwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + readonlySwitch.click(); + expect(readonlySwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + /** + * disables multi + */ + this.disableMulti = function () { + Util.waitUntilElementIsVisible(multiSwitch); + multiSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + multiSwitch.click(); + expect(multiSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables multi + */ + this.enableMulti = function () { + Util.waitUntilElementIsVisible(multiSwitch); + multiSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + multiSwitch.click(); + expect(multiSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + /** + * disables preset + */ + this.disablePreset = function () { + Util.waitUntilElementIsVisible(presetSwitch); + presetSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary mat-checked') { + presetSwitch.click(); + expect(presetSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary'); + } + }) + }; + + /** + * enables preset + */ + this.enablePreset = function () { + Util.waitUntilElementIsVisible(presetSwitch); + presetSwitch.getAttribute('class').then(function (check) { + if (check === 'mat-slide-toggle mat-primary') { + presetSwitch.click(); + expect(presetSwitch.getAttribute('class')).toEqual('mat-slide-toggle mat-primary mat-checked'); + } + }) + }; + + this.checkPopertyIsVisible = function (propertyName, type) { + var property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]')); + Util.waitUntilElementIsVisible(property); + }; + + this.checkPopertyIsNotVisible = function (propertyName, type) { + var property = element(by.css('div[data-automation-id="card-' + type + '-label-' + propertyName + '"]')); + Util.waitUntilElementIsNotVisible(property); + }; +}; + +module.exports = MetadataViewPage; diff --git a/e2e/pages/adf/navigationBarPage.js b/e2e/pages/adf/navigationBarPage.js index 2d5ef4ec4e..ae7ca9684a 100644 --- a/e2e/pages/adf/navigationBarPage.js +++ b/e2e/pages/adf/navigationBarPage.js @@ -16,47 +16,58 @@ */ var Util = require('../../util/util'); +var TestConfig = require('../../test.config'); -var NavigationBarPage = function (){ +var NavigationBarPage = function () { var contentServicesButton = element(by.css("a[data-automation-id='Content Services']")); + var configEditoButton = element(by.css("a[data-automation-id='Config editor']")); var processServicesButton = element(by.css("a[data-automation-id='Process Services']")); var loginButton = element(by.css("a[data-automation-id='Login']")); var trashcanButton = element(by.css("a[data-automation-id='Trashcan']")); - var userProfileButton = element(by.css("div[data-automation-id='user-profile']")); + var userProfileButton = element(by.css("button[data-automation-id='adf-user-profile']")); var themeButton = element(by.css("button[data-automation-id='theme menu']")); var themeMenuContent = element(by.css("div[class*='mat-menu-panel']")); var logoutButton = element(by.css("a[adf-logout]")); - var cardViewButton = element(by.cssContainingText(".sidenav-menu-label","CardView")); + var cardViewButton = element(by.cssContainingText(".sidenav-menu-label", "CardView")); /** * Click Content Services Button * @method clickContentServicesButton */ - this.clickContentServicesButton = function (){ - Util.waitUntilElementIsVisible(contentServicesButton); - contentServicesButton.click(); + this.clickContentServicesButton = function () { + Util.waitUntilElementIsVisible(contentServicesButton); + contentServicesButton.click(); + }; + + /** + * Click on Config Editor Button + * @method clickContentServicesButton + */ + this.clickConfigEditorButton = function () { + Util.waitUntilElementIsVisible(configEditoButton); + configEditoButton.click(); }; /** * Click Process Services Button * @method clickProcessServicesButton */ - this.clickProcessServicesButton = function (){ - Util.waitUntilElementIsVisible(processServicesButton); - processServicesButton.click(); - }; + this.clickProcessServicesButton = function () { + Util.waitUntilElementIsVisible(processServicesButton); + processServicesButton.click(); + }; /** * Click Login Button * @method clickLoginButton */ - this.clickLoginButton = function(){ - Util.waitUntilElementIsVisible(loginButton); - loginButton.click(); - }; + this.clickLoginButton = function () { + Util.waitUntilElementIsVisible(loginButton); + loginButton.click(); + }; - this.clickTrashcanButton = function(){ + this.clickTrashcanButton = function () { Util.waitUntilElementIsVisible(trashcanButton); trashcanButton.click(); }; @@ -83,20 +94,28 @@ var NavigationBarPage = function (){ * Click Logout Button * @method clickLogoutButton */ - this.clickLogoutButton = function(){ + this.clickLogoutButton = function () { Util.waitUntilElementIsVisible(logoutButton); logoutButton.click(); }; - /** + /** * Click Card View Button * @method clickCardViewButton */ - this.clickCardViewButton = function(){ + this.clickCardViewButton = function () { Util.waitUntilElementIsVisible(cardViewButton); cardViewButton.click(); }; + /** + * Click Card View Button + * @method clickCardViewButton + */ + this.openContentServicesFolder = function (folderId) { + return browser.get(TestConfig.adf.url + '/files/' + folderId); + }; + }; module.exports = NavigationBarPage; diff --git a/e2e/pages/adf/process_services/attachmentListPage.ts b/e2e/pages/adf/process_services/attachmentListPage.ts index ef0aafe72b..f2dd8cc93f 100644 --- a/e2e/pages/adf/process_services/attachmentListPage.ts +++ b/e2e/pages/adf/process_services/attachmentListPage.ts @@ -35,7 +35,7 @@ export class AttachmentListPage { clickAttachFileButton(fileLocation) { Util.waitUntilElementIsVisible(this.attachFileButton); - this.attachFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation))); + return this.attachFileButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation))); } checkFileIsAttached(name) { @@ -48,43 +48,42 @@ export class AttachmentListPage { } viewFile(name) { - let fileAttached = element(by.css('div[filename="' + name + '"]')); - Util.waitUntilElementIsVisible(fileAttached); - fileAttached.click(); + Util.waitUntilElementIsVisible(element(by.css('div[filename="' + name + '"]'))); + element(by.css('div[filename="' + name + '"]')).click(); Util.waitUntilElementIsVisible(this.buttonMenu); - Util.waitUntilElementIsClickable(this.buttonMenu); this.buttonMenu.click(); - Util.waitUntilElementIsVisible(this.menuPanel); Util.waitUntilElementIsVisible(this.viewButton); + browser.driver.sleep(500); this.viewButton.click(); + browser.driver.sleep(500); return this; } removeFile(name) { - let fileAttached = element(by.css('div[filename="' + name + '"]')); - fileAttached.click(); + Util.waitUntilElementIsVisible(element(by.css('div[filename="' + name + '"]'))); + element(by.css('div[filename="' + name + '"]')).click(); Util.waitUntilElementIsVisible(this.buttonMenu); - Util.waitUntilElementIsClickable(this.buttonMenu); this.buttonMenu.click(); - Util.waitUntilElementIsVisible(this.menuPanel); Util.waitUntilElementIsVisible(this.removeButton); + browser.driver.sleep(500); this.removeButton.click(); + browser.driver.sleep(500); return this; } downloadFile(name) { - let fileAttached = element(by.css('div[filename="' + name + '"]')); - fileAttached.click(); + Util.waitUntilElementIsVisible(element(by.css('div[filename="' + name + '"]'))); + element(by.css('div[filename="' + name + '"]')).click(); Util.waitUntilElementIsVisible(this.buttonMenu); - Util.waitUntilElementIsClickable(this.buttonMenu); this.buttonMenu.click(); - Util.waitUntilElementIsVisible(this.menuPanel); Util.waitUntilElementIsVisible(this.downloadButton); + browser.driver.sleep(500); this.downloadButton.click(); return this; } doubleClickFile(name) { + Util.waitUntilElementIsVisible(element(by.css('div[filename="' + name + '"]'))); let fileAttached = element(by.css('div[filename="' + name + '"]')); Util.waitUntilElementIsVisible(fileAttached); Util.waitUntilElementIsClickable(fileAttached); diff --git a/e2e/pages/adf/tagPage.js b/e2e/pages/adf/tagPage.js index 8f30ba697e..8ed52f300a 100644 --- a/e2e/pages/adf/tagPage.js +++ b/e2e/pages/adf/tagPage.js @@ -68,16 +68,15 @@ var TagPage = function () { return this; }; - this.deleteTagFromTagListByNodeId = function () { - var deleteChip = element(by.css('button[id=\'tag_delete_0\']')); + this.deleteTagFromTagListByNodeId = function (name) { + var deleteChip = element(by.css('button[id="tag_chips_delete_' + name + '"]')); Util.waitUntilElementIsVisible(deleteChip); deleteChip.click(); return this; }; - - this.deleteTagFromTagList = function () { - var deleteChip = element(by.xpath('//*[@id="tag_delete_0"]/mat-icon')); + this.deleteTagFromTagList = function (name) { + var deleteChip = element(by.xpath('//*[@id="tag_chips_delete_' + name + '"]/mat-icon')); Util.waitUntilElementIsVisible(deleteChip); deleteChip.click(); return this; diff --git a/e2e/pages/adf/viewerPage.js b/e2e/pages/adf/viewerPage.js index 9e86ae775b..6c588797c2 100644 --- a/e2e/pages/adf/viewerPage.js +++ b/e2e/pages/adf/viewerPage.js @@ -16,7 +16,6 @@ */ var Util = require("../../util/util"); -var CardViewPage = require("./cardViewPage"); var ViewerToolbarPage = function () { @@ -52,8 +51,11 @@ var ViewerToolbarPage = function () { var passwordInput = element(by.css("input[data-automation-id='adf-password-dialog-input']")); var passwordError = element(by.css("mat-error[data-automation-id='adf-password-dialog-error']")); var infoSideBar = element(by.css("div[class='adf-info-drawer-layout-header']")); - var unsupportedFileContainer = element(by.cssContainingText(".label","Document preview could not be loaded")); + var unsupportedFileContainer = element(by.cssContainingText(".label", "Document preview could not be loaded")); var pageCanvas = element.all(by.css("div[class='canvasWrapper']")).first(); + var activeTab = element(by.css("div[class*='mat-tab-label-active']")); + var uploadNewVersionButton = element(by.css("input[data-automation-id='upload-single-file']")); + var rightChevron = element(by.css("div[class*='header-pagination-after']")); this.canvasHeight = function () { var deferred = protractor.promise.defer(); @@ -74,21 +76,19 @@ var ViewerToolbarPage = function () { }; this.viewFile = function (fileName) { - var fileView = element(by.xpath("//div[@class='document-list-container']//span[@title='" + fileName +"']")); + var fileView = element.all(by.xpath("//div[@id='document-list-container']//div[@filename='" + fileName + "']")).first(); Util.waitUntilElementIsVisible(fileView); fileView.click(); browser.actions().sendKeys(protractor.Key.ENTER).perform(); }; - this.clearPageNumber = function () - { + this.clearPageNumber = function () { Util.waitUntilElementIsVisible(pageSelectorInput); pageSelectorInput.clear(); pageSelectorInput.sendKeys(protractor.Key.ENTER); }; - this.getZoom = function () - { + this.getZoom = function () { return percentage.getText(); }; @@ -97,41 +97,34 @@ var ViewerToolbarPage = function () { browser.executeScript(jsCode); }; - this.enterPassword = function (password) - { + this.enterPassword = function (password) { Util.waitUntilElementIsVisible(passwordInput); passwordInput.clear(); passwordInput.sendKeys(password); }; - this.checkPasswordErrorIsDisplayed = function () - { + this.checkPasswordErrorIsDisplayed = function () { Util.waitUntilElementIsVisible(passwordError); }; - this.checkPasswordInputIsDisplayed = function () - { + this.checkPasswordInputIsDisplayed = function () { Util.waitUntilElementIsVisible(passwordInput); }; - this.checkPasswordSubmitDisabledIsDisplayed = function () - { + this.checkPasswordSubmitDisabledIsDisplayed = function () { Util.waitUntilElementIsVisible(passwordSubmitDisabled); }; - this.checkPasswordDialogIsDisplayed = function () - { + this.checkPasswordDialogIsDisplayed = function () { Util.waitUntilElementIsVisible(passwordDialog); }; - this.checkAllThumbnailsDisplayed = function (nbPages) - { + this.checkAllThumbnailsDisplayed = function (nbPages) { var defaultThumbnailHeight = 143; - expect(thumbnailsContent.getAttribute("style")).toEqual("height: " + nbPages*defaultThumbnailHeight + "px; transform: translate(-50%, 0px);"); + expect(thumbnailsContent.getAttribute("style")).toEqual("height: " + nbPages * defaultThumbnailHeight + "px; transform: translate(-50%, 0px);"); }; - this.checkCurrentThumbnailIsSelected = function () - { + this.checkCurrentThumbnailIsSelected = function () { var selectedThumbnail = element(by.css("adf-pdf-thumb[class='pdf-thumbnails__thumb ng-star-inserted pdf-thumbnails__thumb--selected'] > img")); pageSelectorInput.getAttribute("value").then(function (pageNumber) { expect("Page " + pageNumber).toEqual(selectedThumbnail.getAttribute("title")); @@ -175,7 +168,7 @@ var ViewerToolbarPage = function () { expect(fileName.getText()).toEqual(file); }; - this.checkPreviousPageButtonIsDisplayed =function () { + this.checkPreviousPageButtonIsDisplayed = function () { Util.waitUntilElementIsVisible(previousPageButton); }; @@ -240,13 +233,11 @@ var ViewerToolbarPage = function () { Util.waitUntilElementIsVisible(percentage); }; - this.checkZoomedIn = function (zoom) - { + this.checkZoomedIn = function (zoom) { expect(percentage.getText()).toBeGreaterThan(zoom); }; - this.checkZoomedOut = function (zoom) - { + this.checkZoomedOut = function (zoom) { expect(percentage.getText()).toBeLessThan(zoom); }; @@ -258,8 +249,7 @@ var ViewerToolbarPage = function () { Util.waitUntilElementIsVisible(rotateRight); }; - this.checkScaled = function (zoom) - { + this.checkScaled = function (zoom) { expect(percentage.getText()).toEqual(zoom); }; @@ -267,58 +257,47 @@ var ViewerToolbarPage = function () { Util.waitUntilElementIsVisible(scaleImg); }; - this.checkRotation = function (text) - { + this.checkRotation = function (text) { var rotation = imgContainer.getAttribute("style"); expect(rotation).toEqual(text); }; - this.checkCustomBtnDisplayed = function () - { + this.checkCustomBtnDisplayed = function () { Util.waitUntilElementIsVisible(customBtn); }; - this.checkUnsupportedFileContainerIsDisplayed = function () - { + this.checkUnsupportedFileContainerIsDisplayed = function () { Util.waitUntilElementIsVisible(unsupportedFileContainer); }; - this.checkInfoSideBarIsNotDisplayed = function () - { + this.checkInfoSideBarIsNotDisplayed = function () { Util.waitUntilElementIsNotVisible(infoSideBar); }; - this.checkInfoSideBarIsDisplayed = function () - { + this.checkInfoSideBarIsDisplayed = function () { Util.waitUntilElementIsVisible(infoSideBar); }; - this.checkInfoSideBarIsNotDisplayed = function () - { + this.checkInfoSideBarIsNotDisplayed = function () { Util.waitUntilElementIsNotOnPage(infoSideBar); }; - this.clickInfoButton = function () - { + this.clickInfoButton = function () { Util.waitUntilElementIsVisible(infoButton); - infoButton.click(); - return new CardViewPage(); + return infoButton.click(); }; - this.clickPasswordSubmit = function () - { + this.clickPasswordSubmit = function () { Util.waitUntilElementIsVisible(passwordSubmit); passwordSubmit.click(); }; - this.clickSecondThumbnail = function () - { + this.clickSecondThumbnail = function () { Util.waitUntilElementIsClickable(secondThumbnail); secondThumbnail.click(); }; - this.clickLastThumbnailDisplayed = function () - { + this.clickLastThumbnailDisplayed = function () { Util.waitUntilElementIsClickable(lastThumbnailDisplayed); lastThumbnailDisplayed.click(); }; @@ -333,14 +312,12 @@ var ViewerToolbarPage = function () { thumbnailsBtn.click(); }; - this.clickScaleImgButton = function () - { + this.clickScaleImgButton = function () { Util.waitUntilElementIsClickable(scaleImg); scaleImg.click(); }; - this.clickScalePdfButton = function () - { + this.clickScalePdfButton = function () { Util.waitUntilElementIsClickable(scalePageButton); scalePageButton.click(); }; @@ -351,7 +328,6 @@ var ViewerToolbarPage = function () { }; this.clickCloseButton = function () { - Util.waitUntilElementIsVisible(closeButton); closeButton.click(); }; @@ -380,23 +356,67 @@ var ViewerToolbarPage = function () { scalePageButton.click(); }; - this.clickFullScreenButton = function () - { + this.clickFullScreenButton = function () { Util.waitUntilElementIsClickable(fullScreenButton); fullScreenButton.click(); }; - this.clickRotateLeftButton = function () - { + this.clickRotateLeftButton = function () { Util.waitUntilElementIsClickable(rotateLeft); rotateLeft.click(); }; - this.clickRotateRightButton = function () - { + this.clickRotateRightButton = function () { Util.waitUntilElementIsClickable(rotateRight); rotateRight.click(); }; + + this.getActiveTab = function () { + Util.waitUntilElementIsVisible(activeTab); + return activeTab.getText(); + }; + + this.checkUnsupportedFileContainerIsDisplayed = function () { + Util.waitUntilElementIsVisible(unsupportedFileContainer); + }; + + this.clickRightChevronToGetToTab = (tabName) => { + element.all(by.css('.mat-tab-label')) + .map((element) => element.getAttribute('innerText')) + .then((texts) => { + for (let text of texts) { + if (text === tabName ) { + break; + } + this.clickRightChevron(); + } + }); + }; + + this.clickRightChevron = function() { + Util.waitUntilElementIsVisible(rightChevron); + rightChevron.click(); + return this; + }; + + this.clickOnVersionsTab = function() { + this.clickRightChevronToGetToTab('Versions'); + var versionsTab = element(by.cssContainingText("div[id*='mat-tab-label']", "Versions")); + Util.waitUntilElementIsVisible(versionsTab); + versionsTab.click(); + return this; + }; + + this.checkUploadVersionsButtonIsDisplayed = function() { + Util.waitUntilElementIsVisible(uploadNewVersionButton); + return this; + }; + + this.checkVersionIsDisplayed = function(version) { + Util.waitUntilElementIsVisible(element(by.cssContainingText("h4[class*='adf-version-list-item-name']", version))); + return this; + }; + }; module.exports = ViewerToolbarPage; diff --git a/e2e/apps-section.e2e.ts b/e2e/process-services/apps-section.e2e.ts similarity index 87% rename from e2e/apps-section.e2e.ts rename to e2e/process-services/apps-section.e2e.ts index 88e9230963..33d1d343e0 100644 --- a/e2e/apps-section.e2e.ts +++ b/e2e/process-services/apps-section.e2e.ts @@ -15,21 +15,21 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); -import CONSTANTS = require('./util/constants'); -import Util = require('./util/util'); +import CONSTANTS = require('../util/constants'); +import Util = require('../util/util'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UsersActions } from './actions/users.actions'; -import { AppsActions } from './actions/APS/apps.actions'; -import { ModelsActions } from './actions/APS/models.actions'; -import AppPublish = require('./models/APS/AppPublish'); +import { UsersActions } from '../actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { ModelsActions } from '../actions/APS/models.actions'; +import AppPublish = require('../models/APS/AppPublish'); describe('Modify applications', () => { @@ -88,7 +88,7 @@ describe('Modify applications', () => { return apps.importNewVersionAppDefinitionPublishDeployApp(this.alfrescoJsApi, replacingApp.file_location, firstApp.id); }); - Util.refreshBrowser(); + browser.refresh(); processServicesPage.checkApsContainer(); @@ -108,7 +108,7 @@ describe('Modify applications', () => { return modelActions.deleteEntireModel(this.alfrescoJsApi, firstApp.id); }); - Util.refreshBrowser(); + browser.refresh(); processServicesPage.checkApsContainer(); processServicesPage.checkAppIsNotDisplayed(app.title); @@ -126,7 +126,7 @@ describe('Modify applications', () => { return apps.importNewVersionAppDefinitionPublishDeployApp(this.alfrescoJsApi, replacingApp.file_location, appVersionToBeDeleted.id); }); - Util.refreshBrowser(); + browser.refresh(); processServicesPage.getBackgroundColor(appTobeDeleted.title); @@ -138,7 +138,7 @@ describe('Modify applications', () => { await apps.publishDeployApp(this.alfrescoJsApi, appVersionToBeDeleted.id); }); - Util.refreshBrowser(); + browser.refresh(); processServicesPage.checkApsContainer(); processServicesPage.checkAppIsDisplayed(appTobeDeleted.title); diff --git a/e2e/attach-file-widget.e2e.ts b/e2e/process-services/attach-file-widget.e2e.ts similarity index 82% rename from e2e/attach-file-widget.e2e.ts rename to e2e/process-services/attach-file-widget.e2e.ts index b07e422353..793574af66 100644 --- a/e2e/attach-file-widget.e2e.ts +++ b/e2e/process-services/attach-file-widget.e2e.ts @@ -15,22 +15,22 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import ViewerPage = require('./pages/adf/viewerPage'); -import UsingWidget = require('./pages/adf/process_services/widgets/usingWidget'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); +import LoginPage = require('../pages/adf/loginPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import ViewerPage = require('../pages/adf/viewerPage'); +import UsingWidget = require('../pages/adf/process_services/widgets/usingWidget'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import FileModel = require('./models/ACS/fileModel'); +import FileModel = require('../models/ACS/fileModel'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); -import { AppsActions } from './actions/APS/apps.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; import AlfrescoApi = require('alfresco-js-api-node'); -import { UsersActions } from './actions/users.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Start Task - Task App', () => { diff --git a/e2e/attachment-list-process.e2e.ts b/e2e/process-services/attachment-list-process.e2e.ts similarity index 72% rename from e2e/attachment-list-process.e2e.ts rename to e2e/process-services/attachment-list-process.e2e.ts index 0c82b38f37..cedcb16c26 100644 --- a/e2e/attachment-list-process.e2e.ts +++ b/e2e/process-services/attachment-list-process.e2e.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import FileModel = require('./models/ACS/fileModel'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import FileModel = require('../models/ACS/fileModel'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UsersActions } from './actions/users.actions'; -import { AppsActions } from './actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; describe('Attachment list', () => { @@ -37,9 +37,9 @@ describe('Attachment list', () => { let processUserModel; let app = resources.Files.APP_WITH_PROCESSES; - let jpgFile = new FileModel({ - 'location': resources.Files.ADF_DOCUMENTS.JPG.file_location, - 'name': resources.Files.ADF_DOCUMENTS.JPG.file_name + let pngFile = new FileModel({ + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location, + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name }); let pdfFile = new FileModel({ 'name': resources.Files.ADF_DOCUMENTS.PDF.file_name }); @@ -70,10 +70,10 @@ describe('Attachment list', () => { processFiltersPage.startProcess().selectFromProcessDropdown(app.process_se_name).clickFormStartProcessButton(); processFiltersPage.clickRunningFilterButton(); processFiltersPage.selectFromProcessList('My Default Name'); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); attachmentListPage.clickAttachFileButton(pdfFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.checkFileIsAttached(pngFile.name); attachmentListPage.checkFileIsAttached(pdfFile.name); }); @@ -82,10 +82,10 @@ describe('Attachment list', () => { processFiltersPage.startProcess().selectFromProcessDropdown(app.process_se_name).clickFormStartProcessButton(); processFiltersPage.clickRunningFilterButton(); processFiltersPage.selectFromProcessList('My Default Name'); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); attachmentListPage.clickAttachFileButton(pdfFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.checkFileIsAttached(pngFile.name); attachmentListPage.checkFileIsAttached(pdfFile.name); }); }); diff --git a/e2e/empty_process_list_component.e2e.ts b/e2e/process-services/empty_process_list_component.e2e.ts similarity index 83% rename from e2e/empty_process_list_component.e2e.ts rename to e2e/process-services/empty_process_list_component.e2e.ts index 674f3d9767..0da1fbdefb 100644 --- a/e2e/empty_process_list_component.e2e.ts +++ b/e2e/process-services/empty_process_list_component.e2e.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import LoginPage = require('./pages/adf/loginPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage'); -import ProcessListPage = require('./pages/adf/process_services/processListPage'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import LoginPage = require('../pages/adf/loginPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage'); +import ProcessListPage = require('../pages/adf/process_services/processListPage'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Empty Process List Test', () => { diff --git a/e2e/form_widgets_component.e2e.ts b/e2e/process-services/form_widgets_component.e2e.ts similarity index 93% rename from e2e/form_widgets_component.e2e.ts rename to e2e/process-services/form_widgets_component.e2e.ts index 2fabd6e941..febb2bba4e 100644 --- a/e2e/form_widgets_component.e2e.ts +++ b/e2e/process-services/form_widgets_component.e2e.ts @@ -15,24 +15,24 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import UsingWidget = require('./pages/adf/process_services/widgets/usingWidget'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import UsingWidget = require('../pages/adf/process_services/widgets/usingWidget'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import FormDefinitionModel = require('./models/APS/FormDefinitionModel'); -import Task = require('./models/APS/Task'); +import FormDefinitionModel = require('../models/APS/FormDefinitionModel'); +import Task = require('../models/APS/Task'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); let formInstance = new FormDefinitionModel(); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Form widgets', () => { @@ -43,10 +43,8 @@ describe('Form widgets', () => { let appFields = app.form_fields; let taskPage = new TasksPage(); let appModel; - let taskModel; let newTask = 'First task'; let usingWidget = new UsingWidget(); - let procUserModel; let alfrescoJsApi; beforeAll(async (done) => { diff --git a/e2e/pagination_processlist_addingProcesses.e2e.ts b/e2e/process-services/pagination_processlist_addingProcesses.e2e.ts similarity index 86% rename from e2e/pagination_processlist_addingProcesses.e2e.ts rename to e2e/process-services/pagination_processlist_addingProcesses.e2e.ts index 1f0a2467fd..cdbdce2745 100644 --- a/e2e/pagination_processlist_addingProcesses.e2e.ts +++ b/e2e/process-services/pagination_processlist_addingProcesses.e2e.ts @@ -15,18 +15,18 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import PaginationPage = require('./pages/adf/paginationPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import PaginationPage = require('../pages/adf/paginationPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Process List - Pagination when adding processes', () => { diff --git a/e2e/pagination_tasklist_addingTasks.e2e.ts b/e2e/process-services/pagination_tasklist_addingTasks.e2e.ts similarity index 86% rename from e2e/pagination_tasklist_addingTasks.e2e.ts rename to e2e/process-services/pagination_tasklist_addingTasks.e2e.ts index 160fb27806..3910a45869 100644 --- a/e2e/pagination_tasklist_addingTasks.e2e.ts +++ b/e2e/process-services/pagination_tasklist_addingTasks.e2e.ts @@ -15,19 +15,19 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import PaginationPage = require('./pages/adf/paginationPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import PaginationPage = require('../pages/adf/paginationPage'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); describe('Items per page set to 15 and adding of tasks', () => { diff --git a/e2e/process_attachmentList_actionMenu.e2e.ts b/e2e/process-services/process_attachmentList_actionMenu.e2e.ts similarity index 66% rename from e2e/process_attachmentList_actionMenu.e2e.ts rename to e2e/process-services/process_attachmentList_actionMenu.e2e.ts index bd2092eb57..5c270f8bd3 100644 --- a/e2e/process_attachmentList_actionMenu.e2e.ts +++ b/e2e/process-services/process_attachmentList_actionMenu.e2e.ts @@ -15,25 +15,25 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage.js'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage.js'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; -import ViewerPage = require('./pages/adf/viewerPage.js'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage.js'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage.js'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; +import ViewerPage = require('../pages/adf/viewerPage.js'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util.js'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util.js'); import path = require('path'); import AlfrescoApi = require('alfresco-js-api-node'); -import { UsersActions } from './actions/users.actions'; -import { AppsActions } from './actions/APS/apps.actions'; -import FileModel = require('./models/ACS/fileModel'); +import { UsersActions } from '../actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import FileModel = require('../models/ACS/fileModel'); describe('Attachment list action menu for processes', () => { @@ -44,12 +44,12 @@ describe('Attachment list action menu for processes', () => { let attachmentListPage = new AttachmentListPage(); let viewerPage = new ViewerPage(); let app = resources.Files.SIMPLE_APP_WITH_USER_FORM; - let jpgFile = new FileModel({ - location: resources.Files.ADF_DOCUMENTS.JPG.file_location, - name: resources.Files.ADF_DOCUMENTS.JPG.file_name + let pngFile = new FileModel({ + location: resources.Files.ADF_DOCUMENTS.PNG.file_location, + name: resources.Files.ADF_DOCUMENTS.PNG.file_name }); - let downloadedJpgFile = path.join(__dirname, 'downloads', jpgFile.name); + let downloadedPngFile = path.join(__dirname, 'downloads', pngFile.name); let tenantId, appId; let processName = { active: 'Active Process', @@ -59,7 +59,7 @@ describe('Attachment list action menu for processes', () => { dragDrop: 'Drag and Drop' }; - beforeAll(async(done) => { + beforeAll(async (done) => { let apps = new AppsActions(); let users = new UsersActions(); @@ -90,7 +90,7 @@ describe('Attachment list action menu for processes', () => { done(); }); - afterAll(async(done) => { + afterAll(async (done) => { await this.alfrescoJsApi.activiti.modelsApi.deleteModel(appId); await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); await this.alfrescoJsApi.activiti.adminTenantsApi.deleteTenant(tenantId); @@ -104,29 +104,31 @@ describe('Attachment list action menu for processes', () => { processDetailsPage.checkProcessTitleIsDisplayed(); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.viewFile(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.viewFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); processFiltersPage.clickRunningFilterButton(); processFiltersPage.selectFromProcessList(processName.active); - attachmentListPage.doubleClickFile(jpgFile.name); + attachmentListPage.doubleClickFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); processFiltersPage.clickRunningFilterButton(); processFiltersPage.selectFromProcessList(processName.active); - attachmentListPage.downloadFile(jpgFile.name); + attachmentListPage.downloadFile(pngFile.name); - expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true); + browser.driver.sleep(500); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); + expect(Util.fileExists(downloadedPngFile, 20)).toBe(true); + + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); }); it('[C279886] Option menu functionality - Completed Process', () => { @@ -137,7 +139,7 @@ describe('Attachment list action menu for processes', () => { processDetailsPage.checkProcessTitleIsDisplayed(); - attachmentListPage.clickAttachFileButton(jpgFile.location); + attachmentListPage.clickAttachFileButton(pngFile.location); processDetailsPage.clickCancelProcessButton(); @@ -146,19 +148,21 @@ describe('Attachment list action menu for processes', () => { processDetailsPage.checkProcessTitleIsDisplayed(); attachmentListPage.checkAttachFileButtonIsNotDisplayed(); - attachmentListPage.viewFile(jpgFile.name); + attachmentListPage.viewFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); processFiltersPage.clickCompletedFilterButton(); - attachmentListPage.downloadFile(jpgFile.name); + attachmentListPage.downloadFile(pngFile.name); - expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true); + browser.driver.sleep(500); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); + expect(Util.fileExists(downloadedPngFile, 20)).toBe(true); + + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); }); it('[C277296] Upload file - ProcessList - Task APP', () => { @@ -169,8 +173,8 @@ describe('Attachment list action menu for processes', () => { processDetailsPage.checkProcessTitleIsDisplayed(); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); }); it('[C260235] Empty list component', () => { @@ -180,10 +184,10 @@ describe('Attachment list action menu for processes', () => { processFiltersPage.selectFromProcessList(processName.emptyList); attachmentListPage.checkEmptyAttachmentList(); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); attachmentListPage.checkEmptyAttachmentList(); }); diff --git a/e2e/process_filters_component.e2e.ts b/e2e/process-services/process_filters_component.e2e.ts similarity index 83% rename from e2e/process_filters_component.e2e.ts rename to e2e/process-services/process_filters_component.e2e.ts index b39f99f163..081d3f8653 100644 --- a/e2e/process_filters_component.e2e.ts +++ b/e2e/process-services/process_filters_component.e2e.ts @@ -15,19 +15,20 @@ * limitations under the License. */ -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import LoginPage = require('./pages/adf/loginPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import StartProcessPage = require('./pages/adf/process_services/startProcessPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import LoginPage = require('../pages/adf/loginPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import StartProcessPage = require('../pages/adf/process_services/startProcessPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import AppNavigationBarPage = require('../pages/adf/process_services/appNavigationBarPage'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; + +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Process Filters Test', () => { @@ -70,12 +71,12 @@ describe('Process Filters Test', () => { await loginPage.loginToProcessServicesUsingUserModel(user); + navigationBarPage.clickProcessServicesButton(); + done(); }); it('Navigate to Running filter', () => { - navigationBarPage.clickProcessServicesButton(); - processServicesPage.checkApsContainer(); processServicesPage.goToApp(app.title); diff --git a/e2e/processlist_pagination.e2e.ts b/e2e/process-services/processlist_pagination.e2e.ts similarity index 95% rename from e2e/processlist_pagination.e2e.ts rename to e2e/process-services/processlist_pagination.e2e.ts index f2a21eb35a..e63f573011 100644 --- a/e2e/processlist_pagination.e2e.ts +++ b/e2e/process-services/processlist_pagination.e2e.ts @@ -15,21 +15,20 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import PaginationPage = require('./pages/adf/paginationPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import PaginationPage = require('../pages/adf/paginationPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); -import Util = require('./util/util'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Process List - Pagination', function () { @@ -52,7 +51,6 @@ describe('Process List - Pagination', function () { let paginationPage = new PaginationPage(); let processFiltersPage = new ProcessFiltersPage(); let processDetailsPage = new ProcessDetailsPage(); - let navigationBarPage = new NavigationBarPage(); let processUserModel; let app = resources.Files.SIMPLE_APP_WITH_USER_FORM; diff --git a/e2e/sort_tasklist_pagination.e2e.ts b/e2e/process-services/sort_tasklist_pagination.e2e.ts similarity index 81% rename from e2e/sort_tasklist_pagination.e2e.ts rename to e2e/process-services/sort_tasklist_pagination.e2e.ts index 19a271a763..70c4c09437 100644 --- a/e2e/sort_tasklist_pagination.e2e.ts +++ b/e2e/process-services/sort_tasklist_pagination.e2e.ts @@ -15,20 +15,20 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import PaginationPage = require('./pages/adf/paginationPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import PaginationPage = require('../pages/adf/paginationPage'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Task List Pagination - Sorting', () => { @@ -66,7 +66,7 @@ describe('Task List Pagination - Sorting', () => { await this.alfrescoJsApi.login(processUserModel.email, processUserModel.password); - let resultApp = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); for (let i = 0; i < nrOfTasks; i++) { this.alfrescoJsApi.activiti.taskApi.createNewTask({name: taskNames[i]}); diff --git a/e2e/start_process_component.e2e.ts b/e2e/process-services/start_process_component.e2e.ts similarity index 93% rename from e2e/start_process_component.e2e.ts rename to e2e/process-services/start_process_component.e2e.ts index 9ed5becbf3..f5a891d2f7 100644 --- a/e2e/start_process_component.e2e.ts +++ b/e2e/process-services/start_process_component.e2e.ts @@ -15,24 +15,24 @@ * limitations under the License. */ -import Util = require('./util/util'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import CONSTANTS = require('./util/constants'); -import LoginPage = require('./pages/adf/loginPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import StartProcessPage = require('./pages/adf/process_services/startProcessPage'); -import ProcessFiltersPage = require('./pages/adf/process_services/processFiltersPage'); -import AppNavigationBarPage = require('./pages/adf/process_services/appNavigationBarPage'); -import ProcessDetailsPage = require('./pages/adf/process_services/processDetailsPage'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; +import Util = require('../util/util'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import CONSTANTS = require('../util/constants'); +import LoginPage = require('../pages/adf/loginPage'); +import NavigationBarPage = require('../pages/adf/navigationBarPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import StartProcessPage = require('../pages/adf/process_services/startProcessPage'); +import ProcessFiltersPage = require('../pages/adf/process_services/processFiltersPage'); +import AppNavigationBarPage = require('../pages/adf/process_services/appNavigationBarPage'); +import ProcessDetailsPage = require('../pages/adf/process_services/processDetailsPage'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; -import User = require('./models/APS/User'); -import AppPublish = require('./models/APS/AppPublish'); -import Tenant = require('./models/APS/Tenant'); +import User = require('../models/APS/User'); +import AppPublish = require('../models/APS/AppPublish'); +import Tenant = require('../models/APS/Tenant'); -import FileModel = require('./models/ACS/fileModel'); +import FileModel = require('../models/ACS/fileModel'); import dateFormat = require('dateformat'); import AlfrescoApi = require('alfresco-js-api-node'); @@ -52,7 +52,7 @@ describe('Start Process Component', () => { let app = resources.Files.APP_WITH_PROCESSES; let appId, procUserModel, secondProcUserModel, tenantId; - let auditLogFile = path.join('./e2e/download/', 'Audit.pdf'); + let auditLogFile = path.join('../e2e/download/', 'Audit.pdf'); let jpgFile = new FileModel({ 'location': resources.Files.ADF_DOCUMENTS.JPG.file_location, diff --git a/e2e/start_task_custom_app.e2e.ts b/e2e/process-services/start_task_custom_app.e2e.ts similarity index 90% rename from e2e/start_task_custom_app.e2e.ts rename to e2e/process-services/start_task_custom_app.e2e.ts index e4a130a7dc..36cbc51955 100644 --- a/e2e/start_task_custom_app.e2e.ts +++ b/e2e/process-services/start_task_custom_app.e2e.ts @@ -15,27 +15,27 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; -import CONSTANTS = require('./util/constants'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; +import CONSTANTS = require('../util/constants'); -import Task = require('./models/APS/Task'); -import Tenant = require('./models/APS/Tenant'); +import Task = require('../models/APS/Task'); +import Tenant = require('../models/APS/Tenant'); -import TaskModel = require('./models/APS/TaskModel'); -import FileModel = require('./models/ACS/fileModel'); -import FormModel = require('./models/APS/FormModel'); +import TaskModel = require('../models/APS/TaskModel'); +import FileModel = require('../models/ACS/fileModel'); +import FormModel = require('../models/APS/FormModel'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import dateFormat = require('dateformat'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Start Task - Custom App', () => { @@ -52,9 +52,9 @@ describe('Start Task - Custom App', () => { let tasks = ['Modifying task', 'Information box', 'No form', 'Not Created', 'Refreshing form', 'Assignee task', 'Attach File']; let showHeaderTask = 'Show Header'; let appModel; - let jpgFile = new FileModel({ - 'location': resources.Files.ADF_DOCUMENTS.JPG.file_location, - 'name': resources.Files.ADF_DOCUMENTS.JPG.file_name + let pngFile = new FileModel({ + 'location': resources.Files.ADF_DOCUMENTS.PNG.file_location, + 'name': resources.Files.ADF_DOCUMENTS.PNG.file_name }); beforeAll(async (done) => { @@ -78,11 +78,12 @@ describe('Start Task - Custom App', () => { appModel = await apps.importPublishDeployApp(this.alfrescoJsApi, app.file_location); + loginPage.loginToProcessServicesUsingUserModel(processUserModel); + done(); }); it('Modifying task', () => { - loginPage.loginToProcessServicesUsingUserModel(processUserModel); processServicesPage.goToProcessServices().goToApp(appModel.name).clickTasksButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); taskPage.createNewTask().addName(tasks[0]) @@ -199,8 +200,8 @@ describe('Start Task - Custom App', () => { taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); taskPage.createNewTask().addName(tasks[6]).clickStartButton() .then(() => { - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); }); }); diff --git a/e2e/start_task_task_app.e2e.ts b/e2e/process-services/start_task_task_app.e2e.ts similarity index 92% rename from e2e/start_task_task_app.e2e.ts rename to e2e/process-services/start_task_task_app.e2e.ts index 28ac0714ec..b4e5857898 100644 --- a/e2e/start_task_task_app.e2e.ts +++ b/e2e/process-services/start_task_task_app.e2e.ts @@ -15,27 +15,26 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import Tenant = require('./models/APS/Tenant'); -import Task = require('./models/APS/Task'); -import TaskModel = require('./models/APS/TaskModel'); -import FormModel = require('./models/APS/FormModel'); -import FileModel = require('./models/ACS/fileModel'); +import Tenant = require('../models/APS/Tenant'); +import Task = require('../models/APS/Task'); +import TaskModel = require('../models/APS/TaskModel'); +import FormModel = require('../models/APS/FormModel'); +import FileModel = require('../models/ACS/fileModel'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import dateFormat = require('dateformat'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { UsersActions } from '../actions/users.actions'; import fs = require('fs'); import path = require('path'); @@ -60,7 +59,6 @@ describe('Start Task - Task App', () => { }); beforeAll(async (done) => { - let apps = new AppsActions(); let users = new UsersActions(); this.alfrescoJsApi = new AlfrescoApi({ diff --git a/e2e/task_attachmentList_actionMenu.e2e.ts b/e2e/process-services/task_attachmentList_actionMenu.e2e.ts similarity index 62% rename from e2e/task_attachmentList_actionMenu.e2e.ts rename to e2e/process-services/task_attachmentList_actionMenu.e2e.ts index 1ce261f53a..e49de61ff0 100644 --- a/e2e/task_attachmentList_actionMenu.e2e.ts +++ b/e2e/process-services/task_attachmentList_actionMenu.e2e.ts @@ -15,25 +15,25 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import { AttachmentListPage } from './pages/adf/process_services/attachmentListPage'; -import ViewerPage = require('./pages/adf/viewerPage.js'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import { AttachmentListPage } from '../pages/adf/process_services/attachmentListPage'; +import ViewerPage = require('../pages/adf/viewerPage.js'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); -import Util = require('./util/util.js'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); +import Util = require('../util/util.js'); import path = require('path'); import fs = require('fs'); import AlfrescoApi = require('alfresco-js-api-node'); -import {UsersActions} from './actions/users.actions'; -import {AppsActions} from './actions/APS/apps.actions'; -import FileModel = require('./models/ACS/fileModel'); +import { UsersActions } from '../actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import FileModel = require('../models/ACS/fileModel'); describe('Attachment list action menu for tasks', () => { @@ -43,11 +43,11 @@ describe('Attachment list action menu for tasks', () => { let attachmentListPage = new AttachmentListPage(); let viewerPage = new ViewerPage(); let app = resources.Files.SIMPLE_APP_WITH_USER_FORM; - let jpgFile = new FileModel({ - location: resources.Files.ADF_DOCUMENTS.JPG.file_location, - name: resources.Files.ADF_DOCUMENTS.JPG.file_name + let pngFile = new FileModel({ + location: resources.Files.ADF_DOCUMENTS.PNG.file_location, + name: resources.Files.ADF_DOCUMENTS.PNG.file_name }); - let downloadedJpgFile = path.join(__dirname, 'downloads', jpgFile.name); + let downloadedPngFile = path.join(__dirname, 'downloads', pngFile.name); let tenantId, appId; let taskName = { active: 'Active Task', @@ -94,84 +94,85 @@ describe('Attachment list action menu for tasks', () => { taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); taskPage.createNewTask().addName(taskName.active).clickStartButton(); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.viewFile(jpgFile.name); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.viewFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); - attachmentListPage.doubleClickFile(jpgFile.name); + attachmentListPage.doubleClickFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); - attachmentListPage.downloadFile(jpgFile.name); + attachmentListPage.downloadFile(pngFile.name); - expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true); + browser.driver.sleep(500); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); + expect(Util.fileExists(downloadedPngFile, 20)).toBe(true); + + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); }); it('[C260236] Should be able to View /Download /Remove from Attachment List on a completed task', () => { processServicesPage.goToProcessServices().goToApp(app.title).clickTasksButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); - taskPage.createNewTask().addName(taskName.completed).clickStartButton() - .then(() => { - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); - }); + taskPage.createNewTask().addName(taskName.completed).clickStartButton(); + + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); taskPage.completeTaskNoForm(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.COMPL_TASKS); taskPage.usingTasksListPage().selectTaskFromTasksList(taskName.completed); attachmentListPage.checkAttachFileButtonIsNotDisplayed(); - attachmentListPage.viewFile(jpgFile.name); + attachmentListPage.viewFile(pngFile.name); - viewerPage.checkFileNameIsDisplayed(jpgFile.name); + viewerPage.checkFileNameIsDisplayed(pngFile.name); viewerPage.clickCloseButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.COMPL_TASKS); taskPage.usingTasksListPage().selectTaskFromTasksList(taskName.completed); - attachmentListPage.downloadFile(jpgFile.name); + attachmentListPage.downloadFile(pngFile.name); - expect(Util.fileExists(downloadedJpgFile, 20)).toBe(true); + browser.driver.sleep(500); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); + expect(Util.fileExists(downloadedPngFile, 20)).toBe(true); + + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); }); it('[C260225] Should be able to upload a file in the Attachment list on Task App', () => { processServicesPage.goToProcessServices().goToTaskApp().clickTasksButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); - taskPage.createNewTask().addName(taskName.taskApp).clickStartButton() - .then(() => { - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); - }); + taskPage.createNewTask().addName(taskName.taskApp).clickStartButton(); + + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); }); it('[C279884] Should be able to view the empty attachment list for tasks', () => { processServicesPage.goToProcessServices().goToTaskApp().clickTasksButton(); taskPage.usingFiltersPage().goToFilter(CONSTANTS.TASKFILTERS.MY_TASKS); - taskPage.createNewTask().addName(taskName.emptyList).clickStartButton() - .then(() => { - attachmentListPage.checkEmptyAttachmentList(); - attachmentListPage.clickAttachFileButton(jpgFile.location); - attachmentListPage.checkFileIsAttached(jpgFile.name); - attachmentListPage.removeFile(jpgFile.name); - attachmentListPage.checkFileIsRemoved(jpgFile.name); - attachmentListPage.checkEmptyAttachmentList(); - }); + taskPage.createNewTask().addName(taskName.emptyList).clickStartButton(); + + attachmentListPage.checkEmptyAttachmentList(); + attachmentListPage.clickAttachFileButton(pngFile.location); + attachmentListPage.checkFileIsAttached(pngFile.name); + attachmentListPage.removeFile(pngFile.name); + attachmentListPage.checkFileIsRemoved(pngFile.name); + attachmentListPage.checkEmptyAttachmentList(); }); }); diff --git a/e2e/task_list_pagination.e2e.ts b/e2e/process-services/task_list_pagination.e2e.ts similarity index 93% rename from e2e/task_list_pagination.e2e.ts rename to e2e/process-services/task_list_pagination.e2e.ts index efeaeb92a7..f5397db765 100644 --- a/e2e/task_list_pagination.e2e.ts +++ b/e2e/process-services/task_list_pagination.e2e.ts @@ -15,20 +15,19 @@ * limitations under the License. */ -import LoginPage = require('./pages/adf/loginPage'); -import ProcessServicesPage = require('./pages/adf/process_services/processServicesPage'); -import TasksPage = require('./pages/adf/process_services/tasksPage'); -import PaginationPage = require('./pages/adf/paginationPage'); -import NavigationBarPage = require('./pages/adf/navigationBarPage'); +import LoginPage = require('../pages/adf/loginPage'); +import ProcessServicesPage = require('../pages/adf/process_services/processServicesPage'); +import TasksPage = require('../pages/adf/process_services/tasksPage'); +import PaginationPage = require('../pages/adf/paginationPage'); -import CONSTANTS = require('./util/constants'); +import CONSTANTS = require('../util/constants'); -import TestConfig = require('./test.config'); -import resources = require('./util/resources'); +import TestConfig = require('../test.config'); +import resources = require('../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); -import { AppsActions } from './actions/APS/apps.actions'; -import { UsersActions } from './actions/users.actions'; +import { AppsActions } from '../actions/APS/apps.actions'; +import { UsersActions } from '../actions/users.actions'; describe('Task List Pagination', () => { @@ -36,7 +35,6 @@ describe('Task List Pagination', () => { let processServicesPage = new ProcessServicesPage(); let taskPage = new TasksPage(); let paginationPage = new PaginationPage(); - let navigationBarPage = new NavigationBarPage(); let processUserModel, processUserModelEmpty; let app = resources.Files.SIMPLE_APP_WITH_USER_FORM; diff --git a/e2e/process-services/z-finish.e2e.ts b/e2e/process-services/z-finish.e2e.ts new file mode 100644 index 0000000000..fc84fa57d3 --- /dev/null +++ b/e2e/process-services/z-finish.e2e.ts @@ -0,0 +1,77 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AlfrescoApi = require('alfresco-js-api-node'); +import TestConfig = require('../test.config'); + +import fs = require('fs'); +import path = require('path'); + +let buildNumber = process.env.TRAVIS_BUILD_NUMBER; +let saveScreenshot = process.env.SAVE_SCREENSHOT; + +describe('Save screenshot at the end', () => { + + beforeAll(async (done) => { + + if (saveScreenshot === 'true') { + if (!buildNumber) { + buildNumber = Date.now(); + } + + let alfrescoJsApi = new AlfrescoApi({ + provider: 'ECM', + hostEcm: TestConfig.adf.url + }); + + let files = fs.readdirSync(path.join(__dirname, '../../e2e-output/screenshots')); + + if (files && files.length > 0) { + alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword); + + let folder = await alfrescoJsApi.nodes.addNode('-my-', { + 'name': 'process-services', + 'relativePath': 'Buiild-screenshot/Screenshot-e2e-' + buildNumber, + 'nodeType': 'cm:folder' + }, {}, {}); + + for (const fileName of files) { + + let pathFile = path.join(__dirname, '../../e2e-output/screenshots', fileName); + let file = fs.createReadStream(pathFile); + + await alfrescoJsApi.upload.uploadFile( + file, + '', + folder.entry.id, + null, + { + 'name': file.name, + 'nodeType': 'cm:content' + } + ); + } + } + } + + done(); + }); + + it('screenshot need it', () => { + expect(true).toEqual(true); + }); +}); diff --git a/e2e/restAPI/ACS/RequestUtil/RequestCoreAPI.js b/e2e/restAPI/ACS/RequestUtil/RequestCoreAPI.js index b18af45d64..db5dbc72f2 100644 --- a/e2e/restAPI/ACS/RequestUtil/RequestCoreAPI.js +++ b/e2e/restAPI/ACS/RequestUtil/RequestCoreAPI.js @@ -26,8 +26,7 @@ exports.getBaseURL = function () { }; exports.requestHeaders = function (auth) { - var headers = { + return { 'Authorization': new APIUtils().getAuthorization(auth.id, auth.password) }; - return headers; }; diff --git a/e2e/restAPI/APIUtil.js b/e2e/restAPI/APIUtil.js index 3580f5fce2..6b21377cce 100644 --- a/e2e/restAPI/APIUtil.js +++ b/e2e/restAPI/APIUtil.js @@ -17,8 +17,6 @@ var url = require('url-join'); var TestConfig = require('../test.config'); -var BasicAuthorization = require('../restAPI/httpRequest/BasicAuthorization'); -var Ajv = require('ajv'); var APIUtils = function () { /** @@ -53,12 +51,10 @@ var APIUtils = function () { urlComponents.path = TestConfig[application].apiContextRoot; Object.assign(urlComponents, urlComponentsParam); - var baseUrl = url(urlComponents.protocol + return url(urlComponents.protocol + "://" + urlComponents.hostname + (urlComponents.port !== "" ? ":" + urlComponents.port : ""), urlComponents.path); - - return baseUrl; }; }; diff --git a/e2e/test.config.js b/e2e/test.config.js index 8365daf19f..0183937f1b 100644 --- a/e2e/test.config.js +++ b/e2e/test.config.js @@ -7,10 +7,13 @@ var HOST = process.env.URL_HOST_ADF; var USERNAME = process.env.USERNAME_ADF; var PASSWORD = process.env.PASSWORD_ADF; var EMAIL = process.env.EMAIL_ADF; +var TIMEOUT = process.env.TIMEOUT || 20000; module.exports = { main: { + timeout: TIMEOUT, + presence_timeout: 60000, rootPath: __dirname diff --git a/e2e/util/constants.js b/e2e/util/constants.js index 71f75c8665..01641d7809 100644 --- a/e2e/util/constants.js +++ b/e2e/util/constants.js @@ -85,20 +85,6 @@ exports.TASKSTATUS = { RUNNING: 'Running' }; -exports.METADATA = { - DATAFORMAT: "mmm dd yyyy", - TITLE: "Details", - COMMENTS_TAB: "COMMENTS", - PROPERTY_TAB: "PROPERTIES", - VERSIONS_TAB: "VERSIONS", - DEFAULT_ASPECT: "Properties", - MORE_INFO_BUTTON: "More information", - LESS_INFO_BUTTON: "Less information", - ARROW_DOWN: "keyboard_arrow_down", - ARROW_UP: "keyboard_arrow_up", - EDIT_BUTTON_TOOLTIP: "Edit" -}; - exports.THEMING = { PINK_BLUE_DARK: "Pink Bluegrey Dark", DEFAULT_PASSWORD_ICON_COLOR: "rgba(0, 0, 0, 0.87)", diff --git a/e2e/util/util.js b/e2e/util/util.js index 7d5e39eb25..2fcfe9c5aa 100644 --- a/e2e/util/util.js +++ b/e2e/util/util.js @@ -28,8 +28,7 @@ var TestConfig = require('../test.config'); var moment = require('moment'); var CONSTANTS = require('./constants'); - -var DEFAULT_TIMEOUT = 20000; +var DEFAULT_TIMEOUT = parseInt(TestConfig.main.timeout); /** * Provides utility methods used throughout the testing framework. * @@ -44,9 +43,7 @@ var apiRequest = TestConfig.main.protocol !== 'http' ? https : http; */ exports.uploadParentFolder = function (filePath) { var parentFolder = path.resolve(path.join(__dirname, 'test')); - var absolutePath = path.resolve(path.join(parentFolder, filePath)); - - return absolutePath; + return path.resolve(path.join(parentFolder, filePath)); }; /** @@ -62,11 +59,6 @@ exports.sleep = function (time, callback) { callback(); }; - -exports.refreshBrowser = function () { - browser.refresh(); -}; - /** * Get current date in long format: Oct 24, 2016 * @@ -91,9 +83,7 @@ exports.getCrtDateLongFormat = function () { * @method getCrtDateInFormat */ exports.getCrtDateInFormat = function (dateFormat) { - var currentDate = moment().format(dateFormat); - // console.debug("Current date formatted with: '" + dateFormat + "' format, is: '" + currentDate + "'"); - return currentDate; + return moment().format(dateFormat); }; /** @@ -121,11 +111,11 @@ exports.generatePasswordString = function (length) { var possibleLowerCase = 'abcdefghijklmnopqrstuvwxyz'; var lowerCaseLimit = Math.floor(length / 2); - for (var i = 0; i < lowerCaseLimit; i++) { + for (let i = 0; i < lowerCaseLimit; i++) { text += possibleLowerCase.charAt(Math.floor(Math.random() * possibleLowerCase.length)); } - for (var i = 0; i < length - lowerCaseLimit; i++) { + for (let i = 0; i < length - lowerCaseLimit; i++) { text += possibleUpperCase.charAt(Math.floor(Math.random() * possibleUpperCase.length)); } @@ -419,7 +409,7 @@ exports.waitUntilElementIsNotVisible = function (elementToCheck, timeout) { return elementToCheck.isPresent().then(function (present) { return !present; }) - }, waitTimeout, 'Element is not in Visible ' + elementToCheck.locator()); + }, waitTimeout, 'Element is Visible and it should not' + elementToCheck.locator()); }; exports.waitUntilElementIsNotDisplayed = function (elementToCheck, timeout) { @@ -429,7 +419,7 @@ exports.waitUntilElementIsNotDisplayed = function (elementToCheck, timeout) { return elementToCheck.isDisplayed().then(function (present) { return !present; }) - }, waitTimeout, 'Element is not in dysplayed ' + elementToCheck.locator()); + }, waitTimeout, 'Element is dysplayed and it should not' + elementToCheck.locator()); }; /* @@ -501,16 +491,11 @@ exports.openNewTabInBrowser = function () { }; exports.switchToWindowHandler = function (number) { - browser.driver.getAllWindowHandles().then(function (handles) { + browser.driver.getAllWindowHandles().then((handles) => { browser.driver.switchTo().window(handles[number]); }); }; -exports.pressDownArrowAndEnter = function () { - browser.actions().sendKeys(protractor.Key.ARROW_DOWN).sendKeys(protractor.Key.ENTER).perform(); -}; - - /** * Verify file exists * @param filePath - absolute path to the searched file diff --git a/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.html b/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.html index 09b8f90a12..4422e61173 100644 --- a/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.html +++ b/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.html @@ -15,17 +15,17 @@ mat-icon-button (click)="toggleEdit()" [attr.title]="'CORE.METADATA.ACTIONS.EDIT' | translate" - data-automation-id="mata-data-card-toggle-edit"> + data-automation-id="meta-data-card-toggle-edit"> mode_edit - diff --git a/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts b/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts index 5313ac37fc..26a49b3aaa 100644 --- a/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts +++ b/lib/content-services/content-metadata/components/content-metadata-card/content-metadata-card.component.spec.ts @@ -120,7 +120,7 @@ describe('ContentMetadataCardComponent', () => { component.node.allowableOperations = [PermissionsEnum.UPDATE]; fixture.detectChanges(); - const button = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-edit"]')); + const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-edit"]')); button.triggerEventHandler('click', {}); fixture.detectChanges(); @@ -131,7 +131,7 @@ describe('ContentMetadataCardComponent', () => { component.expanded = true; fixture.detectChanges(); - const button = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-expand"]')); + const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand"]')); button.triggerEventHandler('click', {}); fixture.detectChanges(); @@ -142,7 +142,7 @@ describe('ContentMetadataCardComponent', () => { component.expanded = false; fixture.detectChanges(); - const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-expand-label"]')); + const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]')); expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.MORE_INFORMATION'); }); @@ -151,7 +151,7 @@ describe('ContentMetadataCardComponent', () => { component.expanded = true; fixture.detectChanges(); - const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-expand-label"]')); + const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]')); expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.LESS_INFORMATION'); }); @@ -160,7 +160,7 @@ describe('ContentMetadataCardComponent', () => { component.readOnly = true; fixture.detectChanges(); - const button = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-edit"]')); + const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-edit"]')); expect(button).toBeNull(); }); @@ -169,7 +169,7 @@ describe('ContentMetadataCardComponent', () => { component.node.allowableOperations = null; fixture.detectChanges(); - const button = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-edit"]')); + const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-edit"]')); expect(button).toBeNull(); }); @@ -178,7 +178,7 @@ describe('ContentMetadataCardComponent', () => { component.node.allowableOperations = [PermissionsEnum.UPDATE]; fixture.detectChanges(); - const button = fixture.debugElement.query(By.css('[data-automation-id="mata-data-card-toggle-edit"]')); + const button = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-edit"]')); expect(button).not.toBeNull(); }); }); diff --git a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.html b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.html index 2d5adcf647..7ad78f2c9d 100644 --- a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.html +++ b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.html @@ -1,6 +1,6 @@ diff --git a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts index 4e725856bc..3ea0b891ee 100644 --- a/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/content-metadata/components/content-metadata/content-metadata.component.ts @@ -49,7 +49,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { @Input() expanded: boolean = false; - /** The multi parameter of the underlying material expansion panel */ + /** The multi parameter of the underlying material expansion panel, set to true to allow multi accordion to be expanded at the same time */ @Input() multi = false; diff --git a/lib/content-services/permission-manager/services/node-permission-dialog.service.spec.ts b/lib/content-services/permission-manager/services/node-permission-dialog.service.spec.ts index 06b3465568..1ba7d9552d 100644 --- a/lib/content-services/permission-manager/services/node-permission-dialog.service.spec.ts +++ b/lib/content-services/permission-manager/services/node-permission-dialog.service.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { TestBed, async } from '@angular/core/testing'; +import { TestBed } from '@angular/core/testing'; import { AppConfigService, setupTestBed, ContentService } from '@alfresco/adf-core'; import { NodePermissionDialogService } from './node-permission-dialog.service'; import { MatDialog } from '@angular/material'; diff --git a/lib/content-services/tag/tag-actions.component.html b/lib/content-services/tag/tag-actions.component.html index 20df0864e1..a35772a505 100644 --- a/lib/content-services/tag/tag-actions.component.html +++ b/lib/content-services/tag/tag-actions.component.html @@ -1,7 +1,7 @@ -
-
+
+
{{currentEntry.entry.tag}}
delete diff --git a/lib/content-services/tag/tag-actions.component.spec.ts b/lib/content-services/tag/tag-actions.component.spec.ts index c624975edf..1cf8adcfd9 100644 --- a/lib/content-services/tag/tag-actions.component.spec.ts +++ b/lib/content-services/tag/tag-actions.component.spec.ts @@ -80,13 +80,13 @@ describe('TagActionsComponent', () => { component.result.subscribe(() => { fixture.detectChanges(); - expect(element.querySelector('#tag_name_0').innerHTML.trim()).toBe('test1'); - expect(element.querySelector('#tag_name_1').innerHTML.trim()).toBe('test2'); - expect(element.querySelector('#tag_name_2').innerHTML.trim()).toBe('test3'); + expect(element.querySelector('#tag_name_test1').innerHTML.trim()).toBe('test1'); + expect(element.querySelector('#tag_name_test2').innerHTML.trim()).toBe('test2'); + expect(element.querySelector('#tag_name_test3').innerHTML.trim()).toBe('test3'); - expect(element.querySelector('#tag_delete_0')).not.toBe(null); - expect(element.querySelector('#tag_delete_1')).not.toBe(null); - expect(element.querySelector('#tag_delete_2')).not.toBe(null); + expect(element.querySelector('#tag_delete_test1')).not.toBe(null); + expect(element.querySelector('#tag_delete_test2')).not.toBe(null); + expect(element.querySelector('#tag_delete_test3')).not.toBe(null); done(); }); @@ -106,7 +106,7 @@ describe('TagActionsComponent', () => { component.result.subscribe(() => { fixture.detectChanges(); - let deleteButton: any = element.querySelector('#tag_delete_0'); + let deleteButton: any = element.querySelector('#tag_delete_test1'); deleteButton.click(); expect(jasmine.Ajax.requests.at(1).url) diff --git a/lib/content-services/tag/tag-node-list.component.html b/lib/content-services/tag/tag-node-list.component.html index 60bec1d61b..6c1d57f305 100644 --- a/lib/content-services/tag/tag-node-list.component.html +++ b/lib/content-services/tag/tag-node-list.component.html @@ -1,7 +1,7 @@ {{currentEntry.entry.tag}} - diff --git a/lib/content-services/tag/tag-node-list.component.spec.ts b/lib/content-services/tag/tag-node-list.component.spec.ts index 0590287eaf..e339698cd5 100644 --- a/lib/content-services/tag/tag-node-list.component.spec.ts +++ b/lib/content-services/tag/tag-node-list.component.spec.ts @@ -76,9 +76,9 @@ describe('TagNodeList', () => { expect(element.querySelector('#tag_name_1').innerHTML).toBe('test2'); expect(element.querySelector('#tag_name_2').innerHTML).toBe('test3'); - expect(element.querySelector('#tag_delete_0')).not.toBe(null); - expect(element.querySelector('#tag_delete_1')).not.toBe(null); - expect(element.querySelector('#tag_delete_2')).not.toBe(null); + expect(element.querySelector('#tag_chips_delete_test1')).not.toBe(null); + expect(element.querySelector('#tag_chips_delete_test2')).not.toBe(null); + expect(element.querySelector('#tag_chips_delete_test3')).not.toBe(null); done(); }); @@ -94,7 +94,7 @@ describe('TagNodeList', () => { component.results.subscribe(() => { fixture.detectChanges(); - let deleteButton: any = element.querySelector('#tag_delete_0'); + let deleteButton: any = element.querySelector('#tag_chips_delete_test1'); deleteButton.click(); expect(tagService.removeTag).toHaveBeenCalledWith('fake-node-id', '0ee933fa-57fc-4587-8a77-b787e814f1d2'); diff --git a/lib/core/card-view/components/card-view-boolitem/card-view-boolitem.component.html b/lib/core/card-view/components/card-view-boolitem/card-view-boolitem.component.html index d3024d959a..e8443a6078 100644 --- a/lib/core/card-view/components/card-view-boolitem/card-view-boolitem.component.html +++ b/lib/core/card-view/components/card-view-boolitem/card-view-boolitem.component.html @@ -1,7 +1,8 @@ -
{{ property.label | translate }}
+
{{ property.label | translate }}
{{ property.label | translate }}
+
{{ property.label | translate }}
- + {{ property.displayValue }} @@ -11,7 +11,7 @@ class="adf-datepicker-toggle" [attr.data-automation-id]="'datepicker-label-toggle-' + property.key" (click)="showDatePicker($event)"> - {{ property.displayValue }} + {{ property.displayValue }} {{ property.label | translate }}
+
{{ property.label | translate }}
{{ 'CORE.CARDVIEW.KEYVALUEPAIRS.ADD' | translate }} -
diff --git a/lib/core/card-view/components/card-view-mapitem/card-view-mapitem.component.html b/lib/core/card-view/components/card-view-mapitem/card-view-mapitem.component.html index 82f9749b3c..1dc68d5da3 100644 --- a/lib/core/card-view/components/card-view-mapitem/card-view-mapitem.component.html +++ b/lib/core/card-view/components/card-view-mapitem/card-view-mapitem.component.html @@ -1,4 +1,4 @@ -
{{ property.label | translate }}
+
{{ property.label | translate }}
diff --git a/lib/core/card-view/components/card-view-selectitem/card-view-selectitem.component.html b/lib/core/card-view/components/card-view-selectitem/card-view-selectitem.component.html index 7fd5e59135..d718f07b62 100644 --- a/lib/core/card-view/components/card-view-selectitem/card-view-selectitem.component.html +++ b/lib/core/card-view/components/card-view-selectitem/card-view-selectitem.component.html @@ -1,4 +1,4 @@ -
{{ property.label | translate }}
+
{{ property.label | translate }}
{{ property.displayValue | async }}
diff --git a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html index de7758095c..b92fad3f44 100644 --- a/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html +++ b/lib/core/card-view/components/card-view-textitem/card-view-textitem.component.html @@ -1,4 +1,4 @@ -
{{ property.label | translate }}
+
{{ property.label | translate }}
@@ -53,7 +53,7 @@ [attr.title]="'CORE.METADATA.ACTIONS.CANCEL' | translate" [attr.data-automation-id]="'card-textitem-reset-' + property.key">clear
- +
  • {{ errorMessage | translate }}
diff --git a/lib/core/form/components/form.component.html b/lib/core/form/components/form.component.html index 750eabc070..588e930999 100644 --- a/lib/core/form/components/form.component.html +++ b/lib/core/form/components/form.component.html @@ -2,11 +2,12 @@
+
-

+

check_circle @@ -18,7 +19,7 @@ refresh
- {{form.taskName}} + {{form.taskName}}

diff --git a/lib/core/login/components/login.component.html b/lib/core/login/components/login.component.html index 2777de76b7..bfb1d834d2 100644 --- a/lib/core/login/components/login.component.html +++ b/lib/core/login/components/login.component.html @@ -13,7 +13,7 @@ ngFor [ngForOf]="[data]" [ngForTemplate]="headerTemplate"> -
diff --git a/lib/core/userinfo/components/user-info.component.html b/lib/core/userinfo/components/user-info.component.html index ac5907a63e..7d574e0830 100644 --- a/lib/core/userinfo/components/user-info.component.html +++ b/lib/core/userinfo/components/user-info.component.html @@ -5,8 +5,8 @@ class="adf-userinfo-name">{{ecmUser.fullNameDisplay}} {{bpmUser.fullNameDisplay}} -