mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-20] Favorite Libraries (#789)
* libraries submenu config * fix item id * favorite libraries columns * libraries submenu text * columns text * submenu schema * submenu routes * role column component * favorite libraries list api * register favorite libraries presets * favorite libraries list component * register role column component * dl custom node list is library route * empty state message icon * remove custom id * merge subscriptions * adapt to child route * fix component selector * revert to favorite library route * sidenav main links font weight * libraries children contants * library expand panel method * update e2e * libraries children columns consistency * isLibrary workaround for custom node list * update isLibrary evaluator * update e2e * lint * Update src/assets/app.extensions.json Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com> * Update src/app/extensions/extension.service.ts Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com> * Update src/app/extensions/extension.service.ts Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com> * Update src/app/extensions/extension.service.ts Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com> * Update src/app/extensions/extension.service.ts Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com> * use correct preset * update e2e * update page titles values * find child active link * fix expected value * update expected * role column tests * check if menu is expanded
This commit is contained in:
committed by
Denys Vuika
parent
76fe33d734
commit
4a420cc9f9
@@ -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';
|
||||
@@ -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"]'
|
||||
};
|
||||
@@ -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));
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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',
|
||||
@@ -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',
|
||||
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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 () => {
|
||||
|
@@ -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`);
|
||||
@@ -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;
|
||||
}, {});
|
||||
|
||||
|
@@ -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 () => {
|
||||
|
Reference in New Issue
Block a user