From 409acbcc9e73d9083ce3215dbd8aa6ae7d34238d Mon Sep 17 00:00:00 2001 From: davidcanonieto Date: Tue, 7 Aug 2018 23:56:56 +0200 Subject: [PATCH] [ADF-3372] Added toggle and global configuration to display metadata (#3636) * [ADF-3372] Added toggle and global configuration to display metadata * [ADF-3372] Fixed typo in shcema.json * [ADF-3372] Removed unnecessary variables and variable name changed * [ADF-3372] Fixed unit test * [ADF-3372] Improved logic * [ADF-3372] Improved Metadata component html logic * [ADF-3372] Demoshell variable from app.config.json removed * [ADF-3372] fixed bugs and tests * [ADF-3372] fixed some error in tests * [ADF-3372] fixed some wrong compilation in test * [ADF-3372] fixed wrong locator * [ADF-3372] fixed randomly failing tests --- .../file-view/file-view.component.html | 13 ++++++ .../file-view/file-view.component.ts | 6 +++ .../content-metadata.component.md | 2 + .../card-view/aspect-oriented-config.e2e.ts | 42 +++++++++---------- e2e/pages/adf/configEditorPage.ts | 2 + e2e/pages/adf/metadataViewPage.js | 7 ++-- .../content-metadata-card.component.html | 5 ++- .../content-metadata-card.component.spec.ts | 12 +++++- .../content-metadata-card.component.ts | 35 +++++++++++++++- .../content-metadata.component.html | 13 ++++-- .../content-metadata.component.spec.ts | 24 ++++++++++- .../content-metadata.component.ts | 4 ++ 12 files changed, 129 insertions(+), 36 deletions(-) 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 91997892c5..0353285704 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 @@ -2,6 +2,7 @@ + @@ -11,13 +12,25 @@ [multi]="multi" [preset]="customPreset" [readOnly]="isReadOnly" + [displayDefaultProperties]="displayDefaultProperties" [displayEmpty]="displayEmptyMetadata"> +

+ + Display Properties + +

+

@@ -27,6 +28,7 @@ Displays and edits metadata related to a node. | Name | Type | Default value | Description | | ---- | ---- | ------------- | ----------- | | displayEmpty | `boolean` | false | Toggles whether to display empty values in the card view | +| displayDefaultProperties | `boolean` | true | Toggles whether to display metadata fields 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, set to true to allow multi accordion to be expanded at the same time | diff --git a/e2e/core/card-view/aspect-oriented-config.e2e.ts b/e2e/core/card-view/aspect-oriented-config.e2e.ts index e952bb3c85..66fd7389cf 100644 --- a/e2e/core/card-view/aspect-oriented-config.e2e.ts +++ b/e2e/core/card-view/aspect-oriented-config.e2e.ts @@ -31,6 +31,7 @@ import resources = require('../../util/resources'); import AlfrescoApi = require('alfresco-js-api-node'); import { UploadActions } from '../../actions/ACS/upload.actions'; +import ContentServicesPage = require('../../pages/adf/contentServicesPage'); describe('Aspect oriented config', () => { @@ -39,6 +40,7 @@ describe('Aspect oriented config', () => { const metadataViewPage = new CardViewPage(); const navigationBarPage = new NavigationBarPage(); const configEditorPage = new ConfigEditorPage(); + let contentServicesPage = new ContentServicesPage(); let acsUser = new AcsUserModel(); @@ -69,15 +71,21 @@ describe('Aspect oriented config', () => { done(); }); - afterEach(() => { + beforeEach(async(done) => { + navigationBarPage.clickConfigEditorButton(); + configEditorPage.clickClearMetadataButton(); + done(); + }); + + afterEach(async(done) => { viewerPage.clickCloseButton(); + contentServicesPage.checkAcsContainer(); browser.refresh(); + contentServicesPage.checkAcsContainer(); + done(); }); it('[C261117] Should be possible restrict the display properties of one an aspect', () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration('{ "presets": {' + ' "default": [{' + @@ -98,11 +106,10 @@ describe('Aspect oriented config', () => { viewerPage.clickInfoButton(); viewerPage.checkInfoSideBarIsDisplayed(); metadataViewPage.clickOnPropertiesTab(); - + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.clickMetadatGroup('IMAGE'); - metadataViewPage.checkPopertyIsVisible('properties.exif:pixelXDimension', 'textitem'); metadataViewPage.checkPopertyIsVisible('properties.exif:pixelYDimension', 'textitem'); metadataViewPage.checkPopertyIsNotVisible('properties.exif:isoSpeedRatings', 'textitem'); @@ -113,9 +120,6 @@ describe('Aspect oriented config', () => { }); it('[C260185] Should ignore not existing aspect when present in the configuration', () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration(' {' + ' "presets": {' + @@ -135,7 +139,7 @@ describe('Aspect oriented config', () => { viewerPage.clickInfoButton(); viewerPage.checkInfoSideBarIsDisplayed(); metadataViewPage.clickOnPropertiesTab(); - + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); @@ -145,9 +149,6 @@ describe('Aspect oriented config', () => { }); it('[C260183] Should show all the aspect if the content-metadata configuration is NOT provided' , () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration('{ }'); @@ -159,7 +160,7 @@ describe('Aspect oriented config', () => { viewerPage.clickInfoButton(); viewerPage.checkInfoSideBarIsDisplayed(); metadataViewPage.clickOnPropertiesTab(); - + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); @@ -172,9 +173,6 @@ describe('Aspect oriented config', () => { }); it('[C260182] Should show all the aspects if the default configuration contains the * symbol' , () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration('{' + ' "presets": {' + @@ -191,6 +189,7 @@ describe('Aspect oriented config', () => { viewerPage.checkInfoSideBarIsDisplayed(); metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.checkkMetadatGroupIsPresent('EXIF'); @@ -203,9 +202,6 @@ describe('Aspect oriented config', () => { }); it('[C268899] Should be possible use a Translation key as Title of a metadata group' , () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration('{' + ' "presets": {' + @@ -244,6 +240,7 @@ describe('Aspect oriented config', () => { viewerPage.checkInfoSideBarIsDisplayed(); metadataViewPage.clickOnPropertiesTab(); + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.checkkMetadatGroupIsPresent('GROUP-TITLE1-TRANSLATION-KEY'); @@ -255,9 +252,6 @@ describe('Aspect oriented config', () => { }); it('[C279968] Should be possible use a custom preset' , () => { - navigationBarPage.clickConfigEditorButton(); - - configEditorPage.clickClearMetadataButton(); configEditorPage.enterMetadataConfiguration('{' + ' "presets": {' + @@ -278,8 +272,10 @@ describe('Aspect oriented config', () => { metadataViewPage.clickOnPropertiesTab(); metadataViewPage.enablePreset(); + metadataViewPage.enterPresetText('custom-preset'); + metadataViewPage.informationButtonIsDisplayed(); metadataViewPage.clickOnInformationButton(); metadataViewPage.checkkMetadatGroupIsPresent('properties'); diff --git a/e2e/pages/adf/configEditorPage.ts b/e2e/pages/adf/configEditorPage.ts index 9344fdc2a4..8446081ad5 100644 --- a/e2e/pages/adf/configEditorPage.ts +++ b/e2e/pages/adf/configEditorPage.ts @@ -33,12 +33,14 @@ export class ConfigEditorPage { clickSaveMetadataButton() { let saveButton = element(by.xpath('//*[@id="adf-metadata-save"]')); Util.waitUntilElementIsVisible(saveButton); + Util.waitUntilElementIsClickable(saveButton); return saveButton.click(); } clickClearMetadataButton() { let clearButton = element(by.xpath('//*[@id="adf-metadata-clear"]')); Util.waitUntilElementIsVisible(clearButton); + Util.waitUntilElementIsClickable(clearButton); return clearButton.click(); } } diff --git a/e2e/pages/adf/metadataViewPage.js b/e2e/pages/adf/metadataViewPage.js index cc9af3b601..7a51434698 100644 --- a/e2e/pages/adf/metadataViewPage.js +++ b/e2e/pages/adf/metadataViewPage.js @@ -116,11 +116,12 @@ var MetadataViewPage = function () { }; this.informationButtonIsDisplayed = function () { - return Util.waitUntilElementIsVisible(informationSpan); + Util.waitUntilElementIsVisible(informationButton); + Util.waitUntilElementIsClickable(informationButton); }; this.clickOnInformationButton = function () { - Util.waitUntilElementIsVisible(informationSpan); + this.informationButtonIsDisplayed(); informationButton.click(); return this; }; @@ -136,7 +137,7 @@ var MetadataViewPage = function () { }; this.clickOnPropertiesTab = function () { - var propertiesTab = element(by.cssContainingText(".adf-info-drawer-layout-content div.mat-tab-labels div", "Properties")); + let propertiesTab = element(by.cssContainingText(".adf-info-drawer-layout-content div.mat-tab-labels div .mat-tab-label-content", "Properties")); Util.waitUntilElementIsVisible(propertiesTab); propertiesTab.click(); return this; 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 4422e61173..d24d637fcb 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 @@ -1,10 +1,11 @@ @@ -19,7 +20,7 @@ mode_edit -