e2e modifications for share dialog

This commit is contained in:
Jatin_Chugh 2023-06-08 18:12:51 +05:30
parent bc230a8440
commit 945e1511a9
5 changed files with 18 additions and 69 deletions

View File

@ -127,35 +127,17 @@ describe('Share file', () => {
await contentServicesPage.clickShareButton(); await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed(); await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickExpireToggle(); await shareDialog.clickExpireToggle();
await shareDialog.clickDateTimePickerButton(); await shareDialog.clickDatePickerButton();
await shareDialog.calendarTodayDayIsDisabled(); await shareDialog.calendarTodayDayIsDisabled();
await BrowserActions.closeMenuAndDialogs(); await BrowserActions.closeMenuAndDialogs();
}); });
it('[C286548] Should be possible to set expiry date for link', async () => {
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickExpireToggle();
await shareDialog.setDefaultDay();
await shareDialog.setDefaultHour();
await shareDialog.setDefaultMinutes();
await shareDialog.dateTimePickerDialogIsClosed();
const value = await shareDialog.getExpirationDate();
await shareDialog.clickCloseButton();
await shareDialog.dialogIsClosed();
await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed();
await shareDialog.expirationDateInputHasValue(value);
await BrowserActions.closeMenuAndDialogs();
});
it('[C310329] Should be possible to set expiry date only for link', async () => { it('[C310329] Should be possible to set expiry date only for link', async () => {
await LocalStorageUtil.setConfigField('sharedLinkDateTimePickerType', JSON.stringify('date'));
await contentServicesPage.clickShareButton(); await contentServicesPage.clickShareButton();
await shareDialog.checkDialogIsDisplayed(); await shareDialog.checkDialogIsDisplayed();
await shareDialog.clickExpireToggle(); await shareDialog.clickExpireToggle();
await shareDialog.setDefaultDay(); await shareDialog.setDefaultDay();
await shareDialog.dateTimePickerDialogIsClosed(); await shareDialog.datePickerDialogIsClosed();
const value = await shareDialog.getExpirationDate(); const value = await shareDialog.getExpirationDate();
await shareDialog.clickCloseButton(); await shareDialog.clickCloseButton();
await shareDialog.dialogIsClosed(); await shareDialog.dialogIsClosed();

View File

@ -80,8 +80,8 @@ export class ShareDialogPage {
await BrowserVisibility.waitUntilElementIsStale(this.shareDialog); await BrowserVisibility.waitUntilElementIsStale(this.shareDialog);
} }
async clickDateTimePickerButton(): Promise<void> { async clickDatePickerButton(): Promise<void> {
await this.dateTimePickerPage.clickDateTimePicker(); await this.dateTimePickerPage.clickDatePicker();
} }
async calendarTodayDayIsDisabled(): Promise<void> { async calendarTodayDayIsDisabled(): Promise<void> {
@ -97,16 +97,8 @@ export class ShareDialogPage {
await this.dateTimePickerPage.setDate(tomorrow); await this.dateTimePickerPage.setDate(tomorrow);
} }
async setDefaultHour(): Promise<void> { async datePickerDialogIsClosed(): Promise<void> {
await this.dateTimePickerPage.dateTime.setDefaultEnabledHour(); await BrowserVisibility.waitUntilElementIsStale($('mat-datepicker-content'));
}
async setDefaultMinutes() {
await this.dateTimePickerPage.dateTime.setDefaultEnabledMinutes();
}
async dateTimePickerDialogIsClosed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsStale($('mat-datetimepicker-content'));
} }
async getExpirationDate(): Promise<string> { async getExpirationDate(): Promise<string> {

View File

@ -136,6 +136,10 @@
padding: 0; padding: 0;
} }
.mat-form-field {
line-height: normal;
}
.mat-form-field-appearance-legacy .mat-form-field-underline { .mat-form-field-appearance-legacy .mat-form-field-underline {
display: none; display: none;
} }

View File

@ -21,15 +21,8 @@ import { BrowserActions } from '../../utils/browser-actions';
export class DateTimePickerCalendarPage { export class DateTimePickerCalendarPage {
datePicker = $(`.mat-datetimepicker-calendar`); datePicker = $(`.mat-calendar`);
today = $(`.mat-datetimepicker-calendar-body-today`); today = $(`.mat-calendar-body-today`);
timePicker = $('.mat-datetimepicker-clock');
hourTime = $$('.mat-datetimepicker-clock-hours .mat-datetimepicker-clock-cell').first();
minutesTime = $$('.mat-datetimepicker-clock-minutes .mat-datetimepicker-clock-cell').first();
firstEnabledHourSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
firstEnabledMinutesSelector = '.mat-datetimepicker-clock-cell:not(.mat-datetimepicker-clock-cell-disabled)';
hoursPicker = $('.mat-datetimepicker-clock-hours');
minutePicker = $('.mat-datetimepicker-clock-minutes');
async waitTillDateDisplayed(): Promise<void> { async waitTillDateDisplayed(): Promise<void> {
await BrowserVisibility.waitUntilElementIsVisible(this.datePicker); await BrowserVisibility.waitUntilElementIsVisible(this.datePicker);
@ -39,19 +32,13 @@ export class DateTimePickerCalendarPage {
await BrowserActions.click(this.today); await BrowserActions.click(this.today);
} }
async setTime(): Promise<void> {
await BrowserActions.clickScript(this.hourTime);
await BrowserActions.clickScript(this.minutesTime);
}
async setDate(date?: string): Promise<boolean> { async setDate(date?: string): Promise<boolean> {
try { try {
if (date) { if (date) {
await BrowserActions.clickScript(element.all(by.cssContainingText(`.mat-datetimepicker-calendar-body-cell-content`, date)).first()); await BrowserActions.clickScript(element.all(by.cssContainingText(`.mat-calendar-body-cell-content`, date)).first());
} else { } else {
await this.setToday(); await this.setToday();
} }
await this.setTime();
return true; return true;
} catch { } catch {
return false; return false;
@ -59,14 +46,6 @@ export class DateTimePickerCalendarPage {
} }
async checkCalendarTodayDayIsDisabled(): Promise<void> { async checkCalendarTodayDayIsDisabled(): Promise<void> {
await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', await BrowserActions.getText(this.today)))); await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-calendar-body-disabled', await BrowserActions.getText(this.today))));
}
async setDefaultEnabledHour(): Promise<void> {
await BrowserActions.click(this.hoursPicker.$$(this.firstEnabledHourSelector).first());
}
async setDefaultEnabledMinutes() {
await BrowserActions.click(this.minutePicker.$$(this.firstEnabledMinutesSelector).first());
} }
} }

View File

@ -22,36 +22,28 @@ import { DateTimePickerCalendarPage } from './date-time-picker-calendar.page';
export class DateTimePickerPage { export class DateTimePickerPage {
rootElement: ElementFinder; rootElement: ElementFinder;
dateTimePicker = $('.mat-datetimepicker-toggle');
datePicker = $('.mat-datepicker-toggle'); datePicker = $('.mat-datepicker-toggle');
dateTime = new DateTimePickerCalendarPage(); dateTime = new DateTimePickerCalendarPage();
constructor(rootElement?: ElementFinder) { constructor(rootElement?: ElementFinder) {
if (rootElement) { if (rootElement) {
this.rootElement = rootElement; this.rootElement = rootElement;
this.dateTimePicker = this.rootElement.$('.mat-datetimepicker-toggle'); this.datePicker = this.rootElement.$('.mat-datepicker-toggle');
} }
} }
async setTodayDateTimeValue(): Promise<void> {
await BrowserActions.click(this.dateTimePicker);
await this.dateTime.waitTillDateDisplayed();
await this.dateTime.setToday();
await this.dateTime.setTime();
}
async setTodayDateValue(): Promise<void> { async setTodayDateValue(): Promise<void> {
await BrowserActions.click(this.dateTimePicker); await BrowserActions.click(this.datePicker);
await this.dateTime.waitTillDateDisplayed(); await this.dateTime.waitTillDateDisplayed();
await this.dateTime.setToday(); await this.dateTime.setToday();
} }
async setDate(date?: string): Promise<boolean> { async setDate(date?: string): Promise<boolean> {
await BrowserActions.click(this.dateTimePicker); await BrowserActions.click(this.datePicker);
return this.dateTime.setDate(date); return this.dateTime.setDate(date);
} }
async clickDateTimePicker(): Promise<void> { async clickDatePicker(): Promise<void> {
await BrowserActions.click(this.datePicker); await BrowserActions.click(this.datePicker);
} }