Prettier upgrade and e2e type checks (#1522)

* upgrade prettier

* noImplicitAny rule

* fix type

* update tsconfig

* upgrade to 150 print width
This commit is contained in:
Denys Vuika
2020-07-14 10:03:23 +01:00
committed by GitHub
parent 32793ea7b0
commit ddc6f36ab4
339 changed files with 5170 additions and 8763 deletions

View File

@@ -23,30 +23,24 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
LoginPage,
BrowsingPage,
EXTENSIBILITY_CONFIGS,
RepoClient,
Utils
} from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, EXTENSIBILITY_CONFIGS, RepoClient, Utils } from '@alfresco/aca-testing-shared';
describe('Extensions - Context submenu', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
let fileId: string;
const folder = `folder-${Utils.random()}`;
let folderId;
let folderId: string;
const restrictedPermissionsItem = 'Share';
const menuItem1 = {
label: 'Test Menu1',
submenu: [ 'Test submenu1', 'Test submenu2', restrictedPermissionsItem ]
submenu: ['Test submenu1', 'Test submenu2', restrictedPermissionsItem]
};
const menuItem2 = {
label: 'Test Menu2',
submenu: [ restrictedPermissionsItem ]
submenu: [restrictedPermissionsItem]
};
const apis = {
@@ -56,11 +50,11 @@ describe('Extensions - Context submenu', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const {dataTable} = page;
const { dataTable } = page;
const contextMenu = dataTable.menu;
beforeAll(async (done) => {
await apis.admin.people.createUser({username});
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(file)).entry.id;
folderId = (await apis.user.nodes.createFolder(folder)).entry.id;
@@ -104,7 +98,10 @@ describe('Extensions - Context submenu', () => {
expect(await contextMenu.getSubmenuItemsCount()).toBe(2, 'submenu has wrong number of items');
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[0])).toBe(true, `${menuItem1.submenu[0]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[1])).toBe(true, `${menuItem1.submenu[1]} is not displayed for ${file}`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[2])).toBe(false, `no permission submenu ${restrictedPermissionsItem} is displayed`);
expect(await contextMenu.isSubMenuItemPresent(menuItem1.submenu[2])).toBe(
false,
`no permission submenu ${restrictedPermissionsItem} is displayed`
);
});
it('[C287784] The parent item is not displayed if all its children have no permission to be displayed', async () => {

View File

@@ -23,18 +23,12 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
BrowsingPage,
LoginPage,
RepoClient,
EXTENSIBILITY_CONFIGS,
Utils
} from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, RepoClient, EXTENSIBILITY_CONFIGS, Utils } from '@alfresco/aca-testing-shared';
describe('Extensions - DocumentList presets', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
let fileId: string;
const testData = [
{
@@ -76,7 +70,7 @@ describe('Extensions - DocumentList presets', () => {
done();
});
beforeEach(async done => {
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
done();
});
@@ -87,16 +81,14 @@ describe('Extensions - DocumentList presets', () => {
});
it('[C286700] Sets the columns to display', async () => {
const expectedColumns = testData
.filter(item => !item.disabled)
.map(data => data.label);
const expectedColumns = testData.filter((item) => !item.disabled).map((data) => data.label);
const actualColumns = await dataTable.getColumnHeadersText();
expect(actualColumns).toEqual(expectedColumns);
});
it('[C286699] Disabled items are not shown', async () => {
const noColumnLabel = testData.find(item => item.disabled).label;
const noColumnLabel = testData.find((item) => item.disabled).label;
const element = dataTable.getColumnHeaderByLabel(noColumnLabel);
expect(await element.isPresent()).toBe(false, `"${noColumnLabel}" is displayed`);

View File

@@ -23,65 +23,57 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
LoginPage,
RepoClient,
EXTENSIBILITY_CONFIGS,
Utils,
Header,
Menu
} from '@alfresco/aca-testing-shared';
import { LoginPage, RepoClient, EXTENSIBILITY_CONFIGS, Utils, Header, Menu } from '@alfresco/aca-testing-shared';
describe('Extensions - Info Drawer', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const disabledMenu = {
id: 'settings',
title: 'App settings',
description: 'Application settings',
icon: 'settings'
};
const disabledMenu = {
id: 'settings',
title: 'App settings',
description: 'Application settings',
icon: 'settings'
};
const enabledMenu = {
id: 'button',
title: 'New Button',
description: 'new button description',
icon: 'alarm_on'
};
const enabledMenu = {
id: 'button',
title: 'New Button',
description: 'new button description',
icon: 'alarm_on'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const header = new Header();
const toolbarMenu = new Menu();
const header = new Header();
const toolbarMenu = new Menu();
const loginPage = new LoginPage();
const loginPage = new LoginPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.HEADER);
await loginPage.loginWith(username);
done();
});
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.HEADER);
await loginPage.loginWith(username);
done();
});
afterEach(async (done) => {
await header.closeMoreMenu();
done();
});
afterEach(async (done) => {
await header.closeMoreMenu();
done();
});
it('[C286474] Add a new button in the header', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(enabledMenu.title)).toBe(true, 'menu item not present');
expect(await toolbarMenu.getItemIconText(enabledMenu.title)).toEqual(enabledMenu.icon);
});
it('[C286477] Disable a button from the header', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(disabledMenu.title)).toBe(true, `${disabledMenu.title} menu item not present`);
expect(await toolbarMenu.isMenuItemDisabled(disabledMenu.title)).toEqual('true', `${disabledMenu.title} is not disabled`);
});
it('[C286474] Add a new button in the header', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(enabledMenu.title)).toBe(true, 'menu item not present');
expect(await toolbarMenu.getItemIconText(enabledMenu.title)).toEqual(enabledMenu.icon);
});
it('[C286477] Disable a button from the header', async () => {
await header.openMoreMenu();
expect(await toolbarMenu.isMenuItemPresent(disabledMenu.title)).toBe(true, `${disabledMenu.title} menu item not present`);
expect(await toolbarMenu.isMenuItemDisabled(disabledMenu.title)).toEqual('true', `${disabledMenu.title} is not disabled`);
});
});

View File

@@ -23,140 +23,133 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
LoginPage, BrowsingPage,
InfoDrawer,
RepoClient,
EXTENSIBILITY_CONFIGS,
Utils
} from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, InfoDrawer, RepoClient, EXTENSIBILITY_CONFIGS, Utils } from '@alfresco/aca-testing-shared';
describe('Extensions - Info Drawer', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
const file = `file-${Utils.random()}.txt`;
let fileId: string;
const properties_tab = {
order: 1,
title: 'MY PROPERTIES'
};
const properties_tab = {
order: 1,
title: 'MY PROPERTIES'
};
const custom_tab = {
order: 2,
icon: 'mood',
title: 'MY CUSTOM TITLE',
component: 'app.toolbar.toggleFavorite'
};
const custom_tab = {
order: 2,
icon: 'mood',
title: 'MY CUSTOM TITLE',
component: 'app.toolbar.toggleFavorite'
};
const no_title_tab = {
order: 3,
icon: 'check_circle',
title: ''
};
const no_title_tab = {
order: 3,
icon: 'check_circle',
title: ''
};
const comments_tab = {
title: 'COMMENTS'
};
const comments_tab = {
title: 'COMMENTS'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const infoDrawer = new InfoDrawer();
const loginPage = new LoginPage();
const page = new BrowsingPage();
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(file)).entry.id;
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId);
done();
});
describe('', () => {
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createFile(file)).entry.id;
done();
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId);
done();
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await page.dataTable.clearSelection();
done();
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER);
await loginPage.loginWith(username);
done();
});
it('[C284646] Add a new tab with icon and title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
await page.dataTable.clearSelection();
done();
});
it('[C284646] Add a new tab with icon and title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
const val = await infoDrawer.getTabTitle(custom_tab.order);
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`);
expect(val.trim()).toEqual(`${custom_tab.icon}\n${custom_tab.title}`.trim());
});
it('[C284647] Remove existing tab', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
});
it('[C284648] Change tab title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(properties_tab.order)).toEqual(properties_tab.title);
});
it('[C284649] Tab with icon and no title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`);
expect((await infoDrawer.getTabTitle(no_title_tab.order)).trim()).toEqual(`${no_title_tab.icon}`.trim());
});
it('[C284651] Insert new component in tab', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`);
await infoDrawer.clickTab(custom_tab.title);
expect(await infoDrawer.getComponentIdOfTab()).toEqual(custom_tab.component);
});
const val = await infoDrawer.getTabTitle(custom_tab.order);
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`);
expect(val.trim()).toEqual(`${custom_tab.icon}\n${custom_tab.title}`.trim());
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER_EMPTY);
await loginPage.loginWith(username);
await page.clickPersonalFilesAndWait();
done();
});
it('[C284647] Remove existing tab', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
it('[C284650] Remove all tabs', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
});
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
});
it('[C284648] Change tab title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(properties_tab.title)).toBe(true, `${properties_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(properties_tab.order)).toEqual(properties_tab.title);
});
it('[C284649] Tab with icon and no title', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(no_title_tab.title)).toBe(true, `${no_title_tab.title} tab is not present`);
expect((await infoDrawer.getTabTitle(no_title_tab.order)).trim()).toEqual(`${no_title_tab.icon}`.trim());
});
it('[C284651] Insert new component in tab', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabDisplayed(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not displayed`);
await infoDrawer.clickTab(custom_tab.title);
expect(await infoDrawer.getComponentIdOfTab()).toEqual(custom_tab.component);
});
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER_EMPTY);
await loginPage.loginWith(username);
await page.clickPersonalFilesAndWait();
done();
});
it('[C284650] Remove all tabs', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.viewDetailsButton.click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
});
});
});

View File

@@ -23,22 +23,14 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
BrowsingPage,
LoginPage,
RepoClient,
EXTENSIBILITY_CONFIGS,
Utils,
InfoDrawer,
MetadataCard
} from '@alfresco/aca-testing-shared';
import { BrowsingPage, LoginPage, RepoClient, EXTENSIBILITY_CONFIGS, Utils, InfoDrawer, MetadataCard } from '@alfresco/aca-testing-shared';
describe('Extensions - Metadata presets', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.png`;
let fileId;
let fileId: string;
const properties_tab = {
title: 'Properties',
@@ -71,7 +63,7 @@ describe('Extensions - Metadata presets', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
beforeAll(async done => {
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
fileId = (await apis.user.nodes.createImage(file)).entry.id;
@@ -82,7 +74,7 @@ describe('Extensions - Metadata presets', () => {
done();
});
beforeEach(async done => {
beforeEach(async (done) => {
await page.refresh();
await page.dataTable.selectItem(file);
@@ -96,7 +88,7 @@ describe('Extensions - Metadata presets', () => {
done();
});
afterAll(async done => {
afterAll(async (done) => {
await apis.user.nodes.deleteNodeById(fileId);
done();
});

View File

@@ -23,155 +23,147 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import {
LoginPage,
BrowsingPage,
Viewer,
RepoClient,
EXTENSIBILITY_CONFIGS,
FILES,
Utils
} from '@alfresco/aca-testing-shared';
import { LoginPage, BrowsingPage, Viewer, RepoClient, EXTENSIBILITY_CONFIGS, FILES, Utils } from '@alfresco/aca-testing-shared';
describe('Extensions - Viewer', () => {
const username = `user-${Utils.random()}`;
const username = `user-${Utils.random()}`;
const pdfFile = {
file_name: FILES.pdfFile,
component: 'app.components.tabs.metadata'
};
let pdfFileId;
const pdfFile = {
file_name: FILES.pdfFile,
component: 'app.components.tabs.metadata'
};
let pdfFileId: string;
const docxFile = {
file_name: FILES.docxFile,
component: 'app.components.tabs.comments'
};
let docxFileId;
const docxFile = {
file_name: FILES.docxFile,
component: 'app.components.tabs.comments'
};
let docxFileId: string;
const customAction = {
id: 'app.viewer.my-action',
title: 'My action',
icon: 'http'
};
const customAction = {
id: 'app.viewer.my-action',
title: 'My action',
icon: 'http'
};
const customSecondaryAction = {
id: 'app.viewer.my-secondary-action',
title: 'My secondary action',
icon: 'alarm'
};
const customSecondaryAction = {
id: 'app.viewer.my-secondary-action',
title: 'My secondary action',
icon: 'alarm'
};
const downloadButton = {
id: 'app.viewer.download',
title: 'My custom title'
};
const downloadButton = {
id: 'app.viewer.download',
title: 'My custom title'
};
const moveAction = {
id: 'app.viewer.move',
title: 'My new title'
}
const moveAction = {
id: 'app.viewer.move',
title: 'My new title'
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const loginPage = new LoginPage();
const page = new BrowsingPage();
const loginPage = new LoginPage();
const page = new BrowsingPage();
const viewer = new Viewer();
const { toolbar } = viewer;
const viewer = new Viewer();
const { toolbar } = viewer;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
pdfFileId = (await apis.user.upload.uploadFile(pdfFile.file_name)).entry.id;
docxFileId = (await apis.user.upload.uploadFile(docxFile.file_name)).entry.id;
beforeAll(async (done) => {
await apis.admin.people.createUser({ username });
pdfFileId = (await apis.user.upload.uploadFile(pdfFile.file_name)).entry.id;
docxFileId = (await apis.user.upload.uploadFile(docxFile.file_name)).entry.id;
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.VIEWER);
await loginPage.loginWith(username);
done();
await loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.VIEWER);
await loginPage.loginWith(username);
done();
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodesById([pdfFileId, docxFileId]);
done();
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
done();
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
});
describe('content', () => {
it('[C284659] Insert new component in a content viewer', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component);
await viewer.closeButton.click();
await page.dataTable.doubleClickOnRowByName(docxFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(docxFile.component);
});
});
describe('toolbar actions', () => {
it('[C286416] Add a new action in the toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isButtonPresent(customAction.title)).toBe(true, 'Custom action is not present');
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getAttribute('id')).toEqual(customAction.id);
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getText()).toEqual(customAction.icon);
});
afterAll(async (done) => {
await apis.user.nodes.deleteNodesById([ pdfFileId, docxFileId ]);
done();
it('[C286417] Modify title of action from toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.getButtonById(downloadButton.id).getAttribute('title')).toEqual(downloadButton.title);
});
beforeEach(async (done) => {
await page.clickPersonalFilesAndWait();
done();
it('[C286419] Remove action from toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isPrintPresent()).toBe(false, 'Print button is still displayed');
});
});
describe('toolbar More actions menu', () => {
it('[C286420] Add a new action', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent(customSecondaryAction.title)).toBe(true, 'action is not present');
expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon);
expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id);
});
afterEach(async (done) => {
await Utils.pressEscape();
done();
it('[C286421] Modify title of action from More actions menu', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemById(moveAction.id).getAttribute('title')).toEqual(moveAction.title);
});
describe('content', () => {
it('[C284659] Insert new component in a content viewer', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(pdfFile.component);
await viewer.closeButton.click();
it('[C286423] Remove action from More actions menu', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await page.dataTable.doubleClickOnRowByName(docxFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isCustomContentPresent()).toBe(true, 'Custom content is not present');
expect(await viewer.getComponentIdOfView()).toEqual(docxFile.component);
});
});
describe('toolbar actions', () => {
it('[C286416] Add a new action in the toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isButtonPresent(customAction.title)).toBe(true, 'Custom action is not present');
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getAttribute('id')).toEqual(customAction.id);
expect(await toolbar.getButtonByTitleAttribute(customAction.title).getText()).toEqual(customAction.icon);
});
it('[C286417] Modify title of action from toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.getButtonById(downloadButton.id).getAttribute('title')).toEqual(downloadButton.title);
});
it('[C286419] Remove action from toolbar', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await toolbar.isPrintPresent()).toBe(false, 'Print button is still displayed');
});
});
describe('toolbar More actions menu', () => {
it('[C286420] Add a new action', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.isMenuItemPresent(customSecondaryAction.title)).toBe(true, 'action is not present');
expect(await toolbar.menu.getItemIconText(customSecondaryAction.title)).toEqual(customSecondaryAction.icon);
expect(await toolbar.menu.getItemIdAttribute(customSecondaryAction.title)).toEqual(customSecondaryAction.id);
});
it('[C286421] Modify title of action from More actions menu', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.getItemById(moveAction.id).getAttribute('title')).toEqual(moveAction.title);
});
it('[C286423] Remove action from More actions menu', async () => {
await page.dataTable.doubleClickOnRowByName(pdfFile.file_name);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
await toolbar.openMoreMenu();
expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed');
});
await toolbar.openMoreMenu();
expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed');
});
});
});