mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Test cases for Edit Folder Directive (#4910)
* added tests for Edit Folder Directive * added tests for Copy and Move actions on no permission folder. * moved the checkDisabled function to BrowserActions to make it reusable. * updated method name
This commit is contained in:
committed by
Eugenio Romano
parent
c151d4535c
commit
65dc1a5c31
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CreateFolderDialog } from './dialog/createFolderDialog';
|
||||
import { FolderDialog } from './dialog/folderDialog';
|
||||
import { CreateLibraryDialog } from './dialog/createLibraryDialog';
|
||||
import { FormControllersPage } from '@alfresco/adf-testing';
|
||||
import { DropActions } from '../../actions/drop.actions';
|
||||
@@ -38,13 +38,14 @@ export class ContentServicesPage {
|
||||
contentList = new DocumentListPage(element.all(by.css('adf-upload-drag-area adf-document-list')).first());
|
||||
formControllersPage = new FormControllersPage();
|
||||
multipleFileUploadToggle = element(by.id('adf-document-list-enable-drop-files'));
|
||||
createFolderDialog = new CreateFolderDialog();
|
||||
createFolderDialog = new FolderDialog();
|
||||
createLibraryDialog = new CreateLibraryDialog();
|
||||
dragAndDropAction = new DropActions();
|
||||
uploadBorder = element(by.id('document-list-container'));
|
||||
contentServices = element(by.css('.adf-sidenav-link[data-automation-id="Content Services"]'));
|
||||
currentFolder = element(by.css('div[class*="adf-breadcrumb-item adf-active"] div'));
|
||||
createFolderButton = element(by.css('button[data-automation-id="create-new-folder"]'));
|
||||
editFolderButton = element(by.css('button[data-automation-id="edit-folder"]'));
|
||||
createLibraryButton = element(by.css('button[data-automation-id="create-new-library"]'));
|
||||
activeBreadcrumb = element(by.css('div[class*="active"]'));
|
||||
tooltip = by.css('div[class*="--text adf-full-width"] span');
|
||||
@@ -359,6 +360,15 @@ export class ContentServicesPage {
|
||||
return this;
|
||||
}
|
||||
|
||||
clickOnEditFolder() {
|
||||
BrowserActions.click(this.editFolderButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkEditFolderButtonIsEnabled() {
|
||||
return this.editFolderButton.isEnabled();
|
||||
}
|
||||
|
||||
openCreateLibraryDialog() {
|
||||
BrowserActions.click(this.createLibraryButton);
|
||||
this.createLibraryDialog.waitForDialogToOpen();
|
||||
@@ -369,7 +379,7 @@ export class ContentServicesPage {
|
||||
this.clickOnCreateNewFolder();
|
||||
this.createFolderDialog.addFolderName(folder);
|
||||
browser.sleep(200);
|
||||
this.createFolderDialog.clickOnCreateButton();
|
||||
this.createFolderDialog.clickOnCreateUpdateButton();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@@ -1,59 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 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 { browser, by, element } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
export class CreateFolderDialog {
|
||||
folderNameField = element(by.id('adf-folder-name-input'));
|
||||
folderDescriptionField = element(by.id('adf-folder-description-input'));
|
||||
createButton = element(by.id('adf-folder-create-button'));
|
||||
cancelButton = element(by.id('adf-folder-cancel-button'));
|
||||
|
||||
clickOnCreateButton() {
|
||||
BrowserActions.click(this.createButton);
|
||||
}
|
||||
|
||||
checkCreateBtnIsDisabled() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.createButton);
|
||||
expect(this.createButton.getAttribute('disabled')).toEqual('true');
|
||||
return this;
|
||||
}
|
||||
|
||||
checkCreateBtnIsEnabled() {
|
||||
this.createButton.isEnabled();
|
||||
return this;
|
||||
}
|
||||
|
||||
clickOnCancelButton() {
|
||||
BrowserActions.click(this.cancelButton);
|
||||
}
|
||||
|
||||
addFolderName(folderName) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.folderNameField);
|
||||
BrowserActions.clearSendKeys(this.folderNameField, folderName);
|
||||
browser.driver.sleep(500);
|
||||
return this;
|
||||
}
|
||||
|
||||
addFolderDescription(folderDescription) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.folderDescriptionField);
|
||||
BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
101
e2e/pages/adf/dialog/folderDialog.ts
Normal file
101
e2e/pages/adf/dialog/folderDialog.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 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 { browser, by, element } from 'protractor';
|
||||
import { BrowserVisibility, BrowserActions } from '@alfresco/adf-testing';
|
||||
|
||||
export class FolderDialog {
|
||||
folderDialog = element(by.css('adf-folder-dialog'));
|
||||
folderNameField = this.folderDialog.element(by.id('adf-folder-name-input'));
|
||||
folderDescriptionField = this.folderDialog.element(by.id('adf-folder-description-input'));
|
||||
createUpdateButton = this.folderDialog.element(by.id('adf-folder-create-button'));
|
||||
cancelButton = this.folderDialog.element(by.id('adf-folder-cancel-button'));
|
||||
folderTitle = this.folderDialog.element((by.css('h2.mat-dialog-title')));
|
||||
validationMessage = this.folderDialog.element(by.css('div.mat-form-field-subscript-wrapper mat-hint span'));
|
||||
|
||||
getDialogTitle() {
|
||||
return BrowserActions.getText(this.folderTitle);
|
||||
}
|
||||
|
||||
checkFolderDialogIsDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.folderDialog);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkFolderDialogIsNotDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsNotVisible(this.folderDialog);
|
||||
return this;
|
||||
}
|
||||
|
||||
clickOnCreateUpdateButton() {
|
||||
BrowserActions.click(this.createUpdateButton);
|
||||
}
|
||||
|
||||
checkCreateUpdateBtnIsDisabled() {
|
||||
BrowserActions.checkIsDisabled(this.createUpdateButton);
|
||||
return this;
|
||||
}
|
||||
|
||||
checkCreateUpdateBtnIsEnabled() {
|
||||
this.createUpdateButton.isEnabled();
|
||||
return this;
|
||||
}
|
||||
|
||||
checkCancelBtnIsEnabled() {
|
||||
this.cancelButton.isEnabled();
|
||||
return this;
|
||||
}
|
||||
|
||||
clickOnCancelButton() {
|
||||
BrowserActions.click(this.cancelButton);
|
||||
}
|
||||
|
||||
addFolderName(folderName) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.folderNameField);
|
||||
BrowserActions.clearSendKeys(this.folderNameField, folderName);
|
||||
browser.driver.sleep(500);
|
||||
return this;
|
||||
}
|
||||
|
||||
addFolderDescription(folderDescription) {
|
||||
BrowserVisibility.waitUntilElementIsVisible(this.folderDescriptionField);
|
||||
BrowserActions.clearSendKeys(this.folderDescriptionField, folderDescription);
|
||||
return this;
|
||||
}
|
||||
|
||||
getFolderName() {
|
||||
return this.folderNameField.getAttribute('value');
|
||||
}
|
||||
|
||||
getValidationMessage() {
|
||||
return BrowserActions.getText(this.validationMessage);
|
||||
}
|
||||
|
||||
checkValidationMessageIsNotDisplayed() {
|
||||
BrowserVisibility.waitUntilElementIsNotVisible(this.validationMessage);
|
||||
return this;
|
||||
}
|
||||
|
||||
getFolderNameField() {
|
||||
return this.folderNameField;
|
||||
}
|
||||
|
||||
getFolderDescriptionField() {
|
||||
return this.folderDescriptionField;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user