You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// HTML template string no-op for VS Code highlighting / formattingfunctionhtml(strings: TemplateStringsArray, ...values: unknown[]){returnstrings.reduce((result,string,i)=>{returnresult+string+(values[i]??'');},'');}test('PDF has screenshot',async({ page })=>{// Go to page without Content-Security-Policy header, to avoid CSP// prevention of script loading from https://mozilla.github.ioawaitpage.goto('about:blank');awaitpage.setContent(html`<!doctype html><html><head><metacharset="UTF-8" /></head><body><canvas></canvas><scriptsrc="https://mozilla.github.io/pdf.js/build/pdf.mjs" type="module"></script><scripttype="module">pdfjsLib.GlobalWorkerOptions.workerSrc='https://mozilla.github.io/pdf.js/build/pdf.worker.mjs';try{constpdf=awaitpdfjsLib.getDocument('https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/examples/learning/helloworld.pdf',).promise;constpage=awaitpdf.getPage(1);constviewport=page.getViewport({scale: 1.5});constcanvas=document.querySelector('canvas');canvas.height=viewport.height;canvas.width=viewport.width;awaitpage.render({canvasContext: canvas.getContext('2d'), viewport,}).promise;}catch(error){console.error('Error loading PDF:',error);}</script></body></html> `);awaitpage.waitForTimeout(1000);awaitexpect(page).toHaveScreenshot({fullPage: true});});
Some of revealjs feature, and especially our quarto-support plugin can't be tested unless we do automated headless testing.
This issue is to store the potential test to implement.
Revealjs
Website
HTML
PDF snapshot ?
It seems we could leverage PDF.js directly (or through quarto preview ?) to have PDF loading in browser and then do screenshot. More at
Example 1
Example 2
[Feature] PDF snapshot tests microsoft/playwright#19253 (comment)
The text was updated successfully, but these errors were encountered: