Skip to content

Commit 867b734

Browse files
committed
fix testcafe tests
1 parent 6ea4af1 commit 867b734

3 files changed

Lines changed: 45 additions & 35 deletions

File tree

e2e/testcafe-devextreme/tests/scheduler/common/appointmentForm/form.visual.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ fixture.disablePageReloads`Appointment Form: Main Form`
1313
const SCHEDULER_SELECTOR = '#container';
1414

1515
const openAppointmentPopup = async (
16+
t: TestController,
1617
appointment: any,
18+
isRecurringAppointment: boolean,
1719
): Promise<AppointmentPopup> => {
1820
await ClientFunction((appointmentData) => {
1921
const instance = ($('#container') as any).dxScheduler('instance');
@@ -22,6 +24,10 @@ const openAppointmentPopup = async (
2224

2325
const scheduler = new Scheduler(SCHEDULER_SELECTOR);
2426

27+
if (isRecurringAppointment) {
28+
await t.click(Scheduler.getEditRecurrenceDialog().series);
29+
}
30+
2531
return scheduler.appointmentPopup;
2632
};
2733

@@ -56,10 +62,10 @@ const windowSize: [number, number] = [1500, 1500];
5662
[
5763
// 'generic.light',
5864
// 'generic.light.compact',
59-
'material.blue.light',
60-
'material.blue.light.compact',
61-
// 'fluent.blue.light',
62-
// 'fluent.blue.light.compact',
65+
// 'material.blue.light',
66+
// 'material.blue.light.compact',
67+
'fluent.blue.light',
68+
'fluent.blue.light.compact',
6369
].forEach((theme) => {
6470
[
6571
{ isRecurringAppointment: false, isAllDay: true },
@@ -81,23 +87,23 @@ const windowSize: [number, number] = [1500, 1500];
8187
safeSizeTest(`appointment main form (${theme})`, async (t) => {
8288
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
8389

84-
const appointmentPopup = await openAppointmentPopup(appointment);
90+
const appointmentPopup = await openAppointmentPopup(t, appointment, isRecurringAppointment);
8591

8692
await takeScreenshot(
8793
`scheduler__appointment__main-form.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
88-
appointmentPopup.popup.content,
94+
appointmentPopup.contentElement,
8995
);
9096

9197
await t
9298
.expect(compareResults.isValid())
9399
.ok(compareResults.errorMessages());
94-
}, windowSize).before(async () => {
100+
}).before(async () => {
95101
await changeTheme(theme);
96102
await createWidget('dxScheduler', {
97103
dataSource: [appointment],
98104
views: ['week'],
99105
currentView: 'week',
100-
currentDate: new Date(2021, 2, 25).toISOString(),
106+
currentDate: new Date(2021, 2, 25),
101107
});
102108
}).after(async () => {
103109
await changeTheme('generic.light');
@@ -106,11 +112,11 @@ const windowSize: [number, number] = [1500, 1500];
106112
safeSizeTest(`appointment main form with timezones (${theme})`, async (t) => {
107113
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
108114

109-
const appointmentPopup = await openAppointmentPopup(appointment);
115+
const appointmentPopup = await openAppointmentPopup(t, appointment, isRecurringAppointment);
110116

111117
await takeScreenshot(
112118
`scheduler__appointment__main-form__with-timezones.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
113-
appointmentPopup.popup.content,
119+
appointmentPopup.contentElement,
114120
);
115121

116122
await t
@@ -122,7 +128,7 @@ const windowSize: [number, number] = [1500, 1500];
122128
dataSource: [appointment],
123129
views: ['week'],
124130
currentView: 'week',
125-
currentDate: new Date(2021, 2, 25).toISOString(),
131+
currentDate: new Date(2021, 2, 25),
126132
editing: {
127133
allowTimeZoneEditing: true,
128134
},
@@ -134,11 +140,11 @@ const windowSize: [number, number] = [1500, 1500];
134140
safeSizeTest(`appointment main form with resources (${theme})`, async (t) => {
135141
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
136142

137-
const appointmentPopup = await openAppointmentPopup(appointment);
143+
const appointmentPopup = await openAppointmentPopup(t, appointment, isRecurringAppointment);
138144

139145
await takeScreenshot(
140146
`scheduler__appointment__main-form__with-resources.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
141-
appointmentPopup.popup.content,
147+
appointmentPopup.contentElement,
142148
);
143149

144150
await t
@@ -150,7 +156,7 @@ const windowSize: [number, number] = [1500, 1500];
150156
dataSource: [appointment],
151157
views: ['week'],
152158
currentView: 'week',
153-
currentDate: new Date(2021, 2, 25).toISOString(),
159+
currentDate: new Date(2021, 2, 25),
154160
resources: getResources(),
155161
});
156162
}).after(async () => {
@@ -160,11 +166,11 @@ const windowSize: [number, number] = [1500, 1500];
160166
safeSizeTest(`appointment main form with resources and timezones (${theme})`, async (t) => {
161167
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
162168

163-
const appointmentPopup = await openAppointmentPopup(appointment);
169+
const appointmentPopup = await openAppointmentPopup(t, appointment, isRecurringAppointment);
164170

165171
await takeScreenshot(
166172
`scheduler__appointment__main-form__with-resources-and-timezones.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
167-
appointmentPopup.popup.content,
173+
appointmentPopup.contentElement,
168174
);
169175

170176
await t
@@ -176,7 +182,7 @@ const windowSize: [number, number] = [1500, 1500];
176182
dataSource: [appointment],
177183
views: ['week'],
178184
currentView: 'week',
179-
currentDate: new Date(2021, 2, 25).toISOString(),
185+
currentDate: new Date(2021, 2, 25),
180186
resources: getResources(),
181187
editing: {
182188
allowTimeZoneEditing: true,

e2e/testcafe-devextreme/tests/scheduler/common/layout/appointments/disable.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import url from '../../../../../helpers/getPageUrl';
66
fixture.disablePageReloads`Layout:Appointments:disable`
77
.page(url(__dirname, '../../../../container.html'));
88

9-
test('Legacy Popup - Appointment popup should be readOnly if appointment is disabled', async (t) => {
9+
test('Appointment popup should be readOnly if appointment is disabled', async (t) => {
1010
const scheduler = new Scheduler('#container');
1111
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
1212
const { appointmentPopup } = scheduler;
@@ -15,25 +15,25 @@ test('Legacy Popup - Appointment popup should be readOnly if appointment is disa
1515

1616
await t.click(scheduler.getAppointment('A', 0).element)
1717
.click(scheduler.appointmentTooltip.getListItem('A').element)
18-
.expect(await takeScreenshot('disabled-appointment.png', appointmentPopup.popup.content)).ok();
18+
.expect(await takeScreenshot('disabled-appointment.png', appointmentPopup.contentElement)).ok();
1919

2020
await t.click(appointmentPopup.cancelButton.element);
2121

2222
await t.click(scheduler.getAppointment('B').element)
2323
.click(scheduler.appointmentTooltip.getListItem('B').element)
24-
.expect(await takeScreenshot('enabled-appointment.png', appointmentPopup.popup.content)).ok();
24+
.expect(await takeScreenshot('enabled-appointment.png', appointmentPopup.contentElement)).ok();
2525

2626
await t.click(appointmentPopup.cancelButton.element);
2727

2828
await t.click(scheduler.getAppointment('C').element)
2929
.click(scheduler.appointmentTooltip.getListItem('C').element)
30-
.expect(await takeScreenshot('disabled-by-function-appointment.png', appointmentPopup.popup.content)).ok();
30+
.expect(await takeScreenshot('disabled-by-function-appointment.png', appointmentPopup.contentElement)).ok();
3131

3232
await t.click(appointmentPopup.cancelButton.element);
3333

3434
await t.click(scheduler.getAppointment('D').element)
3535
.click(scheduler.appointmentTooltip.getListItem('D').element)
36-
.expect(await takeScreenshot('enabled-by-function-appointment.png', appointmentPopup.popup.content)).ok();
36+
.expect(await takeScreenshot('enabled-by-function-appointment.png', appointmentPopup.contentElement)).ok();
3737

3838
await t.click(appointmentPopup.cancelButton.element);
3939

packages/testcafe-models/scheduler/appointment/popup.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import Button from '../../button';
99

1010
export const SELECTORS = {
1111
appointmentPopup: `.dx-scheduler-appointment-popup.dx-popup.dx-widget`,
12+
appointmentPopupContent: '.dx-scheduler-appointment-popup .dx-overlay-content',
13+
appointmentPopupToolbar: '.dx-scheduler-appointment-popup .dx-popup-title',
1214
form: `.dx-scheduler-form`,
1315
doneButton: `.dx-popup-done.dx-button.dx-widget`,
1416
cancelButton: `.dx-popup-cancel.dx-button.dx-widget`,
@@ -26,27 +28,29 @@ export const SELECTORS = {
2628

2729
export default class AppointmentPopup {
2830
popup: Popup = new Popup(SELECTORS.appointmentPopup);
31+
contentElement: Selector = Selector(SELECTORS.appointmentPopupContent);
32+
toolbarElement: Selector = Selector(SELECTORS.appointmentPopupToolbar);
2933

30-
saveButton: Button = new Button(this.popup.getToolbar().find(SELECTORS.doneButton));
31-
cancelButton: Button = new Button(this.popup.getToolbar().find(SELECTORS.cancelButton));
34+
saveButton: Button = new Button(this.toolbarElement.find(SELECTORS.doneButton));
35+
cancelButton: Button = new Button(this.toolbarElement.find(SELECTORS.cancelButton));
3236

33-
form: Form = new Form(this.popup.content.find(SELECTORS.form));
37+
form: Form = new Form(this.contentElement.find(SELECTORS.form));
3438

35-
textEditor: TextBox = new TextBox(this.popup.content.find(SELECTORS.textEditor));
39+
textEditor: TextBox = new TextBox(this.contentElement.find(SELECTORS.textEditor));
3640

37-
allDaySwitch: Selector = Selector(this.popup.content.find(SELECTORS.allDaySwitch));
41+
allDaySwitch: Selector = Selector(this.contentElement.find(SELECTORS.allDaySwitch));
3842

39-
startDateEditor: DateBox = new DateBox(this.popup.content.find(SELECTORS.startDateEditor));
40-
startTimeEditor: DateBox = new DateBox(this.popup.content.find(SELECTORS.startTimeEditor));
41-
startTimeZoneEditor: SelectBox = new SelectBox(this.popup.content.find(SELECTORS.startTimeZoneEditor));
43+
startDateEditor: DateBox = new DateBox(this.contentElement.find(SELECTORS.startDateEditor));
44+
startTimeEditor: DateBox = new DateBox(this.contentElement.find(SELECTORS.startTimeEditor));
45+
startTimeZoneEditor: SelectBox = new SelectBox(this.contentElement.find(SELECTORS.startTimeZoneEditor));
4246

43-
endDateEditor: DateBox = new DateBox(this.popup.content.find(SELECTORS.endDateEditor));
44-
endTimeEditor: DateBox = new DateBox(this.popup.content.find(SELECTORS.endTimeEditor));
45-
endTimeZoneEditor: SelectBox = new SelectBox(this.popup.content.find(SELECTORS.endTimeZoneEditor));
47+
endDateEditor: DateBox = new DateBox(this.contentElement.find(SELECTORS.endDateEditor));
48+
endTimeEditor: DateBox = new DateBox(this.contentElement.find(SELECTORS.endTimeEditor));
49+
endTimeZoneEditor: SelectBox = new SelectBox(this.contentElement.find(SELECTORS.endTimeZoneEditor));
4650

47-
repeatEditor: SelectBox = new SelectBox(this.popup.content.find(SELECTORS.repeatEditor));
51+
repeatEditor: SelectBox = new SelectBox(this.contentElement.find(SELECTORS.repeatEditor));
4852

49-
descriptionEditor: TextArea = new TextArea(this.popup.content.find(SELECTORS.descriptionEditor));
53+
descriptionEditor: TextArea = new TextArea(this.contentElement.find(SELECTORS.descriptionEditor));
5054

5155
constructor(private readonly scheduler: Selector) { }
5256
}

0 commit comments

Comments
 (0)