import { describe, expect, it } from "vitest";
import fs from "node:fs";
import path from "node:path";

describe("flock login two-step", () => {
  it("login.ts 含两步登录（Email → Next → Password）", () => {
    const src = fs.readFileSync(
      path.join(process.cwd(), "workers/rpa/flock/login.ts"),
      "utf8",
    );
    expect(src).toContain("Email Address");
    expect(src).toContain("Next");
    expect(src).toContain("Password");
    expect(src).toContain("勿先等 password");
  });

  it("脱敏基线录制为两步登录", () => {
    const src = fs.readFileSync(
      path.join(
        process.cwd(),
        "scripts/fixtures/flock-logged-in-quote-baseline.js",
      ),
      "utf8",
    );
    expect(src).toContain('name: "Email Address"');
    expect(src).toContain('name: "Next"');
    expect(src).toContain('name: "Password"');
  });
});
