Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.qawolf.com/llms.txt

Use this file to discover all available pages before exploring further.

Store your authenticator app’s OTP URI as a QA Wolf environment variable named OTP_URI before running this flow.

Examples

Complete MFA during login
import { otp } from "@qawolf/testkit";

const code = otp.fromUri(process.env["OTP_URI"]!);
await page.getByLabel("Verification code").fill(code);

When to use

  • Your app requires a time-based one-time password (TOTP) to complete login
  • Your app prompts for an MFA code after username and password are accepted
  • Your flow needs to authenticate as a user who has MFA enabled
  • Your test environment enforces MFA and cannot be bypassed for test accounts

Full example

import { flow } from "@qawolf/flows/web";
import { otp } from "@qawolf/testkit";

export default flow(
  "Log in with MFA",
  { target: "Web - Chrome", launch: true },
  async ({ page, test }) => {
    await test("log in", async () => {
      await page.goto(process.env["BASE_URL"]!);
      await page.fill('[name="email"]', process.env["EMAIL"]!);
      await page.fill('[name="password"]', process.env["PASSWORD"]!);
      await page.click('[type="submit"]');
    });

    await test("complete MFA", async () => {
      const code = otp.fromUri(process.env["OTP_URI"]!);
      await page.getByLabel("Verification code").fill(code);
      await page.click('[type="submit"]');
    });
  },
);
Last modified on May 8, 2026