Files
soroush.asadi 05945f215d
CI/CD / CI - API (dotnet build + engine sim) (push) Successful in 1m53s
CI/CD / CI - Web (tsc + next build) (push) Successful in 1m11s
CI/CD / Deploy - local stack (db + server + web) (push) Successful in 1m0s
add 9:16 store-screenshot capture script (Myket)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 17:43:23 +03:30

57 lines
1.9 KiB
JavaScript

// Capture 9:16 store screenshots (1080x1920) for Myket from the dev server.
// Output -> store-assets/myket/*.png
const { chromium } = require("playwright");
const fs = require("fs");
const path = require("path");
const OUT = path.join(__dirname, "..", "store-assets", "myket");
fs.mkdirSync(OUT, { recursive: true });
const URL = process.env.SHOT_URL || "http://localhost:3025/";
const shot = (page, name) => page.screenshot({ path: path.join(OUT, name + ".png") });
const tap = (page, text) => page.getByText(text, { exact: false }).first().click({ timeout: 6000 });
(async () => {
const browser = await chromium.launch({ channel: "chrome" });
// 432x768 CSS = 9:16, at DSF 2.5 -> 1080x1920 output (exactly 9:16, < 3000px).
const ctx = await browser.newContext({
viewport: { width: 432, height: 768 },
deviceScaleFactor: 2.5,
locale: "fa-IR",
isMobile: true,
hasTouch: true,
});
const page = await ctx.newPage();
await page.goto(URL, { waitUntil: "networkidle" }).catch(() => {});
await page.waitForTimeout(3000);
await shot(page, "01-home");
for (const [label, name] of [
["جدول امتیازات", "02-leaderboard"],
["فروشگاه", "03-shop"],
["دستاوردها", "04-achievements"],
["پروفایل", "05-profile"],
]) {
try {
await tap(page, label);
await page.waitForTimeout(2200);
await shot(page, name);
} catch (e) {
console.log("skip", name, String(e).split("\n")[0]);
}
await page.goto(URL, { waitUntil: "networkidle" }).catch(() => {});
await page.waitForTimeout(1500);
}
try {
await tap(page, "بازی با کامپیوتر");
await page.waitForTimeout(5000);
await shot(page, "06-game");
} catch (e) {
console.log("skip game", String(e).split("\n")[0]);
}
await browser.close();
console.log("DONE");
})().catch((e) => { console.error("FATAL", e); process.exit(1); });