agritheory / beam

General Purpose 2D barcode scanning for ERPNext
https://agritheory.com/documentation/beam/
Other
20 stars 9 forks source link

onscan.js `simulate` function doesn't work #1

Closed agritheory closed 1 year ago

agritheory commented 1 year ago

And it's not clear why. This is important for doing automated testing since you can't hook up a barcode scanner to a CI.

To reproduce, try the following in the browser console:

window.scanHandler.scanner.simulate('3767127653309169910', document) // replace with a valid barcode or handling unit in your system
Alchez commented 1 year ago

@agritheory, the signature for the simulate function is actually simulate(DOMElement, mStringOrArray) and I was able to successfully get this to run:

window.scanHandler.scanner.simulate(document, 'handling_unit_id')
agritheory commented 1 year ago

That's what I was doing wrong. Feels silly now.