Initial import
This commit is contained in:
45
scripts/capture-fullscreen-toggle-screenshot.mjs
Executable file
45
scripts/capture-fullscreen-toggle-screenshot.mjs
Executable file
@@ -0,0 +1,45 @@
|
||||
import process from 'node:process';
|
||||
import { chromium } from 'playwright';
|
||||
import { ensureDirectory, getKstDate, resolveCapturePaths, updateWorklogCaptureSection } from './worklog-capture-utils.mjs';
|
||||
|
||||
const cwd = process.cwd();
|
||||
const captureDate = process.argv[2] ?? getKstDate();
|
||||
const baseUrl = process.env.CAPTURE_BASE_URL ?? 'http://127.0.0.1:5174';
|
||||
const screenshotFileName = 'main-content-fullscreen-toggle.png';
|
||||
const { screenshotDir, screenshotPath, worklogPath, markdownImagePath } = resolveCapturePaths({
|
||||
cwd,
|
||||
captureDate,
|
||||
screenshotFileName,
|
||||
});
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({
|
||||
viewport: { width: 1600, height: 1200 },
|
||||
deviceScaleFactor: 2,
|
||||
});
|
||||
|
||||
try {
|
||||
await ensureDirectory(screenshotDir);
|
||||
|
||||
await page.goto(baseUrl, { waitUntil: 'networkidle' });
|
||||
await page.getByLabel('콘텐츠 최대화').click();
|
||||
|
||||
const target = page.locator('.app-main-content--expanded').first();
|
||||
await target.waitFor({ state: 'visible', timeout: 30000 });
|
||||
await target.screenshot({
|
||||
path: screenshotPath,
|
||||
animations: 'disabled',
|
||||
});
|
||||
|
||||
await updateWorklogCaptureSection({
|
||||
worklogPath,
|
||||
captureDate,
|
||||
imageAlt: 'main-content-fullscreen-toggle',
|
||||
markdownImagePath,
|
||||
});
|
||||
|
||||
console.log(`Saved: ${screenshotPath}`);
|
||||
console.log(`Linked in: ${worklogPath}`);
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
Reference in New Issue
Block a user