Skip to content
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

Cypress component test that reorders grid rows does not trigger onRowOrderChange handler. #9513

Closed
2 tasks done
mschaefer-gresham opened this issue Jun 28, 2023 · 3 comments
Closed
2 tasks done
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Reordering Related to the data grid Reordering feature plan: Premium Impact at least one Premium user support: commercial Support request from paid users

Comments

@mschaefer-gresham
Copy link

Order ID or Support key 💳 (optional)

45466

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I can write a Cypress component test that moves the grid rows, but it doesn't fire the onRowOrderChange handler. Here is a CodeSandbox that contains my Cypress test. But the test is not runnable from inside CodeSandbox (as far as I know).

https://codesandbox.io/s/data-grid-community-forked-dg62qx?file=/src/App.cy.tsx

What am I missing? Any help you can provide is much appreciated!

Your environment 🌎

`npx @mui/envinfo`
  System:
    OS: macOS 13.4.1
  Binaries:
    Node: 19.3.0 - ~/.nvm/versions/node/v19.3.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.2.0 - ~/.nvm/versions/node/v19.3.0/bin/npm
  Browsers:
    Chrome: 114.0.5735.133
    Edge: Not Found
    Firefox: 114.0.2
    Safari: 16.5.1

@mschaefer-gresham mschaefer-gresham added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Jun 28, 2023
@cherniavskii
Copy link
Member

Hi @mschaefer-gresham
Can you reproduce this issue outside of Cypress?
This sounds similar to #6165

@cherniavskii cherniavskii added component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information plan: Premium Impact at least one Premium user feature: Reordering Related to the data grid Reordering feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jun 28, 2023
@mschaefer-gresham
Copy link
Author

mschaefer-gresham commented Jun 28, 2023

@cherniavskii I added 1000 rows to my test and the handler gets called if I manually drag a row many hundred rows away. This highlights a separate issue though - it's extremely painful to drag a row to a location that is not visible. It's hard to get the scroll started, and then it moves very slowly through the rows.

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Jun 28, 2023
@mschaefer-gresham mschaefer-gresham changed the title Cypress component test that re-orders grid rows does not trigger onRowOrderChange handler. Cypress component test that reorders grid rows does not trigger onRowOrderChange handler. Jun 28, 2023
@mschaefer-gresham
Copy link
Author

I figured this out:

it.only('should render grid in correct order after drag-n-drop', () => {
      cy.get('[data-testid="DragIcon"]:first')
          .trigger('dragstart')
          .trigger('dragenter')
          .trigger('dragleave');

      cy.get('[data-testid="DragIcon"]:last')
          .trigger('dragenter')
          .trigger('dragover')
          .trigger('drop');
 });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Reordering Related to the data grid Reordering feature plan: Premium Impact at least one Premium user support: commercial Support request from paid users
Projects
None yet
Development

No branches or pull requests

2 participants