@qawolf/testkit
v1.1.1
Published
`@qawolf/testkit` is a TypeScript toolkit designed to help you use QA Wolf flow helpers and runner integrations for cases outside normal browser or mobile automation.
Downloads
3,635
Keywords
Readme
@qawolf/testkit
@qawolf/testkit is a TypeScript toolkit designed to help you use QA Wolf flow
helpers and runner integrations for cases outside normal browser or mobile
automation.
To learn more about how to use @qawolf/testkit, check out the
API Reference
and Documentation.
Install
npm install @qawolf/testkitUsage
Generate an OTP to complete a two-factor challenge inside your flow.
import { otp } from "@qawolf/testkit";
const code = otp.fromUri(process.env["OTP_URI"]!);
await page.getByLabel("Verification code").fill(code);Decode a QR code from the page when your app uses QR-based setup or login.
import { readQRCode } from "@qawolf/testkit/web";
const qrValue = await readQRCode(page, "[data-testid='qr-code']");
if (!qrValue) throw new Error("QR code was not visible");Save dynamic data to the QA Wolf environment and reload environment variables when another flow has updated them.
import {
reloadEnvironmentVariables,
saveEnvironmentVariable,
} from "@qawolf/testkit";
await saveEnvironmentVariable("LOGIN_TOKEN", token);
await reloadEnvironmentVariables();
const reloadedToken = process.env["LOGIN_TOKEN"];Use runner-backed helpers for environment setup, such as connecting through OpenVPN before the rest of the flow runs.
import { startOpenVpn } from "@qawolf/testkit";
await startOpenVpn({
configPath: "/tmp/client.ovpn",
});