DataGrid - AI Assistant: Add e2e tests#33740
Closed
Alyar666 wants to merge 7 commits into
Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds end-to-end (TestCafe) coverage for the DataGrid AI Assistant feature, extending the existing TestCafe models to support new UI elements (suggestions/title) and introducing positive/negative functional scenarios.
Changes:
- Extended the
AIAssistantChatTestCafe model with selectors for suggestions and header/title access. - Added a large “positive cases” functional suite covering toolbar entry, command execution, suggestions, customization hooks, request-creating hook, and regenerate flow.
- Added a “negative cases” functional suite for empty actions, unknown fields, impossible state commands, and provider errors; also added new AI-assistant helper modules (currently unused).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/testcafe-models/dataGrid/aiAssistantChat.ts | Adds selectors/helpers for chat suggestions and title access (but currently breaks TS due to missing Selector import). |
| e2e/testcafe-devextreme/tests/dataGrid/common/aiAssistant/positiveCases.functional.ts | New comprehensive positive-path functional coverage for AI Assistant behaviors. |
| e2e/testcafe-devextreme/tests/dataGrid/common/aiAssistant/negativeCases.functional.ts | New negative-path functional coverage for AI Assistant error/edge scenarios. |
| e2e/testcafe-devextreme/tests/dataGrid/common/aiAssistant/helpers/testData.ts | Adds shared test data/grid config helpers (currently unused). |
| e2e/testcafe-devextreme/tests/dataGrid/common/aiAssistant/helpers/aiMock.ts | Adds AIIntegration mock helpers (currently unused; includes a doc example referencing a nonexistent helper). |
Comments suppressed due to low confidence (1)
packages/testcafe-models/dataGrid/aiAssistantChat.ts:35
Selectoris referenced in method signatures/returns (e.g.,getWrapper(): Selector) but it's no longer imported in this file, which will cause a TypeScript compile error. Add back an import (preferimport type { Selector } from 'testcafe';if it’s type-only).
export class AIAssistantChat extends Popup {
getWrapper(): Selector {
return this.element;
}
Comment on lines
+653
to
+656
| await t | ||
| .typeText(chat.getInput(), 'Sort by name') | ||
| .pressKey('enter'); | ||
|
|
Comment on lines
+1
to
+36
| export const GRID_SELECTOR = '#container'; | ||
|
|
||
| export const SIMPLE_DATA = [ | ||
| { id: 1, name: 'Alice', value: 30 }, | ||
| { id: 2, name: 'Bob', value: 20 }, | ||
| { id: 3, name: 'Charlie', value: 10 }, | ||
| ]; | ||
|
|
||
| export const PAGED_DATA = Array.from({ length: 20 }, (_, i) => ({ | ||
| id: i + 1, | ||
| name: `Name ${i + 1}`, | ||
| value: (i + 1) * 10, | ||
| })); | ||
|
|
||
| export const DEFAULT_COLUMNS = ['id', 'name', 'value']; | ||
|
|
||
| export function getBaseGridConfig(): Record<string, unknown> { | ||
| return { | ||
| dataSource: SIMPLE_DATA, | ||
| keyExpr: 'id', | ||
| columns: DEFAULT_COLUMNS, | ||
| showBorders: true, | ||
| }; | ||
| } | ||
|
|
||
| export function getPagedGridConfig(): Record<string, unknown> { | ||
| return { | ||
| dataSource: PAGED_DATA, | ||
| keyExpr: 'id', | ||
| columns: DEFAULT_COLUMNS, | ||
| showBorders: true, | ||
| paging: { | ||
| pageSize: 5, | ||
| }, | ||
| }; | ||
| } |
Comment on lines
+1
to
+6
| interface MockSendRequestOptions { | ||
| response?: Record<string, unknown>; | ||
| reject?: boolean; | ||
| error?: Error | string; | ||
| delay?: number; | ||
| } |
Comment on lines
+12
to
+19
| * @example | ||
| * ```ts | ||
| * await createWidget('dxDataGrid', () => ({ | ||
| * ...getGridConfig(), | ||
| * aiAssistant: { | ||
| * enabled: true, | ||
| * aiIntegration: createAIIntegrationMock({ | ||
| * response: { |
9885c51 to
2b3c2b5
Compare
Split positiveCases/negativeCases/edgeCases into functional-area files (toolbarAndPopup, commands, chatExperience, requestLifecycle, requestCustomization, regenerate, errorHandling) and extract shared constants into testHelpers.ts. No test behavior changed; all 86 pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add §4.1–§4.4 coverage to errorHandling.functional.ts: AI-integration failures, response-format and validation rejections, and per-command execution failures. Assert the predefined error text via a shared formatMessage helper (matched by localization key, not wording). 4.1.1 locks current behavior (shows invalid-response instead of the expected unexpected-error — issue 4284). Cases not reproducible through the public mock (sync throw, async reject, reentrancy) are documented inline. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add §5.1 cancellation cases (onAIAssistantRequestCreating cancel) to requestCustomization.functional.ts and a new interruption.functional.ts covering §5.2 (popup close mid-request, abort, ignored late resolution) and §5.5 (dispose mid-request/mid-execution, re-create after dispose). §5.3/§5.4 (close mid-execution) are documented as not e2e-reproducible (issue 4282 + synchronous command execution). 5.1.4 locks current behavior (cancel-aborted message shows Regenerate, cf. 1.12.11). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add treeList/aiAssistant/functional.ts verifying that grid_core AI Assistant commands behave identically on TreeList (sorting, searching, paging, column visibility, selection, row focusing), error paths and the in-flight lock, plus the TreeList-only schema differences (grouping and summary commands absent). Includes hierarchical-data cases. columnsReorder (issue 4294) and summary (unsupported) are documented as not exercised. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2b3c2b5 to
1553c73
Compare
| await t.expect(aiChat.getSuccessMessages().count).eql(0); | ||
| await t.expect(aiChat.getErrorMessages().count).eql(1); | ||
| await t.expect(aiChat.getErrorActionItems(0).count).eql(1); | ||
| await t.expect(dataSourceSortParams).eql(null); |
Comment on lines
+56
to
+59
| // eslint-disable-next-line class-methods-use-this | ||
| getAbortConfirmYesButton(): Selector { | ||
| return Selector(`.${CLASS.abortConfirmDialog} .dx-button`).withExactText('Yes'); | ||
| } |
Comment on lines
+69
to
+71
| getUserMessages(): Selector { | ||
| return this.getMessages().filter((node) => !node.querySelector('.dx-ai-chat__message')); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.