-
Notifications
You must be signed in to change notification settings - Fork 667
Scheduler: Add testing library helper #32516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 26_1
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds Testing Library dependencies to the devextreme package and refactors Scheduler internal Jest test page-object models to use Testing Library (within + role-based queries) instead of direct CSS selectors.
Changes:
- Add
@testing-library/dom,@testing-library/jest-dom, and@testing-library/user-eventtopackages/devextremedevDependencies (and updatepnpm-lock.yaml). - Update Scheduler test POM models (
SchedulerModel,ToolbarModel,PopupModel) to usewithin(...)and role-based queries for key elements. - Adjust POM typing/lookup logic around appointments and toolbar elements.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pnpm-lock.yaml |
Adds lockfile entries for Testing Library packages. |
packages/devextreme/package.json |
Introduces Testing Library packages under devDependencies. |
packages/devextreme/js/__internal/scheduler/__tests__/__mock__/model/toolbar.ts |
Switches navigator button lookup to Testing Library role/name queries. |
packages/devextreme/js/__internal/scheduler/__tests__/__mock__/model/scheduler.ts |
Adds within(container) queries and refactors appointment/toolbar accessors. |
packages/devextreme/js/__internal/scheduler/__tests__/__mock__/model/popup.ts |
Uses Testing Library role/name queries for popup action buttons. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| "@testing-library/dom": "^10.4.0", | ||
| "@testing-library/jest-dom": "^6.6.3", | ||
| "@testing-library/user-event": "^14.5.2", |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly added Testing Library entries use caret ranges, while the rest of this package’s devDependencies are pinned to exact versions (or catalog:). To keep dependency resolution deterministic and consistent with existing conventions, please pin these to exact versions (and regenerate the lockfile accordingly).
| getPrevButton(): HTMLElement { | ||
| return this.queries.getByRole('button', { name: 'Previous page' }) as HTMLElement; | ||
| } | ||
|
|
||
| getNextButton(): HTMLDivElement | null | undefined { | ||
| return this.element?.querySelector('.dx-scheduler-navigator-next'); | ||
| getNextButton(): HTMLElement { | ||
| return this.queries.getByRole('button', { name: 'Next page' }) as HTMLElement; | ||
| } |
Copilot
AI
Feb 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getPrevButton/getNextButton hardcode English accessible names ('Previous page'/'Next page'). Since the actual aria-label is produced via localization (dxScheduler-navigationPrevious/dxScheduler-navigationNext in header/m_date_navigator.ts), this makes the test model brittle if message text or locale changes. Consider deriving the expected name via messageLocalization.format(...) (or reusing those keys/constants) instead of hardcoding the English strings.
No description provided.