Skip to content

Commit

Permalink
refactor: uf mock improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton authored Jan 31, 2023
2 parents cc962b6 + b3c45f7 commit 5f8f659
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 27 deletions.
11 changes: 0 additions & 11 deletions .user-flowrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .user-flowrc.static-dist.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,234 @@ import FlowResult from 'lighthouse/types/lhr/flow';
import { StepOptions, UserFlowOptions } from './types';

const dummyFlowResult: (cfg: UserFlowOptions) => FlowResult = (cfg: UserFlowOptions): FlowResult => {
const config = cfg?.config || { };
logVerbose('dummy config used:', config)
const config = cfg?.config || {};
logVerbose('dummy config used:', config);
const report = {
name: cfg.name,
steps: [
{
name: 'Navigation report (127.0.0.1/)',
lhr: {
fetchTime: new Date().toISOString(),
mock: true, // Notice: This is off standard and only here to check for mock data
configSettings: config,
lighthouseVersion: '9.5.0',
requestedUrl: 'http://127.0.0.1:5032/',
finalUrl: 'http://127.0.0.1:5032/',
fetchTime: new Date().toISOString(),
gatherMode: 'navigation',
runtimeError: {
'code': 'PROTOCOL_TIMEOUT',
'message': 'Waiting for DevTools protocol response has exceeded the allotted time. (Method: Page.captureScreenshot)'
},
runWarnings: [],
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4889.0 Safari/537.36',
environment: {
'networkUserAgent': '',
'hostUserAgent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4889.0 Safari/537.36',
'benchmarkIndex': 601.5,
'credits': { 'axe-core': '4.3.5' }
},
audits: {
// "performance-budget": {},
// "timing-budget": {}
// "timing-budget": {},
'is-on-https': {
'id': 'is-on-https',
'title': 'Uses HTTPS',
'description': 'All sites should be protected with HTTPS, even ones that don\'t handle sensitive data. This includes avoiding [mixed content](https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content), where some resources are loaded over HTTP despite the initial request being served over HTTPS. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web platform APIs. [Learn more](https://web.dev/is-on-https/).',
'score': 1,
'scoreDisplayMode': 'binary',
'details': { 'type': 'table', 'headings': [], 'items': [] }
},
'service-worker': {
'id': 'service-worker',
'title': 'Does not register a service worker that controls page and `start_url`',
'description': 'The service worker is the technology that enables your app to use many Progressive Web App features, such as offline, add to homescreen, and push notifications. [Learn more](https://web.dev/service-worker/).',
'score': 0,
'scoreDisplayMode': 'binary'
},
'viewport': {
'id': 'viewport',
'title': 'Has a `<meta name="viewport">` tag with `width` or `initial-scale`',
'description': 'A `<meta name="viewport">` not only optimizes your app for mobile screen sizes, but also prevents [a 300 millisecond delay to user input](https://developers.google.com/web/updates/2013/12/300ms-tap-delay-gone-away). [Learn more](https://web.dev/viewport/).',
'score': 1,
'scoreDisplayMode': 'binary',
'warnings': []
},
'first-contentful-paint': {
'id': 'first-contentful-paint',
'title': 'First Contentful Paint',
'description': 'First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://web.dev/first-contentful-paint/).',
'score': 1,
'scoreDisplayMode': 'numeric',
'numericValue': 724.2656,
'numericUnit': 'millisecond',
'displayValue': '0.7 s'
},
'largest-contentful-paint': {
'id': 'largest-contentful-paint',
'title': 'Largest Contentful Paint',
'description': 'Largest Contentful Paint marks the time at which the largest text or image is painted. [Learn more](https://web.dev/lighthouse-largest-contentful-paint/)',
'score': 1,
'scoreDisplayMode': 'numeric',
'numericValue': 724.2656,
'numericUnit': 'millisecond',
'displayValue': '0.7 s'
}
},
categories: {
"performance": {
"title": "Performance",
"supportedModes": ["navigation", "timespan", "snapshot"],
"auditRefs": [
{
"id": "first-contentful-paint",
"weight": 10,
"group": "metrics",
"acronym": "FCP",
"relevantAudits": [
"server-response-time",
"render-blocking-resources",
"redirects",
"critical-request-chains",
"uses-text-compression",
"uses-rel-preconnect",
"uses-rel-preload",
"font-display",
"unminified-javascript",
"unminified-css",
"unused-css-rules"
]
},
{
"id": "interactive",
"weight": 10,
"group": "metrics",
"acronym": "TTI"
},
{
"id": "speed-index",
"weight": 10,
"group": "metrics",
"acronym": "SI"
},
{
"id": "total-blocking-time",
"weight": 30,
"group": "metrics",
"acronym": "TBT",
"relevantAudits": [
"long-tasks",
"third-party-summary",
"third-party-facades",
"bootup-time",
"mainthread-work-breakdown",
"dom-size",
"duplicated-javascript",
"legacy-javascript",
"viewport"
]
},
{
"id": "largest-contentful-paint",
"weight": 25,
"group": "metrics",
"acronym": "LCP",
"relevantAudits": [
"server-response-time",
"render-blocking-resources",
"redirects",
"critical-request-chains",
"uses-text-compression",
"uses-rel-preconnect",
"uses-rel-preload",
"font-display",
"unminified-javascript",
"unminified-css",
"unused-css-rules",
"largest-contentful-paint-element",
"preload-lcp-image",
"unused-javascript",
"efficient-animated-content",
"total-byte-weight"
]
},
{
"id": "cumulative-layout-shift",
"weight": 15,
"group": "metrics",
"acronym": "CLS",
"relevantAudits": [
"layout-shift-elements",
"non-composited-animations",
"unsized-images"
]
},
{ "id": "max-potential-fid", "weight": 0, "group": "hidden" },
{
"id": "first-meaningful-paint",
"weight": 0,
"acronym": "FMP",
"group": "hidden"
},
{ "id": "render-blocking-resources", "weight": 0 },
{ "id": "uses-responsive-images", "weight": 0 },
{ "id": "offscreen-images", "weight": 0 },
{ "id": "unminified-css", "weight": 0 },
{ "id": "unminified-javascript", "weight": 0 },
{ "id": "unused-css-rules", "weight": 0 },
{ "id": "unused-javascript", "weight": 0 },
{ "id": "uses-optimized-images", "weight": 0 },
{ "id": "modern-image-formats", "weight": 0 },
{ "id": "uses-text-compression", "weight": 0 },
{ "id": "uses-rel-preconnect", "weight": 0 },
{ "id": "server-response-time", "weight": 0 },
{ "id": "redirects", "weight": 0 },
{ "id": "uses-rel-preload", "weight": 0 },
{ "id": "uses-http2", "weight": 0 },
{ "id": "efficient-animated-content", "weight": 0 },
{ "id": "duplicated-javascript", "weight": 0 },
{ "id": "legacy-javascript", "weight": 0 },
{ "id": "preload-lcp-image", "weight": 0 },
{ "id": "total-byte-weight", "weight": 0 },
{ "id": "uses-long-cache-ttl", "weight": 0 },
{ "id": "dom-size", "weight": 0 },
{ "id": "critical-request-chains", "weight": 0 },
{ "id": "user-timings", "weight": 0 },
{ "id": "bootup-time", "weight": 0 },
{ "id": "mainthread-work-breakdown", "weight": 0 },
{ "id": "font-display", "weight": 0 },
{ "id": "resource-summary", "weight": 0 },
{ "id": "third-party-summary", "weight": 0 },
{ "id": "third-party-facades", "weight": 0 },
{ "id": "largest-contentful-paint-element", "weight": 0 },
{ "id": "lcp-lazy-loaded", "weight": 0 },
{ "id": "layout-shift-elements", "weight": 0 },
{ "id": "uses-passive-event-listeners", "weight": 0 },
{ "id": "no-document-write", "weight": 0 },
{ "id": "long-tasks", "weight": 0 },
{ "id": "non-composited-animations", "weight": 0 },
{ "id": "unsized-images", "weight": 0 },
{ "id": "viewport", "weight": 0 },
{ "id": "no-unload-listeners", "weight": 0 },
{ "id": "performance-budget", "weight": 0, "group": "budgets" },
{ "id": "timing-budget", "weight": 0, "group": "budgets" },
{ "id": "network-requests", "weight": 0, "group": "hidden" },
{ "id": "network-rtt", "weight": 0, "group": "hidden" },
{
"id": "network-server-latency",
"weight": 0,
"group": "hidden"
},
{ "id": "main-thread-tasks", "weight": 0, "group": "hidden" },
{ "id": "diagnostics", "weight": 0, "group": "hidden" },
{ "id": "metrics", "weight": 0, "group": "hidden" },
{ "id": "screenshot-thumbnails", "weight": 0, "group": "hidden" },
{ "id": "final-screenshot", "weight": 0, "group": "hidden" },
{ "id": "script-treemap-data", "weight": 0, "group": "hidden" }
],
"id": "performance",
"score": null
}
}
} as any
}
Expand Down
5 changes: 0 additions & 5 deletions packages/user-flow-cli-testing/package.json

This file was deleted.

0 comments on commit 5f8f659

Please sign in to comment.