Missed files (#19)
Co-authored-by: Sagnik <sagnik7896@gmail.com> Reviewed-on: #19
This commit was merged in pull request #19.
This commit is contained in:
35
app/.codex-readme-shots.mjs
Normal file
35
app/.codex-readme-shots.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
import { chromium } from "@playwright/test";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
const outDir = path.resolve("../docs/images/readme");
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const context = await browser.newContext({ viewport: { width: 1600, height: 1000 }, deviceScaleFactor: 1 });
|
||||
const page = await context.newPage();
|
||||
|
||||
async function shot(name, url, wait = 2000) {
|
||||
await page.goto(url, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(wait);
|
||||
await page.screenshot({ path: path.join(outDir, name), fullPage: true });
|
||||
}
|
||||
|
||||
await shot("login.png", "http://127.0.0.1:5173/login", 1500);
|
||||
|
||||
await page.goto("http://127.0.0.1:5173/login", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(1000);
|
||||
await page.locator('button').first().click();
|
||||
await page.waitForTimeout(3200);
|
||||
await page.goto("http://127.0.0.1:5173/dashboard", { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(2500);
|
||||
await page.screenshot({ path: path.join(outDir, "dashboard.png"), fullPage: true });
|
||||
|
||||
for (const route of ["oracle", "sentinel", "inventory", "catalyst", "settings"]) {
|
||||
await page.goto(`http://127.0.0.1:5173/${route}`, { waitUntil: "networkidle" });
|
||||
await page.waitForTimeout(route === "sentinel" ? 3000 : 2200);
|
||||
await page.screenshot({ path: path.join(outDir, `${route}.png`), fullPage: true });
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
console.log(outDir);
|
||||
Reference in New Issue
Block a user