修改部份ui
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { chromium } from "playwright";
|
||||
import { mkdirSync } from "node:fs";
|
||||
|
||||
const BASE = process.env.BASE || "http://127.0.0.1:5173";
|
||||
const API = process.env.API || "http://127.0.0.1:8010";
|
||||
const OUT = process.argv[2] || "shots-proj-yz";
|
||||
mkdirSync(OUT, { recursive: true });
|
||||
|
||||
const login = await (await fetch(`${API}/api/auth/login/`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username: "airshelf", password: "Restraint2026" })
|
||||
})).json();
|
||||
|
||||
const browser = await chromium.launch();
|
||||
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 }, deviceScaleFactor: 2 });
|
||||
await ctx.addInitScript((t) => localStorage.setItem("airshelf_token", t), login.token);
|
||||
const page = await ctx.newPage();
|
||||
await page.goto(`${BASE}/projects`, { waitUntil: "networkidle", timeout: 40000 });
|
||||
await page.waitForTimeout(2000);
|
||||
await page.screenshot({ path: `${OUT}/projects-yz-preview.png`, fullPage: false });
|
||||
console.log("shot projects-yz-preview");
|
||||
await browser.close();
|
||||
Reference in New Issue
Block a user