Search code examples
javascriptemulationfido-u2fwebauthnfido

Emulate U2F token for automated test of web login in Cypress


I want to automate login for website that uses U2F with usb security key all on Cypress + TS. My script should emulate key and pass it to browser.

For now I've been using https://github.com/github/SoftU2F which is a good solution, but still requires presence of person when test is running.

Tried to apply: https://www.npmjs.com/package/virtual-u2f but, while it generates keys correctly, nothing seems to be passed to browser.

Does anyone automated that king of login on Js/Ts? Would appreciate any idea


Solution

  • Eventually was able to implement solution for Chrome, thanks to: https://github.com/cypress-io/cypress/issues/6991

    This solution worked for me with little adjustments