there is an npm library called testcafe-lighthouse which helps to audit web pages using TestCafe. It also has the capability to produce an HTML detailed report.
import{testcafeLighthouseAudit}from'testcafe-lighthouse';fixture(`Audit Test`).page('http://localhost:3000/login');test('user page performance with specific thresholds',async()=>{constcurrentURL=awaitt.eval(()=>document.documentURI);awaittestcafeLighthouseAudit({url:currentURL,thresholds:{performance:50,accessibility:50,'best-practices':50,seo:50,pwa:50,},cdpPort:9222,});});
you need to kick start the test like below:
# headless mode, preferable for CI
npx testcafe chrome:headless:cdpPort=9222 test.js
# non headless mode
npx testcafe 'chrome --remote-debugging-port=9222' test.js
I hope it will help your automation journey.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
there is an npm library called testcafe-lighthouse which helps to audit web pages using TestCafe. It also has the capability to produce an HTML detailed report.
Install the plugin by:
I hope it will help your automation journey.