mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-1937] automate tests for Library properties (#771)
This commit is contained in:
committed by
Denys Vuika
parent
3a8dbcd7a4
commit
37b4d9d00b
@@ -26,6 +26,7 @@
|
|||||||
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
import { ElementFinder, ElementArrayFinder, by, browser, ExpectedConditions as EC } from 'protractor';
|
||||||
import { Component } from '../component';
|
import { Component } from '../component';
|
||||||
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
import { BROWSER_WAIT_TIMEOUT } from '../../configs';
|
||||||
|
import { Utils } from './../../utilities/utils';
|
||||||
|
|
||||||
export class InfoDrawer extends Component {
|
export class InfoDrawer extends Component {
|
||||||
private static selectors = {
|
private static selectors = {
|
||||||
@@ -40,10 +41,25 @@ export class InfoDrawer extends Component {
|
|||||||
|
|
||||||
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
|
activeTabContent: '.mat-tab-body-active .mat-tab-body-content adf-dynamic-tab',
|
||||||
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
|
next: '.mat-tab-header-pagination-after .mat-tab-header-pagination-chevron',
|
||||||
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron'
|
previous: '.mat-tab-header-pagination-before .mat-tab-header-pagination-chevron',
|
||||||
|
|
||||||
|
headerTitle: '.adf-info-drawer-layout-header-title',
|
||||||
|
|
||||||
|
// metadata card
|
||||||
|
metadataTabContent: '.app-metadata-tab .mat-card-content',
|
||||||
|
metadataTabAction: '.app-metadata-tab .mat-card-actions .mat-button',
|
||||||
|
field: '.mat-form-field',
|
||||||
|
fieldLabelWrapper: '.mat-form-field-label-wrapper',
|
||||||
|
fieldInput: '.mat-input-element',
|
||||||
|
dropDown: '.mat-select',
|
||||||
|
visibilityOption: '.mat-option .mat-option-text',
|
||||||
|
|
||||||
|
hint: '.mat-hint',
|
||||||
|
error: '.mat-error'
|
||||||
};
|
};
|
||||||
|
|
||||||
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
|
header: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.header));
|
||||||
|
headerTitle: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.headerTitle));
|
||||||
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
|
tabLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabLabel));
|
||||||
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
|
tabLabelsList: ElementArrayFinder = this.component.all(by.css(InfoDrawer.selectors.tabLabel));
|
||||||
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
|
tabActiveLabel: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.tabActiveLabel));
|
||||||
@@ -53,6 +69,19 @@ export class InfoDrawer extends Component {
|
|||||||
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
|
nextButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.next));
|
||||||
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
|
previousButton: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.previous));
|
||||||
|
|
||||||
|
metadataTabContent: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabContent));
|
||||||
|
metadataTabAction: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.metadataTabAction));
|
||||||
|
fieldLabelWrapper: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldLabelWrapper));
|
||||||
|
fieldInput: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.fieldInput));
|
||||||
|
|
||||||
|
visibilityDropDown: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.dropDown));
|
||||||
|
visibilityPublic: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Public'));
|
||||||
|
visibilityPrivate: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Private'));
|
||||||
|
visibilityModerated: ElementFinder = browser.element(by.cssContainingText(InfoDrawer.selectors.visibilityOption, 'Moderated'));
|
||||||
|
|
||||||
|
hint: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.hint));
|
||||||
|
error: ElementFinder = this.component.element(by.css(InfoDrawer.selectors.error));
|
||||||
|
|
||||||
constructor(ancestor?: ElementFinder) {
|
constructor(ancestor?: ElementFinder) {
|
||||||
super(InfoDrawer.selectors.root, ancestor);
|
super(InfoDrawer.selectors.root, ancestor);
|
||||||
}
|
}
|
||||||
@@ -61,6 +90,10 @@ export class InfoDrawer extends Component {
|
|||||||
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
return await browser.wait(EC.presenceOf(this.header), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async isOpen() {
|
||||||
|
return await browser.isElementPresent(this.header);
|
||||||
|
}
|
||||||
|
|
||||||
async isEmpty() {
|
async isEmpty() {
|
||||||
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
|
if (await browser.isElementPresent(by.css(InfoDrawer.selectors.tabs))) {
|
||||||
return false;
|
return false;
|
||||||
@@ -91,5 +124,179 @@ export class InfoDrawer extends Component {
|
|||||||
async getComponentIdOfTab() {
|
async getComponentIdOfTab() {
|
||||||
return await this.tabActiveContent.getAttribute('data-automation-id');
|
return await this.tabActiveContent.getAttribute('data-automation-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getHeaderTitle() {
|
||||||
|
return await this.headerTitle.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getLabelWrapper(label: string) {
|
||||||
|
return this.component.element(by.cssContainingText(InfoDrawer.selectors.fieldLabelWrapper, label));
|
||||||
|
}
|
||||||
|
|
||||||
|
getFieldByName(fieldName: string) {
|
||||||
|
const wrapper = this.getLabelWrapper(fieldName);
|
||||||
|
return wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.fieldInput));
|
||||||
|
}
|
||||||
|
|
||||||
|
async isFieldDisplayed(fieldName: string) {
|
||||||
|
return await browser.isElementPresent(this.getFieldByName(fieldName));
|
||||||
|
}
|
||||||
|
|
||||||
|
async isInputEnabled(fieldName: string) {
|
||||||
|
return this.getFieldByName(fieldName).isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isVisibilityEnabled() {
|
||||||
|
const wrapper = this.getLabelWrapper('Visibility');
|
||||||
|
const field = wrapper.element(by.xpath('..')).element(by.css(InfoDrawer.selectors.dropDown));
|
||||||
|
return await field.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async getValueOfField(fieldName: string) {
|
||||||
|
return await this.getFieldByName(fieldName).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async enterTextInInput(fieldName: string, text: string) {
|
||||||
|
const input = this.getFieldByName(fieldName);
|
||||||
|
await input.clear();
|
||||||
|
return await input.sendKeys(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
async typeTextInInput(fieldName: string, text: string) {
|
||||||
|
const input = this.getFieldByName(fieldName);
|
||||||
|
await input.clear();
|
||||||
|
return await Utils.typeInField(input, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
getButton(button: string) {
|
||||||
|
return this.component.element(by.cssContainingText(InfoDrawer.selectors.metadataTabAction, button));
|
||||||
|
}
|
||||||
|
|
||||||
|
async isButtonDisplayed(button: string) {
|
||||||
|
return browser.isElementPresent(this.getButton(button));
|
||||||
|
}
|
||||||
|
|
||||||
|
async isButtonEnabled(button: string) {
|
||||||
|
return await this.getButton(button).isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
async clickButton(button: string) {
|
||||||
|
return await this.getButton(button).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isButtonDisabled(button: string) {
|
||||||
|
try {
|
||||||
|
const disabled = await this.getButton(button).getAttribute('disabled');
|
||||||
|
return disabled;
|
||||||
|
} catch (error) {
|
||||||
|
console.log('----- isButtonDisabled catch: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async isMessageDisplayed() {
|
||||||
|
return await browser.isElementPresent(this.hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMessage() {
|
||||||
|
return await this.hint.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
async isErrorDisplayed() {
|
||||||
|
return await browser.isElementPresent(this.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getError() {
|
||||||
|
return await this.error.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------------
|
||||||
|
async isNameDisplayed() {
|
||||||
|
return await this.isFieldDisplayed('Name');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isDescriptionDisplayed() {
|
||||||
|
return await this.isFieldDisplayed('Description');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isVisibilityDisplayed() {
|
||||||
|
return await this.isFieldDisplayed('Visibility');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isLibraryIdDisplayed() {
|
||||||
|
return await this.isFieldDisplayed('Library ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
async getName() {
|
||||||
|
return await this.getValueOfField('Name');
|
||||||
|
}
|
||||||
|
|
||||||
|
async getVisibility() {
|
||||||
|
return await this.getValueOfField('Visibility');
|
||||||
|
}
|
||||||
|
|
||||||
|
async getLibraryId() {
|
||||||
|
return await this.getValueOfField('Library ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDescription() {
|
||||||
|
return await this.getValueOfField('Description');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isNameEnabled() {
|
||||||
|
return await this.isInputEnabled('Name');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isLibraryIdEnabled() {
|
||||||
|
return await this.isInputEnabled('Library ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
async isDescriptionEnabled() {
|
||||||
|
return await this.isInputEnabled('Description');
|
||||||
|
}
|
||||||
|
|
||||||
|
async enterName(name: string) {
|
||||||
|
return await this.enterTextInInput('Name', name);
|
||||||
|
}
|
||||||
|
|
||||||
|
async typeName(name: string) {
|
||||||
|
return await this.typeTextInInput('Name', name);
|
||||||
|
}
|
||||||
|
|
||||||
|
async enterDescription(desc: string) {
|
||||||
|
return await this.enterTextInInput('Description', desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
async typeDescription(desc: string) {
|
||||||
|
return await this.typeTextInInput('Description', desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForDropDownToOpen() {
|
||||||
|
await browser.wait(EC.presenceOf(this.visibilityDropDown), BROWSER_WAIT_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForDropDownToClose() {
|
||||||
|
await browser.wait(EC.stalenessOf(browser.$('.mat-option .mat-option-text')), BROWSER_WAIT_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
async setVisibility(visibility: string) {
|
||||||
|
const val = visibility.toLowerCase();
|
||||||
|
|
||||||
|
await this.visibilityDropDown.click();
|
||||||
|
await this.waitForDropDownToOpen();
|
||||||
|
|
||||||
|
if (val === 'public') {
|
||||||
|
await this.visibilityPublic.click();
|
||||||
|
} else if (val === 'private') {
|
||||||
|
await this.visibilityPrivate.click();
|
||||||
|
} else if (val === 'moderated') {
|
||||||
|
await this.visibilityModerated.click();
|
||||||
|
} else {
|
||||||
|
console.log('----- invalid visibility', val);
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.waitForDropDownToClose();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
264
e2e/suites/info-drawer/library-properties.test.ts
Executable file
264
e2e/suites/info-drawer/library-properties.test.ts
Executable file
@@ -0,0 +1,264 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { SITE_VISIBILITY, SITE_ROLES } from '../../configs';
|
||||||
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
import { InfoDrawer } from './../../components/info-drawer/info-drawer';
|
||||||
|
import { Utils } from '../../utilities/utils';
|
||||||
|
|
||||||
|
describe('Library properties', () => {
|
||||||
|
const username = `user1-${Utils.random()}`;
|
||||||
|
const user2 = `user2-${Utils.random()}`;
|
||||||
|
const user3 = `user3-${Utils.random()}`;
|
||||||
|
|
||||||
|
const site = {
|
||||||
|
name: `site1-${Utils.random()}`,
|
||||||
|
id: `site-id-${Utils.random()}`,
|
||||||
|
visibility: SITE_VISIBILITY.MODERATED,
|
||||||
|
description: 'my site description'
|
||||||
|
};
|
||||||
|
|
||||||
|
const siteForUpdate = {
|
||||||
|
name: `site2-${Utils.random()}`,
|
||||||
|
id: `site-id-${Utils.random()}`,
|
||||||
|
visibility: SITE_VISIBILITY.MODERATED,
|
||||||
|
description: 'my initial description'
|
||||||
|
};
|
||||||
|
|
||||||
|
const siteUpdated = {
|
||||||
|
name: `site-for-rename-${Utils.random()}`,
|
||||||
|
visibility: SITE_VISIBILITY.PRIVATE,
|
||||||
|
description: 'new description'
|
||||||
|
}
|
||||||
|
|
||||||
|
const siteDup = `site3-${Utils.random()}`;
|
||||||
|
|
||||||
|
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();
|
||||||
|
const { dataTable } = page;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
await apis.admin.people.createUser({ username });
|
||||||
|
await apis.admin.people.createUser({ username: user2 });
|
||||||
|
await apis.admin.people.createUser({ username: user3 });
|
||||||
|
await apis.user.sites.createSite(site.name, site.visibility, site.description, site.id);
|
||||||
|
await apis.user.sites.createSite(siteForUpdate.name, siteForUpdate.visibility, siteForUpdate.description, siteForUpdate.id);
|
||||||
|
await apis.user.sites.createSite(siteDup);
|
||||||
|
|
||||||
|
await apis.user.sites.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR);
|
||||||
|
await apis.user.sites.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER);
|
||||||
|
|
||||||
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async (done) => {
|
||||||
|
await apis.user.sites.deleteSite(site.id);
|
||||||
|
await apis.user.sites.deleteSite(siteForUpdate.id);
|
||||||
|
await apis.user.sites.deleteSite(siteDup);
|
||||||
|
await logoutPage.load();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(async (done) => {
|
||||||
|
await page.clickFileLibrariesAndWait();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async done => {
|
||||||
|
if (await infoDrawer.isOpen()) {
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Info drawer opens for a library - [C289336]', async () => {
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
|
||||||
|
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
|
||||||
|
expect(await infoDrawer.isTabPresent('About')).toBe(true, 'About tab is not displayed');
|
||||||
|
expect(await infoDrawer.isNameDisplayed()).toBe(true, 'Name field not displayed');
|
||||||
|
expect(await infoDrawer.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
|
||||||
|
expect(await infoDrawer.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
|
||||||
|
expect(await infoDrawer.isDescriptionDisplayed()).toBe(true, 'Description field not displayed');
|
||||||
|
|
||||||
|
expect(await infoDrawer.getName()).toEqual(site.name);
|
||||||
|
expect(await infoDrawer.getLibraryId()).toEqual(site.id);
|
||||||
|
expect((await infoDrawer.getVisibility()).toLowerCase()).toEqual((site.visibility).toLowerCase());
|
||||||
|
expect(await infoDrawer.getDescription()).toEqual(site.description);
|
||||||
|
|
||||||
|
expect(await infoDrawer.isButtonDisplayed('Edit')).toBe(true, 'Edit action is not displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Editable properties - [C289338]', async () => {
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Edit')).toBe(true, 'Edit action is not enabled');
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
expect(await infoDrawer.isNameEnabled()).toBe(true, 'Name field not enabled');
|
||||||
|
expect(await infoDrawer.isLibraryIdEnabled()).toBe(false, 'Library ID field not disabled');
|
||||||
|
expect(await infoDrawer.isVisibilityEnabled()).toBe(true, 'Visibility field not enabled');
|
||||||
|
expect(await infoDrawer.isDescriptionEnabled()).toBe(true, 'Description field not enabled');
|
||||||
|
|
||||||
|
expect(await infoDrawer.isButtonDisplayed('Cancel')).toBe(true, 'Cancel button not displayed');
|
||||||
|
expect(await infoDrawer.isButtonDisplayed('Update')).toBe(true, 'Update button not displayed');
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Cancel')).toBe(true, 'Cancel button not enabled');
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Update')).toBe(false, 'Update button not disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Edit site details - [C289339]', async () => {
|
||||||
|
await dataTable.selectItem(siteForUpdate.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Edit')).toBe(true, 'Edit action is not enabled');
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await infoDrawer.enterName(siteUpdated.name);
|
||||||
|
await infoDrawer.enterDescription(siteUpdated.description);
|
||||||
|
await infoDrawer.setVisibility(siteUpdated.visibility);
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Update')).toBe(true, 'Update button not enabled');
|
||||||
|
|
||||||
|
await infoDrawer.clickButton('Update');
|
||||||
|
|
||||||
|
expect(await page.getSnackBarMessage()).toEqual('Library properties updated');
|
||||||
|
expect(await dataTable.getRowByName(siteUpdated.name).isPresent()).toBe(true, 'New site name not displayed in the list');
|
||||||
|
expect(await infoDrawer.isOpen()).toBe(false, 'Info drawer still open');
|
||||||
|
|
||||||
|
expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.title).toEqual(siteUpdated.name);
|
||||||
|
expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.description).toEqual(siteUpdated.description);
|
||||||
|
expect((await apis.user.sites.getSite(siteForUpdate.id)).entry.visibility).toEqual(siteUpdated.visibility);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Cancel editing a site - [C289340]', async () => {
|
||||||
|
const newName = `new-name-${Utils.random}`;
|
||||||
|
const newDesc = `new desc ${Utils.random}`;
|
||||||
|
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Edit')).toBe(true, 'Edit action is not enabled');
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await infoDrawer.enterName(newName);
|
||||||
|
await infoDrawer.enterDescription(newDesc);
|
||||||
|
await infoDrawer.setVisibility(SITE_VISIBILITY.MODERATED);
|
||||||
|
|
||||||
|
await infoDrawer.clickButton('Cancel');
|
||||||
|
|
||||||
|
expect(await dataTable.getRowByName(newName).isPresent()).toBe(false, 'New site name is displayed in the list');
|
||||||
|
expect(await dataTable.getRowByName(site.name).isPresent()).toBe(true, 'Original site name not displayed in the list');
|
||||||
|
expect(await infoDrawer.isOpen()).toBe(true, 'Info drawer not open');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Warning appears when editing the name of the library by entering an existing name - [C289341]', async () => {
|
||||||
|
await apis.user.queries.waitForApi(site.name, { expect: 1 });
|
||||||
|
|
||||||
|
await dataTable.selectItem(siteDup);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await infoDrawer.enterName(site.name);
|
||||||
|
expect(await infoDrawer.isMessageDisplayed()).toBe(true, 'Message not displayed');
|
||||||
|
expect(await infoDrawer.getMessage()).toEqual('Library name already in use');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Site name too long - [C289342]', async () => {
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await infoDrawer.enterName(Utils.string257);
|
||||||
|
await Utils.pressTab();
|
||||||
|
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed');
|
||||||
|
expect(await infoDrawer.getError()).toEqual('Use 256 characters or less for title');
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Update')).toBe(false, 'Update button not disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Site description too long - [C289343]', async () => {
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await infoDrawer.enterDescription(Utils.string513);
|
||||||
|
await Utils.pressTab();
|
||||||
|
expect(await infoDrawer.isErrorDisplayed()).toBe(true, 'Message not displayed');
|
||||||
|
expect(await infoDrawer.getError()).toEqual('Use 512 characters or less for description');
|
||||||
|
expect(await infoDrawer.isButtonEnabled('Update')).toBe(false, 'Update button not disabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Non manager', () => {
|
||||||
|
afterAll(async done => {
|
||||||
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Edit button is not displayed when user is not the library manager - [C289337]', async () => {
|
||||||
|
await loginPage.loginWith(user2);
|
||||||
|
|
||||||
|
await page.clickFileLibrariesAndWait();
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
expect(await infoDrawer.isButtonDisplayed('Edit')).toBe(false, 'Edit action is displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Error notification - [C289344]', async () => {
|
||||||
|
await loginPage.loginWith(user3);
|
||||||
|
|
||||||
|
await page.clickFileLibrariesAndWait();
|
||||||
|
await dataTable.selectItem(site.name);
|
||||||
|
await page.toolbar.getButtonByTitleAttribute('View details').click();
|
||||||
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
await infoDrawer.clickButton('Edit');
|
||||||
|
|
||||||
|
await apis.user.sites.updateSiteMember(site.id, user3, SITE_ROLES.SITE_CONSUMER);
|
||||||
|
|
||||||
|
await infoDrawer.enterDescription('new description');
|
||||||
|
await infoDrawer.clickButton('Update');
|
||||||
|
|
||||||
|
expect(await page.getSnackBarMessage()).toEqual('There was an error updating library properties');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
61
e2e/utilities/repo-client/apis/queries/queries-api.ts
Executable file
61
e2e/utilities/repo-client/apis/queries/queries-api.ts
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
/*!
|
||||||
|
* @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 { RepoApi } from '../repo-api';
|
||||||
|
import { Utils } from '../../../../utilities/utils';
|
||||||
|
|
||||||
|
export class QueriesApi extends RepoApi {
|
||||||
|
|
||||||
|
constructor(username?, password?) {
|
||||||
|
super(username, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
async findSites(searchTerm: string) {
|
||||||
|
const data = {
|
||||||
|
term: searchTerm,
|
||||||
|
fields: ['title']
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.apiAuth();
|
||||||
|
return this.alfrescoJsApi.core.queriesApi.findSites(searchTerm, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async waitForApi(searchTerm, data) {
|
||||||
|
try {
|
||||||
|
const sites = async () => {
|
||||||
|
const totalItems = (await this.findSites(searchTerm)).list.pagination.totalItems;
|
||||||
|
if ( totalItems !== data.expect ) {
|
||||||
|
return Promise.reject(totalItems);
|
||||||
|
} else {
|
||||||
|
return Promise.resolve(totalItems);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return await Utils.retryCall(sites);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch queries findSites: ', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -29,6 +29,7 @@ import { PeopleApi } from './apis/people/people-api';
|
|||||||
import { NodesApi } from './apis/nodes/nodes-api';
|
import { NodesApi } from './apis/nodes/nodes-api';
|
||||||
import { SitesApi } from './apis/sites/sites-api';
|
import { SitesApi } from './apis/sites/sites-api';
|
||||||
import { FavoritesApi } from './apis/favorites/favorites-api';
|
import { FavoritesApi } from './apis/favorites/favorites-api';
|
||||||
|
import { QueriesApi } from './apis/queries/queries-api';
|
||||||
import { SharedLinksApi } from './apis/shared-links/shared-links-api';
|
import { SharedLinksApi } from './apis/shared-links/shared-links-api';
|
||||||
import { TrashcanApi } from './apis/trashcan/trashcan-api';
|
import { TrashcanApi } from './apis/trashcan/trashcan-api';
|
||||||
import { SearchApi } from './apis/search/search-api';
|
import { SearchApi } from './apis/search/search-api';
|
||||||
@@ -74,6 +75,10 @@ export class RepoClient {
|
|||||||
return new SearchApi(this.auth.username, this.auth.password);
|
return new SearchApi(this.auth.username, this.auth.password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get queries() {
|
||||||
|
return new QueriesApi(this.auth.username, this.auth.password);
|
||||||
|
}
|
||||||
|
|
||||||
get upload() {
|
get upload() {
|
||||||
return new UploadApi(this.auth.username, this.auth.password);
|
return new UploadApi(this.auth.username, this.auth.password);
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,14 @@ const path = require('path');
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
export class Utils {
|
export class Utils {
|
||||||
|
static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \
|
||||||
|
reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation';
|
||||||
|
|
||||||
|
static string513 = 'great indirect brain tune other expectation fun silver drain tumble rhythm harmful wander picture distribute opera complication copyright \
|
||||||
|
explosion snack ride pool machinery pair frog joint wrestle video referee drive window cage falsify happen tablet horror thank conception \
|
||||||
|
extension decay dismiss platform respect ceremony applaud absorption presentation dominate race courtship soprano body \
|
||||||
|
lighter track cinema tread tick climate lend summit singer radical flower visual negotiation promises cooperative dead';
|
||||||
|
|
||||||
// generate a random value
|
// generate a random value
|
||||||
static random() {
|
static random() {
|
||||||
return Math.random().toString(36).substring(5, 10).toLowerCase();
|
return Math.random().toString(36).substring(5, 10).toLowerCase();
|
||||||
@@ -71,8 +79,6 @@ export class Utils {
|
|||||||
|
|
||||||
static async waitUntilElementClickable(element: ElementFinder) {
|
static async waitUntilElementClickable(element: ElementFinder) {
|
||||||
return await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
|
return await browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT).catch(Error);
|
||||||
// static waitUntilElementClickable(element: ElementFinder) {
|
|
||||||
// return browser.wait(EC.elementToBeClickable(element), BROWSER_WAIT_TIMEOUT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async typeInField(elem: ElementFinder, value: string) {
|
static async typeInField(elem: ElementFinder, value: string) {
|
||||||
@@ -112,6 +118,10 @@ export class Utils {
|
|||||||
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
return browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static pressTab() {
|
||||||
|
return browser.actions().sendKeys(protractor.Key.TAB).perform();
|
||||||
|
}
|
||||||
|
|
||||||
static getBrowserLog() {
|
static getBrowserLog() {
|
||||||
return browser.manage().logs().get('browser');
|
return browser.manage().logs().get('browser');
|
||||||
}
|
}
|
||||||
@@ -119,4 +129,5 @@ export class Utils {
|
|||||||
static formatDate(date: string) {
|
static formatDate(date: string) {
|
||||||
return new Date(date).toLocaleDateString('en-US');
|
return new Date(date).toLocaleDateString('en-US');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ exports.config = {
|
|||||||
'./e2e/suites/pagination/*.test.ts',
|
'./e2e/suites/pagination/*.test.ts',
|
||||||
'./e2e/suites/actions/*.test.ts',
|
'./e2e/suites/actions/*.test.ts',
|
||||||
'./e2e/suites/viewer/*.test.ts',
|
'./e2e/suites/viewer/*.test.ts',
|
||||||
|
'./e2e/suites/info-drawer/*.test.ts',
|
||||||
'./e2e/suites/extensions/*.test.ts'
|
'./e2e/suites/extensions/*.test.ts'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user