-
Notifications
You must be signed in to change notification settings - Fork 671
Grids - Stabilize tests (Part 2 & 3) #34221
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: main
Are you sure you want to change the base?
Changes from all commits
fb68eca
566518c
d1bbc32
a62c9f1
ee84401
6c0a5d6
dad40bc
9bab139
7ac8962
2b141b1
c419f90
4603c3a
f0030a7
16ebd6e
4f896a3
cdf9d31
4b23b81
230ea5e
a969b23
ffc7033
4f7410d
16c6d6f
c225896
b8faee4
f9bb795
7555c1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ import { | |
| expectColumns, | ||
| getColumnItem, | ||
| triggerDragStart, | ||
| triggerDragEnd, | ||
| SELECTORS, | ||
| } from './utils'; | ||
|
|
||
|
|
@@ -29,12 +30,16 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
|
|
||
| await triggerDragStart(columnElement); | ||
|
|
||
| const draggingElement = Selector(SELECTORS.dragging); | ||
| try { | ||
| const draggingElement = Selector(SELECTORS.dragging); | ||
|
|
||
| if (result) { | ||
| await t.expect(draggingElement.exists).ok(); | ||
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| if (result) { | ||
| await t.expect(draggingElement.exists).ok(); | ||
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| } | ||
| } finally { | ||
| await triggerDragEnd(columnElement); | ||
| } | ||
| }).before(async () => createWidget('dxCardView', { | ||
| allowColumnReordering, | ||
|
|
@@ -59,12 +64,16 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
|
|
||
| await triggerDragStart(columnElement); | ||
|
|
||
| const draggingElement = Selector(SELECTORS.dragging); | ||
| try { | ||
| const draggingElement = Selector(SELECTORS.dragging); | ||
|
|
||
| if (result) { | ||
| await t.expect(draggingElement.exists).ok(); | ||
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| if (result) { | ||
| await t.expect(draggingElement.exists).ok(); | ||
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| } | ||
| } finally { | ||
| await triggerDragEnd(columnElement); | ||
| } | ||
| }).before(async () => createWidget('dxCardView', { | ||
| allowColumnReordering: true, | ||
|
|
@@ -102,18 +111,18 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
|
|
||
| [0, 1].forEach((columnIndex) => { | ||
| [0, 1, 2].forEach((gapIndex) => { | ||
| test.meta({ unstable: true })(`drag from columnChooser to headerPanel: from index ${columnIndex} to index ${gapIndex}`, async (t) => { | ||
| test(`drag from columnChooser to headerPanel: from index ${columnIndex} to index ${gapIndex}`, async (t) => { | ||
| const cardView = new CardView('#container'); | ||
| await cardView.apiShowColumnChooser(); | ||
|
|
||
| const columnElement = getColumnItem(cardView, columnIndex, 'columnChooser'); | ||
|
|
||
| await dragToHeaderPanel(t, cardView, columnElement, gapIndex); | ||
|
|
||
| const headerPanelColumns = [2, 3, 4]; | ||
| const headerPanelColumns = [2, 3]; | ||
| headerPanelColumns.splice(gapIndex, 0, columnIndex); | ||
|
|
||
| const chooserColumns = [0, 1, 2, 3, 4].filter((c) => !headerPanelColumns.includes(c)); | ||
| const chooserColumns = [0, 1].filter((c) => c !== columnIndex); | ||
|
|
||
| await expectColumns(t, cardView, headerPanelColumns); | ||
| await expectColumns(t, cardView, chooserColumns, 'columnChooser'); | ||
|
|
@@ -124,7 +133,6 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
| { dataField: 'Column 1', visible: false }, | ||
| { dataField: 'Column 2' }, | ||
| { dataField: 'Column 3' }, | ||
| { dataField: 'Column 4' }, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This matrix tests iterates through [0, 1, 2] for gapIndex. With 4 columns, testcases for gapIndex==1 and gapIndex==2 basically test the same thing: drag from column chooser to the middle of header panel. With 3 columns, gapIndex==2 now checks the case when column is dragged to the end of header panel |
||
| ], | ||
| })); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ const checkAIColumnTexts = async ( | |
| } | ||
| }; | ||
|
|
||
| const isAIRequestPending = ClientFunction(() => !!(window as any).aiResolve); | ||
|
|
||
| const resolveAIRequest = ClientFunction((): void => { | ||
| const { aiResponseData } = (window as any); | ||
| const { aiResolve } = (window as any); | ||
|
|
@@ -41,12 +43,14 @@ const deleteGlobalVariables = ClientFunction((): void => { | |
| delete (window as any).aiResolve; | ||
| }); | ||
|
|
||
| test.meta({ unstable: true })('DataGrid should send an AI request for rendered rows after scrolling without changing the page index', async (t) => { | ||
| test('DataGrid should send an AI request for rendered rows after scrolling without changing the page index', async (t) => { | ||
| // arrange | ||
| const dataGrid = new DataGrid(DATA_GRID_SELECTOR); | ||
|
|
||
| // assert | ||
| await t | ||
| .expect(isAIRequestPending()) | ||
| .ok() | ||
| .expect(dataGrid.getLoadPanel().isVisible()) | ||
| .ok(); | ||
|
|
||
|
|
@@ -72,6 +76,8 @@ test.meta({ unstable: true })('DataGrid should send an AI request for rendered r | |
| .eql(0) | ||
| .expect(dataGrid.getDataCell(20, 0).element.textContent) | ||
| .eql('21') | ||
| .expect(isAIRequestPending()) | ||
| .ok() | ||
| .expect(dataGrid.getLoadPanel().isVisible()) | ||
| .ok(); | ||
|
|
||
|
|
@@ -144,13 +150,15 @@ test.meta({ unstable: true })('DataGrid should send an AI request for rendered r | |
| await deleteGlobalVariables(); | ||
| }); | ||
|
|
||
| test.meta({ unstable: true })('DataGrid should send an AI request for rendered rows after scrolling with changing the page index', async (t) => { | ||
| test('DataGrid should send an AI request for rendered rows after scrolling with changing the page index', async (t) => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same questions apply as in the previous test (see above).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
| // arrange | ||
| const dataGrid = new DataGrid(DATA_GRID_SELECTOR); | ||
|
|
||
| // assert | ||
| await t | ||
| .expect(dataGrid.getLoadPanel().isVisible()) | ||
| .ok() | ||
| .expect(isAIRequestPending()) | ||
| .ok(); | ||
|
|
||
| // act | ||
|
|
@@ -175,6 +183,8 @@ test.meta({ unstable: true })('DataGrid should send an AI request for rendered r | |
| .eql(1) | ||
| .expect(dataGrid.getDataCell(20, 0).element.textContent) | ||
| .eql('21') | ||
| .expect(isAIRequestPending()) | ||
| .ok() | ||
| .expect(dataGrid.getLoadPanel().isVisible()) | ||
| .ok(); | ||
|
|
||
|
|
||
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.
Shouldn't we check isReady here? Also, shouldn't we verify that the Column Chooser exists before accessing it?
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.
isReady won't help here, because it indicates whether dataController finished loading data:
DevExtreme/packages/devextreme/js/__internal/grids/grid_core/data_controller/m_data_controller.ts
Line 389 in 4f7410d
In this test we don't care whether the data was loaded or not. Explicit wait for column chooser is also not needed, because there's an implement check:
const columnElement = getColumnItem(cardView, columnIndex, 'columnChooser');. Column element is a testcafe Selector, so testcafe will wait for the element to appear before doing anything with it