Skip to content

Commit

Permalink
T1186741: Add test cases for scheduler custom dnd demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Vinogradov committed Sep 6, 2023
1 parent 3cb63d8 commit 173a58a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions testing/widgets/scheduler/customDragAndDrop.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { runManualTest } from '../../../utils/visual-tests/matrix-test-helper';
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';

const LIST_SELECTOR = '#list.dx-draggable';
const LIST_ITEM_SELECTOR = '.dx-card.dx-draggable';
const DATE_TABLE_CELL_SELECTOR = '.dx-scheduler-date-table .dx-scheduler-date-table-cell';
const ALL_DAY_PANEL_CELL_SELECTOR = '.dx-scheduler-all-day-table .dx-scheduler-all-day-table-cell';
const DATE_TABLE_APPOINTMENT_SELECTOR = '.dx-scheduler-date-table-container .dx-scheduler-appointment';
const ALL_DAY_PANEL_APPOINTMENT_SELECTOR = '.dx-scheduler-all-day-panel .dx-scheduler-appointment';

const DRAG_MOUSE_OPTIONS = { speed: 0.5 };

fixture('Scheduler.CustomDragAndDrop')
.page('http://localhost:8080/')
.beforeEach(async (t) => {
await t
.resizeWindow(900, 600);
});

[
[LIST_ITEM_SELECTOR, DATE_TABLE_CELL_SELECTOR, 'list', 'date-table'],
[DATE_TABLE_APPOINTMENT_SELECTOR, LIST_SELECTOR, 'date-table', 'list'],
[LIST_ITEM_SELECTOR, ALL_DAY_PANEL_CELL_SELECTOR, 'list', 'all-day-panel'],
[ALL_DAY_PANEL_APPOINTMENT_SELECTOR, LIST_SELECTOR, 'all-day-panel', 'list'],
].forEach(([
fromSelector,
toSelector,
fromName,
toName,
]) => {
runManualTest('Scheduler', 'CustomDragAndDrop', ['jQuery', 'React', 'Vue', 'Angular'], (test) => {
test(`Should drag-and-drop from ${fromName} to ${toName}`, async (t) => {
const {
takeScreenshot,
compareResults
} = createScreenshotsComparer(t);

await t.dragToElement(fromSelector, toSelector, DRAG_MOUSE_OPTIONS);
await takeScreenshot(`scheduler_custom-dnd_${fromName}_${toName}.png`);

await t
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
});
});
});

0 comments on commit 173a58a

Please sign in to comment.