[no-issue] fix share dialog test for scenario of last day of the month (#3937)

* fix share dialog test for scenario of last day of the month

* fix today and tomorrow

* remove fit

* fix spec share file

* use moment to calculate tomorrow
This commit is contained in:
Eugenio Romano 2018-11-02 14:01:50 +00:00 committed by GitHub
parent c10f2dc276
commit ee068db496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -17,6 +17,7 @@
import { element, by } from 'protractor';
import Util = require('../../../util/util');
import moment = require('moment');
import { FormControllersPage } from '../material/formControllersPage';
export class ShareDialog {
@ -110,16 +111,16 @@ export class ShareDialog {
this.timeDatePickerButton.click();
}
async calendarTodayDayIsDisabled() {
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
calendarTodayDayIsDisabled() {
const today = this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
Util.waitUntilElementIsPresent(element(by.cssContainingText('.mat-datetimepicker-calendar-body-disabled', today)));
}
async setDefaultDay() {
setDefaultDay() {
const selector = '.mat-datetimepicker-calendar-body-active .mat-datetimepicker-calendar-body-cell-content';
Util.waitUntilElementIsVisible(this.dayPicker);
const today = await this.dayPicker.element(by.css('.mat-datetimepicker-calendar-body-today')).getText();
const tomorrow = (parseInt(today, 10) + 1).toString();
const tomorrow = moment().add(1, 'day').date();
let tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000).getDate().toString();
this.dayPicker.element(by.cssContainingText(selector, tomorrow)).click();
}

View File

@ -118,7 +118,7 @@ describe('ShareDialogComponent', () => {
});
}));
it(`should copy shared link and notify on button event`, async(() => {
it(`should copy shared link and notify on button event`, (done) => {
node.entry.properties['qshare:sharedId'] = 'sharedId';
spyOn(document, 'execCommand').and.callThrough();
@ -139,8 +139,9 @@ describe('ShareDialogComponent', () => {
expect(document.execCommand).toHaveBeenCalledWith('copy');
expect(notificationServiceMock.openSnackMessage).toHaveBeenCalledWith('SHARE.CLIPBOARD-MESSAGE');
done();
});
});
}));
it('should open a confirmation dialog when unshare button is triggered', () => {
spyOn(matDialog, 'open').and.returnValue({ beforeClose: () => of(false) });