Files
alfresco-content-app/e2e/suites/extensions/ext-info-drawer.test.ts
Alfresco Build User 980f2206ca Update branch for ADF 32602 and JS-API 4.4.0 (#2152)
* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32602 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32602

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32602 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32602

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32602 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32602

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32602 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32602

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32602 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32602

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32615 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32615

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32615 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32615

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32615 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32615

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32615 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32615

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32615 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32615

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32619 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32619

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32619 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32619

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32619 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32619

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32619 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32619

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32619 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32619

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32637 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32637

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32658 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32658

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32658 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32658

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32658 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32658

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32658 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32658

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32668 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32668

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32668 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32668

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32668 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32668

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32668 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32668

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32668 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32668

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32688 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32688

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32688 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32688

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32688 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32688

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32688 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32688

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32688 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32688

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32698 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32698

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32698 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32698

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32698 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32698

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32698 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32698

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32698 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32698

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32704 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32704

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32704 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32704

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32704 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32704

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32704 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32704

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32704 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32704

* [ci:force]

* [ci:force] fix snackbar

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32712 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32712

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32712 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32712

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32712 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32712

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32712 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32712

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32712 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32712

* [ci:force]

* [ci:force]

* [ci:force]

* [ci:force]

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32716 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32715

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32716 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32715

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32716 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32715

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32716 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32715

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32716 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32715

* remove getAttribute

* fix lint

* update adf version

* fix argv

* [ci:force] fix getSnackBarMessage()

* [ci:force]

* [ci:force] Fix getTabTitle()

* [ci:force]

* [ci:force][auto-commit] Update @alfresco/adf-extensions to 4.5.0-32744 for branch: update-alfresco-dependencies originated from @alfresco/adf-extensions PR: 32744

* [ci:force][auto-commit] Update @alfresco/adf-core to 4.5.0-32744 for branch: update-alfresco-dependencies originated from @alfresco/adf-core PR: 32744

* [ci:force][auto-commit] Update @alfresco/adf-content-services to 4.5.0-32744 for branch: update-alfresco-dependencies originated from @alfresco/adf-content-services PR: 32744

* [ci:force][auto-commit] Update @alfresco/adf-cli to 4.5.0-32744 for branch: update-alfresco-dependencies originated from @alfresco/adf-cli PR: 32744

* [ci:force][auto-commit] Update @alfresco/adf-testing to 4.5.0-32744 for branch: update-alfresco-dependencies originated from @alfresco/adf-testing PR: 32744

* [ci:force]

Co-authored-by: Travis CI User <travis@example.org>
Co-authored-by: Cristina Jalba <cristina.jalba@ness.com>
Co-authored-by: Eugenio Romano <eugenio.romano@alfresco.com>
2021-06-02 12:01:55 +01:00

157 lines
5.4 KiB
TypeScript
Executable File

/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 Alfresco Software Limited
*
* 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 { AdminActions, LoginPage, BrowsingPage, InfoDrawer, RepoClient, EXTENSIBILITY_CONFIGS, Utils } 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();
beforeAll(async (done) => {
await adminApiActions.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 loginPage.load();
await Utils.setSessionStorageFromConfig(EXTENSIBILITY_CONFIGS.INFO_DRAWER);
await loginPage.loginWith(username);
done();
});
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 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 (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 BrowserActions.click(page.toolbar.viewDetailsButton);
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
});
});
});