mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACS-5343] refactor Playwright framework in ACA (#3261)
* [ACS-5343] refactor Playwright framework in ACA * Add the tests for Actions, from the Adam PR [ACS-5328] * Small fixes * Improve logs * [ACS-5343] adding-goThroughPages-and-delete * [ACS-5343] added git changes * [ACS-5343] added git changes for playwright * [ACS-5343] fix for e2e * [ACS-5343] e2e protractor path fix * remove import * [ACS-5343] e2e playwright user fix * [ACS-5343] e2e playwright user ids fix * [ACS-5343] e2e playwright users ids fix * changes for git * fix playwright test run * tsconfig path fix * playwright action yml added * retrigger checks * add test id from testrail * merge conflits * fix gha * fix credentials --------- Co-authored-by: adam.zakrzewski <adam.zakrzewski@hyland.com> Co-authored-by: akash.rathod@hyland.com <akash.rathod@hyland.com> Co-authored-by: Denys Vuika <denys.vuika@gmail.com>
This commit is contained in:
109
e2e/protractor/suites/extensions/ext-context-submenus.test.ts
Normal file
109
e2e/protractor/suites/extensions/ext-context-submenus.test.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/*!
|
||||
* 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 { AdminActions, LoginPage, BrowsingPage, EXTENSIBILITY_CONFIGS, RepoClient, Utils, UserActions } from '@alfresco/aca-testing-shared';
|
||||
|
||||
describe('Extensions - Context submenu', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
const file = `file-${Utils.random()}.txt`;
|
||||
let fileId: string;
|
||||
const folder = `folder-${Utils.random()}`;
|
||||
let folderId: string;
|
||||
|
||||
const restrictedPermissionsItem = 'Share';
|
||||
|
||||
const menuItem1 = {
|
||||
label: 'Test Menu1',
|
||||
submenu: ['Test submenu1', 'Test submenu2', restrictedPermissionsItem]
|
||||
};
|
||||
const menuItem2 = {
|
||||
label: 'Test Menu2',
|
||||
submenu: [restrictedPermissionsItem]
|
||||
};
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
const contextMenu = dataTable.menu;
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
await userActions.login(username, username);
|
||||
|
||||
fileId = await apis.user.createFile(file);
|
||||
folderId = await apis.user.createFolder(folder);
|
||||
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.CONTEXT_SUBMENUS);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await Utils.pressEscape();
|
||||
await dataTable.clearSelection();
|
||||
await page.clickPersonalFilesAndWait();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await userActions.deleteNodes([fileId, folderId]);
|
||||
});
|
||||
|
||||
it('[C286717] Displays the submenu actions set from config', async () => {
|
||||
await dataTable.rightClickOnItem(file);
|
||||
expect(await contextMenu.isMenuItemPresent(menuItem1.label)).toBe(true, `${menuItem1.label} is not displayed for ${file}`);
|
||||
expect(await contextMenu.hasSubMenu(menuItem1.label)).toBe(true, 'Menu does not have submenu');
|
||||
await contextMenu.mouseOverMenuItem(menuItem1.label);
|
||||
|
||||
expect(await contextMenu.getSubmenuItemsCount()).toBe(3, '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(true, `${restrictedPermissionsItem} is not displayed for ${file}`);
|
||||
});
|
||||
|
||||
it('[C286718] Does not display submenu actions without permissions', async () => {
|
||||
await dataTable.rightClickOnItem(folder);
|
||||
expect(await contextMenu.isMenuItemPresent(menuItem1.label)).toBe(true, `${menuItem1.label} is not displayed for ${folder}`);
|
||||
await contextMenu.mouseOverMenuItem(menuItem1.label);
|
||||
|
||||
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`
|
||||
);
|
||||
});
|
||||
|
||||
it('[C287784] The parent item is not displayed if all its children have no permission to be displayed', async () => {
|
||||
await dataTable.rightClickOnItem(folder);
|
||||
expect(await contextMenu.isMenuItemPresent(menuItem2.label)).toBe(false, `${menuItem2.label} menu is displayed for ${folder}`);
|
||||
});
|
||||
});
|
91
e2e/protractor/suites/extensions/ext-document-list.test.ts
Normal file
91
e2e/protractor/suites/extensions/ext-document-list.test.ts
Normal file
@@ -0,0 +1,91 @@
|
||||
/*!
|
||||
* 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 { AdminActions, 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: string;
|
||||
|
||||
const testData = [
|
||||
{
|
||||
id: 'app.files.name',
|
||||
label: 'Name'
|
||||
},
|
||||
{
|
||||
id: 'app.files.size',
|
||||
label: 'Size',
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
id: 'app.files.modifiedBy',
|
||||
label: 'Test header'
|
||||
},
|
||||
{
|
||||
id: 'some.id.createdBy',
|
||||
label: 'New column'
|
||||
}
|
||||
];
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
const { dataTable } = page;
|
||||
const adminApiActions = new AdminActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
fileId = (await apis.user.nodes.createFile(file)).entry.id;
|
||||
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.DOCUMENT_LIST_PRESETS);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.clickPersonalFilesAndWait();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await apis.user.nodes.deleteNodeById(fileId);
|
||||
});
|
||||
|
||||
it('[C286700] Sets the columns to display', async () => {
|
||||
const expectedColumns = testData.filter((item) => !item.disabled).map((data) => data.label);
|
||||
const actualColumns = await dataTable.getColumnHeadersText();
|
||||
|
||||
await expect(actualColumns).toEqual(expectedColumns);
|
||||
});
|
||||
|
||||
it('[C286699] Disabled items are not shown', async () => {
|
||||
const noColumnLabel = testData.find((item) => item.disabled).label;
|
||||
const element = dataTable.getColumnHeaderByLabel(noColumnLabel);
|
||||
|
||||
expect(await element.isPresent()).toBe(false, `"${noColumnLabel}" is displayed`);
|
||||
});
|
||||
});
|
72
e2e/protractor/suites/extensions/ext-header.test.ts
Executable file
72
e2e/protractor/suites/extensions/ext-header.test.ts
Executable file
@@ -0,0 +1,72 @@
|
||||
/*!
|
||||
* 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 { AdminActions, LoginPage, EXTENSIBILITY_CONFIGS, Utils, Header, Menu } from '@alfresco/aca-testing-shared';
|
||||
|
||||
describe('Extensions - Header', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
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 header = new Header();
|
||||
const toolbarMenu = new Menu();
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const adminApiActions = new AdminActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.HEADER);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await header.closeMoreMenu();
|
||||
});
|
||||
|
||||
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`);
|
||||
});
|
||||
});
|
163
e2e/protractor/suites/extensions/ext-info-drawer.test.ts
Executable file
163
e2e/protractor/suites/extensions/ext-info-drawer.test.ts
Executable file
@@ -0,0 +1,163 @@
|
||||
/*!
|
||||
* 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 {
|
||||
AdminActions,
|
||||
LoginPage,
|
||||
BrowsingPage,
|
||||
InfoDrawer,
|
||||
RepoClient,
|
||||
EXTENSIBILITY_CONFIGS,
|
||||
Utils,
|
||||
UserActions
|
||||
} from '@alfresco/aca-testing-shared';
|
||||
import { BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Extensions - Info Drawer', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const file = `file-${Utils.random()}.txt`;
|
||||
let fileId: string;
|
||||
|
||||
const PROPERTIES_TAB = {
|
||||
order: 1,
|
||||
title: 'MY PROPERTIES'
|
||||
};
|
||||
|
||||
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 COMMENTS_TAB = {
|
||||
title: 'COMMENTS'
|
||||
};
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const infoDrawer = new InfoDrawer();
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
await userActions.login(username, username);
|
||||
|
||||
fileId = await apis.user.createFile(file);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await userActions.deleteNodes([fileId]);
|
||||
});
|
||||
|
||||
describe('', () => {
|
||||
beforeAll(async () => {
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.clickPersonalFilesAndWait();
|
||||
await page.dataTable.clearSelection();
|
||||
});
|
||||
|
||||
it('[C284646] Add a new tab with icon and title ', async () => {
|
||||
await page.dataTable.selectItem(file);
|
||||
await BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
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 BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
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 BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
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 BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
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 BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
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 () => {
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER_EMPTY);
|
||||
await loginPage.loginWith(username);
|
||||
await page.clickPersonalFilesAndWait();
|
||||
});
|
||||
|
||||
it('[C284650] Remove all tabs', async () => {
|
||||
await page.dataTable.selectItem(file);
|
||||
await BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
await infoDrawer.waitForInfoDrawerToOpen();
|
||||
|
||||
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
|
||||
});
|
||||
});
|
||||
});
|
117
e2e/protractor/suites/extensions/ext-metadata.test.ts
Normal file
117
e2e/protractor/suites/extensions/ext-metadata.test.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
/*!
|
||||
* 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 {
|
||||
AdminActions,
|
||||
BrowsingPage,
|
||||
LoginPage,
|
||||
RepoClient,
|
||||
EXTENSIBILITY_CONFIGS,
|
||||
Utils,
|
||||
InfoDrawer,
|
||||
MetadataCard,
|
||||
UserActions
|
||||
} from '@alfresco/aca-testing-shared';
|
||||
import { BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Extensions - Metadata presets', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const file = `file-${Utils.random()}.png`;
|
||||
|
||||
let fileId: string;
|
||||
|
||||
const PROPERTIES_TAB = {
|
||||
title: 'Properties',
|
||||
component: 'app.components.tabs.metadata'
|
||||
};
|
||||
|
||||
const customGroup1 = {
|
||||
id: 'a.testGroup',
|
||||
title: 'A Test Group of Properties'
|
||||
};
|
||||
|
||||
const customGroup2 = {
|
||||
id: 'another.testGroup',
|
||||
title: 'Another Test Group of Properties'
|
||||
};
|
||||
|
||||
const disabledGroup = {
|
||||
id: 'disabled.testGroup',
|
||||
title: 'Hidden Group of Properties'
|
||||
};
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const infoDrawer = new InfoDrawer();
|
||||
const metadataCard = new MetadataCard();
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
const adminApiActions = new AdminActions();
|
||||
const userActions = new UserActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
await userActions.login(username, username);
|
||||
|
||||
fileId = (await apis.user.nodes.createImage(file)).entry.id;
|
||||
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.METADATA_PRESETS);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.refresh();
|
||||
|
||||
await page.dataTable.selectItem(file);
|
||||
await BrowserActions.click(page.toolbar.viewDetailsButton);
|
||||
await infoDrawer.waitForInfoDrawerToOpen();
|
||||
|
||||
await infoDrawer.clickTab(PROPERTIES_TAB.title);
|
||||
await BrowserActions.click(metadataCard.expandButton);
|
||||
await metadataCard.waitForFirstExpansionPanel();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await userActions.deleteNodes([fileId]);
|
||||
});
|
||||
|
||||
it('[C286636] Set groups of properties to display', async () => {
|
||||
expect(await metadataCard.isExpansionPanelPresent(0)).toBe(true, `expansion panel is not present`);
|
||||
expect(await metadataCard.getComponentIdOfPanel(0)).toEqual(`adf-metadata-group-${customGroup1.title}`);
|
||||
expect(await metadataCard.isExpansionPanelPresent(1)).toBe(true, `expansion panel is not present`);
|
||||
expect(await metadataCard.getComponentIdOfPanel(1)).toEqual(`adf-metadata-group-${customGroup2.title}`);
|
||||
});
|
||||
|
||||
it('[C286637] Disabled group is not displayed', async () => {
|
||||
expect(await metadataCard.isExpansionPanelPresent(2)).toBe(false, `disabled group is displayed`);
|
||||
expect(await metadataCard.getComponentIdOfPanel(1)).not.toEqual(`adf-metadata-group-${disabledGroup.title}`);
|
||||
expect(await metadataCard.getComponentIdOfPanel(0)).not.toEqual(`adf-metadata-group-${disabledGroup.title}`);
|
||||
});
|
||||
});
|
165
e2e/protractor/suites/extensions/ext-viewer.test.ts
Executable file
165
e2e/protractor/suites/extensions/ext-viewer.test.ts
Executable file
@@ -0,0 +1,165 @@
|
||||
/*!
|
||||
* 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 { AdminActions, LoginPage, BrowsingPage, Viewer, RepoClient, EXTENSIBILITY_CONFIGS, FILES, Utils } from '@alfresco/aca-testing-shared';
|
||||
import { BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
describe('Extensions - Viewer', () => {
|
||||
const username = `user-${Utils.random()}`;
|
||||
|
||||
const pdfFile = {
|
||||
fileName: FILES.pdfFile,
|
||||
component: 'app.components.tabs.metadata'
|
||||
};
|
||||
let pdfFileId: string;
|
||||
|
||||
const docxFile = {
|
||||
fileName: FILES.docxFile,
|
||||
component: 'app.components.tabs.comments'
|
||||
};
|
||||
let docxFileId: string;
|
||||
|
||||
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 downloadButton = {
|
||||
id: 'app.viewer.download',
|
||||
title: 'My custom title'
|
||||
};
|
||||
|
||||
const moveAction = {
|
||||
id: 'app.viewer.move',
|
||||
title: 'My new title'
|
||||
};
|
||||
|
||||
const apis = {
|
||||
user: new RepoClient(username, username)
|
||||
};
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const page = new BrowsingPage();
|
||||
|
||||
const viewer = new Viewer();
|
||||
const { toolbar } = viewer;
|
||||
const adminApiActions = new AdminActions();
|
||||
|
||||
beforeAll(async () => {
|
||||
await adminApiActions.createUser({ username });
|
||||
pdfFileId = (await apis.user.upload.uploadFile(pdfFile.fileName)).entry.id;
|
||||
docxFileId = (await apis.user.upload.uploadFile(docxFile.fileName)).entry.id;
|
||||
|
||||
await loginPage.load();
|
||||
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.VIEWER);
|
||||
await loginPage.loginWith(username);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await apis.user.nodes.deleteNodesById([pdfFileId, docxFileId]);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.clickPersonalFilesAndWait();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await Utils.pressEscape();
|
||||
});
|
||||
|
||||
describe('content', () => {
|
||||
it('[C284659] Insert new component in a content viewer', async () => {
|
||||
await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
|
||||
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 BrowserActions.click(viewer.closeButton);
|
||||
|
||||
await page.dataTable.doubleClickOnRowByName(docxFile.fileName);
|
||||
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.fileName);
|
||||
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 BrowserActions.getAttribute(toolbar.getButtonByTitleAttribute(customAction.title), '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.fileName);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
|
||||
expect(await BrowserActions.getAttribute(toolbar.getButtonById(downloadButton.id), 'title')).toEqual(downloadButton.title);
|
||||
});
|
||||
|
||||
it('[C286419] Remove action from toolbar', async () => {
|
||||
await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
|
||||
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.fileName);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
|
||||
await toolbar.openViewerMoreMenu();
|
||||
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.fileName);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
|
||||
await toolbar.openViewerMoreMenu();
|
||||
expect(await BrowserActions.getAttribute(toolbar.menu.getItemById(moveAction.id), 'title')).toEqual(moveAction.title);
|
||||
});
|
||||
|
||||
it('[C286423] Remove action from More actions menu', async () => {
|
||||
await page.dataTable.doubleClickOnRowByName(pdfFile.fileName);
|
||||
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
|
||||
|
||||
await toolbar.openViewerMoreMenu();
|
||||
expect(await toolbar.menu.managePermissionsAction.isPresent()).toBe(false, 'Action is still displayed');
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user