[ACA-1549] info drawer extension e2e tests (#580)

* add Info Drawer component and Info Drawer extensibility tests

* add default extensibility configs
This commit is contained in:
Adina Parpalita
2018-08-24 12:15:10 +03:00
committed by Suzana Dirla
parent ef8c9a8740
commit a3c5753a6e
15 changed files with 2596 additions and 16 deletions

View File

@@ -0,0 +1,176 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2018 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 { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { InfoDrawer } from './../../components/info-drawer/info-drawer';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { SIDEBAR_LABELS, EXTENSIBILITY_CONFIGS } from '../../configs';
import { Utils } from '../../utilities/utils';
xit('');
describe('Extensions - Info Drawer', () => {
const username = `user-${Utils.random()}`;
const file = `file-${Utils.random()}.txt`;
let fileId;
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 = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const infoDrawer = new InfoDrawer();
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
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 loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.INFO_DRAWER);
await loginPage.loginWith(username);
done();
});
beforeEach(async (done) => {
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
await page.dataTable.clearSelection();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('Add a new tab with icon and title - [C284646]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(custom_tab.title)).toBe(true, `${custom_tab.title} tab is not present`);
expect(await infoDrawer.getTabTitle(custom_tab.order)).toEqual(`${custom_tab.icon}\n${custom_tab.title}\n`);
});
it('Remove existing tab - [C284647]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isTabPresent(comments_tab.title)).toBe(false, `${comments_tab.title} tab should not be present!`);
});
it('Change tab title - [C284648]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').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('Tab with icon and no title - [C284649]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').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)).toEqual(`${no_title_tab.icon}\n`);
});
it('Insert new component in tab - [C284651]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').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(custom_tab.title)).toEqual(custom_tab.component);
});
});
describe('', () => {
beforeAll(async (done) => {
await loginPage.load();
await Utils.setSessionStorageFromConfig('"aca.extension.config"', EXTENSIBILITY_CONFIGS.INFO_DRAWER_EMPTY);
await loginPage.loginWith(username);
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
await page.dataTable.waitForHeader();
done();
});
afterAll(async (done) => {
await logoutPage.load();
done();
});
it('Remove all tabs - [C284650]', async () => {
await page.dataTable.selectItem(file);
await page.toolbar.actions.getButtonByTitleAttribute('View details').click();
await infoDrawer.waitForInfoDrawerToOpen();
expect(await infoDrawer.isEmpty()).toBe(true, 'Info Drawer is not empty');
});
});
xit('');
});