/**
 * Flock 登录后查价录制脱敏基线（自 flock-logged-in-20260715-155553.js）
 * 不含真实账密；供 UI/RPA 对齐
 */
const { chromium } = require("playwright");

(async () => {
  const browser = await chromium.launch({ headless: false });
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto("https://app.flockfreight.com/login");
  await page.getByRole("textbox", { name: "Email Address" }).fill("REDACTED");
  await page.getByRole("button", { name: "Next" }).click();
  await page.getByRole("textbox", { name: "Password" }).fill("REDACTED");
  await page.getByRole("button", { name: "Log in" }).click();
  await page.goto("https://app.flockfreight.com/home");
  await page.getByTestId("header-new-quote-button").click();
  await page.getByTestId("quick-form-toggle").click();
  await page.getByRole("button", { name: "Choose date" }).click();
  await page.getByRole("gridcell", { name: "16" }).click();
  await page.getByRole("textbox", { name: "Pickup ZIP Code" }).fill("90248");
  await page.getByRole("combobox", { name: "Pickup Type *" }).click();
  await page.getByRole("option", { name: "Business with Dock" }).click();
  await page.getByRole("textbox", { name: "Delivery ZIP Code" }).fill("15222");
  await page.getByRole("combobox", { name: "Delivery Type *" }).click();
  await page.getByRole("option", { name: "Business with Dock" }).click();
  await page.getByRole("textbox", { name: "Quantity" }).fill("2");
  await page.getByRole("combobox", { name: "Packaging Type *" }).click();
  await page.getByRole("option", { name: "Bags" }).click();
  await page.getByRole("textbox", { name: "Length (in)" }).fill("48");
  await page.getByRole("textbox", { name: "Width (in)" }).fill("40");
  await page.getByRole("textbox", { name: "Height (in)" }).fill("48");
  await page.getByRole("textbox", { name: "Total Weight (lbs)" }).fill("500");
  await page.getByRole("combobox", { name: "Freight Class *" }).click();
  await page
    .getByRole("option", { name: "Use density-based calculation" })
    .click();
  await page.getByRole("textbox", { name: "Description of Contents" }).fill("papers");
  await page.getByText("Stackable").click();
  await page.getByTestId("quote-request-quick-form__submit_button").click();
  // 结果页示例：https://app.flockfreight.com/quote/{id}
  // Standard-fulfillment-option / FlockDirect®-fulfillment-option
  await context.close();
  await browser.close();
})();
