Skip to content

Commit 67ca9c5

Browse files
committed
DataGrid: e2e unskip flaky scrolling test
1 parent f8786d1 commit 67ca9c5

File tree

3 files changed

+68
-67
lines changed

3 files changed

+68
-67
lines changed
-6.1 KB
Loading
-6.1 KB
Loading

e2e/testcafe-devextreme/tests/dataGrid/common/scrolling.ts

Lines changed: 68 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ClientFunction, Selector } from 'testcafe';
22
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
33
import DataGrid from 'devextreme-testcafe-models/dataGrid';
44
import { ClassNames } from 'devextreme-testcafe-models/dataGrid/classNames';
5+
import type { DataGridScrollMode } from 'devextreme/ui/data_grid';
56
import { insertStylesheetRulesToPage } from '../../../helpers/domUtils';
67
import url from '../../../helpers/getPageUrl';
78
import { createWidget } from '../../../helpers/createWidget';
@@ -1544,73 +1545,73 @@ test('Last group should not disappear after collapsing another subgroup with vir
15441545
}));
15451546

15461547
// T1152498
1547-
// TODO: fix unstable tests
1548-
// ['infinite', 'virtual'].forEach((scrollingMode) => {
1549-
// eslint-disable-next-line @stylistic/max-len
1550-
// test.meta({ browserSize: [900, 600] })(`${scrollingMode} scrolling - the markup should be correct for continuous scrolling when there is a fixed column with cellTemplate (React)`, async (t) => {
1551-
// // arrange
1552-
// const dataGrid = new DataGrid('#container');
1553-
// const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
1554-
//
1555-
// // act
1556-
// await dataGrid.scrollTo({ y: 200 });
1557-
// await t.wait(100);
1558-
// await dataGrid.scrollTo({ y: 400 });
1559-
// await t.wait(300);
1560-
//
1561-
// // assert
1562-
// await t
1563-
// .expect(await takeScreenshot(`grid-${scrollingMode}-scrolling-T1152498.png`, '#container'))
1564-
// .ok()
1565-
// .expect(compareResults.isValid())
1566-
// .ok(compareResults.errorMessages());
1567-
// }).before(async (t) => {
1568-
// await createWidget('dxDataGrid', {
1569-
// dataSource: [...new Array(500)].map((_, index) => ({ id: index, text: `item ${index}` })),
1570-
// keyExpr: 'id',
1571-
// height: 440,
1572-
// width: 800,
1573-
// renderAsync: false,
1574-
// templatesRenderAsynchronously: true,
1575-
// columnFixing: {
1576-
// // @ts-expect-error private option
1577-
// legacyMode: true,
1578-
// },
1579-
// customizeColumns(columns) {
1580-
// columns[0].width = 70;
1581-
// columns[0].fixed = true;
1582-
// columns[0].cellTemplate = '#test';
1583-
// },
1584-
// scrolling: {
1585-
// mode: scrollingMode,
1586-
// },
1587-
// });
1588-
//
1589-
// await t.wait(100);
1590-
//
1591-
// // simulating async rendering in React
1592-
// await ClientFunction(() => {
1593-
// const dataGrid = ($('#container') as any).dxDataGrid('instance');
1594-
//
1595-
// // eslint-disable-next-line no-underscore-dangle
1596-
// dataGrid.getView('rowsView')._templatesCache = {};
1597-
//
1598-
// // eslint-disable-next-line no-underscore-dangle
1599-
// dataGrid._getTemplate = () => ({
1600-
// render(options) {
1601-
// setTimeout(() => {
1602-
// ($(options.container) as any).append(($('<div/>') as any).text(options.model.value));
1603-
// options.deferred?.resolve();
1604-
// }, 200);
1605-
// },
1606-
// });
1607-
//
1608-
// dataGrid.repaint();
1609-
// })();
1610-
//
1611-
// await t.wait(300);
1612-
// });
1613-
// });
1548+
['infinite', 'virtual'].forEach((scrollingMode: DataGridScrollMode) => {
1549+
test.meta({
1550+
browserSize: [900, 600],
1551+
})(`${scrollingMode} scrolling - the markup should be correct for continuous scrolling when there is a fixed column with cellTemplate (React)`, async (t) => {
1552+
// arrange
1553+
const dataGrid = new DataGrid('#container');
1554+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
1555+
1556+
// act
1557+
await dataGrid.scrollTo(t, { y: 200 });
1558+
await t.wait(100);
1559+
await dataGrid.scrollTo(t, { y: 400 });
1560+
await t.wait(500);
1561+
1562+
// assert
1563+
await testScreenshot(t, takeScreenshot, `grid-${scrollingMode}-scrolling-T1152498.png`, { element: '#container' });
1564+
1565+
await t
1566+
.expect(compareResults.isValid())
1567+
.ok(compareResults.errorMessages());
1568+
}).before(async (t) => {
1569+
await createWidget('dxDataGrid', {
1570+
dataSource: [...new Array(500)].map((_, index) => ({ id: index, text: `item ${index}` })),
1571+
keyExpr: 'id',
1572+
height: 440,
1573+
width: 800,
1574+
renderAsync: false,
1575+
templatesRenderAsynchronously: true,
1576+
columnFixing: {
1577+
// @ts-expect-error private option
1578+
legacyMode: true,
1579+
},
1580+
customizeColumns(columns) {
1581+
columns[0].width = 70;
1582+
columns[0].fixed = true;
1583+
columns[0].cellTemplate = '#test';
1584+
},
1585+
scrolling: {
1586+
mode: scrollingMode,
1587+
},
1588+
});
1589+
1590+
await t.wait(100);
1591+
1592+
// simulating async rendering in React
1593+
await ClientFunction(() => {
1594+
const dataGrid = ($('#container') as any).dxDataGrid('instance');
1595+
1596+
// eslint-disable-next-line no-underscore-dangle
1597+
dataGrid.getView('rowsView')._templatesCache = {};
1598+
1599+
// eslint-disable-next-line no-underscore-dangle
1600+
dataGrid._getTemplate = () => ({
1601+
render(options) {
1602+
setTimeout(() => {
1603+
($(options.container) as any).append(($('<div/>') as any).text(options.model.value));
1604+
options.deferred?.resolve();
1605+
}, 200);
1606+
},
1607+
});
1608+
1609+
dataGrid.repaint();
1610+
})();
1611+
1612+
await t.wait(300);
1613+
});
1614+
});
16141615

16151616
test('Editors should keep changes after being scrolled out of sight (T1145698)', async (t) => {
16161617
const dataGrid = new DataGrid('#container');

0 commit comments

Comments
 (0)