Inital Version
This commit is contained in:
commit
94cd6b984b
211 changed files with 4765 additions and 0 deletions
13
design-concepts/render_gallery.cjs
Normal file
13
design-concepts/render_gallery.cjs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
const {chromium}=require('C:/Users/Elijah/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
|
||||
const path=require('path'),{pathToFileURL}=require('url');
|
||||
(async()=>{
|
||||
const browser=await chromium.launch({executablePath:'C:/Program Files/Google/Chrome/Application/chrome.exe',headless:true,args:['--disable-gpu','--disable-extensions','--no-first-run']});
|
||||
try{
|
||||
const page=await browser.newPage({viewport:{width:1680,height:1000}});
|
||||
await page.goto(pathToFileURL(path.join(__dirname,'index.html')).href,{waitUntil:'load'});
|
||||
await page.evaluate(async()=>{await document.fonts.ready;await Promise.all([...document.images].map(i=>i.decode()));});
|
||||
const counts=await page.evaluate(()=>({cards:document.querySelectorAll('article').length,imagesLoaded:[...document.images].every(i=>i.naturalWidth>0),horizontalOverflow:document.documentElement.scrollWidth>innerWidth}));
|
||||
if(counts.cards!==5||!counts.imagesLoaded||counts.horizontalOverflow)throw new Error(JSON.stringify(counts));
|
||||
await page.screenshot({path:path.join(__dirname,'gallery-preview.png'),fullPage:true});console.log(JSON.stringify(counts));
|
||||
}finally{await browser.close();}
|
||||
})().catch(e=>{console.error(e);process.exitCode=1});
|
||||
Loading…
Add table
Add a link
Reference in a new issue