mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
* upgrade to HttpClient * upgrade to Renderer2 * upgrade Document reference * remove useless test with deprecated ReflectiveInjector * upgrade to latest typescript * upgrade libs * upgrade package scripts * remove rxjs blacklists and duplicate rules * add rxjs compat to help with migration * fix breaking changes * fix breaking changes in material * fix breaking changes (material 6) * upgrade rxjs, ngx-translate and flex layout * update unit tests * restore providers * upgrade deprecated Observable.error * rebase fix first configuration problems * fix style issues commented * fix core build * fix lib template errors * move lib test execution in angular.json * ignore * karma conf files * fix import statement test * single run option * update packages reporter * restore report * increase timeout * improve karma conf test configuration * fix test issues about lint * fix test analytics * fix process service test * content service fix test * fix logout directive test * fix core test * fix build * update node-sass to latest * update angular cli dependencies * improve build script create directorites and move files only if previous command succeded * upgrade individual libs to 6.0 * remove old webpack files * revert sass change * fix type issues fix style issues * fix tslint demo shell issue * fix peerdependencies * fix test e2e BC * package upate * fix style import issue * extract-text-webpack-plugin beta * fix test dist build command * remove alpha js-api * fix tslint issue add banner tslint rule * upload service fix * change BC script * fix test dist script * increase demo shell timeout test * verbose copy * path absolute * fix script bc * fix copy part * fix path warning fix monaco editor * remove duplicate header * remove unused import * fix align and check ago tests * add missing import * fix notification button selector * [ANGULAR6] fixed core tests * fix CS test * fix cs test step 2 * increase travis_wait for dist * fix attachment PS * fix checklist test * use pdf min
233 lines
8.0 KiB
TypeScript
233 lines
8.0 KiB
TypeScript
/*!
|
|
* @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 = require('../../util/util');
|
|
import TestConfig = require('../../test.config');
|
|
import path = require('path');
|
|
import { browser, by, element, protractor } from 'protractor';
|
|
|
|
export class VersionManagePage {
|
|
|
|
showNewVersionButton = element(by.css('#adf-show-version-upload-button'));
|
|
uploadNewVersionButton = element(by.css('adf-upload-version-button input[data-automation-id="upload-single-file"]'));
|
|
uploadNewVersionContainer = element(by.css('#adf-new-version-uploader-container'));
|
|
cancelButton = element(by.css('#adf-new-version-cancel'));
|
|
majorRadio = element(by.css('#adf-new-version-major'));
|
|
minorRadio = element(by.css('#adf-new-version-minor'));
|
|
commentText = element(by.css('#adf-new-version-text-area'));
|
|
readOnlySwitch = element(by.id('adf-version-manager-switch-readonly'));
|
|
downloadSwitch = element(by.id('adf-version-manager-switch-download'));
|
|
commentsSwitch = element(by.id('adf-version-manager-switch-comments'));
|
|
|
|
checkUploadNewVersionsButtonIsDisplayed() {
|
|
Util.waitUntilElementIsVisible(this.showNewVersionButton);
|
|
return this;
|
|
}
|
|
|
|
uploadNewVersionFile = function (fileLocation) {
|
|
Util.waitUntilElementIsVisible(this.uploadNewVersionButton);
|
|
this.uploadNewVersionButton.sendKeys(path.resolve(path.join(TestConfig.main.rootPath, fileLocation)));
|
|
Util.waitUntilElementIsVisible(this.showNewVersionButton);
|
|
return this;
|
|
};
|
|
|
|
getFileVersionName(version) {
|
|
let fileElement = element(by.css(`[id="adf-version-list-item-name-${version}"]`));
|
|
Util.waitUntilElementIsVisible(fileElement);
|
|
return fileElement.getText();
|
|
}
|
|
|
|
chekFileVersionExist(version) {
|
|
let fileVersion = element(by.css(`[id="adf-version-list-item-version-${version}"]`));
|
|
return Util.waitUntilElementIsVisible(fileVersion);
|
|
}
|
|
|
|
chekFileVersionNotExist(version) {
|
|
let fileVersion = element(by.css(`[id="adf-version-list-item-version-${version}"]`));
|
|
return Util.waitUntilElementIsNotVisible(fileVersion);
|
|
}
|
|
|
|
getFileVersionComment(version) {
|
|
let fileComment = element(by.css(`[id="adf-version-list-item-comment-${version}"]`));
|
|
Util.waitUntilElementIsVisible(fileComment);
|
|
return fileComment.getText();
|
|
}
|
|
|
|
getFileVersionDate(version) {
|
|
let fileDate = element(by.css(`[id="adf-version-list-item-date-${version}"]`));
|
|
Util.waitUntilElementIsVisible(fileDate);
|
|
return fileDate.getText();
|
|
}
|
|
|
|
enterCommentText(text) {
|
|
Util.waitUntilElementIsVisible(this.commentText);
|
|
this.commentText.sendKeys('');
|
|
this.commentText.clear();
|
|
this.commentText.sendKeys(text);
|
|
return this;
|
|
}
|
|
|
|
clickMajorChange() {
|
|
let radioMajor = element(by.css(`[id="adf-new-version-major"]`));
|
|
Util.waitUntilElementIsVisible(radioMajor);
|
|
radioMajor.click();
|
|
}
|
|
|
|
clickMinorChange() {
|
|
let radioMinor = element(by.css(`[id="adf-new-version-minor"]`));
|
|
Util.waitUntilElementIsVisible(radioMinor);
|
|
radioMinor.click();
|
|
}
|
|
|
|
/**
|
|
* disables download
|
|
*/
|
|
disableReadOnly() {
|
|
Util.waitUntilElementIsVisible(this.readOnlySwitch);
|
|
this.readOnlySwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') >= 0) {
|
|
this.readOnlySwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* enables download
|
|
*/
|
|
enableReadOnly() {
|
|
Util.waitUntilElementIsVisible(this.readOnlySwitch);
|
|
this.readOnlySwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') < 0) {
|
|
this.readOnlySwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* disables download
|
|
*/
|
|
disableDownload() {
|
|
Util.waitUntilElementIsVisible(this.downloadSwitch);
|
|
this.downloadSwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') >= 0) {
|
|
this.downloadSwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* enables download
|
|
*/
|
|
enableDownload() {
|
|
Util.waitUntilElementIsVisible(this.downloadSwitch);
|
|
this.downloadSwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') < 0) {
|
|
this.downloadSwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
*
|
|
* disables comments
|
|
*/
|
|
disableComments() {
|
|
Util.waitUntilElementIsVisible(this.commentsSwitch);
|
|
this.commentsSwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') >= 0) {
|
|
this.commentsSwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* enables comments
|
|
*/
|
|
enableComments() {
|
|
Util.waitUntilElementIsVisible(this.commentsSwitch);
|
|
this.commentsSwitch.getAttribute('class').then((check) => {
|
|
if (check.indexOf('mat-checked') < 0) {
|
|
this.commentsSwitch.click();
|
|
}
|
|
});
|
|
}
|
|
|
|
clickActionButton(version) {
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-menu-button-${version}"]`)));
|
|
element(by.css(`[id="adf-version-list-action-menu-button-${version}"]`)).click();
|
|
return this;
|
|
}
|
|
|
|
clickAcceptConfirm() {
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-confirm-accept"]`)));
|
|
element(by.css(`[id="adf-confirm-accept"]`)).click();
|
|
return this;
|
|
}
|
|
|
|
clickCancelConfirm() {
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-confirm-cancel"]`)));
|
|
element(by.css(`[id="adf-confirm-cancel"]`)).click();
|
|
return this;
|
|
}
|
|
|
|
closeActionButton() {
|
|
let container = element(by.css('div.cdk-overlay-backdrop.cdk-overlay-transparent-backdrop.cdk-overlay-backdrop-showing'));
|
|
Util.waitUntilElementIsVisible(container);
|
|
container.click();
|
|
Util.waitUntilElementIsNotVisible(container);
|
|
return this;
|
|
}
|
|
|
|
downloadFileVersion(version) {
|
|
this.clickActionButton(version);
|
|
let downloadButton = element(by.css(`[id="adf-version-list-action-download-${version}"]`));
|
|
Util.waitUntilElementIsVisible(downloadButton);
|
|
browser.driver.sleep(500);
|
|
downloadButton.click();
|
|
return this;
|
|
}
|
|
|
|
deleteFileVersion(version) {
|
|
this.clickActionButton(version);
|
|
let deleteButton = element(by.css(`[id="adf-version-list-action-delete-${version}"]`));
|
|
Util.waitUntilElementIsVisible(deleteButton);
|
|
browser.driver.sleep(500);
|
|
deleteButton.click();
|
|
return this;
|
|
}
|
|
|
|
restoreFileVersion(version) {
|
|
this.clickActionButton(version);
|
|
let restoreButton = element(by.css(`[id="adf-version-list-action-restore-${version}"]`));
|
|
Util.waitUntilElementIsVisible(restoreButton);
|
|
browser.driver.sleep(500);
|
|
restoreButton.click();
|
|
return this;
|
|
}
|
|
|
|
checkActionsArePresent(version) {
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-download-${version}"]`)));
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-delete-${version}"]`)));
|
|
Util.waitUntilElementIsVisible(element(by.css(`[id="adf-version-list-action-restore-${version}"]`)));
|
|
}
|
|
|
|
closeVersionDialog() {
|
|
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
|
Util.waitUntilElementIsNotOnPage(this.uploadNewVersionContainer);
|
|
}
|
|
}
|