first commit
This commit is contained in:
commit
669f49b1d6
342 files changed
+320811
No files matched your search
@@ -0,0 +1,45 @@
|
||||
const path = require("path");
|
||||
const { pathToFileURL } = require("url");
|
||||
const { chromium } = require("F:/software/Hermes/hermes-agent/node_modules/playwright");
|
||||
|
||||
(async () => {
|
||||
const root = __dirname;
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage({
|
||||
viewport: { width: 1920, height: 1200 },
|
||||
deviceScaleFactor: 1,
|
||||
});
|
||||
|
||||
await page.goto(pathToFileURL(path.join(root, "profile-visual.html")).href, {
|
||||
waitUntil: "load",
|
||||
});
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
|
||||
const profile = page.locator("#profile");
|
||||
await profile.screenshot({
|
||||
path: path.join(root, "Hermes-Agent-Profile.png"),
|
||||
animations: "disabled",
|
||||
});
|
||||
|
||||
const report = await page.evaluate(() => {
|
||||
const sheet = document.querySelector("#profile");
|
||||
const overflowing = [...sheet.querySelectorAll("*")]
|
||||
.filter((el) => el.children.length === 0 && el.textContent.trim())
|
||||
.filter((el) => el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1)
|
||||
.map((el) => el.textContent.trim().slice(0, 80));
|
||||
return {
|
||||
width: sheet.getBoundingClientRect().width,
|
||||
height: sheet.getBoundingClientRect().height,
|
||||
overflowX: sheet.scrollWidth > sheet.clientWidth,
|
||||
overflowY: sheet.scrollHeight > sheet.clientHeight,
|
||||
overflowing,
|
||||
};
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(report, null, 2));
|
||||
await browser.close();
|
||||
})().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user