Skip to content

Commit 7edd33a

Browse files
committed
use legacyForm option in legacy tests
update pom testcafe tests use legacyForm option fix testcafe tests
1 parent fbe2c0c commit 7edd33a

32 files changed

Lines changed: 442 additions & 222 deletions

File tree

e2e/testcafe-devextreme/tests/scheduler/common/a11y/legacyPopup.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test('Scheduler edit appointment is accessible', async (t) => {
1616
const scheduler = new Scheduler('#container');
1717

1818
await t.doubleClick(scheduler.getAppointmentByIndex(0).element());
19-
await t.expect(scheduler.appointmentPopup.isVisible()).ok();
19+
await t.expect(scheduler.legacyAppointmentPopup.isVisible()).ok();
2020

2121
await a11yCheck(t, checkOptions, '#container');
2222
}).before(async () => {
@@ -28,6 +28,7 @@ test('Scheduler edit appointment is accessible', async (t) => {
2828
endDate: new Date('2021-03-29T22:30:00.000Z'),
2929
recurrenceRule: 'FREQ=DAILY',
3030
}],
31+
editing: { legacyForm: true },
3132
recurrenceEditMode: 'series',
3233
currentView: 'week',
3334
currentDate: new Date(2021, 2, 28),
@@ -37,20 +38,20 @@ test('Scheduler edit appointment is accessible', async (t) => {
3738
test('Scheduler recurrence editor repeat end accessible', async (t) => {
3839
const scheduler = new Scheduler('#container');
3940
const getItem = (index: number) => scheduler
40-
.appointmentPopup
41+
.legacyAppointmentPopup
4142
.getEndRepeatRadioButton(index);
4243
const getAriaLabel = (index: number) => getItem(index)
4344
.getAttribute('aria-label');
4445

4546
await t.doubleClick(scheduler.getAppointmentByIndex(0).element());
46-
await t.expect(scheduler.appointmentPopup.isVisible()).ok();
47+
await t.expect(scheduler.legacyAppointmentPopup.isVisible()).ok();
4748

4849
await t
4950
.expect(getAriaLabel(1))
5051
.eql('On 22 May 2025')
5152
.expect(getAriaLabel(2))
5253
.eql('After')
53-
.typeText(scheduler.appointmentPopup.repeatUntilElement, '2026')
54+
.typeText(scheduler.legacyAppointmentPopup.repeatUntilElement, '2026')
5455
.click(getItem(1)) // unfocus input
5556
.expect(getAriaLabel(1))
5657
.eql('On 22 May 2026')
@@ -68,7 +69,7 @@ test('Scheduler recurrence editor repeat end accessible', async (t) => {
6869
.eql('On')
6970
.expect(getAriaLabel(2))
7071
.eql('After 1 occurrence(s)')
71-
.typeText(scheduler.appointmentPopup.repeatCountElement, '3')
72+
.typeText(scheduler.legacyAppointmentPopup.repeatCountElement, '3')
7273
.click(getItem(2)) // unfocus input
7374
.expect(getAriaLabel(1))
7475
.eql('On')
@@ -77,6 +78,7 @@ test('Scheduler recurrence editor repeat end accessible', async (t) => {
7778
}).before(async () => {
7879
await createWidget('dxScheduler', {
7980
timeZone: 'America/Los_Angeles',
81+
editing: { legacyForm: true },
8082
dataSource: [{
8183
text: 'Install New Router in Dev Room',
8284
startDate: new Date('2021-03-29T21:30:00.000Z'),

e2e/testcafe-devextreme/tests/scheduler/common/agenda/keyField.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ test('Wrong behavior: editing recurrence appointment does not affect to appointm
122122

123123
await t.doubleClick(scheduler.getAppointment('Test').element);
124124
await t
125-
.typeText(scheduler.appointmentPopup.subjectElement, 'Updated', { replace: true })
126-
.click(scheduler.appointmentPopup.doneButton);
125+
.typeText(scheduler.appointmentPopup.textEditor.element, 'Updated', { replace: true })
126+
.click(scheduler.appointmentPopup.saveButton.element);
127127

128128
await t.expect(scheduler.getAppointment('Updated').element.exists).notOk();
129129
// TODO: In correct behavior, expected assert is ok()
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
import Scheduler from 'devextreme-testcafe-models/scheduler';
2+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
3+
import AppointmentPopup from 'devextreme-testcafe-models/scheduler/appointment/popup';
4+
import { ClientFunction } from 'testcafe';
5+
import { createWidget } from '../../../../helpers/createWidget';
6+
import url from '../../../../helpers/getPageUrl';
7+
import { changeTheme } from '../../../../helpers/changeTheme';
8+
import { safeSizeTest } from '../../../../helpers/safeSizeTest';
9+
10+
fixture.disablePageReloads`Appointment Form: Main Form`
11+
.page(url(__dirname, '../../../container.html'));
12+
13+
const SCHEDULER_SELECTOR = '#container';
14+
15+
const openAppointmentPopup = async (
16+
appointment: any,
17+
): Promise<AppointmentPopup> => {
18+
await ClientFunction((appointmentData) => {
19+
const instance = ($('#container') as any).dxScheduler('instance');
20+
instance.showAppointmentPopup(appointmentData);
21+
})(appointment);
22+
23+
const scheduler = new Scheduler(SCHEDULER_SELECTOR);
24+
25+
return scheduler.appointmentPopup;
26+
};
27+
28+
const getResources = () => ([
29+
{
30+
fieldExpr: 'assigneeId',
31+
allowMultiple: true,
32+
label: 'Assignee',
33+
dataSource: [
34+
{ text: 'Samantha Bright', id: 1, color: '#727bd2' },
35+
{ text: 'John Heart', id: 2, color: '#32c9ed' },
36+
],
37+
},
38+
{
39+
fieldExpr: 'roomId',
40+
label: 'Room',
41+
dataSource: [
42+
{ text: 'Room 1', id: 1, color: '#00af2c' },
43+
],
44+
},
45+
{
46+
fieldExpr: 'priorityId',
47+
label: 'Priority',
48+
dataSource: [
49+
{ text: 'High', id: 1, color: '#cc5c53' },
50+
],
51+
},
52+
]);
53+
54+
['generic.light', 'material.blue.light', 'fluent.blue.light'].forEach((theme) => {
55+
[
56+
{ isRecurringAppointment: false, isAllDay: true },
57+
{ isRecurringAppointment: false, isAllDay: false },
58+
{ isRecurringAppointment: true, isAllDay: true },
59+
{ isRecurringAppointment: true, isAllDay: false },
60+
].forEach(({ isRecurringAppointment, isAllDay }) => {
61+
const appointment = {
62+
text: 'Appointment',
63+
startDate: new Date('2021-04-26T16:30:00.000Z'),
64+
endDate: new Date('2021-04-26T18:30:00.000Z'),
65+
allDay: isAllDay,
66+
recurrenceRule: isRecurringAppointment ? 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10' : undefined,
67+
assigneeId: [1, 2],
68+
roomId: 1,
69+
priorityId: 1,
70+
};
71+
72+
safeSizeTest(`appointment main form (${theme})`, async (t) => {
73+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
74+
75+
const appointmentPopup = await openAppointmentPopup(appointment);
76+
77+
await takeScreenshot(
78+
`scheduler__appointment__main-form.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
79+
appointmentPopup.popup.content,
80+
);
81+
82+
await t
83+
.expect(compareResults.isValid())
84+
.ok(compareResults.errorMessages());
85+
}).before(async () => {
86+
await changeTheme(theme);
87+
await createWidget('dxScheduler', {
88+
dataSource: [appointment],
89+
views: ['week'],
90+
currentView: 'week',
91+
currentDate: new Date(2021, 2, 25).toISOString(),
92+
});
93+
});
94+
95+
safeSizeTest(`appointment main form with timezones (${theme})`, async (t) => {
96+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
97+
98+
const appointmentPopup = await openAppointmentPopup(appointment);
99+
100+
await takeScreenshot(
101+
`scheduler__appointment__main-form__with-timezones.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
102+
appointmentPopup.popup.content,
103+
);
104+
105+
await t
106+
.expect(compareResults.isValid())
107+
.ok(compareResults.errorMessages());
108+
}).before(async () => {
109+
await changeTheme(theme);
110+
await createWidget('dxScheduler', {
111+
dataSource: [appointment],
112+
views: ['week'],
113+
currentView: 'week',
114+
currentDate: new Date(2021, 2, 25).toISOString(),
115+
editing: {
116+
allowTimeZoneEditing: true,
117+
},
118+
});
119+
});
120+
121+
safeSizeTest(`appointment main form with resources (${theme})`, async (t) => {
122+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
123+
124+
const appointmentPopup = await openAppointmentPopup(appointment);
125+
126+
await takeScreenshot(
127+
`scheduler__appointment__main-form__with-resources.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
128+
appointmentPopup.popup.content,
129+
);
130+
131+
await t
132+
.expect(compareResults.isValid())
133+
.ok(compareResults.errorMessages());
134+
}).before(async () => {
135+
await changeTheme(theme);
136+
await createWidget('dxScheduler', {
137+
dataSource: [appointment],
138+
views: ['week'],
139+
currentView: 'week',
140+
currentDate: new Date(2021, 2, 25).toISOString(),
141+
resources: getResources(),
142+
});
143+
});
144+
145+
safeSizeTest(`appointment main form with resources and timezones (${theme})`, async (t) => {
146+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
147+
148+
const appointmentPopup = await openAppointmentPopup(appointment);
149+
150+
await takeScreenshot(
151+
`scheduler__appointment__main-form__with-resources-and-timezones.png (recurring=${isRecurringAppointment},allDay=${isAllDay},theme=${theme})`,
152+
appointmentPopup.popup.content,
153+
);
154+
155+
await t
156+
.expect(compareResults.isValid())
157+
.ok(compareResults.errorMessages());
158+
}).before(async () => {
159+
await changeTheme(theme);
160+
await createWidget('dxScheduler', {
161+
dataSource: [appointment],
162+
views: ['week'],
163+
currentView: 'week',
164+
currentDate: new Date(2021, 2, 25).toISOString(),
165+
resources: getResources(),
166+
editing: {
167+
allowTimeZoneEditing: true,
168+
},
169+
});
170+
});
171+
});
172+
});

e2e/testcafe-devextreme/tests/scheduler/common/appointments/displayArguments.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ fixture.disablePageReloads`Display* arguments in appointment templates and event
1414
await t.doubleClick(scheduler.getDateTableCell(1, 0), { speed: 0.5 });
1515

1616
await t
17-
.typeText(scheduler.appointmentPopup.subjectElement, 'text')
18-
.click(scheduler.appointmentPopup.doneButton);
17+
.typeText(scheduler.appointmentPopup.textEditor.element, 'text')
18+
.click(scheduler.appointmentPopup.saveButton.element);
1919

2020
await t
2121
.expect(scheduler.getAppointmentByIndex(0).element.innerText)

e2e/testcafe-devextreme/tests/scheduler/common/appointments/legacyEditing.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ test('Should correctly update appointment if dataSource is a simple array', asyn
2121

2222
await t
2323
.doubleClick(appointment.element, CLICK_OPTIONS)
24-
.click(appointmentPopup.subjectElement)
25-
.typeText(appointmentPopup.subjectElement, ADDITIONAL_TITLE_TEXT)
26-
.expect(appointmentPopup.subjectElement.value)
24+
.click(appointmentPopup.textEditor.element)
25+
.typeText(appointmentPopup.textEditor.element, ADDITIONAL_TITLE_TEXT)
26+
.expect(appointmentPopup.textEditor.element.value)
2727
.eql(UPDATED_APPOINTMENT_TITLE)
28-
.click(appointmentPopup.doneButton)
28+
.click(appointmentPopup.saveButton.element)
2929
.expect(updatedAppointment.element.exists)
3030
.ok();
3131
}).before(async () => createWidget('dxScheduler', {
@@ -51,11 +51,11 @@ test('Should correctly update appointment if dataSource is a Store with key arra
5151

5252
await t
5353
.doubleClick(appointment.element, CLICK_OPTIONS)
54-
.click(appointmentPopup.subjectElement)
55-
.typeText(appointmentPopup.subjectElement, ADDITIONAL_TITLE_TEXT)
56-
.expect(appointmentPopup.subjectElement.value)
54+
.click(appointmentPopup.textEditor.element)
55+
.typeText(appointmentPopup.textEditor.element, ADDITIONAL_TITLE_TEXT)
56+
.expect(appointmentPopup.textEditor.element.value)
5757
.eql(UPDATED_APPOINTMENT_TITLE)
58-
.click(appointmentPopup.doneButton)
58+
.click(appointmentPopup.saveButton.element)
5959
.expect(updatedAppointment.element.exists)
6060
.ok();
6161
}).before(async () => {
@@ -100,7 +100,7 @@ test('Appointment EditForm screenshot', async (t) => {
100100
.expect(await takeScreenshot('appointment-popup-screenshot.png', appointment.element))
101101
.ok()
102102
// assert
103-
.expect(scheduler.appointmentPopup.element.exists)
103+
.expect(scheduler.appointmentPopup.popup.element.exists)
104104
.ok()
105105
.expect(compareResults.isValid())
106106
.ok(compareResults.errorMessages());

e2e/testcafe-devextreme/tests/scheduler/common/appointments/resources.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,10 @@ test('Scheduler should renders correctly if resource dataSource is not set', asy
106106
test('Resource with allowMultiple should be set correctly for new the appointment (T1075028)', async (t) => {
107107
const scheduler = new Scheduler('#container');
108108
const cell = scheduler.getDateTableCell(2, 0);
109-
const popup = scheduler.appointmentPopup;
110109

111110
await t
112111
.doubleClick(cell)
113-
.expect(popup.element.exists)
112+
.expect(scheduler.appointmentPopup.popup.isVisible())
114113
.ok();
115114

116115
const resourceTagBox = new TagBox('.dx-tagbox');

e2e/testcafe-devextreme/tests/scheduler/common/hotkeysBehaviour/hotkeysBehaviour.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fixture.disablePageReloads`Hotkeys for appointments update and navigation`
5757
.click(appointment.element)
5858
.expect(appointment.isFocused).ok()
5959
.pressKey('enter')
60-
.expect(appointmentPopup.isVisible())
60+
.expect(appointmentPopup.popup.isVisible())
6161
.ok();
6262
}).before(async () => createScheduler({
6363
views: [view],
@@ -83,7 +83,7 @@ fixture.disablePageReloads`Hotkeys for appointments update and navigation`
8383
.pressKey('enter')
8484
.expect(appointmentTooltip.isVisible())
8585
.notOk()
86-
.expect(appointmentPopup.isVisible())
86+
.expect(appointmentPopup.popup.isVisible())
8787
.ok();
8888
}).before(async () => createScheduler({
8989
views: [view],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('Appointment key should be deleted when removing an appointment from series
1313

1414
await t
1515
.doubleClick(scheduler.getAppointmentByIndex(1).element)
16-
.click(scheduler.appointmentPopup.doneButton)
16+
.click(scheduler.appointmentPopup.saveButton.element)
1717

1818
.expect(await takeScreenshot('exclude-appointment-from-series-via-form-editing.png', scheduler.workSpace))
1919
.ok()

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

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

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

1314
await t.expect(await takeScreenshot('disabled-appointments-in-grid.png')).ok();
1415

1516
await t.click(scheduler.getAppointment('A', 0).element)
1617
.click(scheduler.appointmentTooltip.getListItem('A').element)
17-
.expect(await takeScreenshot('disabled-appointment.png', scheduler.appointmentPopup.content)).ok();
18+
.expect(await takeScreenshot('disabled-appointment.png', appointmentPopup.popup.content)).ok();
1819

19-
await t.click(scheduler.appointmentPopup.cancelButton);
20+
await t.click(appointmentPopup.cancelButton.element);
2021

2122
await t.click(scheduler.getAppointment('B').element)
2223
.click(scheduler.appointmentTooltip.getListItem('B').element)
23-
.expect(await takeScreenshot('enabled-appointment.png', scheduler.appointmentPopup.content)).ok();
24+
.expect(await takeScreenshot('enabled-appointment.png', appointmentPopup.popup.content)).ok();
2425

25-
await t.click(scheduler.appointmentPopup.cancelButton);
26+
await t.click(appointmentPopup.cancelButton.element);
2627

2728
await t.click(scheduler.getAppointment('C').element)
2829
.click(scheduler.appointmentTooltip.getListItem('C').element)
29-
.expect(await takeScreenshot('disabled-by-function-appointment.png', scheduler.appointmentPopup.content)).ok();
30+
.expect(await takeScreenshot('disabled-by-function-appointment.png', appointmentPopup.popup.content)).ok();
3031

31-
await t.click(scheduler.appointmentPopup.cancelButton);
32+
await t.click(appointmentPopup.cancelButton.element);
3233

3334
await t.click(scheduler.getAppointment('D').element)
3435
.click(scheduler.appointmentTooltip.getListItem('D').element)
35-
.expect(await takeScreenshot('enabled-by-function-appointment.png', scheduler.appointmentPopup.content)).ok();
36+
.expect(await takeScreenshot('enabled-by-function-appointment.png', appointmentPopup.popup.content)).ok();
3637

37-
await t.click(scheduler.appointmentPopup.cancelButton);
38+
await t.click(appointmentPopup.cancelButton.element);
3839

3940
await t.expect(compareResults.isValid())
4041
.ok(compareResults.errorMessages());

0 commit comments

Comments
 (0)