I have to write automation tests for an application that listens to events of a USB barcode scanner, and does some functionality on the event of a scan. The application uses react-barcode-reader. I want to simulate a scan event (i.e. triggering the functionality without physical scanner).
Any idea how to do this?
Thanks for all the comments. Here is the cypress code that worked for me:
cy.get('body').type("MY BARCODE").trigger('keydown', { keyCode: 13, which: 13 })
This code creates an event of scan. Thanks!!!