mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* increase timeout and modify login async * run e2e if testing is changed * improve cdk fix * fix travis update projects * disable ghostMode lite server * lint fix * fix timeout * multiple try * Update content-services-e2e.sh * Update search-e2e.sh * Update process-services-e2e.sh * Update core-e2e.sh * Update protractor.conf.ts * fix unit * remove async * increqase notification time * 3 parallel * dix path issue in save * small refactor protractor ts * fix save * create license check first script adf cli * modify regex check * refactor notification history component * decrease notification * fix notification message problem * fix test * update packages wit high risk * revert cahnge login sso e2e * fix dep * fix documentation duplication and issue * fix after review * fix after review * try 6 parallel test * back to 3 parallel test no real time improve with 6
144 lines
5.4 KiB
TypeScript
144 lines
5.4 KiB
TypeScript
/*!
|
|
* @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 { element, by } from 'protractor';
|
|
import { BrowserVisibility, FormControllersPage, BrowserActions } from '@alfresco/adf-testing';
|
|
import moment = require('moment');
|
|
|
|
export class ShareDialog {
|
|
|
|
formControllersPage = new FormControllersPage();
|
|
shareDialog = element(by.css('adf-share-dialog'));
|
|
dialogTitle = element(by.css('[data-automation-id="adf-share-dialog-title"]'));
|
|
shareToggle = element(by.css('[data-automation-id="adf-share-toggle"] label'));
|
|
shareToggleChecked = element(by.css('mat-dialog-container mat-slide-toggle.mat-checked'));
|
|
shareToggleDisabled = element(by.css('mat-dialog-container mat-slide-toggle.mat-disabled'));
|
|
shareLink = element(by.css('[data-automation-id="adf-share-link"]'));
|
|
closeButton = element(by.css('button[data-automation-id="adf-share-dialog-close"]'));
|
|
snackBar = element(by.css('simple-snack-bar'));
|
|
copySharedLinkButton = element(by.css('.adf-input-action'));
|
|
timeDatePickerButton = element(by.css('mat-datetimepicker-toggle button'));
|
|
dayPicker = element(by.css('mat-datetimepicker-month-view'));
|
|
clockPicker = element(by.css('mat-datetimepicker-clock'));
|
|
hoursPicker = element(by.css('.mat-datetimepicker-clock-hours'));
|
|
minutePicker = element(by.css('.mat-datetimepicker-clock-minutes'));
|
|
expirationDateInput = element(by.css('input[formcontrolname="time"]'));
|
|
confirmationDialog = element(by.css('adf-confirm-dialog'));
|
|
confirmationCancelButton = element(by.id('adf-confirm-cancel'));
|
|
confirmationRemoveButton = element(by.id('adf-confirm-accept'));
|
|
|
|
checkDialogIsDisplayed() {
|
|
return BrowserVisibility.waitUntilElementIsVisible(this.dialogTitle);
|
|
}
|
|
|
|
clickUnShareFile() {
|
|
this.formControllersPage.enableToggle(this.shareToggle);
|
|
}
|
|
|
|
clickConfirmationDialogCancelButton() {
|
|
BrowserActions.click(this.confirmationCancelButton);
|
|
}
|
|
|
|
clickConfirmationDialogRemoveButton() {
|
|
BrowserActions.click(this.confirmationRemoveButton);
|
|
}
|
|
|
|
checkShareLinkIsDisplayed() {
|
|
return BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
|
|
}
|
|
|
|
getShareLink() {
|
|
BrowserVisibility.waitUntilElementIsVisible(this.shareLink);
|
|
return this.shareLink.getAttribute('value');
|
|
}
|
|
|
|
clickCloseButton() {
|
|
return BrowserActions.click(this.closeButton);
|
|
|
|
}
|
|
|
|
clickShareLinkButton() {
|
|
return BrowserActions.click(this.copySharedLinkButton);
|
|
}
|
|
|
|
shareToggleButtonIsChecked() {
|
|
BrowserVisibility.waitUntilElementIsPresent(this.shareToggleChecked);
|
|
}
|
|
|
|
shareToggleButtonIsDisabled() {
|
|
BrowserVisibility.waitUntilElementIsPresent(this.shareToggleDisabled);
|
|
}
|
|
|
|
dialogIsClosed() {
|
|
BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
|
|
}
|
|
|
|
clickDateTimePickerButton() {
|
|
BrowserActions.click(this.timeDatePickerButton);
|
|
}
|
|
|
|
calendarTodayDayIsDisabled() {
|
|
const tomorrow = moment().add(1, 'days').format('D');
|
|
|
|
if (tomorrow !== '1') {
|
|
const today: any = this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
|
|
BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
|
|
}
|
|
}
|
|
|
|
setDefaultDay() {
|
|
BrowserVisibility.waitUntilElementIsVisible(this.dayPicker);
|
|
|
|
const tomorrow = moment().add(1, 'days').format('LL');
|
|
BrowserVisibility.waitUntilElementIsClickable(this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)));
|
|
this.dayPicker.element(by.css(`td[aria-label="${tomorrow}"]`)).click();
|
|
}
|
|
|
|
setDefaultHour() {
|
|
const selector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
|
|
BrowserVisibility.waitUntilElementIsVisible(this.clockPicker);
|
|
BrowserVisibility.waitUntilElementIsVisible(this.hoursPicker);
|
|
this.hoursPicker.all(by.css(selector)).first().click();
|
|
}
|
|
|
|
setDefaultMinutes() {
|
|
const selector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
|
|
BrowserVisibility.waitUntilElementIsVisible(this.minutePicker);
|
|
this.minutePicker.all(by.css(selector)).first().click();
|
|
}
|
|
|
|
dateTimePickerDialogIsClosed() {
|
|
BrowserVisibility.waitUntilElementIsStale(element(by.css('mat-datetimepicker-content')));
|
|
}
|
|
|
|
getExpirationDate() {
|
|
return this.expirationDateInput.getAttribute('value');
|
|
}
|
|
|
|
expirationDateInputHasValue(value) {
|
|
BrowserVisibility.waitUntilElementHasValue(this.expirationDateInput, value);
|
|
}
|
|
|
|
confirmationDialogIsDisplayed() {
|
|
return BrowserVisibility.waitUntilElementIsVisible(this.confirmationDialog);
|
|
}
|
|
|
|
confirmationDialogIsNotDisplayed() {
|
|
return BrowserVisibility.waitUntilElementIsNotVisible(this.confirmationDialog);
|
|
}
|
|
}
|