cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.72k stars 3.16k forks source link

Textarea input event not firing from inside a shadow DOM when typing #8655

Closed jmetterrothan closed 1 year ago

jmetterrothan commented 3 years ago

Current behavior

With React Unit Testing, when we spy the input event of a textarea inside the shadow DOM of a Web Component, we expect to have our function called when we type using

cy.get('xxx').shadow().get('textarea').type('test')

But no event is triggered using the native type method.

Until recently, we used cypress-shadow-dom. So we tried to reproduce the test mentioned above with the custom shadowType command and it did work fine. It seems the issue is only related to the newly introduced shadow feature.

image The target element for the mouse events is ok, but not for the keyboard events (which is null).

Desired behavior

We would like to have a native input event triggered when we use the method type inside a web component (shadow DOM).

Test code to reproduce

I'm not able to provide an example since the source code is confidential and I do not have time to set up a proper test.

Versions

Cypress : 5.2.0 Cypress Shadow DOM 1.4.1

edimitchel commented 3 years ago

@bahmutov @jennifer-shehane sorry for the missing example but this problem is problematic. This problem is probably caused by the no-native element type of our web component. Cypress don't find the right event to use for. Could you add an option to force the event to trigger? Something like that:

cy.get('...').shadow().find('textarea')
  .type('example{enter}', {
    event: 'input',
    // or
    forceEvent: 'input',
  });
baermathias commented 2 years ago

Was this solved with with version 9.1.1? https://docs.cypress.io/guides/references/changelog#9-1-1

cypress-app-bot commented 1 year ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

cypress-app-bot commented 1 year ago

This issue has been closed due to inactivity.