0

For clarity we are using this reactDataGrid, (https://reactdatagrid.io/)

Does anyone know if there any way to add an id or data-testid to the grid? I cannot find anything in the documentation and I I have tried anything I can think of. I unfortunately need to add ids because of testing. Any help is much appreciated!

 <ReactDataGrid
    treeColumn="description"
    licenseKey="..."
    style={gridStyle}
    columns={columns}
    data-id="workPlease"
  />

 <ReactDataGrid
    treeColumn="description"
    licenseKey="..."
    style={gridStyle}
    columns={columns}
    data-testid="workPlease"
  />

 <ReactDataGrid
    treeColumn="description"
    licenseKey="..."
    style={gridStyle}
    columns={columns}
    id="workPlease"
  />
zazvorniki
  • 3,512
  • 21
  • 74
  • 122
  • I've found this a problem myself. RTL doesn't seem to read data-testid on components unlike Enzyme. It only reads them on elements. The solution is to wrap the grid in a
    ...
    or find another way to access the component like a classname or id property.
    – Vayne Valerius Jun 06 '23 at 15:24

0 Answers0