This commit is contained in:
Denys Vuika
2023-02-28 22:42:13 +00:00
committed by Sheena Malhotra
parent 738d93f5d1
commit 12e9e2a221
3 changed files with 1 additions and 43 deletions

View File

@@ -47,20 +47,6 @@ describe('Sidebar', () => {
expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Default active link'); expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Default active link');
}); });
it('[C217150] File Libraries has correct sub-categories', async () => {
await page.clickFileLibraries();
expect(await sidenav.isFileLibrariesMenuExpanded()).toBe(true, 'File Libraries not expanded');
expect(await sidenav.getLink(SIDEBAR_LABELS.MY_LIBRARIES).isPresent()).toBe(true, 'My Libraries link not present');
expect(await sidenav.getLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES).isPresent()).toBe(true, 'Favorite Libraries link not present');
});
it('[C289900] Favorite Libraries is automatically selected on expanding File Libraries', async () => {
await sidenav.expandFileLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES);
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries is not active');
expect(await sidenav.isActive(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toBe(true, 'Favorite Libraries link not active');
});
it('[C289902] navigate to Favorite Libraries', async () => { it('[C289902] navigate to Favorite Libraries', async () => {
await page.goToFavoriteLibraries(); await page.goToFavoriteLibraries();
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES); expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES);

View File

@@ -25,7 +25,7 @@
import { ElementFinder, by, element, browser } from 'protractor'; import { ElementFinder, by, element, browser } from 'protractor';
import { Logger, BrowserActions } from '@alfresco/adf-testing'; import { Logger, BrowserActions } from '@alfresco/adf-testing';
import { SIDEBAR_LABELS, BROWSER_WAIT_TIMEOUT } from '../../configs'; import { BROWSER_WAIT_TIMEOUT } from '../../configs';
import { Menu } from '../menu/menu'; import { Menu } from '../menu/menu';
import { Component } from '../component'; import { Component } from '../component';
@@ -48,20 +48,6 @@ export class Sidenav extends Component {
super('app-sidenav', ancestor); super('app-sidenav', ancestor);
} }
private async expandMenu(name: string): Promise<void> {
try {
if (await element(by.cssContainingText('.mat-expanded', name)).isPresent()) {
return Promise.resolve();
} else {
const link = this.getLink(name);
await BrowserActions.click(link);
await element(by.css('.mat-expansion-panel-body')).isPresent();
}
} catch (e) {
Logger.error(`---- sidebar navigation catch expandMenu: failed to expand ${name} menu : `, e);
}
}
async openNewMenu(): Promise<void> { async openNewMenu(): Promise<void> {
await BrowserActions.click(this.newButton.first()); await BrowserActions.click(this.newButton.first());
await this.menu.waitForMenuToOpen(); await this.menu.waitForMenuToOpen();
@@ -147,12 +133,4 @@ export class Sidenav extends Component {
Logger.error(`---- clickLink catch : sidebar navigation failed to click on - ${name} : `, error); Logger.error(`---- clickLink catch : sidebar navigation failed to click on - ${name} : `, error);
} }
} }
async isFileLibrariesMenuExpanded(): Promise<boolean> {
return element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent();
}
async expandFileLibraries(): Promise<void> {
await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
}
} }

View File

@@ -54,9 +54,6 @@ export class BrowsingPage extends Page {
} }
async goToFavoriteLibraries(): Promise<void> { async goToFavoriteLibraries(): Promise<void> {
if (!(await this.sidenav.isFileLibrariesMenuExpanded())) {
await this.sidenav.expandFileLibraries();
}
await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES); await this.sidenav.clickLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES);
} }
@@ -66,9 +63,6 @@ export class BrowsingPage extends Page {
} }
async goToMyLibraries(): Promise<void> { async goToMyLibraries(): Promise<void> {
if (!(await this.sidenav.isFileLibrariesMenuExpanded())) {
await this.sidenav.expandFileLibraries();
}
await this.sidenav.clickLink(SIDEBAR_LABELS.MY_LIBRARIES); await this.sidenav.clickLink(SIDEBAR_LABELS.MY_LIBRARIES);
} }