mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-1946] automate tests for Favourite Libraries list (#803)
* automate part of the Favourite Libraries tests refactor File Libraries tests to include My Libraries * rephrasing * forgotten changes * fix tests
This commit is contained in:
parent
dcacbc1210
commit
ca67da3657
@ -36,6 +36,7 @@ export class Sidenav extends Component {
|
||||
label: '.item--label',
|
||||
expansion_panel: ".mat-expansion-panel-header",
|
||||
expansion_panel_content: ".mat-expansion-panel-body",
|
||||
active: 'item--active',
|
||||
activeLink: '.item--active',
|
||||
newButton: '[data-automation-id="create-button"]'
|
||||
};
|
||||
@ -50,6 +51,23 @@ export class Sidenav extends Component {
|
||||
super(Sidenav.selectors.root, ancestor);
|
||||
}
|
||||
|
||||
private async expandMenu(name: string) {
|
||||
try{
|
||||
|
||||
if (await element(by.cssContainingText('.mat-expanded', name)).isPresent()) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
const link = this.getLink(name);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
async openNewMenu() {
|
||||
const { menu, newButton } = this;
|
||||
|
||||
@ -67,38 +85,40 @@ export class Sidenav extends Component {
|
||||
await this.menu.clickMenuItem('Create Library');
|
||||
}
|
||||
|
||||
async isActiveByLabel(label: string) {
|
||||
const className = await this.getLinkByLabel(label).getAttribute('class');
|
||||
return className.includes(Sidenav.selectors.activeLink.replace('.', ''));
|
||||
async isActive(name: string) {
|
||||
const className = await this.getLinkLabel(name).getAttribute('class');
|
||||
return className.includes(Sidenav.selectors.active);
|
||||
}
|
||||
|
||||
async childIsActiveByLabel(label: string) {
|
||||
const labelElement = await this.getLinkByLabel(label).element(by.css('span'));
|
||||
return (await labelElement.getAttribute('class'))
|
||||
.includes(Sidenav.selectors.activeLink.replace('.', ''));
|
||||
async childIsActive(name: string) {
|
||||
const childClass = await this.getLinkLabel(name).element(by.css('span')).getAttribute('class');
|
||||
return childClass.includes(Sidenav.selectors.active);
|
||||
}
|
||||
|
||||
getLink(label: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.link, label));
|
||||
getLink(name: string) {
|
||||
return this.getLinkLabel(name).element(by.xpath('..'));
|
||||
}
|
||||
|
||||
getLinkByLabel(label: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.label, label));
|
||||
// return browser.element(by.xpath(`.//*[.="${label}" and class="${Sidenav.selectors.label}"]`))
|
||||
getLinkLabel(name: string) {
|
||||
return this.component.element(by.cssContainingText(Sidenav.selectors.label, name));
|
||||
}
|
||||
|
||||
async getLinkTooltip(label: string) {
|
||||
return await this.getLink(label).getAttribute('title');
|
||||
getActiveLink() {
|
||||
return this.activeLink;
|
||||
}
|
||||
|
||||
async navigateToLinkByLabel(label: string) {
|
||||
async getLinkTooltip(name: string) {
|
||||
return await this.getLink(name).getAttribute('title');
|
||||
}
|
||||
|
||||
async navigateToLink(name: string) {
|
||||
try{
|
||||
const link = this.getLinkByLabel(label);
|
||||
const link = this.getLinkLabel(name);
|
||||
await Utils.waitUntilElementClickable(link);
|
||||
return await link.click();
|
||||
|
||||
} catch (e){
|
||||
console.log('---- sidebar navigation catch navigateToLinkByLabel: ', e);
|
||||
console.log('---- sidebar navigation catch navigateToLink: ', e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,21 +126,8 @@ export class Sidenav extends Component {
|
||||
return await element(by.cssContainingText('.mat-expanded', SIDEBAR_LABELS.FILE_LIBRARIES)).isPresent();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
async expandFileLibraries() {
|
||||
return await this.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ export const E2E_ROOT_PATH = __dirname;
|
||||
export const APP_ROUTES = {
|
||||
FAVORITES: '/favorites',
|
||||
MY_LIBRARIES: '/libraries',
|
||||
FAVORITE_LIBRARIES: '/favorite/libraries',
|
||||
LOGIN: '/login',
|
||||
LOGOUT: '/logout',
|
||||
PERSONAL_FILES: '/personal-files',
|
||||
@ -70,7 +71,8 @@ export const SIDEBAR_LABELS = {
|
||||
export const PAGE_TITLES = {
|
||||
VIEWER: 'Preview',
|
||||
SEARCH: 'Search Results',
|
||||
MY_LIBRARIES: 'File Libraries'
|
||||
MY_LIBRARIES: 'My Libraries',
|
||||
FAVORITE_LIBRARIES: 'Favorite Libraries'
|
||||
};
|
||||
|
||||
// Site visibility
|
||||
@ -82,10 +84,22 @@ export const SITE_VISIBILITY = {
|
||||
|
||||
// Site roles
|
||||
export const SITE_ROLES = {
|
||||
SITE_CONSUMER: 'SiteConsumer',
|
||||
SITE_COLLABORATOR: 'SiteCollaborator',
|
||||
SITE_CONTRIBUTOR: 'SiteContributor',
|
||||
SITE_MANAGER: 'SiteManager'
|
||||
SITE_CONSUMER: {
|
||||
ROLE: 'SiteConsumer',
|
||||
LABEL: 'Consumer'
|
||||
},
|
||||
SITE_COLLABORATOR: {
|
||||
ROLE: 'SiteCollaborator',
|
||||
LABEL: 'Collaborator'
|
||||
},
|
||||
SITE_CONTRIBUTOR: {
|
||||
ROLE: 'SiteContributor',
|
||||
LABEL: 'Contributor'
|
||||
},
|
||||
SITE_MANAGER: {
|
||||
ROLE: 'SiteManager',
|
||||
LABEL: 'Manager'
|
||||
}
|
||||
};
|
||||
|
||||
export const FILES = {
|
||||
|
@ -43,75 +43,75 @@ export class BrowsingPage extends Page {
|
||||
// helper methods
|
||||
|
||||
async clickPersonalFilesAndWait() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickPersonalFiles() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
}
|
||||
|
||||
|
||||
async clickFileLibrariesAndWait() {
|
||||
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
await this.sidenav.expandFileLibraries();
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickFileLibraries() {
|
||||
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
await this.sidenav.expandFileLibraries();
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
}
|
||||
|
||||
async clickFavoriteLibraries() {
|
||||
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITE_LIBRARIES);
|
||||
async goToFavoriteLibraries() {
|
||||
await this.sidenav.expandFileLibraries();
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITE_LIBRARIES);
|
||||
}
|
||||
|
||||
async clickMyLibraries() {
|
||||
async goToMyLibraries() {
|
||||
if ( !(await this.sidenav.isFileLibrariesMenuExpanded()) ) {
|
||||
await this.sidenav.expandMenu(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||
await this.sidenav.expandFileLibraries();
|
||||
}
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.MY_LIBRARIES);
|
||||
}
|
||||
|
||||
async clickRecentFilesAndWait() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.RECENT_FILES);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickRecentFiles() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.RECENT_FILES);
|
||||
}
|
||||
|
||||
|
||||
async clickSharedFilesAndWait() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.SHARED_FILES);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickSharedFiles() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.SHARED_FILES);
|
||||
}
|
||||
|
||||
|
||||
async clickFavoritesAndWait() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITES);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickFavorites() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.FAVORITES);
|
||||
}
|
||||
|
||||
|
||||
async clickTrashAndWait() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.TRASH);
|
||||
await this.dataTable.waitForHeader();
|
||||
}
|
||||
|
||||
async clickTrash() {
|
||||
await this.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
|
||||
await this.sidenav.navigateToLink(SIDEBAR_LABELS.TRASH);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ describe('Context menu actions - single selection : ', () => {
|
||||
it('Context menu closes when clicking away from it - [C280619]', async () => {
|
||||
await dataTable.rightClickOnItem(fileUser);
|
||||
expect(await dataTable.hasContextMenu()).toBe(true, 'Context menu is not displayed');
|
||||
await page.sidenav.activeLink.click();
|
||||
await page.sidenav.getActiveLink().click();
|
||||
expect(await dataTable.hasContextMenu()).toBe(false, 'Context menu is displayed');
|
||||
});
|
||||
|
||||
|
@ -59,7 +59,7 @@ describe('Create folder', () => {
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
|
||||
const docLibId = (await apis.admin.sites.getDocLibId(siteName));
|
||||
await apis.admin.nodes.createFolder(folderName1, docLibId);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||
await apis.user.nodes.createFolder(duplicateFolderName, parentId);
|
||||
await loginPage.loginWith(username);
|
||||
|
@ -61,7 +61,7 @@ describe('Edit folder', () => {
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PRIVATE);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(siteName);
|
||||
await apis.admin.nodes.createFolder(folderName, docLibId);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
|
||||
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||
await apis.user.nodes.createFolder(folderName, parentId, '', folderDescription);
|
||||
|
@ -123,7 +123,7 @@ describe('Restore from Trash', () => {
|
||||
await toolbar.getButtonByTitleAttribute('Restore').click();
|
||||
await page.clickSnackBarAction();
|
||||
await page.dataTable.waitForHeader();
|
||||
expect(await page.sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
|
||||
expect(await page.sidenav.isActive('Personal Files')).toBe(true, 'Personal Files sidebar link not active');
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
|
||||
await apis.user.nodes.deleteNodeById(fileId, false);
|
||||
|
@ -77,10 +77,10 @@ describe('Granular permissions available actions : ', () => {
|
||||
|
||||
docxFileId = (await apis.admin.upload.uploadFile(docxFile, docLibId)).entry.id;
|
||||
|
||||
await apis.admin.sites.addSiteMember(siteName, userManager, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(siteName, userManager, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
await apis.admin.sites.addSiteMember(siteName, userConsumer, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
|
||||
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.admin.nodes.setGranularPermission(file3Id, false, userConsumer, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
|
||||
await apis.userConsumer.shared.shareFileById(file1Id);
|
||||
await apis.userConsumer.shared.shareFileById(file2Id);
|
||||
|
@ -90,10 +90,28 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
xit('');
|
||||
|
||||
describe('General tests', () => {
|
||||
it('actions are displayed for top level of File Libraries - [C213135]', async () => {
|
||||
await page.clickFileLibrariesAndWait();
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await dataTable.clearSelection();
|
||||
done();
|
||||
});
|
||||
|
||||
it('Correct actions appear when a library is selected - My Libraries - [C213135]', async () => {
|
||||
await page.goToMyLibraries();
|
||||
await dataTable.selectItem(siteName);
|
||||
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
|
||||
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${siteName}`);
|
||||
await toolbar.openMoreMenu();
|
||||
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${siteName}`);
|
||||
});
|
||||
|
||||
it('Correct actions appear when a library is selected - Favorite Libraries - [C289892]', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
await dataTable.selectItem(siteName);
|
||||
expect(await toolbar.isEmpty()).toBe(false, 'toolbar not displayed');
|
||||
expect(await toolbar.isButtonPresent('View details')).toBe(true, `View details is not displayed for ${siteName}`);
|
||||
await toolbar.openMoreMenu();
|
||||
expect(await toolbar.menu.isMenuItemPresent('Delete')).toBe(true, `Delete is not displayed for ${siteName}`);
|
||||
});
|
||||
|
||||
it('selected row is marked with a check circle icon - [C213134]', async () => {
|
||||
@ -103,7 +121,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Personal Files', () => {
|
||||
describe('on Personal Files', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickPersonalFilesAndWait();
|
||||
@ -144,7 +162,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('File Libraries', () => {
|
||||
describe('on File Libraries', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickFileLibrariesAndWait();
|
||||
@ -187,7 +205,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Shared Files', () => {
|
||||
describe('on Shared Files', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickSharedFilesAndWait();
|
||||
@ -215,7 +233,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Recent Files', () => {
|
||||
describe('on Recent Files', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickRecentFilesAndWait();
|
||||
@ -242,7 +260,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Favorites', () => {
|
||||
describe('on Favorites', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickFavoritesAndWait();
|
||||
@ -283,7 +301,7 @@ describe('Toolbar actions - single selection : ', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Trash', () => {
|
||||
describe('on Trash', () => {
|
||||
beforeEach(async (done) => {
|
||||
await Utils.pressEscape();
|
||||
await page.clickTrashAndWait();
|
||||
|
@ -711,7 +711,7 @@ describe('Unshare a file', () => {
|
||||
file1Id = (await apis.admin.nodes.createFile(file1, docLibId)).entry.id;
|
||||
file2Id = (await apis.admin.nodes.createFile(file2, docLibId)).entry.id;
|
||||
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
|
||||
await apis.admin.shared.shareFileById(file1Id);
|
||||
await apis.user.shared.shareFileById(file2Id);
|
||||
|
@ -76,44 +76,45 @@ describe('Page titles', () => {
|
||||
it('Personal Files page - [C217157]', async () => {
|
||||
const label = SIDEBAR_LABELS.PERSONAL_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
await page.sidenav.navigateToLink(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('File Libraries page - [C217158]', async () => {
|
||||
const parent = SIDEBAR_LABELS.FILE_LIBRARIES;
|
||||
const label = SIDEBAR_LABELS.MY_LIBRARIES;
|
||||
|
||||
await page.sidenav.expandMenu(parent);
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
it('My Libraries page - [C217158]', async () => {
|
||||
await page.goToMyLibraries();
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.MY_LIBRARIES);
|
||||
});
|
||||
|
||||
it('Favorite Libraries page - [C289907]', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.FAVORITE_LIBRARIES);
|
||||
});
|
||||
|
||||
it('Shared Files page - [C217159]', async () => {
|
||||
const label = SIDEBAR_LABELS.SHARED_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
await page.sidenav.navigateToLink(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Recent Files page - [C217160]', async () => {
|
||||
const label = SIDEBAR_LABELS.RECENT_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
await page.sidenav.navigateToLink(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Favorites page - [C217161]', async () => {
|
||||
const label = SIDEBAR_LABELS.FAVORITES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
await page.sidenav.navigateToLink(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Trash page - [C217162]', async () => {
|
||||
const label = SIDEBAR_LABELS.TRASH;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
await page.sidenav.navigateToLink(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
|
@ -75,8 +75,8 @@ describe('Library properties', () => {
|
||||
await apis.user.sites.createSite(siteForUpdate.name, siteForUpdate.visibility, siteForUpdate.description, siteForUpdate.id);
|
||||
await apis.user.sites.createSite(siteDup);
|
||||
|
||||
await apis.user.sites.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR);
|
||||
await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.user.sites.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
done();
|
||||
@ -250,7 +250,7 @@ describe('Library properties', () => {
|
||||
await infoDrawer.waitForInfoDrawerToOpen();
|
||||
await infoDrawer.clickButton('Edit');
|
||||
|
||||
await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
|
||||
await infoDrawer.enterDescription('new description');
|
||||
await infoDrawer.clickButton('Update');
|
||||
|
@ -52,13 +52,20 @@ describe('Empty list views', () => {
|
||||
expect(await dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
|
||||
});
|
||||
|
||||
it('empty File Libraries - [C217099]', async () => {
|
||||
await page.clickFileLibraries();
|
||||
it('empty My Libraries - [C217099]', async () => {
|
||||
await page.goToMyLibraries();
|
||||
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
|
||||
expect(await dataTable.getEmptyStateSubtitle()).toContain('Join libraries to upload, view, and share files.');
|
||||
});
|
||||
|
||||
it('empty Favorite Libraries - [C289911]', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
expect(await dataTable.getEmptyStateTitle()).toContain(`No Favorite Libraries`);
|
||||
expect(await dataTable.getEmptyStateSubtitle()).toContain('Favorite a library that you want to find easily later.');
|
||||
});
|
||||
|
||||
it('empty Shared Files - [C280132]', async () => {
|
||||
await page.clickSharedFiles();
|
||||
expect(await dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||
|
@ -53,7 +53,7 @@ describe('Favorites', () => {
|
||||
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(siteName);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
|
||||
const file1Id = (await apis.admin.nodes.createFile(fileName1, docLibId)).entry.id;
|
||||
const folderId = (await apis.user.nodes.createFolder(favFolderName)).entry.id;
|
||||
@ -135,7 +135,7 @@ describe('Favorites', () => {
|
||||
|
||||
it('Location column redirect - file in site - [C280485]', async () => {
|
||||
await dataTable.clickItemLocation(fileName1);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]);
|
||||
});
|
||||
|
||||
it('Navigate into folder from Favorites - [C213230]', async () => {
|
||||
|
@ -32,13 +32,21 @@ describe('File Libraries', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const password = username;
|
||||
|
||||
const sitePrivate = `private-${Utils.random()}`;
|
||||
const siteModerated = `moderated-${Utils.random()}`;
|
||||
const sitePublic = `public-${Utils.random()}`;
|
||||
const userSitePrivate = `user-private-${Utils.random()}`;
|
||||
const userSiteModerated = `user-moderated-${Utils.random()}`;
|
||||
const userSitePublic = `user-public-${Utils.random()}`;
|
||||
|
||||
const siteName = `siteName-${Utils.random()}`;
|
||||
|
||||
const siteId1 = Utils.random();
|
||||
const siteId2 = Utils.random();
|
||||
const adminSite = `admin-${Utils.random()}`;
|
||||
|
||||
const adminSite1 = `admin1-${Utils.random()}`;
|
||||
const adminSite2 = `admin2-${Utils.random()}`;
|
||||
const adminSite3 = `admin3-${Utils.random()}`;
|
||||
const adminSite4 = `admin4-${Utils.random()}`;
|
||||
const adminSite5 = `admin5-${Utils.random()}`;
|
||||
const adminSite6 = `admin6-${Utils.random()}`;
|
||||
|
||||
const siteDescription = 'my site description';
|
||||
|
||||
@ -53,86 +61,214 @@ describe('File Libraries', () => {
|
||||
|
||||
beforeAll(async (done) => {
|
||||
await apis.admin.people.createUser({ username });
|
||||
await apis.admin.sites.createSite(sitePublic, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(siteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
|
||||
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE, null);
|
||||
await apis.admin.sites.createSite(adminSite, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
|
||||
await apis.admin.sites.addSiteMember(sitePublic, username, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(siteModerated, username, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_CONTRIBUTOR);
|
||||
await apis.admin.sites.addSiteMember(siteId1, username, SITE_ROLES.SITE_CONTRIBUTOR);
|
||||
await apis.admin.sites.addSiteMember(siteId2, username, SITE_ROLES.SITE_CONTRIBUTOR);
|
||||
|
||||
await apis.user.sites.createSite(userSitePublic, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.user.sites.createSite(userSiteModerated, SITE_VISIBILITY.MODERATED, siteDescription);
|
||||
await apis.user.sites.createSite(userSitePrivate, SITE_VISIBILITY.PRIVATE, null);
|
||||
|
||||
await apis.admin.sites.createSite(adminSite1, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(adminSite2, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(adminSite3, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(adminSite4, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(adminSite5, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.createSite(adminSite6, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.addSiteMember(adminSite1, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
await apis.admin.sites.addSiteMember(adminSite2, username, SITE_ROLES.SITE_CONTRIBUTOR.ROLE);
|
||||
await apis.admin.sites.addSiteMember(adminSite3, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
await apis.admin.sites.addSiteMember(adminSite4, username, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
await apis.admin.sites.addSiteMember(adminSite6, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
|
||||
await apis.user.favorites.addFavoriteById('site', adminSite1);
|
||||
await apis.user.favorites.addFavoriteById('site', adminSite2);
|
||||
await apis.user.favorites.addFavoriteById('site', adminSite3);
|
||||
await apis.user.favorites.addFavoriteById('site', adminSite4);
|
||||
|
||||
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId1);
|
||||
await apis.user.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC, null, siteId2);
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
done();
|
||||
});
|
||||
|
||||
beforeEach(async (done) => {
|
||||
await page.clickFileLibrariesAndWait();
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await apis.admin.sites.deleteSites([ sitePublic, siteModerated, sitePrivate, adminSite, siteId1, siteId2 ]);
|
||||
await apis.user.sites.deleteSites([ userSitePublic, userSiteModerated, userSitePrivate, siteId1, siteId2 ]);
|
||||
await apis.admin.sites.deleteSites([ adminSite1, adminSite2, adminSite3, adminSite4, adminSite5, adminSite6 ]);
|
||||
done();
|
||||
});
|
||||
|
||||
it('has the correct columns - [C217095]', async () => {
|
||||
const labels = [ 'Name', 'My Role', 'Visibility' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
xit('');
|
||||
|
||||
expect(await dataTable.getColumnHeaders().count()).toBe(3 + 1, 'Incorrect number of columns');
|
||||
describe('My Libraries', () => {
|
||||
beforeEach(async (done) => {
|
||||
await page.goToMyLibraries();
|
||||
done();
|
||||
});
|
||||
|
||||
await elements.forEach(async (element, index) => {
|
||||
expect(await element.isPresent()).toBe(true, `"${labels[index]}" is missing`);
|
||||
it('has the correct columns - [C217095]', async () => {
|
||||
const labels = [ 'Name', 'My Role', 'Visibility' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
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`);
|
||||
});
|
||||
});
|
||||
|
||||
it('User can see only the sites he is a member of - [C280501]', async () => {
|
||||
const sitesCount = await dataTable.countRows();
|
||||
|
||||
expect(sitesCount).toEqual(10, 'Incorrect number of sites displayed');
|
||||
expect(await dataTable.getRowByName(adminSite5).isPresent()).toBe(false, `${adminSite5} should not appear in the list`);
|
||||
});
|
||||
|
||||
it('Library visibility is correctly displayed - [C289905]', async () => {
|
||||
const expectedSitesVisibility = {
|
||||
[userSitePrivate]: SITE_VISIBILITY.PRIVATE,
|
||||
[userSiteModerated]: SITE_VISIBILITY.MODERATED,
|
||||
[userSitePublic]: SITE_VISIBILITY.PUBLIC
|
||||
};
|
||||
|
||||
const rowCells = await dataTable.getRows().map((row) => {
|
||||
return row.all(dataTable.cell).map(async cell => await cell.getText());
|
||||
});
|
||||
const sitesList = rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[3].toUpperCase();
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Object.keys(expectedSitesVisibility).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
|
||||
});
|
||||
});
|
||||
|
||||
it('User role is correctly displayed - [C289903]', async () => {
|
||||
const expectedSitesRoles = {
|
||||
[adminSite1]: SITE_ROLES.SITE_CONSUMER.LABEL,
|
||||
[adminSite2]: SITE_ROLES.SITE_CONTRIBUTOR.LABEL,
|
||||
[adminSite3]: SITE_ROLES.SITE_COLLABORATOR.LABEL,
|
||||
[adminSite4]: SITE_ROLES.SITE_MANAGER.LABEL
|
||||
};
|
||||
|
||||
const rowCells = await dataTable.getRows().map((row) => {
|
||||
return row.all(dataTable.cell).map(async cell => await cell.getText());
|
||||
});
|
||||
const sitesList = rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Object.keys(expectedSitesRoles).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
|
||||
});
|
||||
});
|
||||
|
||||
it('Site ID is displayed when two sites have the same name - [C217098]', async () => {
|
||||
const expectedSites = [
|
||||
`${siteName} (${siteId1})`,
|
||||
`${siteName} (${siteId2})`
|
||||
];
|
||||
const cells = await dataTable.getCellsContainingName(siteName);
|
||||
const expectedJSON = JSON.stringify(expectedSites.sort());
|
||||
const actualJSON = JSON.stringify(cells.sort());
|
||||
expect(actualJSON).toEqual(expectedJSON);
|
||||
});
|
||||
|
||||
it('Tooltip for sites without description - [C217096]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(userSitePrivate);
|
||||
expect(tooltip).toBe(`${userSitePrivate}`);
|
||||
});
|
||||
|
||||
it('Tooltip for sites with description - [C217097]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(userSiteModerated);
|
||||
expect(tooltip).toBe(`${siteDescription}`);
|
||||
});
|
||||
});
|
||||
|
||||
it('User can see only the sites he is a member of - [C280501]', async () => {
|
||||
const sitesCount = await dataTable.countRows();
|
||||
|
||||
const expectedSites = {
|
||||
[sitePrivate]: SITE_VISIBILITY.PRIVATE,
|
||||
[siteModerated]: SITE_VISIBILITY.MODERATED,
|
||||
[sitePublic]: SITE_VISIBILITY.PUBLIC
|
||||
};
|
||||
|
||||
expect(sitesCount).toEqual(5, 'Incorrect number of sites displayed');
|
||||
expect(await dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
|
||||
|
||||
const rowCells = await dataTable.getRows().map((row) => {
|
||||
return row.all(dataTable.cell).map(async cell => await cell.getText());
|
||||
describe('Favorite Libraries', () => {
|
||||
beforeEach(async (done) => {
|
||||
await page.goToFavoriteLibraries();
|
||||
done();
|
||||
});
|
||||
const sitesList = rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[3].toUpperCase();
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Object.keys(expectedSites).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSites[site]);
|
||||
it('has the correct columns - [C289893]', async () => {
|
||||
const labels = [ 'Name', 'My Role', 'Visibility' ];
|
||||
const elements = labels.map(label => dataTable.getColumnHeaderByLabel(label));
|
||||
|
||||
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`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Site ID is displayed when two sites have the same name - [C217098]', async () => {
|
||||
const expectedSites = [
|
||||
`${siteName} (${siteId1})`,
|
||||
`${siteName} (${siteId2})`
|
||||
];
|
||||
const cells = await dataTable.getCellsContainingName(siteName);
|
||||
const expectedJSON = JSON.stringify(expectedSites.sort());
|
||||
const actualJSON = JSON.stringify(cells.sort());
|
||||
expect(actualJSON).toEqual(expectedJSON);
|
||||
});
|
||||
it('User can see only his favorite sites - [C289897]', async () => {
|
||||
const sitesCount = await dataTable.countRows();
|
||||
|
||||
it('Tooltip for sites without description - [C217096]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(sitePrivate);
|
||||
expect(tooltip).toBe(`${sitePrivate}`);
|
||||
});
|
||||
expect(sitesCount).toEqual(9, 'Incorrect number of sites displayed');
|
||||
expect(await dataTable.getRowByName(adminSite6).isPresent()).toBe(false, `${adminSite6} should not appear`);
|
||||
});
|
||||
|
||||
it('Tooltip for sites with description - [C217097]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(siteModerated);
|
||||
expect(tooltip).toBe(`${siteDescription}`);
|
||||
it('Library visibility is correctly displayed - [C289906]', async () => {
|
||||
const expectedSitesVisibility = {
|
||||
[userSitePrivate]: SITE_VISIBILITY.PRIVATE,
|
||||
[userSiteModerated]: SITE_VISIBILITY.MODERATED,
|
||||
[userSitePublic]: SITE_VISIBILITY.PUBLIC
|
||||
};
|
||||
|
||||
const rowCells = await dataTable.getRows().map((row) => {
|
||||
return row.all(dataTable.cell).map(async cell => await cell.getText());
|
||||
});
|
||||
const sitesList = rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[3].toUpperCase();
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Object.keys(expectedSitesVisibility).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSitesVisibility[site]);
|
||||
});
|
||||
});
|
||||
|
||||
it('User role is correctly displayed - [C289904]', async () => {
|
||||
const expectedSitesRoles = {
|
||||
[adminSite1]: SITE_ROLES.SITE_CONSUMER.LABEL,
|
||||
[adminSite2]: SITE_ROLES.SITE_CONTRIBUTOR.LABEL,
|
||||
[adminSite3]: SITE_ROLES.SITE_COLLABORATOR.LABEL,
|
||||
[adminSite4]: SITE_ROLES.SITE_MANAGER.LABEL
|
||||
};
|
||||
|
||||
const rowCells = await dataTable.getRows().map((row) => {
|
||||
return row.all(dataTable.cell).map(async cell => await cell.getText());
|
||||
});
|
||||
const sitesList = rowCells.reduce((acc, cell) => {
|
||||
acc[cell[1]] = cell[2];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
Object.keys(expectedSitesRoles).forEach((site) => {
|
||||
expect(sitesList[site]).toEqual(expectedSitesRoles[site]);
|
||||
});
|
||||
});
|
||||
|
||||
it('Site ID is displayed when two sites have the same name - [C289896]', async () => {
|
||||
const expectedSites = [
|
||||
`${siteName} (${siteId1})`,
|
||||
`${siteName} (${siteId2})`
|
||||
];
|
||||
const cells = await dataTable.getCellsContainingName(siteName);
|
||||
const expectedJSON = JSON.stringify(expectedSites.sort());
|
||||
const actualJSON = JSON.stringify(cells.sort());
|
||||
expect(actualJSON).toEqual(expectedJSON);
|
||||
});
|
||||
|
||||
it('Tooltip for sites without description - [C289894]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(userSitePrivate);
|
||||
expect(tooltip).toBe(`${userSitePrivate}`);
|
||||
});
|
||||
|
||||
it('Tooltip for sites with description - [C289895]', async () => {
|
||||
const tooltip = await dataTable.getItemNameTooltip(userSiteModerated);
|
||||
expect(tooltip).toBe(`${siteDescription}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -55,7 +55,7 @@ describe('Special permissions', () => {
|
||||
|
||||
beforeAll(async (done) => {
|
||||
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
|
||||
fileId = (await apis.admin.nodes.createFile(fileName, docLibId)).entry.id;
|
||||
await apis.user.favorites.addFavoriteById('file', fileId);
|
||||
@ -70,7 +70,7 @@ describe('Special permissions', () => {
|
||||
});
|
||||
|
||||
afterEach(async (done) => {
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
done();
|
||||
});
|
||||
|
||||
@ -111,7 +111,7 @@ describe('Special permissions', () => {
|
||||
|
||||
beforeAll(async (done) => {
|
||||
await apis.admin.sites.createSite(sitePrivate, SITE_VISIBILITY.PRIVATE);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR);
|
||||
await apis.admin.sites.addSiteMember(sitePrivate, username, SITE_ROLES.SITE_COLLABORATOR.ROLE);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(sitePrivate);
|
||||
fileId = (await apis.user.nodes.createFile(fileName, docLibId)).entry.id;
|
||||
await apis.user.favorites.addFavoriteById('file', fileId);
|
||||
|
@ -79,8 +79,8 @@ describe('Personal Files', () => {
|
||||
});
|
||||
|
||||
it('has Data Dictionary and created content - [C213241]', async () => {
|
||||
expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
|
||||
expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
|
||||
expect(await dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true, 'Data Dictionary not displayed');
|
||||
expect(await dataTable.getRowByName(adminFolder).isPresent()).toBe(true, 'admin folder not displayed');
|
||||
});
|
||||
});
|
||||
|
||||
@ -111,7 +111,7 @@ describe('Personal Files', () => {
|
||||
});
|
||||
|
||||
it('has user created content - [C213242]', async () => {
|
||||
expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true);
|
||||
expect(await dataTable.getRowByName(userFolder).isPresent()).toBe(true, 'user folder not displayed');
|
||||
});
|
||||
|
||||
it('navigates to folder - [C213244]', async () => {
|
||||
|
@ -131,6 +131,6 @@ describe('Recent Files', () => {
|
||||
|
||||
it('Location column redirect - file in site - [C280487]', async () => {
|
||||
await dataTable.clickItemLocation(fileSite);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName, folderSite ]);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName, folderSite ]);
|
||||
});
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ describe('Shared Files', () => {
|
||||
beforeAll(async (done) => {
|
||||
await apis.admin.people.createUser({ username });
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_CONSUMER.ROLE);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(siteName);
|
||||
const nodeId = (await apis.admin.nodes.createFile(fileAdmin, docLibId)).entry.id;
|
||||
await apis.admin.shared.shareFileById(nodeId);
|
||||
@ -131,7 +131,7 @@ describe('Shared Files', () => {
|
||||
|
||||
it('Location column redirect - file in site - [C280491]', async () => {
|
||||
await dataTable.clickItemLocation(fileAdmin);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]);
|
||||
});
|
||||
|
||||
it('Location column displays a tooltip with the entire path of the file - [C213667]', async () => {
|
||||
|
@ -60,7 +60,7 @@ describe('Trash', () => {
|
||||
fileAdminId = (await apis.admin.nodes.createFiles([ fileAdmin ])).entry.id;
|
||||
folderAdminId = (await apis.admin.nodes.createFolders([ folderAdmin ])).entry.id;
|
||||
await apis.admin.sites.createSite(siteName, SITE_VISIBILITY.PUBLIC);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER);
|
||||
await apis.admin.sites.addSiteMember(siteName, username, SITE_ROLES.SITE_MANAGER.ROLE);
|
||||
const docLibId = await apis.admin.sites.getDocLibId(siteName);
|
||||
fileSiteId = (await apis.admin.nodes.createFile(fileSite, docLibId)).entry.id;
|
||||
fileUserId = (await apis.user.nodes.createFiles([ fileUser ])).entry.id;
|
||||
@ -186,7 +186,7 @@ describe('Trash', () => {
|
||||
|
||||
it('Location column redirect - file in site - [C280497]', async () => {
|
||||
await dataTable.clickItemLocation(fileSite);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'File Libraries', siteName ]);
|
||||
expect(await breadcrumb.getAllItems()).toEqual([ 'My Libraries', siteName ]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -90,13 +90,13 @@ describe('Breadcrumb', () => {
|
||||
});
|
||||
|
||||
it('My Libraries breadcrumb main node - [C260966]', async () => {
|
||||
await page.clickMyLibraries();
|
||||
await page.goToMyLibraries();
|
||||
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
|
||||
expect(await breadcrumb.getCurrentItemName()).toBe('My Libraries');
|
||||
});
|
||||
|
||||
it('Favorite Libraries breadcrumb main node - [C289891]', async () => {
|
||||
await page.clickFavoriteLibraries();
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await breadcrumb.getItemsCount()).toEqual(1, 'Breadcrumb has incorrect number of items');
|
||||
expect(await breadcrumb.getCurrentItemName()).toBe('Favorite Libraries');
|
||||
});
|
||||
@ -140,7 +140,7 @@ describe('Breadcrumb', () => {
|
||||
await page.dataTable.doubleClickOnRowByName(parent);
|
||||
await page.dataTable.doubleClickOnRowByName(subFolder1);
|
||||
await page.dataTable.doubleClickOnRowByName(subFolder2);
|
||||
const expectedItems = [ 'File Libraries', siteName, parent, subFolder1, subFolder2 ];
|
||||
const expectedItems = [ 'My Libraries', siteName, parent, subFolder1, subFolder2 ];
|
||||
expect(await breadcrumb.getAllItems()).toEqual(expectedItems);
|
||||
});
|
||||
|
||||
|
@ -40,77 +40,111 @@ describe('Sidebar', () => {
|
||||
|
||||
it('has "Personal Files" as default - [C217149]', async () => {
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
expect(await sidenav.isActiveByLabel('Personal Files')).toBe(true, 'Active link');
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Active link');
|
||||
});
|
||||
|
||||
it('navigates to "File Libraries" - [C217150]', async () => {
|
||||
it('File Libraries has correct sub-categories - [C217150]', 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('My Libraries is automatically selected on expanding File Libraries - [C289900]', async () => {
|
||||
await page.clickFileLibraries();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES);
|
||||
expect(await sidenav.childIsActiveByLabel(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active');
|
||||
expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active');
|
||||
});
|
||||
|
||||
it('navigate to Favorite Libraries - [C289902]', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITE_LIBRARIES);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active');
|
||||
expect(await sidenav.childIsActive(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toBe(true, 'Favorite Libraries link not active');
|
||||
});
|
||||
|
||||
it('navigate to My Libraries - [C289901]', async () => {
|
||||
await page.goToMyLibraries();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.MY_LIBRARIES);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.FILE_LIBRARIES)).toBe(true, 'File Libraries link not active');
|
||||
expect(await sidenav.childIsActive(SIDEBAR_LABELS.MY_LIBRARIES)).toBe(true, 'My Libraries link not active');
|
||||
});
|
||||
|
||||
it('navigates to "Personal Files" - [C280409]', async () => {
|
||||
await page.clickPersonalFiles();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.PERSONAL_FILES)).toBe(true, 'Personal Files link not active');
|
||||
});
|
||||
|
||||
it('navigates to "Shared Files" - [C213110]', async () => {
|
||||
await page.clickSharedFiles();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.SHARED_FILES);
|
||||
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.SHARED_FILES)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.SHARED_FILES)).toBe(true, 'Shared Files link not active');
|
||||
});
|
||||
|
||||
it('navigates to "Recent Files" - [C213166]', async () => {
|
||||
await page.clickRecentFiles();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.RECENT_FILES);
|
||||
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.RECENT_FILES)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.RECENT_FILES)).toBe(true, 'Recent Files link not active');
|
||||
});
|
||||
|
||||
it('navigates to "Favorites" - [C213225]', async () => {
|
||||
await page.clickFavorites();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.FAVORITES);
|
||||
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.FAVORITES)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.FAVORITES)).toBe(true, 'Favorites link not active');
|
||||
});
|
||||
|
||||
it('navigates to "Trash" - [C213216]', async () => {
|
||||
await page.clickTrash();
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.TRASHCAN);
|
||||
expect(await sidenav.isActiveByLabel(SIDEBAR_LABELS.TRASH)).toBe(true);
|
||||
expect(await sidenav.isActive(SIDEBAR_LABELS.TRASH)).toBe(true, 'Trash link not active');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('Personal Files tooltip - [C217151]', async () => {
|
||||
it('Personal Files tooltip - [C217151]', async () => {
|
||||
await page.clickPersonalFiles();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.PERSONAL_FILES)).toContain('View your Personal Files');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('File Libraries tooltip - [C217152]', async () => {
|
||||
it('File Libraries tooltip - [C217152]', async () => {
|
||||
await page.clickFileLibraries();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('Access File Libraries');
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FILE_LIBRARIES)).toContain('File Libraries');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('Shared Files tooltip - [C213111]', async () => {
|
||||
it('My Libraries tooltip - [C289916]', async () => {
|
||||
await page.goToMyLibraries();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.MY_LIBRARIES)).toContain('Access my libraries');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
it('Favorite Libraries tooltip - [C289917]', async () => {
|
||||
await page.goToFavoriteLibraries();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITE_LIBRARIES)).toContain('Access my favorite libraries');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
it('Shared Files tooltip - [C213111]', async () => {
|
||||
await page.clickSharedFiles();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.SHARED_FILES)).toContain('View files that have been shared');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('Recent Files tooltip - [C213167]', async () => {
|
||||
it('Recent Files tooltip - [C213167]', async () => {
|
||||
await page.clickRecentFiles();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.RECENT_FILES)).toContain('View files you recently edited');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('Favorites tooltip - [C217153]', async () => {
|
||||
it('Favorites tooltip - [C217153]', async () => {
|
||||
await page.clickFavorites();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.FAVORITES)).toContain('View your favorite files and folders');
|
||||
});
|
||||
|
||||
// TODO: incomplete test
|
||||
xit('Trash tooltip - [C217154]', async () => {
|
||||
it('Trash tooltip - [C217154]', async () => {
|
||||
await page.clickTrash();
|
||||
expect(await sidenav.getLinkTooltip(SIDEBAR_LABELS.TRASH)).toContain('View deleted files in the trash');
|
||||
});
|
||||
|
@ -45,19 +45,26 @@ export class FavoritesApi extends RepoApi {
|
||||
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
|
||||
}
|
||||
|
||||
async addFavoriteById(nodeType: 'file' | 'folder', id: string) {
|
||||
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string) {
|
||||
let guid;
|
||||
await this.apiAuth();
|
||||
|
||||
if ( nodeType === 'site' ) {
|
||||
guid = (await this.alfrescoJsApi.core.sitesApi.getSite(id)).entry.guid;
|
||||
} else {
|
||||
guid = id;
|
||||
}
|
||||
const data = {
|
||||
target: {
|
||||
[nodeType]: {
|
||||
guid: id
|
||||
guid: guid
|
||||
}
|
||||
}
|
||||
};
|
||||
await this.apiAuth();
|
||||
return await this.alfrescoJsApi.core.favoritesApi.addFavorite('-me-', data);
|
||||
}
|
||||
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder', ids: string[]) {
|
||||
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]) {
|
||||
await this.apiAuth();
|
||||
return await ids.reduce(async (previous, current) => {
|
||||
await previous;
|
||||
|
@ -44,7 +44,7 @@
|
||||
}
|
||||
},
|
||||
"LIBRARIES": {
|
||||
"TITLE": "File Libraries",
|
||||
"TITLE": "My Libraries",
|
||||
"DESCRIPTION": "Access File Libraries",
|
||||
"SIDENAV_LINK": {
|
||||
"LABEL": "File Libraries",
|
||||
@ -65,14 +65,14 @@
|
||||
"TITLE": "My Libraries",
|
||||
"SIDENAV_LINK": {
|
||||
"LABEL": "My Libraries",
|
||||
"TOOLTIP": "Access My Libraries"
|
||||
"TOOLTIP": "Access my libraries"
|
||||
}
|
||||
},
|
||||
"FAVORITE_LIBRARIES": {
|
||||
"TITLE": "Favorite Libraries",
|
||||
"SIDENAV_LINK": {
|
||||
"LABEL": "Favorite Libraries",
|
||||
"TOOLTIP": "Access Favorited Libraries"
|
||||
"TOOLTIP": "Access my favorite libraries"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user