adamraine / lighthouse-plugin-soft-navigation Goto Github PK
View Code? Open in Web Editor NEWLighthouse plugin that reports metrics such as LCP and FCP from a soft navigation.
Lighthouse plugin that reports metrics such as LCP and FCP from a soft navigation.
Hi there !
I'm trying to do my own plugin, based on your excellent work. But as I'm currently coding it, I would like to load it directly from my local fs and not release it each time.
I tried things like (based on yours) :
import {writeFileSync} from 'fs';
import * as pptrTestingLibrary from 'pptr-testing-library';
import {startFlow, desktopConfig} from 'lighthouse';
import { scrollPageToBottom } from 'puppeteer-autoscroll-down'
import SoftNavigationPlugin from './lighthouse-plugin-soft-navigation/plugin.js'
const {getDocument, queries} = pptrTestingLibrary;
// Setup the browser and Lighthouse.
const browser = await puppeteer
//.use(StealthPlugin())
.launch({
headless: 'false',
});
const page = await browser.newPage();
const flow = await startFlow(page, {
config: desktopConfig,
extends: 'lighthouse:default',
plugins: [SoftNavigationPlugin]
});
await flow.navigate('https://www.myURL');
await page.click('#cookie-notice-agree-button');
//await flow.endTimespan();
// Phase 3 - Analyze the new state.
await flow.snapshot();
let lastPosition = await scrollPageToBottom(page, {
size: 500,
delay: 1000,
})
await flow.snapshot();
// Get the comprehensive flow report.
const reportHtmlPath = './reports/lighthouse_report.html';
writeFileSync(reportHtmlPath, await flow.generateReport());
// Save results as JSON.
const reportJsonPath = './reports/lighthouse_report.json';
writeFileSync(reportJsonPath, JSON.stringify(await flow.createFlowResult(), null, 2));
console.log('Rapport HTML enregistré à :', reportHtmlPath);
console.log('Rapport JSON enregistré à :', reportJsonPath);
// Cleanup.
await browser.close();
or
plugins: ['lighthouse-plugin-soft-navigation']
Do you know if I'm missing something ? No errors but plugin doesn't show up in reports.
What I'm trying to do : optimize huge lazy loads, particularly on a sustainability side.
Scenario :
That's the idea.
Thank you very much if you can help !
I got an answer here on how to use startFlows in desktop mode. However, I want add a few more things to config like const config = {
extends: 'lighthouse:default',
plugins: ['lighthouse-plugin-soft-navigation'],
} and run them in desktop mode.
can anyone help me out, please?
A sample script would be greatly appreciated
:)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.