From 945e1511a99c5c0fb1692866457f9a775cfcc3d8 Mon Sep 17 00:00:00 2001 From: Jatin_Chugh Date: Thu, 8 Jun 2023 18:12:51 +0530 Subject: [PATCH] e2e modifications for share dialog --- .../components/share-file.e2e.ts | 22 ++------------ e2e/core/pages/dialog/share-dialog.page.ts | 16 +++------- .../content-node-share.dialog.scss | 4 +++ .../date-time-picker-calendar.page.ts | 29 +++---------------- .../pages/material/date-time-picker.page.ts | 16 +++------- 5 files changed, 18 insertions(+), 69 deletions(-) diff --git a/e2e/content-services/components/share-file.e2e.ts b/e2e/content-services/components/share-file.e2e.ts index 0886e47144..91def44ae6 100644 --- a/e2e/content-services/components/share-file.e2e.ts +++ b/e2e/content-services/components/share-file.e2e.ts @@ -127,35 +127,17 @@ describe('Share file', () => { await contentServicesPage.clickShareButton(); await shareDialog.checkDialogIsDisplayed(); await shareDialog.clickExpireToggle(); - await shareDialog.clickDateTimePickerButton(); + await shareDialog.clickDatePickerButton(); await shareDialog.calendarTodayDayIsDisabled(); 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 () => { - await LocalStorageUtil.setConfigField('sharedLinkDateTimePickerType', JSON.stringify('date')); await contentServicesPage.clickShareButton(); await shareDialog.checkDialogIsDisplayed(); await shareDialog.clickExpireToggle(); await shareDialog.setDefaultDay(); - await shareDialog.dateTimePickerDialogIsClosed(); + await shareDialog.datePickerDialogIsClosed(); const value = await shareDialog.getExpirationDate(); await shareDialog.clickCloseButton(); await shareDialog.dialogIsClosed(); diff --git a/e2e/core/pages/dialog/share-dialog.page.ts b/e2e/core/pages/dialog/share-dialog.page.ts index d7e38d5b54..317df98597 100644 --- a/e2e/core/pages/dialog/share-dialog.page.ts +++ b/e2e/core/pages/dialog/share-dialog.page.ts @@ -80,8 +80,8 @@ export class ShareDialogPage { await BrowserVisibility.waitUntilElementIsStale(this.shareDialog); } - async clickDateTimePickerButton(): Promise { - await this.dateTimePickerPage.clickDateTimePicker(); + async clickDatePickerButton(): Promise { + await this.dateTimePickerPage.clickDatePicker(); } async calendarTodayDayIsDisabled(): Promise { @@ -97,16 +97,8 @@ export class ShareDialogPage { await this.dateTimePickerPage.setDate(tomorrow); } - async setDefaultHour(): Promise { - await this.dateTimePickerPage.dateTime.setDefaultEnabledHour(); - } - - async setDefaultMinutes() { - await this.dateTimePickerPage.dateTime.setDefaultEnabledMinutes(); - } - - async dateTimePickerDialogIsClosed(): Promise { - await BrowserVisibility.waitUntilElementIsStale($('mat-datetimepicker-content')); + async datePickerDialogIsClosed(): Promise { + await BrowserVisibility.waitUntilElementIsStale($('mat-datepicker-content')); } async getExpirationDate(): Promise { diff --git a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.scss b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.scss index 4bf4f0d29d..d8e66064a0 100644 --- a/lib/content-services/src/lib/content-node-share/content-node-share.dialog.scss +++ b/lib/content-services/src/lib/content-node-share/content-node-share.dialog.scss @@ -136,6 +136,10 @@ padding: 0; } + .mat-form-field { + line-height: normal; + } + .mat-form-field-appearance-legacy .mat-form-field-underline { display: none; } diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts index 6265717d41..72a2b38c91 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker-calendar.page.ts @@ -21,15 +21,8 @@ import { BrowserActions } from '../../utils/browser-actions'; export class DateTimePickerCalendarPage { - datePicker = $(`.mat-datetimepicker-calendar`); - today = $(`.mat-datetimepicker-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'); + datePicker = $(`.mat-calendar`); + today = $(`.mat-calendar-body-today`); async waitTillDateDisplayed(): Promise { await BrowserVisibility.waitUntilElementIsVisible(this.datePicker); @@ -39,19 +32,13 @@ export class DateTimePickerCalendarPage { await BrowserActions.click(this.today); } - async setTime(): Promise { - await BrowserActions.clickScript(this.hourTime); - await BrowserActions.clickScript(this.minutesTime); - } - async setDate(date?: string): Promise { try { 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 { await this.setToday(); } - await this.setTime(); return true; } catch { return false; @@ -59,14 +46,6 @@ export class DateTimePickerCalendarPage { } async checkCalendarTodayDayIsDisabled(): Promise { - await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', await BrowserActions.getText(this.today)))); - } - - async setDefaultEnabledHour(): Promise { - await BrowserActions.click(this.hoursPicker.$$(this.firstEnabledHourSelector).first()); - } - - async setDefaultEnabledMinutes() { - await BrowserActions.click(this.minutePicker.$$(this.firstEnabledMinutesSelector).first()); + await BrowserVisibility.waitUntilElementIsPresent(element(by.cssContainingText('.mat-calendar-body-disabled', await BrowserActions.getText(this.today)))); } } diff --git a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts index 5b185f3af9..15c87228f4 100644 --- a/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts +++ b/lib/testing/src/lib/protractor/core/pages/material/date-time-picker.page.ts @@ -22,36 +22,28 @@ import { DateTimePickerCalendarPage } from './date-time-picker-calendar.page'; export class DateTimePickerPage { rootElement: ElementFinder; - dateTimePicker = $('.mat-datetimepicker-toggle'); datePicker = $('.mat-datepicker-toggle'); dateTime = new DateTimePickerCalendarPage(); constructor(rootElement?: ElementFinder) { if (rootElement) { this.rootElement = rootElement; - this.dateTimePicker = this.rootElement.$('.mat-datetimepicker-toggle'); + this.datePicker = this.rootElement.$('.mat-datepicker-toggle'); } } - async setTodayDateTimeValue(): Promise { - await BrowserActions.click(this.dateTimePicker); - await this.dateTime.waitTillDateDisplayed(); - await this.dateTime.setToday(); - await this.dateTime.setTime(); - } - async setTodayDateValue(): Promise { - await BrowserActions.click(this.dateTimePicker); + await BrowserActions.click(this.datePicker); await this.dateTime.waitTillDateDisplayed(); await this.dateTime.setToday(); } async setDate(date?: string): Promise { - await BrowserActions.click(this.dateTimePicker); + await BrowserActions.click(this.datePicker); return this.dateTime.setDate(date); } - async clickDateTimePicker(): Promise { + async clickDatePicker(): Promise { await BrowserActions.click(this.datePicker); }