mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ADF-3823] Add tests for create site dialog (#4090)
* [ADF-3823] Create Library component tests * [ADF-3823] Create Library component tests * [ADF-3823] Fixing lint errors. * [ADF-3823] Added automation id for Create Library btn * [ADF-3823] Updated tests and added check for white spaces only. * [ADF-3823] Updated tests & rebased
This commit is contained in:
committed by
Eugenio Romano
parent
c7c4dcb659
commit
5b2887fea1
@@ -88,6 +88,7 @@
|
|||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.CREATE_LIBRARY' | translate }}"
|
matTooltip="{{ 'DOCUMENT_LIST.TOOLBAR.CREATE_LIBRARY' | translate }}"
|
||||||
|
data-automation-id="create-new-library"
|
||||||
(click)="createLibrary()">
|
(click)="createLibrary()">
|
||||||
<mat-icon>library_add</mat-icon>
|
<mat-icon>library_add</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
264
e2e/content-services/directives/create-library-directive.e2e.ts
Normal file
264
e2e/content-services/directives/create-library-directive.e2e.ts
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { LoginPage } from '../../pages/adf/loginPage';
|
||||||
|
import { ContentServicesPage } from '../../pages/adf/contentServicesPage';
|
||||||
|
import { CreateLibraryDialog } from '../../pages/adf/dialog/createLibraryDialog';
|
||||||
|
import { CustomSources } from '../../pages/adf/demo-shell/customSourcesPage';
|
||||||
|
|
||||||
|
import { AcsUserModel } from '../../models/ACS/acsUserModel';
|
||||||
|
import TestConfig = require('../../test.config');
|
||||||
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
|
import { browser, Key } from 'protractor';
|
||||||
|
import { Util } from '../../util/util';
|
||||||
|
|
||||||
|
describe('Create library directive', function () {
|
||||||
|
|
||||||
|
let loginPage = new LoginPage();
|
||||||
|
let contentServicesPage = new ContentServicesPage();
|
||||||
|
let createLibraryDialog = new CreateLibraryDialog();
|
||||||
|
let customSourcesPage = new CustomSources();
|
||||||
|
|
||||||
|
let visibility = {
|
||||||
|
public: 'Public',
|
||||||
|
private: 'Private',
|
||||||
|
moderated: 'Moderated'
|
||||||
|
};
|
||||||
|
|
||||||
|
let createSite;
|
||||||
|
|
||||||
|
let acsUser = new AcsUserModel();
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
this.alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'ECM',
|
||||||
|
hostEcm: TestConfig.adf.url
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||||
|
|
||||||
|
loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||||
|
|
||||||
|
createSite = await this.alfrescoJsApi.core.sitesApi.createSite({
|
||||||
|
'title': Util.generateRandomString(20).toLowerCase(),
|
||||||
|
'visibility': 'PUBLIC'
|
||||||
|
});
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach( (done) => {
|
||||||
|
contentServicesPage.goToDocumentList();
|
||||||
|
contentServicesPage.openCreateLibraryDialog();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async (done) => {
|
||||||
|
await browser.actions().sendKeys(Key.ESCAPE).perform();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290158] Should display the Create Library defaults', () => {
|
||||||
|
expect(createLibraryDialog.getTitle()).toMatch('Create Library');
|
||||||
|
expect(createLibraryDialog.isNameDisplayed()).toBe(true, 'Name input field is not displayed');
|
||||||
|
expect(createLibraryDialog.isLibraryIdDisplayed()).toBe(true, 'Library ID field is not displayed');
|
||||||
|
expect(createLibraryDialog.isDescriptionDisplayed()).toBe(true, 'Library description is not displayed');
|
||||||
|
expect(createLibraryDialog.isPublicDisplayed()).toBe(true, 'Public radio button is not displayed');
|
||||||
|
expect(createLibraryDialog.isPrivateDisplayed()).toBe(true, 'Private radio button is not displayed');
|
||||||
|
expect(createLibraryDialog.isModeratedDisplayed()).toBe(true, 'Moderated radio button is not displayed');
|
||||||
|
expect(createLibraryDialog.isCreateEnabled()).toBe(false, 'Create button is not disabled');
|
||||||
|
expect(createLibraryDialog.isCancelEnabled()).toBe(true, 'Cancel button is disabled');
|
||||||
|
expect(createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The default visibility is not public');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290159] Should close the dialog when clicking Cancel button', () => {
|
||||||
|
let libraryName = 'cancelLibrary';
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(libraryName);
|
||||||
|
|
||||||
|
createLibraryDialog.clickCancel();
|
||||||
|
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290160] Should create a public library', () => {
|
||||||
|
let libraryName = Util.generateRandomString();
|
||||||
|
let libraryDescription = Util.generateRandomString();
|
||||||
|
createLibraryDialog.typeLibraryName(libraryName);
|
||||||
|
createLibraryDialog.typeLibraryDescription(libraryDescription);
|
||||||
|
createLibraryDialog.selectPublic();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.getSelectedRadio()).toMatch(visibility.public, 'The visibility is not public');
|
||||||
|
|
||||||
|
createLibraryDialog.clickCreate();
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.isDialogOpen()).not.toBe(true, 'The Create Library dialog is not closed');
|
||||||
|
|
||||||
|
customSourcesPage.navigateToCustomSources();
|
||||||
|
customSourcesPage.selectMySitesSourceType();
|
||||||
|
customSourcesPage.checkRowIsDisplayed(libraryName);
|
||||||
|
|
||||||
|
expect(customSourcesPage.getStatusCell(libraryName)).toMatch('PUBLIC', 'Wrong library status.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290173] Should create a private library', () => {
|
||||||
|
let libraryName = Util.generateRandomString();
|
||||||
|
let libraryDescription = Util.generateRandomString();
|
||||||
|
createLibraryDialog.typeLibraryName(libraryName);
|
||||||
|
createLibraryDialog.typeLibraryDescription(libraryDescription);
|
||||||
|
createLibraryDialog.selectPrivate();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.getSelectedRadio()).toMatch(visibility.private, 'The visibility is not private');
|
||||||
|
|
||||||
|
createLibraryDialog.clickCreate();
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.isDialogOpen()).not.toBe(true, 'The Create Library dialog is not closed');
|
||||||
|
|
||||||
|
customSourcesPage.navigateToCustomSources();
|
||||||
|
customSourcesPage.selectMySitesSourceType();
|
||||||
|
customSourcesPage.checkRowIsDisplayed(libraryName);
|
||||||
|
|
||||||
|
expect(customSourcesPage.getStatusCell(libraryName)).toMatch('PRIVATE', 'Wrong library status.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290174, C290175] Should create a moderated library with a given Library ID', () => {
|
||||||
|
let libraryName = Util.generateRandomString();
|
||||||
|
let libraryId = Util.generateRandomString();
|
||||||
|
let libraryDescription = Util.generateRandomString();
|
||||||
|
createLibraryDialog.typeLibraryName(libraryName);
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
createLibraryDialog.typeLibraryDescription(libraryDescription);
|
||||||
|
createLibraryDialog.selectModerated();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.getSelectedRadio()).toMatch(visibility.moderated, 'The visibility is not moderated');
|
||||||
|
|
||||||
|
createLibraryDialog.clickCreate();
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.isDialogOpen()).not.toBe(true, 'The Create Library dialog is not closed');
|
||||||
|
|
||||||
|
customSourcesPage.navigateToCustomSources();
|
||||||
|
customSourcesPage.selectMySitesSourceType();
|
||||||
|
customSourcesPage.checkRowIsDisplayed(libraryName);
|
||||||
|
|
||||||
|
expect(customSourcesPage.getStatusCell(libraryName)).toMatch('MODERATED', 'Wrong library status.');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290163] Should disable Create button when a mandatory field is not filled in', () => {
|
||||||
|
let inputValue = Util.generateRandomString();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(inputValue);
|
||||||
|
createLibraryDialog.clearLibraryId();
|
||||||
|
expect(createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
|
||||||
|
createLibraryDialog.clearLibraryName();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryId(inputValue);
|
||||||
|
expect(createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
|
||||||
|
createLibraryDialog.clearLibraryId();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryDescription(inputValue);
|
||||||
|
expect(createLibraryDialog.isCreateEnabled()).not.toBe(true, 'The Create button is enabled');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290164] Should auto-fill in the Library Id built from library name', () => {
|
||||||
|
let name: string[] = ['abcd1234', 'ab cd 12 34', 'ab cd&12+34_@link/*'];
|
||||||
|
let libraryId: string[] = ['abcd1234', 'ab-cd-12-34', 'ab-cd1234link'];
|
||||||
|
|
||||||
|
for (let _i = 0; _i < 3; _i++) {
|
||||||
|
createLibraryDialog.typeLibraryName(name[_i]);
|
||||||
|
expect(createLibraryDialog.getLibraryIdText()).toMatch(libraryId[_i]);
|
||||||
|
createLibraryDialog.clearLibraryName();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290176] Should not accept special characters for Library Id', () => {
|
||||||
|
let name = 'My Library';
|
||||||
|
let libraryId: string[] = ['My New Library', 'My+New+Library123!', '<>'];
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name);
|
||||||
|
|
||||||
|
for (let _i = 0; _i < 3; _i++) {
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId[_i]);
|
||||||
|
expect(createLibraryDialog.isErrorMessageDisplayed()).toBe(true, 'Error message is not displayed');
|
||||||
|
expect(createLibraryDialog.getErrorMessage()).toMatch('Use numbers and letters only');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C291793] Should display error for Name field filled in with spaces only', () => {
|
||||||
|
let name = ' ';
|
||||||
|
let libraryId = Util.generateRandomString();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name);
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
|
||||||
|
expect(createLibraryDialog.isErrorMessageDisplayed()).toBe(true, 'Error message is not displayed');
|
||||||
|
expect(createLibraryDialog.getErrorMessage()).toMatch("Library name can't contain only spaces");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290177] Should not accept a duplicate Library Id', () => {
|
||||||
|
let name = 'My Library';
|
||||||
|
let libraryId = Util.generateRandomString();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name);
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
createLibraryDialog.clickCreate();
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
|
||||||
|
contentServicesPage.openCreateLibraryDialog();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name);
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
expect(createLibraryDialog.isErrorMessageDisplayed()).toBe(true, 'Error message is not displayed');
|
||||||
|
expect(createLibraryDialog.getErrorMessage()).toMatch("This Library ID isn't available. Try a different Library ID.");
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290178] Should accept the same library name but different Library Ids', () => {
|
||||||
|
let name = createSite.entry.title;
|
||||||
|
let libraryId = Util.generateRandomString();
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name.toUpperCase());
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
|
||||||
|
createLibraryDialog.waitForLibraryNameHint();
|
||||||
|
expect(createLibraryDialog.getLibraryNameHint()).toMatch('Library name already in use', 'The library name hint is wrong');
|
||||||
|
|
||||||
|
createLibraryDialog.clickCreate();
|
||||||
|
createLibraryDialog.waitForDialogToClose();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.isDialogOpen()).not.toBe(true, 'The Create library dialog remained open');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C290179] Should not accept more than the expected characters for input fields', () => {
|
||||||
|
let name = Util.generateRandomString(257);
|
||||||
|
let libraryId = Util.generateRandomString(73);
|
||||||
|
let libraryDescription = Util.generateRandomString(513);
|
||||||
|
|
||||||
|
createLibraryDialog.typeLibraryName(name);
|
||||||
|
createLibraryDialog.typeLibraryId(libraryId);
|
||||||
|
createLibraryDialog.typeLibraryDescription(libraryDescription);
|
||||||
|
|
||||||
|
createLibraryDialog.selectPublic();
|
||||||
|
|
||||||
|
expect(createLibraryDialog.getErrorMessages(0)).toMatch('Use 256 characters or less for title');
|
||||||
|
expect(createLibraryDialog.getErrorMessages(1)).toMatch('Use 72 characters or less for the URL name');
|
||||||
|
expect(createLibraryDialog.getErrorMessages(2)).toMatch('Use 512 characters or less for description');
|
||||||
|
});
|
||||||
|
});
|
@@ -19,6 +19,7 @@ import TestConfig = require('../../test.config');
|
|||||||
import { Util } from '../../util/util';
|
import { Util } from '../../util/util';
|
||||||
import { ContentListPage } from './dialog/contentListPage';
|
import { ContentListPage } from './dialog/contentListPage';
|
||||||
import { CreateFolderDialog } from './dialog/createFolderDialog';
|
import { CreateFolderDialog } from './dialog/createFolderDialog';
|
||||||
|
import { CreateLibraryDialog } from './dialog/createLibraryDialog';
|
||||||
import { NavigationBarPage } from './navigationBarPage';
|
import { NavigationBarPage } from './navigationBarPage';
|
||||||
import { NodeActions } from '../../actions/ACS/node.actions';
|
import { NodeActions } from '../../actions/ACS/node.actions';
|
||||||
import { by, element, protractor, $$, browser } from 'protractor';
|
import { by, element, protractor, $$, browser } from 'protractor';
|
||||||
@@ -30,11 +31,13 @@ export class ContentServicesPage {
|
|||||||
contentList = new ContentListPage();
|
contentList = new ContentListPage();
|
||||||
createFolderDialog = new CreateFolderDialog();
|
createFolderDialog = new CreateFolderDialog();
|
||||||
nodeActions = new NodeActions();
|
nodeActions = new NodeActions();
|
||||||
|
createLibraryDialog = new CreateLibraryDialog();
|
||||||
uploadBorder = element(by.id('document-list-container'));
|
uploadBorder = element(by.id('document-list-container'));
|
||||||
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
|
tableBody = element.all(by.css('adf-document-list div[class="adf-datatable-body"]')).first();
|
||||||
contentServices = element(by.css('a[data-automation-id="Content Services"]'));
|
contentServices = element(by.css('a[data-automation-id="Content Services"]'));
|
||||||
currentFolder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div'));
|
currentFolder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div'));
|
||||||
createFolderButton = element(by.css('button[data-automation-id="create-new-folder"]'));
|
createFolderButton = element(by.css('button[data-automation-id="create-new-folder"]'));
|
||||||
|
createLibraryButton = element(by.css('button[data-automation-id="create-new-library"]'));
|
||||||
activeBreadcrumb = element(by.css('div[class*="active"]'));
|
activeBreadcrumb = element(by.css('div[class*="active"]'));
|
||||||
tooltip = by.css('div[class*="--text adf-full-width"] span');
|
tooltip = by.css('div[class*="--text adf-full-width"] span');
|
||||||
uploadFileButton = element(by.css('input[data-automation-id="upload-single-file"]'));
|
uploadFileButton = element(by.css('input[data-automation-id="upload-single-file"]'));
|
||||||
@@ -360,6 +363,13 @@ export class ContentServicesPage {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openCreateLibraryDialog() {
|
||||||
|
Util.waitUntilElementIsVisible(this.createLibraryButton);
|
||||||
|
this.createLibraryButton.click();
|
||||||
|
this.createLibraryDialog.waitForDialogToOpen();
|
||||||
|
return this.createLibraryDialog;
|
||||||
|
}
|
||||||
|
|
||||||
createNewFolder(folder) {
|
createNewFolder(folder) {
|
||||||
this.clickOnCreateNewFolder();
|
this.clickOnCreateNewFolder();
|
||||||
this.createFolderDialog.addFolderName(folder);
|
this.createFolderDialog.addFolderName(folder);
|
||||||
|
79
e2e/pages/adf/demo-shell/customSourcesPage.ts
Normal file
79
e2e/pages/adf/demo-shell/customSourcesPage.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Util } from '../../../util/util';
|
||||||
|
import { element, by } from 'protractor';
|
||||||
|
import { ContentListPage } from '../dialog/contentListPage';
|
||||||
|
import { NavigationBarPage } from '../navigationBarPage';
|
||||||
|
|
||||||
|
let source = {
|
||||||
|
favorites: 'Favorites',
|
||||||
|
recent: 'Recent',
|
||||||
|
sharedLinks: 'Shared Links',
|
||||||
|
sites: 'Sites',
|
||||||
|
mySites: 'My Sites',
|
||||||
|
trashcan: 'Trashcan',
|
||||||
|
root: 'Root',
|
||||||
|
my: 'My',
|
||||||
|
shared: 'Shared'
|
||||||
|
};
|
||||||
|
|
||||||
|
let column = {
|
||||||
|
status: 'Status'
|
||||||
|
};
|
||||||
|
|
||||||
|
export class CustomSources {
|
||||||
|
|
||||||
|
contentList = new ContentListPage();
|
||||||
|
navigationBarPage = new NavigationBarPage();
|
||||||
|
|
||||||
|
toolbar = element(by.css('app-custom-sources .adf-toolbar-title'));
|
||||||
|
sourceTypeDropdown = element(by.css('div[class*="select-arrow"]>div'));
|
||||||
|
|
||||||
|
getSourceType(option) {
|
||||||
|
return element(by.cssContainingText('.cdk-overlay-pane span', `${option}`));
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForToolbarToBeVisible() {
|
||||||
|
Util.waitUntilElementIsVisible(this.toolbar);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateToCustomSources() {
|
||||||
|
this.navigationBarPage.navigateToCustomSources();
|
||||||
|
this.waitForToolbarToBeVisible();
|
||||||
|
}
|
||||||
|
clickOnSourceType() {
|
||||||
|
return this.sourceTypeDropdown.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectMySitesSourceType() {
|
||||||
|
this.clickOnSourceType();
|
||||||
|
this.getSourceType(source.mySites).click();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRowIsDisplayed(rowName) {
|
||||||
|
let row = this.contentList.getRowsName(rowName);
|
||||||
|
Util.waitUntilElementIsVisible(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
getStatusCell(rowName) {
|
||||||
|
Util.waitUntilElementIsVisible(this.contentList.getCellByNameAndColumn(rowName, column.status));
|
||||||
|
return this.contentList.getCellByNameAndColumn(rowName, column.status).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -47,11 +47,11 @@ export class ContentListPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTooltip(nodeName) {
|
getTooltip(nodeName) {
|
||||||
return this.getRowByRowName(nodeName).element(by.css(`#document-list-container span[title="${nodeName}"]`)).getAttribute('title');
|
return this.getRowByRowName(nodeName).element(by.css(`adf-document-list span[title="${nodeName}"]`)).getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
getRowsName(content) {
|
getRowsName(content) {
|
||||||
let row = element.all(by.css(`#document-list-container span[title='${content}']`)).first();
|
let row = element.all(by.css(`adf-document-list span[title='${content}']`)).first();
|
||||||
Util.waitUntilElementIsVisible(row);
|
Util.waitUntilElementIsVisible(row);
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
@@ -61,6 +61,10 @@ export class ContentListPage {
|
|||||||
return this.getRowsName(content).element(this.rowByRowName);
|
return this.getRowsName(content).element(this.rowByRowName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCellByNameAndColumn(content, columnName) {
|
||||||
|
return this.getRowByRowName(content).element(by.css(`div[title='${columnName}']`));
|
||||||
|
}
|
||||||
|
|
||||||
getAllDisplayedRows() {
|
getAllDisplayedRows() {
|
||||||
return element.all(this.rows).count();
|
return element.all(this.rows).count();
|
||||||
}
|
}
|
||||||
|
169
e2e/pages/adf/dialog/createLibraryDialog.ts
Normal file
169
e2e/pages/adf/dialog/createLibraryDialog.ts
Normal file
@@ -0,0 +1,169 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { by, element, browser, protractor } from 'protractor';
|
||||||
|
import { Util } from '../../../util/util';
|
||||||
|
|
||||||
|
export class CreateLibraryDialog {
|
||||||
|
libraryDialog = element(by.css('[role="dialog"]'));
|
||||||
|
libraryTitle = element(by.css('.adf-library-dialog>h2'));
|
||||||
|
libraryNameField = element(by.css('input[formcontrolname="title"]'));
|
||||||
|
libraryIdField = element(by.css('input[formcontrolname="id"]'));
|
||||||
|
libraryDescriptionField = element(by.css('textarea[formcontrolname="description"]'));
|
||||||
|
publicRadioButton = element(by.css('[data-automation-id="PUBLIC"]>label'));
|
||||||
|
privateRadioButton = element(by.css('[data-automation-id="PRIVATE"]>label'));
|
||||||
|
moderatedRadioButton = element(by.css('[data-automation-id="MODERATED"]>label'));
|
||||||
|
cancelButton = element(by.css('button[data-automation-id="cancel-library-id"]'));
|
||||||
|
createButton = element(by.css('button[data-automation-id="create-library-id"]'));
|
||||||
|
errorMessage = element(by.css('.mat-dialog-content .mat-error'));
|
||||||
|
errorMessages = element.all(by.css('.mat-dialog-content .mat-error'));
|
||||||
|
libraryNameHint = element(by.css('adf-library-dialog .mat-hint'));
|
||||||
|
|
||||||
|
getSelectedRadio() {
|
||||||
|
let radio = element(by.css('.mat-radio-button[class*="checked"]'));
|
||||||
|
Util.waitUntilElementIsVisible(radio);
|
||||||
|
return radio.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForDialogToOpen() {
|
||||||
|
Util.waitUntilElementIsPresent(this.libraryDialog);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForDialogToClose() {
|
||||||
|
Util.waitUntilElementIsNotOnPage(this.libraryDialog);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
isDialogOpen() {
|
||||||
|
return browser.isElementPresent(this.libraryDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle() {
|
||||||
|
return this.libraryTitle.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getLibraryIdText() {
|
||||||
|
return this.libraryIdField.getAttribute('value');
|
||||||
|
}
|
||||||
|
|
||||||
|
isErrorMessageDisplayed() {
|
||||||
|
return this.errorMessage.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
getErrorMessage() {
|
||||||
|
Util.waitUntilElementIsVisible(this.errorMessage);
|
||||||
|
return this.errorMessage.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
getErrorMessages(position) {
|
||||||
|
Util.waitUntilElementIsVisible(this.errorMessages);
|
||||||
|
return this.errorMessages.get(position).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
waitForLibraryNameHint() {
|
||||||
|
Util.waitUntilElementIsVisible(this.libraryNameHint);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
getLibraryNameHint() {
|
||||||
|
Util.waitUntilElementIsVisible(this.libraryNameHint);
|
||||||
|
return this.libraryNameHint.getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
isNameDisplayed() {
|
||||||
|
return this.libraryNameField.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isLibraryIdDisplayed() {
|
||||||
|
return this.libraryIdField.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isDescriptionDisplayed() {
|
||||||
|
return this.libraryDescriptionField.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isPublicDisplayed() {
|
||||||
|
return this.publicRadioButton.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isModeratedDisplayed() {
|
||||||
|
return this.moderatedRadioButton.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isPrivateDisplayed() {
|
||||||
|
return this.privateRadioButton.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
isCreateEnabled() {
|
||||||
|
return this.createButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
isCancelEnabled() {
|
||||||
|
return this.cancelButton.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
clickCreate() {
|
||||||
|
Util.waitUntilElementIsClickable(this.createButton);
|
||||||
|
this.createButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
clickCancel() {
|
||||||
|
this.cancelButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
typeLibraryName(libraryName: string) {
|
||||||
|
this.libraryNameField.clear();
|
||||||
|
this.libraryNameField.sendKeys(libraryName);
|
||||||
|
}
|
||||||
|
|
||||||
|
typeLibraryId(libraryId) {
|
||||||
|
this.libraryIdField.clear();
|
||||||
|
this.libraryIdField.sendKeys(libraryId);
|
||||||
|
}
|
||||||
|
|
||||||
|
typeLibraryDescription(libraryDescription) {
|
||||||
|
this.libraryDescriptionField.clear();
|
||||||
|
this.libraryDescriptionField.sendKeys(libraryDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearLibraryName() {
|
||||||
|
this.libraryNameField.clear();
|
||||||
|
this.libraryNameField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearLibraryId() {
|
||||||
|
this.libraryIdField.clear();
|
||||||
|
this.libraryIdField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearLibraryDescription() {
|
||||||
|
this.libraryDescriptionField.clear();
|
||||||
|
this.libraryDescriptionField.sendKeys(' ', protractor.Key.CONTROL, 'a', protractor.Key.NULL, protractor.Key.BACK_SPACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectPublic() {
|
||||||
|
this.publicRadioButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectPrivate() {
|
||||||
|
this.privateRadioButton.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectModerated() {
|
||||||
|
this.moderatedRadioButton.click();
|
||||||
|
}
|
||||||
|
}
|
@@ -46,6 +46,7 @@ export class NavigationBarPage {
|
|||||||
processListButton = element(by.css('a[data-automation-id="Process List"]'));
|
processListButton = element(by.css('a[data-automation-id="Process List"]'));
|
||||||
treeViewButton = element(by.css('a[data-automation-id="Tree View"]'));
|
treeViewButton = element(by.css('a[data-automation-id="Tree View"]'));
|
||||||
iconsButton = element(by.css('a[data-automation-id="Icons"]'));
|
iconsButton = element(by.css('a[data-automation-id="Icons"]'));
|
||||||
|
customSourcesButton = element(by.css('a[data-automation-id="Custom Sources"]'));
|
||||||
|
|
||||||
navigateToDatatable() {
|
navigateToDatatable() {
|
||||||
Util.waitUntilElementIsVisible(this.dataTableButton);
|
Util.waitUntilElementIsVisible(this.dataTableButton);
|
||||||
@@ -221,4 +222,9 @@ export class NavigationBarPage {
|
|||||||
Util.waitUntilElementIsVisible(this.processListButton);
|
Util.waitUntilElementIsVisible(this.processListButton);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
navigateToCustomSources() {
|
||||||
|
Util.waitUntilElementIsVisible(this.customSourcesButton);
|
||||||
|
this.customSourcesButton.click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,6 +68,7 @@
|
|||||||
color="primary"
|
color="primary"
|
||||||
[disabled]="option.disabled"
|
[disabled]="option.disabled"
|
||||||
*ngFor="let option of visibilityOptions"
|
*ngFor="let option of visibilityOptions"
|
||||||
|
[attr.data-automation-id]="option.value"
|
||||||
[value]="option.value"
|
[value]="option.value"
|
||||||
[checked]="visibilityOption.value === option.value"
|
[checked]="visibilityOption.value === option.value"
|
||||||
>
|
>
|
||||||
@@ -78,7 +79,7 @@
|
|||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
|
|
||||||
<mat-dialog-actions class="adf-action-buttons">
|
<mat-dialog-actions class="adf-action-buttons">
|
||||||
<button mat-button mat-dialog-close>
|
<button mat-button mat-dialog-close data-automation-id="cancel-library-id">
|
||||||
{{ 'LIBRARY.DIALOG.CANCEL' | translate }}
|
{{ 'LIBRARY.DIALOG.CANCEL' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@
|
|||||||
mat-button
|
mat-button
|
||||||
(click)="submit()"
|
(click)="submit()"
|
||||||
[disabled]="!form.valid"
|
[disabled]="!form.valid"
|
||||||
|
data-automation-id="create-library-id"
|
||||||
>
|
>
|
||||||
{{ 'LIBRARY.DIALOG.CREATE' | translate }}
|
{{ 'LIBRARY.DIALOG.CREATE' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
Reference in New Issue
Block a user