In this test suite otpcredential-helper.js
is a testing framework that enables engines to test OTPCredential by intercepting the connection between the browser and the underlying operating system and mock its behavior.
Usage:
<script src="./support/otpcredential-helper.js"></script>
in your testawait expect(receive).andReturn(() => { // mock behavior })
navigator.credentials.get({otp: {transport: ["sms"]}})
The mocking API is browser agnostic and is designed such that other engines could implement it too.
Here are the symbols that are exposed to tests that need to be implemented per engine: