-
Notifications
You must be signed in to change notification settings - Fork 670
Grids - Stabilize tests (Part 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
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'; | ||
|
|
||
|
|
@@ -36,6 +37,8 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| } | ||
|
|
||
| await triggerDragEnd(columnElement); | ||
| }).before(async () => createWidget('dxCardView', { | ||
| allowColumnReordering, | ||
| columns: [{ | ||
|
|
@@ -66,6 +69,8 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` | |
| } else { | ||
| await t.expect(draggingElement.exists).notOk(); | ||
| } | ||
|
|
||
| await triggerDragEnd(columnElement); | ||
| }).before(async () => createWidget('dxCardView', { | ||
| allowColumnReordering: true, | ||
| columns: [{ | ||
|
|
@@ -102,18 +107,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 +129,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 |
|---|---|---|
|
|
@@ -7,22 +7,39 @@ import { testScreenshot } from '../../../helpers/themeUtils'; | |
| fixture.disablePageReloads`Toasts in TreeList` | ||
| .page(url(__dirname, '../../container.html')); | ||
|
|
||
| test('Toast should be visible after calling and should be not visible after default display time', async (t) => { | ||
| test('Toast should be visible after calling', async (t) => { | ||
| const treeList = new TreeList('#container'); | ||
| const { takeScreenshot, compareResults } = createScreenshotsComparer(t); | ||
| await t | ||
| .expect(treeList.isReady()) | ||
| .ok(); | ||
|
|
||
| await treeList.apiShowErrorToast(); | ||
| await treeList.apiShowErrorToast({ displayTime: 100000 }); | ||
|
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. toast could disappear before the screenshot is taken, which can lead to instability. So I have added more display time |
||
| await t.expect(treeList.getToast().exists).ok(); | ||
|
|
||
| await testScreenshot(t, takeScreenshot, 'ai-column__toast__at-the-right-position.png', { element: treeList.element }); | ||
|
|
||
| await t | ||
| .expect(compareResults.isValid()) | ||
| .ok(compareResults.errorMessages()); | ||
| await t.expect(treeList.getToast().exists).notOk(); | ||
| }).before(async () => { | ||
| await createWidget('dxTreeList', {}); | ||
| }); | ||
|
|
||
| test('Toast should hide after the display time', async (t) => { | ||
| const treeList = new TreeList('#container'); | ||
|
|
||
| await t | ||
| .expect(treeList.isReady()) | ||
| .ok(); | ||
|
|
||
| await treeList.apiShowErrorToast({ displayTime: 1000 }); | ||
| await t | ||
| .expect(treeList.getToast().exists).ok(); | ||
|
|
||
| await t | ||
| .wait(1000) | ||
| .expect(treeList.getToast().exists).notOk(); | ||
| }).before(async () => { | ||
| await createWidget('dxTreeList', {}); | ||
| }); | ||
| 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,16 +43,12 @@ 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(dataGrid.getLoadPanel().isVisible()) | ||
| .ok(); | ||
|
Comment on lines
-49
to
-51
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. race condition: load panel can hide before this check runs. The test name doesn't suggest that load panel has to be checked, so I have removed this expect |
||
|
|
||
| // act | ||
| await t.expect(isAIRequestPending()).ok(); | ||
| await resolveAIRequest(); | ||
|
|
||
| // assert | ||
|
|
@@ -76,6 +74,7 @@ test.meta({ unstable: true })('DataGrid should send an AI request for rendered r | |
| .ok(); | ||
|
|
||
| // act | ||
| await t.expect(isAIRequestPending()).ok(); | ||
| await resolveAIRequest(); | ||
|
|
||
| // assert | ||
|
|
@@ -144,16 +143,12 @@ 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) => { | ||
| // arrange | ||
| const dataGrid = new DataGrid(DATA_GRID_SELECTOR); | ||
|
|
||
| // assert | ||
| await t | ||
| .expect(dataGrid.getLoadPanel().isVisible()) | ||
| .ok(); | ||
|
|
||
| // act | ||
| await t.expect(isAIRequestPending()).ok(); | ||
| await resolveAIRequest(); | ||
|
|
||
| // assert | ||
|
|
@@ -179,6 +174,7 @@ test.meta({ unstable: true })('DataGrid should send an AI request for rendered r | |
| .ok(); | ||
|
|
||
| // act | ||
| await t.expect(isAIRequestPending()).ok(); | ||
| await resolveAIRequest(); | ||
|
|
||
| // assert | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,11 +245,15 @@ test('It should not fire row events if focusedRowEnabled: false', async (t) => { | |
| await clearCallbackTesting(); | ||
| }); | ||
|
|
||
| test.meta({ unstable: true })('It should fire rowChanged event on initialization if focusedRowKey options is set', async (t) => { | ||
| test('It should fire rowChanged event on initialization if focusedRowKey options is set', async (t) => { | ||
| const dataGrid = new DataGrid(GRID_SELECTOR); | ||
|
|
||
| const expectedRowFocusChanged: FocusRowChangedData[] = [ | ||
| [1], | ||
| ]; | ||
|
|
||
| await t.expect(dataGrid.getDataRow(1).element).ok(); | ||
|
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. wait for the row to appear before checking callback results |
||
|
|
||
| const [ | ||
| , | ||
| , | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
This test was stable, but page reloads are disabled in this fixture, so to prevent any leakage between tests I have added this.