Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 0 additions & 102 deletions e2e/testcafe-devextreme/tests/scheduler/common/deleteAppointments.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,18 @@ export class PopupModel {
return this.queries.getByRole('button', { name: 'Edit series' }) as HTMLElement;
}

get deleteSeriesButton(): HTMLElement {
return this.queries.getByRole('button', { name: 'Delete series' }) as HTMLElement;
}

get editAppointmentButton(): HTMLElement {
return this.queries.getByRole('button', { name: 'Edit appointment' }) as HTMLElement;
}

get deleteAppointmentButton(): HTMLElement {
return this.queries.getByRole('button', { name: 'Delete appointment' }) as HTMLElement;
}

get recurrenceSettingsButton(): HTMLElement {
return queryRequiredElement(this.element, '.dx-scheduler-form-recurrence-settings-button');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { POPUP_DIALOG_CLASS } from '../../../m_scheduler';
import type { AppointmentModel } from './appointment';
import { createAppointmentModel } from './appointment';
import { PopupModel } from './popup';
import { TooltipModel } from './tooltip';

const getTexts = (
cells: ArrayLike<Element>,
Expand All @@ -25,6 +26,10 @@ export class SchedulerModel {
return this.getPopup();
}

get tooltip(): TooltipModel {
return new TooltipModel();
}

get toolbar(): ToolbarModel {
return new ToolbarModel(this.queries.getByRole('toolbar'));
}
Expand Down Expand Up @@ -55,6 +60,17 @@ export class SchedulerModel {
return getTexts(collectors);
}

getCollectorButton(index = 0): HTMLElement {
const allButtons = this.queries.queryAllByRole('button') as HTMLElement[];
const collectors = allButtons.filter((btn) => btn.classList.contains('dx-scheduler-appointment-collector'));

if (collectors.length === 0) {
throw new Error('Collector button not found');
}

return collectors[index];
}

getDateTableContent(): string[] {
const cells = this.container.querySelectorAll('.dx-scheduler-date-table-cell');
return getTexts(cells);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { within } from '@testing-library/dom';

const TOOLTIP_WRAPPER_SELECTOR = '.dx-overlay-wrapper.dx-scheduler-appointment-tooltip-wrapper';

export class TooltipModel {
private get element(): HTMLElement | null {
return document.querySelector<HTMLElement>(TOOLTIP_WRAPPER_SELECTOR);
}

isVisible(): boolean {
return this.element !== null;
}

getScrollableContent(): Element | null {
return this.element?.querySelector('.dx-scrollable .dx-scrollview-content') ?? null;
}

getDeleteButton(index = 0): HTMLElement {
const tooltip = this.element;
const buttons = tooltip
? within(tooltip).queryAllByRole('button').filter((btn) => btn.classList.contains('dx-tooltip-appointment-item-delete-button'))
: [];

if (buttons.length === 0) {
throw new Error('Tooltip delete button not found');
}

return buttons[index];
}

getAppointmentItem(index = 0): HTMLElement | null {
const tooltip = this.element;
if (!tooltip) {
return null;
}
return within(tooltip).queryAllByRole('option')[index] ?? null;
}
}
Loading
Loading