Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACA-20] Favorite Libraries #789

Merged
merged 45 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
bc35e61
libraries submenu config
pionnegru Nov 7, 2018
1a1f2a0
fix item id
pionnegru Nov 7, 2018
d638804
favorite libraries columns
pionnegru Nov 7, 2018
9acbcb3
libraries submenu text
pionnegru Nov 7, 2018
c401ab4
columns text
pionnegru Nov 7, 2018
7bb75f3
submenu schema
pionnegru Nov 7, 2018
ba2f7ab
submenu routes
pionnegru Nov 7, 2018
290b3b9
role column component
pionnegru Nov 7, 2018
0a36312
favorite libraries list api
pionnegru Nov 7, 2018
0077638
register favorite libraries presets
pionnegru Nov 7, 2018
abb3099
favorite libraries list component
pionnegru Nov 7, 2018
9513589
register role column component
pionnegru Nov 7, 2018
ac75fd4
dl custom node list is library route
pionnegru Nov 7, 2018
f8db230
empty state message icon
pionnegru Nov 7, 2018
5d77b16
remove custom id
pionnegru Nov 7, 2018
32a38ee
merge subscriptions
pionnegru Nov 7, 2018
f43608b
adapt to child route
pionnegru Nov 7, 2018
c465a4c
fix component selector
pionnegru Nov 7, 2018
799677c
revert to favorite library route
pionnegru Nov 8, 2018
9dc18a8
sidenav main links font weight
pionnegru Nov 8, 2018
1dfba54
Merge branch 'development' into dev-pionnegru-ACA-20-favorite-libraries
pionnegru Nov 8, 2018
9ad4358
libraries children contants
pionnegru Nov 8, 2018
eaf4a33
library expand panel method
pionnegru Nov 8, 2018
2d480e6
update e2e
pionnegru Nov 8, 2018
86b215e
libraries children columns consistency
pionnegru Nov 8, 2018
3e91c54
Merge branch 'dev-pionnegru-ACA-20-favorite-libraries' of https://git…
pionnegru Nov 8, 2018
78fa952
Merge branch 'development' into dev-pionnegru-ACA-20-favorite-libraries
pionnegru Nov 8, 2018
626fef0
isLibrary workaround for custom node list
pionnegru Nov 8, 2018
6ec45da
update isLibrary evaluator
pionnegru Nov 8, 2018
ad48899
update e2e
pionnegru Nov 8, 2018
767be4c
Merge branch 'development' into dev-pionnegru-ACA-20-favorite-libraries
pionnegru Nov 8, 2018
ce840a5
lint
pionnegru Nov 8, 2018
8f931a0
Update src/assets/app.extensions.json
DenysVuika Nov 8, 2018
6f5d064
Update src/app/extensions/extension.service.ts
DenysVuika Nov 8, 2018
90fe092
Update src/app/extensions/extension.service.ts
DenysVuika Nov 8, 2018
d998ffb
Update src/app/extensions/extension.service.ts
DenysVuika Nov 8, 2018
c70c007
Update src/app/extensions/extension.service.ts
DenysVuika Nov 8, 2018
d2c06e8
use correct preset
pionnegru Nov 9, 2018
241614b
update e2e
pionnegru Nov 9, 2018
48ee97f
update page titles values
pionnegru Nov 9, 2018
1bf6c64
find child active link
pionnegru Nov 9, 2018
5e181d4
fix expected value
pionnegru Nov 9, 2018
2400d25
update expected
pionnegru Nov 9, 2018
d64bfed
role column tests
pionnegru Nov 9, 2018
e2bdfae
check if menu is expanded
pionnegru Nov 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions e2e/components/sidenav/sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/

import { ElementFinder, ElementArrayFinder, by } from 'protractor';
import { ElementFinder, ElementArrayFinder, by, element } from 'protractor';
import { Menu } from '../menu/menu';
import { Component } from '../component';
import { Utils } from '../../utilities/utils';
Expand All @@ -33,6 +33,8 @@ export class Sidenav extends Component {
root: 'app-sidenav',
link: '.menu__item',
label: '.item--label',
expansion_panel: ".mat-expansion-panel-header",
expansion_panel_content: ".mat-expansion-panel-body",
activeLink: '.item--active',
newButton: '[data-automation-id="create-button"]'
};
Expand Down Expand Up @@ -64,6 +66,12 @@ export class Sidenav extends Component {
return className.includes(Sidenav.selectors.activeLink.replace('.', ''));
}

async childIsActiveByLabel(label: string) {
const labelElement = await this.getLinkByLabel(label).element(by.css('span'));
return (await labelElement.getAttribute('class'))
.includes(Sidenav.selectors.activeLink.replace('.', ''));
}

getLink(label: string) {
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
}
Expand All @@ -84,7 +92,24 @@ export class Sidenav extends Component {
return await link.click();

} catch (e){
console.log('---- sidebar navigation catch : ', e);
console.log('---- sidebar navigation catch navigateToLinkByLabel: ', e);
}
}

async expandMenu(label: string) {
try{

if (await element(by.cssContainingText('.mat-expanded', label)).isPresent()) {
return Promise.resolve();
} else {
const link = this.getLinkByLabel(label);
await Utils.waitUntilElementClickable(link);
await link.click();
await element(by.css(Sidenav.selectors.expansion_panel_content)).isPresent();
}

} catch (e) {
console.log('---- sidebar navigation catch expandMenu: ', e);
}
}
}
7 changes: 5 additions & 2 deletions e2e/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const E2E_ROOT_PATH = __dirname;
// Application Routes
export const APP_ROUTES = {
FAVORITES: '/favorites',
FILE_LIBRARIES: '/libraries',
MY_LIBRARIES: '/libraries',
LOGIN: '/login',
LOGOUT: '/logout',
PERSONAL_FILES: '/personal-files',
Expand All @@ -58,6 +58,8 @@ export const APP_ROUTES = {
export const SIDEBAR_LABELS = {
PERSONAL_FILES: 'Personal Files',
FILE_LIBRARIES: 'File Libraries',
MY_LIBRARIES: 'My Libraries',
FAVORITE_LIBRARIES: 'Favorite Libraries',
SHARED_FILES: 'Shared',
RECENT_FILES: 'Recent Files',
FAVORITES: 'Favorites',
Expand All @@ -67,7 +69,8 @@ export const SIDEBAR_LABELS = {
// Page titles
export const PAGE_TITLES = {
VIEWER: 'Preview',
SEARCH: 'Search Results'
SEARCH: 'Search Results',
MY_LIBRARIES: 'File Libraries'
};

// Site visibility
Expand Down
6 changes: 4 additions & 2 deletions e2e/pages/browsing-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export class BrowsingPage extends Page {


async clickFileLibrariesAndWait() {
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES);
await this.dataTable.waitForHeader();
}

async clickFileLibraries() {
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES);
}


Expand Down
6 changes: 4 additions & 2 deletions e2e/suites/application/page-titles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ describe('Page titles', () => {
});

it('File Libraries page - [C217158]', async () => {
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
const parent = SIDEBAR_LABELS.FILE_LIBRARIES;
const label = SIDEBAR_LABELS.MY_LIBRARIES;

await page.sidenav.expandMenu(parent);
await page.sidenav.navigateToLinkByLabel(label);
expect(await browser.getTitle()).toContain(label);
expect(await browser.getTitle()).toContain(PAGE_TITLES.MY_LIBRARIES);
});

it('Shared Files page - [C217159]', async () => {
Expand Down
6 changes: 3 additions & 3 deletions e2e/suites/list-views/file-libraries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ describe('File Libraries', () => {
});

it('has the correct columns - [C217095]', async () => {
const labels = [ 'Title', 'Visibility' ];
const labels = [ 'Name', 'My Role', 'Visibility' ];
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));

expect(await dataTable.getColumnHeaders().count()).toBe(2 + 1, 'Incorrect number of columns');
expect(await dataTable.getColumnHeaders().count()).toBe(3 + 1, 'Incorrect number of columns');

await elements.forEach(async (element, index) => {
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
Expand All @@ -106,7 +106,7 @@ describe('File Libraries', () => {
return row.all(dataTable.cell).map(async cell => await cell.getText());
});
const sitesList = rowCells.reduce((acc, cell) => {
acc[cell[1]] = cell[2].toUpperCase();
acc[cell[1]] = cell[3].toUpperCase();
return acc;
}, {});

Expand Down
4 changes: 2 additions & 2 deletions e2e/suites/navigation/sidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ describe('Sidebar', () => {

it('navigates to "File Libraries" - [C217150]', async () => {
await page.clickFileLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FILE_LIBRARIES);
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true);
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES);
expect(await sidenav.childIsActiveByLabel(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true);
});

it('navigates to "Personal Files" - [C280409]', async () => {
Expand Down
30 changes: 29 additions & 1 deletion extension.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,35 @@
"children": {
"description": "Navigation children items",
"type": "array",
"items": { "$ref": "#/definitions/navBarLinkRef" },
"items": {
"oneOf": [
{
"type": "object",
"required": [
"id",
"title",
"route"
],
"properties": {
"id": {
"description": "Unique identifier",
"type": "string"
},
"title": {
"description": "Element title",
"type": "string"
},
"route": {
"description": "Route reference identifier",
"type": "string"
}
},
"not": {
"required": ["children"]
}
}
]
},
"minItems": 1
},
"rules": {
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { APP_ROUTES } from './app.routes';

import { FilesComponent } from './components/files/files.component';
import { LibrariesComponent } from './components/libraries/libraries.component';
import { FavoriteLibrariesComponent } from './components/favorite-libraries/favorite-libraries.component';
import { NodeVersionsDialogComponent } from './dialogs/node-versions/node-versions.dialog';
import { LibraryDialogComponent } from './dialogs/library/library.dialog';

Expand Down Expand Up @@ -107,6 +108,7 @@ import { environment } from '../environments/environment';
AppComponent,
FilesComponent,
LibrariesComponent,
FavoriteLibrariesComponent,
NodeVersionsDialogComponent,
LibraryDialogComponent
],
Expand Down
9 changes: 9 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Routes } from '@angular/router';
import { AppLayoutComponent } from './components/layout/app-layout/app-layout.component';
import { FilesComponent } from './components/files/files.component';
import { LibrariesComponent } from './components/libraries/libraries.component';
import { FavoriteLibrariesComponent } from './components/favorite-libraries/favorite-libraries.component';
import { GenericErrorComponent } from './components/common/generic-error/generic-error.component';
import { SearchResultsComponent } from './components/search/search-results/search-results.component';
import { SearchLibrariesResultsComponent } from './components/search/search-libraries-results/search-libraries-results.component';
Expand Down Expand Up @@ -105,6 +106,14 @@ export const APP_ROUTES: Routes = [
}
]
},
{
path: 'favorite/libraries',
component: FavoriteLibrariesComponent,
data: {
title: 'APP.BROWSE.LIBRARIES.MENU.FAVORITE_LIBRARIES.TITLE',
sortingPreferenceKey: 'favorite-libraries'
}
},
{
path: 'personal-files',
data: {
Expand Down
4 changes: 4 additions & 0 deletions src/app/components/common/common.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { LocationLinkComponent } from './location-link/location-link.component';
import { NameColumnComponent } from './name-column/name-column.component';
import { LibraryNameColumnComponent } from './library-name-column/library-name-column.component';
import { LibraryStatusColumnComponent } from './library-status-column/library-status-column.component';
import { LibraryRoleColumnComponent } from './library-role-column/library-role-column.component';
import { TrashcanNameColumnComponent } from './trashcan-name-column/trashcan-name-column.component';
import { DynamicColumnComponent } from './dynamic-column/dynamic-column.component';

Expand All @@ -42,6 +43,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent,
DynamicColumnComponent
],
Expand All @@ -51,6 +53,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent,
DynamicColumnComponent
],
Expand All @@ -59,6 +62,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent
]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/

import { LibraryRoleColumnComponent } from './library-role-column.component';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { NO_ERRORS_SCHEMA } from '@angular/core';

describe('LibraryNameColumnComponent', () => {
let fixture: ComponentFixture<LibraryRoleColumnComponent>;
let component: LibraryRoleColumnComponent;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [AppTestingModule],
declarations: [LibraryRoleColumnComponent],
schemas: [NO_ERRORS_SCHEMA]
});

fixture = TestBed.createComponent(LibraryRoleColumnComponent);
component = fixture.componentInstance;
});

it('should render Manager', () => {
component.context = { row: { node: { entry: { role: 'SiteManager' } } } };
fixture.detectChanges();
expect(component.displayText).toBe('APP.SITES_ROLE.MANAGER');
});

it('should render Collaborator', () => {
component.context = {
row: { node: { entry: { role: 'SiteCollaborator' } } }
};
fixture.detectChanges();
expect(component.displayText).toBe('APP.SITES_ROLE.COLLABORATOR');
});

it('should render Contributor', () => {
component.context = {
row: { node: { entry: { role: 'SiteContributor' } } }
};
fixture.detectChanges();
expect(component.displayText).toBe('APP.SITES_ROLE.CONTRIBUTOR');
});

it('should render Consumer', () => {
component.context = {
row: { node: { entry: { role: 'SiteConsumer' } } }
};
fixture.detectChanges();
expect(component.displayText).toBe('APP.SITES_ROLE.CONSUMER');
});

it('should not render text for unknown', () => {
component.context = {
row: { node: { entry: { role: 'ROLE' } } }
};
fixture.detectChanges();
expect(component.displayText).toBe('');
});
});
Loading