[ACS-6066] viewer special permissions playwright (#3453)

* [ACS-5923] sidenav and singleclick test

* [ACS-5923] remove protractor test and fix flaky test

* [ACS-5923] test fix

* [ACS-5639] fix exclude test  in viewer

* [ACS-5923] remove exclude test and fix test

* [ACS-6066] viewer special permissions playwright test

* [ACS-6066] viewer protractor test remove

* [ACS-6066] viewer failed test fix

* [ACS-5923] review changes added

* [ACS-5923] fix error in script
This commit is contained in:
Akash Rathod
2023-10-05 12:19:57 +02:00
committed by GitHub
parent 4059a3d219
commit f2d09e8b1a
30 changed files with 1515 additions and 39 deletions

View File

@@ -23,7 +23,7 @@
*/
import { ApiClientFactory } from './api-client-factory';
import { FavoriteEntry } from '@alfresco/js-api';
import { FavoriteEntry, FavoritePaging } from '@alfresco/js-api';
import { Logger } from '@alfresco/adf-testing';
import { Utils } from '../utils';
@@ -38,7 +38,7 @@ export class FavoritesPageApi {
await classObj.apiService.setUpAcaBackend(userName, password);
return classObj;
}
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry | null> {
async addFavoriteById(nodeType: 'file' | 'folder' | 'site', id: string): Promise<FavoriteEntry> {
let guid = nodeType === 'site' ? (await this.apiService.sites.getSite(id)).entry.guid : id;
const data = {
target: {
@@ -50,25 +50,40 @@ export class FavoritesPageApi {
return await this.apiService.favorites.createFavorite('-me-', data);
}
private async getFavorites(username: string) {
async addFavoritesByIds(nodeType: 'file' | 'folder' | 'site', ids: string[]): Promise<FavoriteEntry[]> {
const favorites: FavoriteEntry[] = [];
try {
if (ids && ids.length > 0) {
for (const id of ids) {
const favorite = await this.addFavoriteById(nodeType, id);
favorites.push(favorite);
}
}
} catch (error) {
Logger.error(`FavoritesApi addFavoritesByIds : catch : `, error);
}
return favorites;
}
private async getFavorites(username: string): Promise<FavoritePaging> {
try {
return await this.apiService.favorites.listFavorites(username);
} catch (error) {
Logger.error(`FavoritesApi getFavorites : catch : `, error);
return null;
return new FavoritePaging;
}
}
async isFavorite(username: string, nodeId: string) {
async isFavorite(username: string, nodeId: string): Promise<boolean> {
try {
return JSON.stringify((await this.getFavorites(username)).list.entries).includes(nodeId);
} catch (error) {
Logger.error(`FavoritesApi isFavorite : catch : `, error);
return null;
return false;
}
}
async isFavoriteWithRetry(username: string, nodeId: string, data: { expect: boolean }) {
async isFavoriteWithRetry(username: string, nodeId: string, data: { expect: boolean }): Promise<boolean> {
let isFavorite = false;
try {
const favorite = async () => {
@@ -83,4 +98,30 @@ export class FavoritesPageApi {
} catch (error) {}
return isFavorite;
}
async getFavoritesTotalItems(username: string): Promise<number> {
try {
return (await this.apiService.favorites.listFavorites(username)).list.pagination.totalItems;
} catch (error) {
Logger.error(`FavoritesApi getFavoritesTotalItems : catch : `, error);
return -1;
}
}
async waitForApi(username: string, data: { expect: number }) {
try {
const favoriteFiles = async () => {
const totalItems = await this.getFavoritesTotalItems(username);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
return Promise.resolve(totalItems);
}
};
return await Utils.retryCall(favoriteFiles);
} catch (error) {
Logger.error(`FavoritesApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}
}

View File

@@ -26,7 +26,7 @@ import * as fs from 'fs';
import { ApiClientFactory } from './api-client-factory';
import { Utils } from '../utils';
import { ApiUtil, Logger } from '@alfresco/adf-testing';
import { NodeEntry } from '@alfresco/js-api';
import { NodeBodyCreate, NodeEntry, ResultSetPaging } from '@alfresco/js-api';
export class FileActionsApi {
private apiService: ApiClientFactory;
@@ -50,6 +50,27 @@ export class FileActionsApi {
});
}
async uploadFileWithRename(fileLocation: string, parentId: string = '-my-', newName: string, title: string = '', description: string = '') {
const file = fs.createReadStream(fileLocation);
const nodeProps = {
properties: {
'cm:title': title,
'cm:description': description
}
} as NodeBodyCreate;
const opts = {
name: newName,
nodeType: 'cm:content'
};
try {
return await this.apiService.upload.uploadFile(file, '', parentId, nodeProps, opts);
} catch (error) {
Logger.error(`${this.constructor.name} ${this.uploadFileWithRename.name}`, error);
}
}
async lockNodes(nodeIds: string[], lockType: string = 'ALLOW_OWNER_CHANGES') {
try {
for (const nodeId of nodeIds) {
@@ -111,7 +132,7 @@ export class FileActionsApi {
return isLocked;
}
private async queryNodesNames(searchTerm: string) {
private async queryNodesNames(searchTerm: string): Promise<ResultSetPaging> {
const data = {
query: {
query: `cm:name:\"${searchTerm}*\"`,
@@ -124,10 +145,11 @@ export class FileActionsApi {
return this.apiService.search.search(data);
} catch (error) {
Logger.error(`SearchApi queryNodesNames : catch : `, error);
return null;
return new ResultSetPaging;
}
}
async waitForNodes(searchTerm: string, data: { expect: number }) {
async waitForNodes(searchTerm: string, data: { expect: number }): Promise<void> {
const predicate = (totalItems: number) => totalItems === data.expect;
const apiCall = async () => {

View File

@@ -31,3 +31,4 @@ export * from './people-api-models';
export * from './nodes-api';
export * from './sites-api';
export * from './node-content-tree';
export * from './search-api';

View File

@@ -223,6 +223,27 @@ export class NodesApi {
}
}
async setGranularPermission(nodeId: string, inheritPermissions: boolean = false, username: string, role: string): Promise<NodeEntry | null> {
const data = {
permissions: {
isInheritanceEnabled: inheritPermissions,
locallySet: [
{
authorityId: username,
name: role
}
]
}
};
try {
return await this.apiService.nodes.updateNode(nodeId, data);
} catch (error) {
logger.error(`${this.constructor.name} ${this.setGranularPermission.name}`, error);
return null;
}
}
async removeUserAccessOnSpaceTemplate(nodeName: string): Promise<NodeEntry> {
try {
const templatesRootFolderId = await this.getSpaceTemplatesFolderId();
@@ -295,5 +316,4 @@ export class NodesApi {
return null;
}
}
}

View File

@@ -0,0 +1,84 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* 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 { ApiClientFactory } from './api-client-factory';
import { Logger } from '@alfresco/adf-testing';
import { Utils } from '../utils';
import { ResultSetPaging } from '@alfresco/js-api';
export class SearchPageApi {
private apiService: ApiClientFactory;
constructor() {
this.apiService = new ApiClientFactory();
}
static async initialize(userName: string, password?: string): Promise<SearchPageApi> {
const classObj = new SearchPageApi();
await classObj.apiService.setUpAcaBackend(userName, password);
return classObj;
}
private async querySearchFiles(username: string): Promise<ResultSetPaging> {
const data = {
query: {
query: '*',
language: 'afts'
},
filterQueries: [
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
{ query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"` }
]
};
try {
return this.apiService.search.search(data);
} catch (error) {
Logger.error(`SearchApi queryRecentFiles : catch : `, error);
return new ResultSetPaging;
}
}
async getTotalItems(username: string): Promise<number> {
return (await this.querySearchFiles(username)).list.pagination.totalItems;
}
async waitForApi(username: string, data: { expect: number }) {
try {
const searchFiles = async () => {
const totalItems = await this.getTotalItems(username);
if (totalItems !== data.expect) {
return Promise.reject(totalItems);
} else {
return Promise.resolve(totalItems);
}
};
return await Utils.retryCall(searchFiles);
} catch (error) {
Logger.error(`SearchApi waitForApi : catch : `);
Logger.error(`\tExpected: ${data.expect} items, but found ${error}`);
}
}
}

View File

@@ -22,8 +22,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { logger } from '@alfresco/adf-cli/scripts/logger';
import { ApiClientFactory } from './api-client-factory';
import { SharedLinkEntry } from '@alfresco/js-api';
import { SharedLinkEntry, SharedLinkPaging } from '@alfresco/js-api';
import { Utils } from '../utils';
export class SharedLinksApi {
private apiService: ApiClientFactory;
@@ -48,4 +50,50 @@ export class SharedLinksApi {
return null;
}
}
async shareFilesByIds(ids: string[]): Promise<SharedLinkEntry[]> {
const sharedLinks: SharedLinkEntry[] = [];
try {
if (ids && ids.length > 0) {
for (const id of ids) {
const sharedLink = await this.shareFileById(id);
sharedLinks.push(sharedLink);
}
}
} catch (error) {
logger.error(`SharedLinksApi shareFilesByIds : catch : `, error);
}
return sharedLinks;
}
private async getSharedLinks(maxItems: number = 250): Promise<SharedLinkPaging> {
try {
const opts = {
maxItems
};
return await this.apiService.share.listSharedLinks(opts);
} catch (error) {
logger.error(`SharedLinksApi getSharedLinks : catch : `, error);
return new SharedLinkPaging;
}
}
async waitForFilesToBeShared(filesIds: string[]): Promise<void> {
try {
const sharedFile = async () => {
const sharedFiles = (await this.getSharedLinks()).list.entries.map((link) => link.entry.nodeId);
const foundItems = filesIds.every((id) => sharedFiles.includes(id));
if (foundItems) {
return Promise.resolve(foundItems);
} else {
return Promise.reject(foundItems);
}
};
return Utils.retryCall(sharedFile);
} catch (error) {
logger.error(`SharedLinksApi waitForFilesToBeShared : catch : ${error}`);
logger.error(`\tWait timeout reached waiting for files to be shared`);
}
}
}

View File

@@ -23,7 +23,7 @@
*/
import { ApiClientFactory } from './api-client-factory';
import { Site, SiteBodyCreate, SiteEntry } from '@alfresco/js-api';
import { Site, SiteBodyCreate, SiteEntry, SiteMemberEntry, SiteMembershipBodyCreate, SiteMembershipBodyUpdate } from '@alfresco/js-api';
import { logger } from '@alfresco/adf-cli/scripts/logger';
export class SitesApi {
@@ -63,20 +63,51 @@ export class SitesApi {
}
}
/**
/**
* Delete multiple sites/libraries.
* @param siteIds The list of the site/library IDs to delete.
* @param permanent Delete permanently, without moving to the trashcan? (default: true)
*/
async deleteSites(siteIds: string[], permanent: boolean = true) {
try {
if (siteIds && siteIds.length > 0) {
for (const siteId of siteIds) {
await this.apiService.sites.deleteSite(siteId, { permanent });
}
}
} catch (error) {
logger.error(`${this.constructor.name} ${this.deleteSites.name}`, error);
async deleteSites(siteIds: string[], permanent: boolean = true) {
try {
if (siteIds && siteIds.length > 0) {
for (const siteId of siteIds) {
await this.apiService.sites.deleteSite(siteId, { permanent });
}
}
} catch (error) {
logger.error(`${this.constructor.name} ${this.deleteSites.name}`, error);
}
}
async updateSiteMember(siteId: string, userId: string, role: string): Promise<SiteMemberEntry> {
const siteRole = {
role: role
} as SiteMembershipBodyUpdate;
try {
return await this.apiService.sites.updateSiteMembership(siteId, userId, siteRole);
} catch (error) {
logger.error(`SitesApi updateSiteMember : catch : `, error);
return new SiteMemberEntry;
}
}
async addSiteMember(siteId: string, userId: string, role: string): Promise<SiteMemberEntry> {
const memberBody = {
id: userId,
role: role
} as SiteMembershipBodyCreate;
try {
return await this.apiService.sites.createSiteMembership(siteId, memberBody);
} catch (error) {
if (error.status === 409) {
return this.updateSiteMember(siteId, userId, role);
} else {
logger.error(`SitesApi addSiteMember : catch : `, error);
return new SiteMemberEntry;
}
}
}
}

View File

@@ -29,3 +29,4 @@ export * from './page-objects';
export * from './fixtures/page-initialization';
export * from './utils';
export * from './resources/test-files';
export * from './resources/test-data';

View File

@@ -24,6 +24,7 @@
import { Page } from '@playwright/test';
import { BaseComponent } from '../base.component';
import { expect } from '@playwright/test';
export class MatMenuComponent extends BaseComponent {
private static rootElement = '.mat-menu-content';
@@ -51,4 +52,18 @@ export class MatMenuComponent extends BaseComponent {
await menuElement.waitFor({ state: 'attached' });
return await menuElement.isVisible();
}
async verifyActualMoreActions(expectedToolbarMore: string[]): Promise<void> {
await this.page.locator('.mat-menu-content').waitFor({ state: 'attached' });
let menus = await this.page.$$('.mat-menu-content .mat-menu-item');
let actualMoreActions: string[] = await Promise.all(
menus.map(async (button) => {
const title = await (await button.$('span')).innerText();
return title || '';
})
);
for (const action of expectedToolbarMore) {
expect(actualMoreActions.includes(action), `Expected to contain ${action} ${actualMoreActions}`).toBe(true);
}
}
}

View File

@@ -44,7 +44,7 @@ export class SearchInputComponent extends BaseComponent {
}
async performDoubleClickFolderOrFileToOpen(name: string): Promise<void> {
await this.getCellLinkByName(name).waitFor({ state: 'visible', timeout: timeouts.normal });
await this.getCellLinkByName(name).waitFor({ state: 'visible', timeout: timeouts.medium });
await this.getCellLinkByName(name).dblclick();
await this.spinnerWaitForReload();
}

View File

@@ -26,6 +26,7 @@ import { Page } from '@playwright/test';
import { BaseComponent } from './base.component';
import { AcaHeader } from './aca-header.component';
import { timeouts } from '../../utils';
import { expect } from '@playwright/test';
export class ViewerComponent extends BaseComponent {
private static rootElement = 'adf-viewer';
@@ -35,6 +36,7 @@ export class ViewerComponent extends BaseComponent {
public fileTitleButtonLocator = this.getChild('.adf-viewer__file-title');
public pdfViewerContentPages = this.getChild('.adf-pdf-viewer__content .page');
public shareButton = this.getChild('button[id="share-action-button"]');
public allButtons = this.getChild('button');
toolbar = new AcaHeader(this.page);
@@ -70,4 +72,23 @@ export class ViewerComponent extends BaseComponent {
await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
return await this.closeButtonLocator.getAttribute('title');
}
async verifyViewerPrimaryActions(expectedToolbarPrimary: string[]): Promise<void> {
const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
const removeClosePreviousNextOldInfo = (actions: string[]): string[] => actions.filter((elem) => !toRemove.includes(elem));
let buttons = await this.page.$$('adf-viewer button');
let actualPrimaryActions: string[] = await Promise.all(
buttons.map(async (button) => {
const title = await button.getAttribute('title');
return title || '';
})
);
actualPrimaryActions = removeClosePreviousNextOldInfo(actualPrimaryActions);
for (const action of expectedToolbarPrimary) {
expect(actualPrimaryActions.includes(action), `Expected to contain ${action}`).toBe(true);
}
}
}

View File

@@ -0,0 +1,25 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
export * from './test-data-permissions';

View File

@@ -0,0 +1,385 @@
/*!
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* Alfresco Example Content Application
*
* 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
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { Utils } from '@alfresco/playwright-shared';
export const random = Utils.random();
// ----- files -----
const consumerContextMenu = ['Share', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions'];
const consumerFavContextMenu = ['Share', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions'];
const consumerSharedContextMenu = ['Shared Link Settings', 'Download', 'View', 'Favorite', 'Copy', 'Manage Versions'];
const consumerSharedFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Remove Favorite', 'Copy', 'Manage Versions'];
const consumerToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
const consumerSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const searchConsumerToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
const searchConsumerSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
const consumerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
const consumerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
// ---- VIEWER ----
const consumerViewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
const consumerViewerToolbarPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions'];
const consumerViewerFavToolbarMore = ['Remove Favorite', 'Copy', 'Manage Versions'];
const consumerViewerToolbarMore = ['Favorite', 'Copy', 'Manage Versions'];
// ---- FAVORITES workarounds ----
const favoritesConsumerToolbarMore = ['Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions'];
const favoritesConsumerContextMenu = [
'Share',
'Download',
'View',
'Upload New Version',
'Remove Favorite',
'Move',
'Copy',
'Delete',
'Manage Versions'
];
const favoritesConsumerSharedContextMenu = [
'Shared Link Settings',
'Download',
'View',
'Upload New Version',
'Remove Favorite',
'Move',
'Copy',
'Delete',
'Manage Versions'
];
// ---- SHARED FILES workaround ----
const sharedConsumerToolbarMore = ['Upload New Version', 'Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerFavToolbarMore = ['Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerLockedContextMenu = [
'Shared Link Settings',
'Download',
'View',
'Cancel Editing',
'Upload New Version',
'Favorite',
'Copy',
'Manage Versions'
];
const sharedConsumerFavContextMenu = ['Shared Link Settings', 'Download', 'View', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions'];
const sharedConsumerFavLockedContextMenu = [
'Shared Link Settings',
'Download',
'View',
'Cancel Editing',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions'
];
export const fileDocx = {
name: `file-${random}-docx.docx`,
description: 'file not shared, not fav, office, not locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileDocxFav = {
name: `file-${random}-docx-fav.docx`,
description: 'file not shared, fav, office, not locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const file = {
name: `file-${random}.txt`,
description: 'file not shared, not fav, not office, not locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileFav = {
name: `file-${random}-fav.txt`,
description: 'file not shared, fav, not office, not locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileDocxShared = {
name: `file-${random}-docx-shared.docx`,
description: 'file shared, not fav, office, not locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerToolbarMore,
sharedContextMenu: sharedConsumerContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileDocxSharedFav = {
name: `file-${random}-docx-shared-fav.docx`,
description: 'file shared, fav, office, not locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
sharedToolbarMore: sharedConsumerFavToolbarMore,
sharedContextMenu: sharedConsumerFavContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileShared = {
name: `file-${random}-shared.txt`,
description: 'file shared, not fav, not office, not locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerToolbarMore,
sharedContextMenu: sharedConsumerContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileSharedFav = {
name: `file-${random}-shared-fav.txt`,
description: 'file shared, fav, not office, not locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
sharedToolbarMore: sharedConsumerFavToolbarMore,
sharedContextMenu: sharedConsumerFavContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileLocked = {
name: `file-${random}-locked.txt`,
description: 'file not shared, not fav, not office, locked',
contextMenu: consumerContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileFavLocked = {
name: `file-${random}-fav-locked.txt`,
description: 'file not shared, fav, not office, locked',
contextMenu: consumerFavContextMenu,
toolbarPrimary: consumerToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerContextMenu,
searchToolbarPrimary: searchConsumerToolbarPrimary
};
export const fileSharedLocked = {
name: `file-${random}-shared-locked.txt`,
description: 'file shared, not fav, not office, locked',
contextMenu: consumerSharedContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerToolbarMore,
sharedToolbarMore: sharedConsumerLockedToolbarMore,
sharedContextMenu: sharedConsumerLockedContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileSharedFavLocked = {
name: `file-${random}-shared-fav-locked.txt`,
description: 'file shared, fav, not office, locked',
contextMenu: consumerSharedFavContextMenu,
toolbarPrimary: consumerSharedToolbarPrimary,
toolbarMore: consumerFavToolbarMore,
viewerToolbarPrimary: consumerViewerSharedToolbarPrimary,
viewerToolbarMore: consumerViewerFavToolbarMore,
favoritesToolbarMore: favoritesConsumerToolbarMore,
favoritesContextMenu: favoritesConsumerSharedContextMenu,
sharedToolbarMore: sharedConsumerFavLockedToolbarMore,
sharedContextMenu: sharedConsumerFavLockedContextMenu,
searchToolbarPrimary: searchConsumerSharedToolbarPrimary
};
export const fileGranularPermission = `file-${random}-granular.txt`;
export const fileLockedByUser = `file-${random}-my-locked.txt`;
// ---- folders ---
const consumerFolderContextMenu = ['Download', 'Favorite', 'Copy'];
const consumerFolderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const consumerFolderToolbarMore = ['Favorite', 'Copy'];
const searchConsumerFolderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const consumerFolderFavContextMenu = ['Download', 'Remove Favorite', 'Copy'];
const consumerFolderFavToolbarMore = ['Remove Favorite', 'Copy'];
// ---- FAVORITES workarounds ----
const favoritesConsumerFolderContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
const favoritesConsumerFolderToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
export const folder = {
name: `folder-${random}`,
description: 'folder not favorite',
contextMenu: consumerFolderContextMenu,
toolbarPrimary: consumerFolderToolbarPrimary,
toolbarMore: consumerFolderToolbarMore,
searchToolbarPrimary: searchConsumerFolderToolbarPrimary
};
export const folderFav = {
name: `folder-fav-${random}`,
description: 'folder favorite',
contextMenu: consumerFolderFavContextMenu,
toolbarPrimary: consumerFolderToolbarPrimary,
toolbarMore: consumerFolderFavToolbarMore,
favoritesContextMenu: favoritesConsumerFolderContextMenu,
favoritesToolbarMore: favoritesConsumerFolderToolbarMore,
searchToolbarPrimary: searchConsumerFolderToolbarPrimary
};
export const folderFav2 = {
name: `folder-fav-2-${random}`,
description: 'folder 2 favorite'
};
// ---- multiple selection ---
const multipleSelContextMenu = ['Download', 'Favorite', 'Copy'];
const multipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Copy'];
const multipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const multipleSelToolbarMore = ['Favorite', 'Copy'];
const multipleSelAllFavToolbarMore = ['Remove Favorite', 'Copy'];
const searchMultipleSelToolbarPrimary = ['Download', 'View Details', 'More Actions'];
// ---- FAVORITES workarounds ----
const favoritesMultipleSelContextMenu = ['Download', 'Favorite', 'Move', 'Copy', 'Delete'];
const favoritesMultipleSelToolbarMore = ['Favorite', 'Move', 'Copy', 'Delete'];
const favoritesMultipleSelAllFavContextMenu = ['Download', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
const favoritesMultipleSelAllFavToolbarMore = ['Remove Favorite', 'Move', 'Copy', 'Delete'];
export const multipleSel = {
contextMenu: multipleSelContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelToolbarMore,
favoritesContextMenu: favoritesMultipleSelContextMenu,
favoritesToolbarMore: favoritesMultipleSelToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary
};
export const multipleSelAllFav = {
contextMenu: multipleSelAllFavContextMenu,
toolbarPrimary: multipleSelToolbarPrimary,
toolbarMore: multipleSelAllFavToolbarMore,
favoritesContextMenu: favoritesMultipleSelAllFavContextMenu,
favoritesToolbarMore: favoritesMultipleSelAllFavToolbarMore,
searchToolbarPrimary: searchMultipleSelToolbarPrimary
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1 @@
<EFBFBD><EFBFBD>

View File

@@ -30,11 +30,21 @@ export const TEST_FILES = {
name: 'file-docx',
data: 'Lorem ipsum dolor sit amet'
},
DOCX2: {
path: resolve(__dirname, 'file2-docx.docx'),
name: 'file-docx',
data: 'Lorem ipsum dolor sit amet'
},
PDF: {
path: resolve(__dirname, 'file-pdf.pdf'),
name: 'file-pdf',
data: 'Lorem ipsum dolor sit amet'
},
FILE_UNSUPPORTED: {
path: resolve(__dirname, 'file_unsupported.3DS'),
name: 'file-3DS',
data: 'Lorem ipsum dolor sit amet'
},
PDF_PROTECTED: {
path: resolve(__dirname, 'file-pdf-protected.pdf'),
name: 'file-pdf-protected',
@@ -45,5 +55,20 @@ export const TEST_FILES = {
path: resolve(__dirname, 'file-xlsx.xlsx'),
name: 'file-xlsx',
data: 'Lorem ipsum dolor sit amet'
},
XLSX2: {
path: resolve(__dirname, 'file2-xlsx.xlsx'),
name: 'file-xlsx',
data: 'Lorem ipsum dolor sit amet'
},
JPG_FILE: {
path: resolve(__dirname, 'file-jpg.jpg'),
name: 'file-jpg'
},
PDF_PROTECTED2: {
path: resolve(__dirname, 'protected.pdf'),
name: 'file-protected',
data: 'Lorem ipsum dolor sit amet',
password: '0000'
}
};