Open
Description
While it is generally advised to avoid MFA in tests, sometimes it simply cannot be avoided. We don't have any guide for these use cases now.
Taking inspiration from this video, it should be possible to implement a similar flow with k6-browser as well. And add there something like this with otpauth package:
import * as OTPAuth from "https://unpkg.com/[email protected]/dist/otpauth.esm.js"
import crypto from 'k6/experimental/webcrypto';
globalThis.crypto = crypto.crypto;
export let options = {
iterations: 1
};
export default function () {
let totp = new OTPAuth.TOTP({
issuer: "ACME",
label: "Alice",
secret: "US3WHSG7X5KAPV27VANWKQHF3SH3HULL",
});
let secret = new OTPAuth.Secret({ size: 128 });
let token = totp.generate();
console.log("token", token);
}