diff --git a/e2e/testcafe-devextreme/tests/cardView/columnChooser/functional.ts b/e2e/testcafe-devextreme/tests/cardView/columnChooser/functional.ts index aebcc8529d41..08425775c674 100644 --- a/e2e/testcafe-devextreme/tests/cardView/columnChooser/functional.ts +++ b/e2e/testcafe-devextreme/tests/cardView/columnChooser/functional.ts @@ -65,7 +65,6 @@ function testsFactory(testModel: { await testModel.assertFirstColumnHidden(t, cardView); await testModel.showFirstColumn(t, cardView); - await testModel.assertFirstColumnVisible(t, cardView); await testModel.hideFirstColumn(t, cardView); diff --git a/e2e/testcafe-devextreme/tests/cardView/columnSortable/functional.ts b/e2e/testcafe-devextreme/tests/cardView/columnSortable/functional.ts index 67cc6c0e00c9..af7bf3f3c99a 100644 --- a/e2e/testcafe-devextreme/tests/cardView/columnSortable/functional.ts +++ b/e2e/testcafe-devextreme/tests/cardView/columnSortable/functional.ts @@ -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,7 +111,7 @@ 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(); @@ -110,10 +119,10 @@ fixture.disablePageReloads`CardView - ColumnSortable.Functional` 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' }, ], })); }); diff --git a/e2e/testcafe-devextreme/tests/cardView/columnSortable/utils.ts b/e2e/testcafe-devextreme/tests/cardView/columnSortable/utils.ts index 1d9d654acc65..e69b369b3630 100644 --- a/e2e/testcafe-devextreme/tests/cardView/columnSortable/utils.ts +++ b/e2e/testcafe-devextreme/tests/cardView/columnSortable/utils.ts @@ -79,24 +79,26 @@ export const dragToHeaderPanel = async ( if (gapIndex < columnsNum) { const insertBeforeColumn = headers.getHeaderItemNth(gapIndex).element; + const { width } = await insertBeforeColumn.boundingClientRect; await t.dragToElement( columnElement, insertBeforeColumn, { - destinationOffsetX: 5, + destinationOffsetX: -(Math.floor(width) + 3), // 3px left of the left edge destinationOffsetY: HEADER_DROP_OFFSET_Y, speed: 0.5, }, ); } else { const insertAfterColumn = headers.getHeaderItemNth(columnsNum - 1).element; + const { width } = await insertAfterColumn.boundingClientRect; await t.dragToElement( columnElement, insertAfterColumn, { - destinationOffsetX: -5, + destinationOffsetX: (Math.floor(width) + 3), // 3px right of the right edge destinationOffsetY: HEADER_DROP_OFFSET_Y, speed: 0.5, }, @@ -119,6 +121,12 @@ export const dragToColumnChooser = async ( const treeView = columnChooser.element.find(SELECTORS.treeView); await t.dragToElement(columnElement, treeView); + + await t + .expect(Selector(SELECTORS.dragging).exists) + .notOk({ timeout: DRAG_ASSERTION_TIMEOUT }) + .expect(cardView.isReady()) + .ok({ timeout: DRAG_ASSERTION_TIMEOUT }); }; export const arrayMoveToGap = (arr: number[], index: number, gapIndex: number): number[] => { @@ -139,23 +147,20 @@ export const expectColumns = async ( expectedColumns: number[], source: 'headerPanel' | 'columnChooser' = 'headerPanel', ): Promise => { + const actualColumns: string[] = []; const adjustedExpectedColumns = expectedColumns.map((columnIndex) => `Column ${columnIndex}`); - for (let i = 0; i < expectedColumns.length; i += 1) { - // eslint-disable-next-line @typescript-eslint/init-declarations - let column: Selector; - - if (source === 'headerPanel') { - column = cardView.getHeaders().getHeaderItemNth(i)?.element; - } else { - const treeView = new TreeView(cardView.getColumnChooser().element.find(SELECTORS.treeView)); - column = treeView.getNodeItem(i); - } - - await t - .expect(column.exists) - .ok({ timeout: DRAG_ASSERTION_TIMEOUT }) - .expect(column.innerText) - .eql(adjustedExpectedColumns[i], { timeout: DRAG_ASSERTION_TIMEOUT }); + const actualColumnsCount = source === 'headerPanel' + ? await cardView.getHeaders().getHeaderItemsElements().count + : await cardView.getColumnChooser().getColumns().count; + + for (let i = 0; i < actualColumnsCount; i += 1) { + const column = source === 'headerPanel' + ? cardView.getHeaders().getHeaderItemNth(i).element + : cardView.getColumnChooser().getColumn(i); + + actualColumns.push(await column.innerText); } + + await t.expect(actualColumns).eql(adjustedExpectedColumns, 'Columns order should match'); }; diff --git a/e2e/testcafe-devextreme/tests/common/treeList/toast.ts b/e2e/testcafe-devextreme/tests/common/treeList/toast.ts index 93e47076e37a..cd77c12e53f3 100644 --- a/e2e/testcafe-devextreme/tests/common/treeList/toast.ts +++ b/e2e/testcafe-devextreme/tests/common/treeList/toast.ts @@ -1,19 +1,29 @@ import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; import TreeList from 'devextreme-testcafe-models/treeList'; +import { ClientFunction } from 'testcafe'; import url from '../../../helpers/getPageUrl'; import { createWidget } from '../../../helpers/createWidget'; import { testScreenshot } from '../../../helpers/themeUtils'; -fixture.disablePageReloads`Toasts in TreeList` +fixture`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) => { +const setToastDisplayTime = (displayTime: number) => ClientFunction(() => { + (window as any).DevExpress.ui.dxToast.defaultOptions({ + options: { + displayTime, + }, + }); +}, { dependencies: { displayTime } })(); + +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 setToastDisplayTime(100000); await treeList.apiShowErrorToast(); await t.expect(treeList.getToast().exists).ok(); @@ -22,7 +32,25 @@ test('Toast should be visible after calling and should be not visible after defa 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 setToastDisplayTime(100); + await treeList.apiShowErrorToast(); + await t + .expect(treeList.getToast().exists).ok(); + + await t + .wait(150) + .expect(treeList.getToast().exists).notOk(); }).before(async () => { await createWidget('dxTreeList', {}); }); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/aiColumn/virtualScrolling.functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/aiColumn/virtualScrolling.functional.ts index 08bb56bdc7fe..791c0c2237a1 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/aiColumn/virtualScrolling.functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/aiColumn/virtualScrolling.functional.ts @@ -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) => { // 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(); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/editing/editing.functional_matrix.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/editing/editing.functional_matrix.ts index 3ee950629fea..a666b25b0359 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/editing/editing.functional_matrix.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/editing/editing.functional_matrix.ts @@ -409,6 +409,7 @@ editingModes.forEach((mode) => { await clickCellEditor(t, mode, columnInfo, form, cell, editor); await setEditorValue(t, mode, columnInfo, editor, false, useMask); + await t.expect(dataGrid.isReady()).ok(); } const saveButton = getSaveButton(mode, form); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/editing/functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/editing/functional.ts index fbe068aeb6c5..4acd172ae7b2 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/editing/functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/editing/functional.ts @@ -68,9 +68,18 @@ test('DataGrid - The "Cannot read properties of undefined error" occurs when usi await t .click(dataGrid.getDataCell(0, 0).element) .typeText(dataGrid.getDataCell(0, 0).element, 'new_value') - .pressKey('enter tab tab'); + .pressKey('enter') + .expect(dataGrid.isReady()) + .ok() + .pressKey('tab tab') + .expect(dataGrid.getDataCell(2, 0).isFocused) + .ok(); + await resolveOnSavingDeferred(); - await t.expect(dataGrid.getDataCell(2, 0).isFocused).ok(); + + await t + .expect(dataGrid.isReady()).ok() + .expect(dataGrid.getDataCell(2, 0).isFocused).ok(); }).before(async () => { await ClientFunction(() => { (window as any).deferred = $.Deferred(); @@ -94,6 +103,10 @@ test('DataGrid - The "Cannot read properties of undefined error" occurs when usi e.promise = (window as any).deferred; }, }); +}).after(async () => { + await ClientFunction(() => { + delete (window as any).deferred; + })(); }); test('Tab key on editor should focus next cell if editing mode is cell', async (t) => { @@ -2318,7 +2331,9 @@ test('Cells should be focused correctly on click when cell editing mode is used .typeText(dataGrid.getDataCell(0, 0).getEditor().element, '1') .click(dataGrid.getDataCell(1, 0).getEditor().element); - await t.expect(getStoredName(1)).eql('Name 11'); + await t + .expect(dataGrid.isReady()).ok() + .expect(getStoredName(1)).eql('Name 11'); // assert await t @@ -2334,7 +2349,9 @@ test('Cells should be focused correctly on click when cell editing mode is used .typeText(dataGrid.getDataCell(1, 0).getEditor().element, '2') .click(dataGrid.getDataCell(2, 0).getEditor().element); - await t.expect(getStoredName(2)).eql('Name 22'); + await t + .expect(dataGrid.isReady()).ok() + .expect(getStoredName(2)).eql('Name 22'); // assert await t @@ -2343,6 +2360,8 @@ test('Cells should be focused correctly on click when cell editing mode is used .expect(dataGrid.getDataCell(2, 0).isFocused) .ok() .expect(dataGrid.getDataCell(2, 0).getEditor().element.focused) + .ok() + .expect(dataGrid.isReady()) .ok(); // act @@ -2350,7 +2369,9 @@ test('Cells should be focused correctly on click when cell editing mode is used .typeText(dataGrid.getDataCell(2, 0).getEditor().element, '3') .click(dataGrid.getDataCell(1, 0).getEditor().element); - await t.expect(getStoredName(3)).eql('Name 33'); + await t + .expect(dataGrid.isReady()).ok() + .expect(getStoredName(3)).eql('Name 33'); // assert await t @@ -2366,7 +2387,9 @@ test('Cells should be focused correctly on click when cell editing mode is used .typeText(dataGrid.getDataCell(1, 0).getEditor().element, '2') .click(dataGrid.getDataCell(0, 0).getEditor().element); - await t.expect(getStoredName(2)).eql('Name 222'); + await t + .expect(dataGrid.isReady()).ok() + .expect(getStoredName(2)).eql('Name 222'); // assert await t diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focusEvents/newRows_T1162227.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focusEvents/newRows_T1162227.ts index 6fc3e42e929b..f428baa0b915 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focusEvents/newRows_T1162227.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/focus/focusEvents/newRows_T1162227.ts @@ -245,11 +245,21 @@ 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], ]; + // The focused row is applied asynchronously on initialization: + // wait for it before collecting callback results (one-shot read, no retries) + await t + .expect(dataGrid.isReady()) + .ok() + .expect(dataGrid.getDataRow(1).isFocusedRow) + .ok(); + const [ , , diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/headerPanel.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/headerPanel.ts index 6155fc792a9c..ae84d69c3e34 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/headerPanel.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/headerPanel.ts @@ -87,10 +87,16 @@ test('Drop-down window should be positioned correctly after resizing the toolbar // visual: fluent.blue.light // visual: fluent.blue.dark -test.meta({ unstable: true })('Disabled toolbar buttons are not grayed out in Material themes (T1217416)', async (t) => { +test('Disabled toolbar buttons should be grayed out in Material themes (T1217416)', async (t) => { const { takeScreenshot, compareResults } = createScreenshotsComparer(t); const dataGrid = new DataGrid('#container'); + await t + .expect(dataGrid.isReady()) + .ok() + .expect(dataGrid.getDataRow(4).element.exists) + .ok(); + await testScreenshot(t, takeScreenshot, 'disabled-toolbar-buttons.png', { element: dataGrid.element }); await t .expect(compareResults.isValid()) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts index 099752eb961e..2005febacf41 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.functional.ts @@ -27,7 +27,7 @@ const getOnKeyDownCallCount = ClientFunction(() => (window as any).onKeyDownCall fixture.disablePageReloads`Keyboard Navigation - common` .page(url(__dirname, '../../../container.html')); -test.meta({ unstable: true })('Changing keyboardNavigation options should not invalidate the entire content (T1197829)', async (t) => { +test('Changing keyboardNavigation options should not invalidate the entire content (T1197829)', async (t) => { const dataGrid = new DataGrid('#container'); await t .expect(dataGrid.isReady()) @@ -167,9 +167,7 @@ test('Navigation via the Tab key should work when cellRender/cellComponent is us // eslint-disable-next-line no-underscore-dangle dataGrid._getTemplate = () => ({ render(options) { - setTimeout(() => { - options.deferred?.resolve(); - }, 100); + Promise.resolve().then(() => options.deferred?.resolve()); }, }); @@ -1870,7 +1868,7 @@ test('The expand cell should not lose focus on expanding a master row (T892203)' columns: ['a', 'b'], })); - test.meta({ unstable: true })(`${editMode} mode - Shift+Tab from the first editable cell should move focus to the last header (T1329750)`, async (t) => { + test(`${editMode} mode - Shift+Tab from the first editable cell should move focus to the last header (T1329750)`, async (t) => { const dataGrid = new DataGrid('#container') as any; const cell00 = dataGrid.getDataCell(0, 0); const editor00 = cell00.getEditor(); @@ -1880,7 +1878,6 @@ test('The expand cell should not lose focus on expanding a master row (T892203)' await t .click(cell00.element) - .expect(cell00.isFocused).ok() .expect(editor00.element.focused) .ok() @@ -2969,10 +2966,11 @@ test('New mode. A cell should be focused when the PageDow/Up key is pressed (T89 .eql(0); // act - await t - .pressKey('pagedown'); + await t.pressKey('pagedown'); // assert + await t.expect(dataGrid.isReady()).ok(); + const focusedRowIndex = await dataGrid.option('focusedRowIndex'); await t .expect(dataGrid.getDataCell(focusedRowIndex, 0).isFocused) @@ -2983,11 +2981,11 @@ test('New mode. A cell should be focused when the PageDow/Up key is pressed (T89 .eql(0); // act - await t - .pressKey('pageup'); + await t.pressKey('pageup'); // assert await t + .expect(dataGrid.isReady()).ok() .expect(dataGrid.getDataCell(0, 0).isFocused) .ok() .expect(dataGrid.option('focusedRowIndex')) @@ -3066,7 +3064,7 @@ test('New mode. A cell should be focused when the PageDow/Up key is pressed (T89 }); }); -test.meta({ unstable: true })('Cells should be focused after saving data when filter is applied and cell mode is used (T1029906)', async (t) => { +test('Cells should be focused after saving data when filter is applied and cell mode is used (T1029906)', async (t) => { const dataGrid = new DataGrid('#container'); await t .expect(dataGrid.isReady()) @@ -3108,9 +3106,10 @@ test.meta({ unstable: true })('Cells should be focused after saving data when fi .pressKey('d') .pressKey('enter'); - const visibleRows = await dataGrid.apiGetVisibleRows(); - // assert + await t.expect(dataGrid.isReady()).ok(); + + const visibleRows = await dataGrid.apiGetVisibleRows(); await t .expect(visibleRows.length) .eql(4) @@ -3147,7 +3146,6 @@ test.meta({ unstable: true })('Cells should be focused after saving data when fi enterKeyDirection: 'column', editOnKeyPress: true, }, - editing: { mode: 'cell', allowUpdating: true, @@ -3272,9 +3270,8 @@ test('Lookup editor should update cell value on down or up key when cell is focu .typeText(filterRowEditor.element, 'Name') .wait(1000); - let visibleRows = await dataGrid.apiGetVisibleRows(); - // assert + let visibleRows = await dataGrid.apiGetVisibleRows(); await t .expect(visibleRows.length) .eql(5) @@ -3288,9 +3285,8 @@ test('Lookup editor should update cell value on down or up key when cell is focu .typeText(filterRowEditor.element, '_1') .wait(1000); - visibleRows = await dataGrid.apiGetVisibleRows(); - // assert + visibleRows = await dataGrid.apiGetVisibleRows(); await t .expect(visibleRows.length) .eql(2) @@ -3691,70 +3687,6 @@ test('Window should not be scrolled after clicking on freespace row (T1104035)', height: 1500, })); -test('edit => scroll => command, should not result in grid scrolling back to edit', async (t) => { - const dataGrid = new DataGrid('#container'); - await t - .expect(dataGrid.isReady()) - .ok(); - - await t.wait(100); - await ClientFunction(() => { - const grid = ($('#container') as any).dxDataGrid('instance'); - setTimeout(() => { - grid.getCellElement(1, 1).trigger('dxclick'); - setTimeout(() => { - grid.getScrollable().scrollTo({ x: 10000 }); - setTimeout( - () => { $('.dx-link-delete').first().trigger('focusin'); }, - 100, - ); - }, 100); - }, 500); - })(); - - await t.wait(100) - .expect(dataGrid.getScrollLeft()) - .notEql(0); -}).before(async () => createWidget('dxDataGrid', { - editing: { - mode: 'cell', - allowUpdating: true, - allowDeleting: true, - }, - width: 900, - scrolling: { - useNative: false, - }, - dataSource: [ - { - ID: 1, Prefix: '1', FirstName: '1', LastName: '1', StateID: '1', BirthDate: '1', - }, { - ID: 2, Prefix: '2', FirstName: '2', LastName: '2', StateID: '2', BirthDate: '2', - }, - ], - columns: [ - { - dataField: 'Prefix', - caption: 'Title', - width: 200, - }, - { dataField: 'FirstName', width: 200 }, - { dataField: 'LastName', width: 200 }, { - dataField: 'Position', - width: 200, - }, { - dataField: 'StateID', - caption: 'State', - width: 200, - - }, { - dataField: 'BirthDate', - dataType: 'date', - width: 200, - }, - ], -})); - test('Navigation shouldn\'t get stuck on cell templates with links in them when navigating from outside the grid (T1123129)', async (t) => { const dataGrid = new DataGrid('#container'); await t @@ -6116,6 +6048,8 @@ test('The last cell should be focused after changing the page size (T1063530)', // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(19, 14).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6193,6 +6127,8 @@ test('The last cell should be focused after changing the page size (T1063530)', // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(19, 34).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6268,10 +6204,11 @@ test('The last cell should be focused after changing the page size (T1063530)', // act await t.pressKey('ctrl+end'); - await t.wait(100); // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(199, 34).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6347,12 +6284,12 @@ test('The last cell should be focused after changing the page size (T1063530)', await resetFocusedEventsTestData(); // act - await t - .pressKey('ctrl+end') - .wait(100); + await t.pressKey('ctrl+end'); // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(19, 14).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6430,7 +6367,7 @@ test('The last cell should be focused after changing the page size (T1063530)', // act await t .pressKey('ctrl+end') - .wait(100); + .expect(dataGrid.isReady()).ok(); // assert await t @@ -6512,6 +6449,8 @@ test('The last cell should be focused after changing the page size (T1063530)', // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(19, 14).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6600,6 +6539,7 @@ test('The last cell should be focused after changing the page size (T1063530)', // assert await t + .expect(dataGrid.isReady()).ok() .expect(dataGrid.getDataCell(19, 34).element.focused) .ok() .expect(getOrderOfEventCalls()) @@ -6686,10 +6626,11 @@ test('The last cell should be focused after changing the page size (T1063530)', // act await t.pressKey('ctrl+end'); - await t.wait(1000); // assert await t + .expect(dataGrid.isReady()) + .ok() .expect(dataGrid.getDataCell(199, 34).element.focused) .ok() .expect(getOrderOfEventCalls()) diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.visual.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.visual.ts index 29f837bd4ad7..df0f06fcb4bf 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.visual.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/keyboardNavigation/keyboardNavigation.visual.ts @@ -568,6 +568,8 @@ test('Navigate to first cell in the first row when virtual scrolling is enabled' await t .click(dataGrid.getDataCell(199, 14).element) .pressKey('ctrl+home') + .expect(dataGrid.getScrollLeft()) + .eql(0) .wait(1000); await testScreenshot(t, takeScreenshot, 'navigate_to_first_cell_in_first_row_when_virtual_scrolling_is_enabled_2.png', { element: dataGrid.element }); @@ -720,7 +722,7 @@ test('Navigate to first cell in the first row when virtual scrolling and columns }, })); - test(`${useNative ? 'Native' : 'Simulated'} scrolling: Focus should be on the last focusable cell when pressing the Ctrl + Home key when row dragging, virtual scrolling and columns are enabled`, async (t) => { + test.meta({ unstable: true })(`${useNative ? 'Native' : 'Simulated'} scrolling: Focus should be on the last focusable cell when pressing the Ctrl + End key when row dragging, virtual scrolling and columns are enabled`, async (t) => { // arrange const dataGrid = new DataGrid('#container'); const { takeScreenshot, compareResults } = createScreenshotsComparer(t); @@ -731,12 +733,17 @@ test('Navigate to first cell in the first row when virtual scrolling and columns // act await t .click(dataGrid.getDataCell(0, 0).element) - .pressKey('ctrl+end') - .wait(1000); + .pressKey('ctrl+end'); + + // assert + await t + .expect(dataGrid.isReady()) + .ok() + .expect(dataGrid.getDataCell(199, 34).element.focused) + .ok(); await testScreenshot(t, takeScreenshot, `${useNative ? 'native' : 'simulated'}_scrolling_-_navigate_to_last_cell_row_dragging__virtual_scrolling__virtual_columns.png`, { element: dataGrid.element }); - // assert await t .expect(compareResults.isValid()) .ok(compareResults.errorMessages()); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/markup/T838734_alternateRowSizes.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/markup/T838734_alternateRowSizes.ts index 274b3c2e6e96..27caf1ffdb84 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/markup/T838734_alternateRowSizes.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/markup/T838734_alternateRowSizes.ts @@ -15,9 +15,10 @@ const generateData = (rowCount) => new Array(rowCount).fill(null).map((_, idx) = C: `C_${idx}`, })); -test.meta({ unstable: true })('Alternate rows should be the same size', async (t) => { +test('Alternate rows should be the same size', async (t) => { const { takeScreenshot, compareResults } = createScreenshotsComparer(t); const dataGrid = new DataGrid(GRID_SELECTOR); + await t.expect(dataGrid.isReady()).ok(); await testScreenshot(t, takeScreenshot, 'T838734_alternate-rows-same-size.png', { element: dataGrid.element }); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/rowDragging/functional.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/rowDragging/functional.ts index 51aca76648cf..b60b5623bf5c 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/rowDragging/functional.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/rowDragging/functional.ts @@ -794,11 +794,15 @@ test('toIndex should not be corrected when source item gets removed from DOM', a }); // T1139685 -test.meta({ unstable: true })('Item should appear in a correct spot when dragging to a different page with scrolling.mode: "virtual"', async (t) => { +test('Item should appear in a correct spot when dragging to a different page with scrolling.mode: "virtual"', async (t) => { const dataGrid = new DataGrid('#container'); await t.expect(dataGrid.isReady()).ok(); - await t.drag(dataGrid.getDataRow(2).getDragCommand(), 0, 32, { speed: 0.95 }); + + await t.dragToElement( + dataGrid.getDataRow(2).getDragCommand(), + dataGrid.getDataRow(4).element, + ); const visibleRows = await dataGrid.apiGetVisibleRows(); const visibleRowKeys = visibleRows.map((row) => row.key); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts index f3865c4088a3..70d87706ce3b 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts @@ -1044,7 +1044,7 @@ test.meta({ browserSize: [800, 800] })('Rows are rendered properly when window c })()); // T1129252 -test.meta({ unstable: true })('The data should display correctly after changing the dataSource and focusedRowIndex options when scroll position is at the end', async (t) => { +test('The data should display correctly after changing the dataSource and focusedRowIndex options when scroll position is at the end', async (t) => { // arrange const dataGrid = new DataGrid('#container'); const { takeScreenshot, compareResults } = createScreenshotsComparer(t); @@ -1067,6 +1067,7 @@ test.meta({ unstable: true })('The data should display correctly after changing .expect(dataGrid.isReady()) .ok(); + await t.expect(dataGrid.apiGetTopVisibleRowData()).eql({ id: 96, text: 'item 96' }); await testScreenshot(t, takeScreenshot, 'grid-virtual-scrolling-T1129252.png', { element: '#container' }); await t .expect(compareResults.isValid()) @@ -1705,7 +1706,7 @@ test.meta({ browserSize: [800, 200] })('Editing buttons should rerender correctl }); // T1181439 -test.meta({ unstable: true })('Restoring focus on re-rendering should be done without unexpected scrolling to the focused element', async (t) => { +test('Restoring focus on re-rendering should be done without unexpected scrolling to the focused element', async (t) => { const dataGrid = new DataGrid('#container'); await t.expect(dataGrid.isReady()).ok(); @@ -1714,7 +1715,7 @@ test.meta({ unstable: true })('Restoring focus on re-rendering should be done wi await t.click(dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(19).element); - await dataGrid.scrollBy(t, { left: 0 }); + await dataGrid.scrollBy(t, { left: -1000 }); await dataGrid.scrollBy(t, { top: 50 }); await t.expect(dataGrid.getScrollLeft()).eql(0); diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/selection.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/selection.ts index 2c2ce3d0dba7..4d5b755d2812 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/selection.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/selection.ts @@ -248,19 +248,26 @@ test('Sensitivity option change should be correctly handled during runtime chang // --- -test.meta({ unstable: true })('"Select All" checkbox should not react when not visible', async (t) => { +test('"Select All" checkbox should not react when not visible', async (t) => { const dataGrid = new DataGrid('#container'); + await t.expect(dataGrid.isReady()).ok(); const selectAllCheckBox = new CheckBox( dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(0).getEditor().element, ); const editorCell = dataGrid.getHeaders().getHeaderRow(0).getHeaderCell(0).element; - await t.expect(await selectAllCheckBox.option('visible')).notOk(); + await t + .expect(selectAllCheckBox.element.exists) + .ok() + .expect(selectAllCheckBox.element.visible) + .notOk(); await t.click(editorCell); - await t.expect(await selectAllCheckBox.option('visible')).notOk(); + await t + .expect(selectAllCheckBox.element.visible) + .notOk(); }).before(async () => createWidget('dxDataGrid', { dataSource: [], keyExpr: 'orderId', diff --git a/e2e/testcafe-devextreme/tests/dataGrid/common/toast.ts b/e2e/testcafe-devextreme/tests/dataGrid/common/toast.ts index e283e0516ace..60322c042f61 100644 --- a/e2e/testcafe-devextreme/tests/dataGrid/common/toast.ts +++ b/e2e/testcafe-devextreme/tests/dataGrid/common/toast.ts @@ -1,27 +1,57 @@ import DataGrid from 'devextreme-testcafe-models/dataGrid'; import { createScreenshotsComparer } from 'devextreme-screenshot-comparer'; +import { ClientFunction } from 'testcafe'; import url from '../../../helpers/getPageUrl'; import { createWidget } from '../../../helpers/createWidget'; import { testScreenshot } from '../../../helpers/themeUtils'; -fixture.disablePageReloads`Toasts in DataGrid`.page( +fixture`Toasts in DataGrid`.page( url(__dirname, '../../container.html'), ); -test.meta({ unstable: true })('Toast should be visible after calling and should be not visible after default display time', async (t) => { +const setToastDisplayTime = (displayTime: number) => ClientFunction(() => { + (window as any).DevExpress.ui.dxToast.defaultOptions({ + options: { + displayTime, + }, + }); +}, { dependencies: { displayTime } })(); + +test('Toast should be visible after calling and should be not visible after default display time', async (t) => { const dataGrid = new DataGrid('#container'); const { takeScreenshot, compareResults } = createScreenshotsComparer(t); await t .expect(dataGrid.isReady()) .ok(); + await setToastDisplayTime(100000); await dataGrid.apiShowErrorToast(); + await t.expect(dataGrid.getToast().exists).ok(); await testScreenshot(t, takeScreenshot, 'ai-column__toast__at-the-right-position.png', { element: dataGrid.element }); + await t .expect(compareResults.isValid()) .ok(compareResults.errorMessages()); - await t.expect(dataGrid.getToast().exists).notOk(); +}).before(async () => { + await createWidget('dxDataGrid', {}); +}); + +test('Toast should hide after the display time', async (t) => { + const dataGrid = new DataGrid('#container'); + + await t + .expect(dataGrid.isReady()) + .ok(); + + await setToastDisplayTime(100); + await dataGrid.apiShowErrorToast(); + await t + .expect(dataGrid.getToast().exists).ok(); + + await t + .wait(150) + .expect(dataGrid.getToast().exists).notOk(); }).before(async () => { await createWidget('dxDataGrid', {}); });