From e40cc12f835606d0d9a039c42b6fac1ab2e081ef Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Fri, 18 Jan 2019 15:59:15 -0600 Subject: [PATCH 1/4] core: add FCP on 3G audit to JSON --- .../test/cli/__snapshots__/index-test.js.snap | 7 ++ .../metrics/first-contentful-paint-3g.js | 68 +++++++++++++++++ lighthouse-core/config/constants.js | 13 ++++ lighthouse-core/config/default-config.js | 2 + lighthouse-core/test/results/sample_v2.json | 73 +++++++++++++++---- proto/sample_v2_round_trip.json | 60 ++++++++++++--- 6 files changed, 197 insertions(+), 26 deletions(-) create mode 100644 lighthouse-core/audits/metrics/first-contentful-paint-3g.js diff --git a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap index 884aaa7bd912..e8c334ac3d94 100644 --- a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap +++ b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap @@ -27,6 +27,9 @@ Object { Object { "path": "metrics/first-meaningful-paint", }, + Object { + "path": "metrics/first-contentful-paint-3g", + }, Object { "path": "load-fast-enough-for-pwa", }, @@ -775,6 +778,10 @@ Object { "id": "network-requests", "weight": 0, }, + Object { + "id": "first-contentful-paint-3g", + "weight": 0, + }, Object { "id": "metrics", "weight": 0, diff --git a/lighthouse-core/audits/metrics/first-contentful-paint-3g.js b/lighthouse-core/audits/metrics/first-contentful-paint-3g.js new file mode 100644 index 000000000000..123912647dac --- /dev/null +++ b/lighthouse-core/audits/metrics/first-contentful-paint-3g.js @@ -0,0 +1,68 @@ +/** + * @license Copyright 2019 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +'use strict'; + +const Audit = require('../audit'); +const regular3G = require('../../config/constants.js').throttling.mobileRegluar3G; +const i18n = require('../../lib/i18n/i18n.js'); +const FCP = require('./first-contentful-paint.js'); +const ComputedFcp = require('../../computed/metrics/first-contentful-paint.js'); + +const i18nFilename = require.resolve('./first-contentful-paint.js'); +const str_ = i18n.createMessageInstanceIdFn(i18nFilename, FCP.UIStrings); + +class FirstContentfulPaint3G extends Audit { + /** + * @return {LH.Audit.Meta} + */ + static get meta() { + return { + id: 'first-contentful-paint-3g', + title: str_(FCP.UIStrings.title), + description: str_(FCP.UIStrings.description), + scoreDisplayMode: Audit.SCORING_MODES.NUMERIC, + requiredArtifacts: ['traces', 'devtoolsLogs'], + }; + } + + /** + * @return {LH.Audit.ScoreOptions} + */ + static get defaultOptions() { + return { + // 75th and 95th percentiles HTTPArchive on Fast 3G -> multiply by 1.5 for RTT differential -> median and PODR + // https://bigquery.cloud.google.com/table/httparchive:lighthouse.2018_04_01_mobile?pli=1 + scorePODR: 3000, + scoreMedian: 6000, + }; + } + + /** + * @param {LH.Artifacts} artifacts + * @param {LH.Audit.Context} context + * @return {Promise} + */ + static async audit(artifacts, context) { + const trace = artifacts.traces[Audit.DEFAULT_PASS]; + const devtoolsLog = artifacts.devtoolsLogs[Audit.DEFAULT_PASS]; + /** @type {LH.Config.Settings} */ + const settings = {...context.settings, throttlingMethod: 'simulate', throttling: regular3G}; + const metricComputationData = {trace, devtoolsLog, settings}; + const metricResult = await ComputedFcp.request(metricComputationData, context); + + return { + score: Audit.computeLogNormalScore( + metricResult.timing, + context.options.scorePODR, + context.options.scoreMedian + ), + rawValue: metricResult.timing, + displayValue: str_(i18n.UIStrings.seconds, {timeInMs: metricResult.timing}), + }; + } +} + +module.exports = FirstContentfulPaint3G; diff --git a/lighthouse-core/config/constants.js b/lighthouse-core/config/constants.js index 46d19987f17e..4aea3ef776b2 100644 --- a/lighthouse-core/config/constants.js +++ b/lighthouse-core/config/constants.js @@ -16,6 +16,8 @@ const DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR = 0.9; const throttling = { DEVTOOLS_RTT_ADJUSTMENT_FACTOR, DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR, + // These values align with WebPageTest's definition of "Fast 3G" + // But offer similar charateristics to roughly the 75th percentile of 4G connections. mobileSlow4G: { rttMs: 150, throughputKbps: 1.6 * 1024, @@ -24,6 +26,17 @@ const throttling = { uploadThroughputKbps: 750 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR, cpuSlowdownMultiplier: 4, }, + // These values partially align with WebPageTest's definition of "Regular 3G". + // These values are meant to roughly align with Chrome UX report's 3G definition which are based + // on HTTP RTT of 300-1400ms and downlink throughput of <700kbps. + mobileRegluar3G: { + rttMs: 300, + throughputKbps: 700, + requestLatencyMs: 300 * DEVTOOLS_RTT_ADJUSTMENT_FACTOR, + downloadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR, + uploadThroughputKbps: 700 * DEVTOOLS_THROUGHPUT_ADJUSTMENT_FACTOR, + cpuSlowdownMultiplier: 4, + }, }; /** @type {LH.Config.Settings} */ diff --git a/lighthouse-core/config/default-config.js b/lighthouse-core/config/default-config.js index 75df84c4609d..ce39e0e5cb8d 100644 --- a/lighthouse-core/config/default-config.js +++ b/lighthouse-core/config/default-config.js @@ -140,6 +140,7 @@ const defaultConfig = { 'without-javascript', 'metrics/first-contentful-paint', 'metrics/first-meaningful-paint', + 'metrics/first-contentful-paint-3g', 'load-fast-enough-for-pwa', 'metrics/speed-index', 'screenshot-thumbnails', @@ -349,6 +350,7 @@ const defaultConfig = { {id: 'dom-size', weight: 0, group: 'diagnostics'}, {id: 'critical-request-chains', weight: 0, group: 'diagnostics'}, {id: 'network-requests', weight: 0}, + {id: 'first-contentful-paint-3g', weight: 0}, {id: 'metrics', weight: 0}, {id: 'user-timings', weight: 0, group: 'diagnostics'}, {id: 'bootup-time', weight: 0, group: 'diagnostics'}, diff --git a/lighthouse-core/test/results/sample_v2.json b/lighthouse-core/test/results/sample_v2.json index b47b0931de26..b4ca71f621e5 100644 --- a/lighthouse-core/test/results/sample_v2.json +++ b/lighthouse-core/test/results/sample_v2.json @@ -99,6 +99,15 @@ "rawValue": 3969.136, "displayValue": "4.0 s" }, + "first-contentful-paint-3g": { + "id": "first-contentful-paint-3g", + "title": "First Contentful Paint", + "description": "First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).", + "score": 0.22, + "scoreDisplayMode": "numeric", + "rawValue": 8321.9015, + "displayValue": "8.3 s" + }, "load-fast-enough-for-pwa": { "id": "load-fast-enough-for-pwa", "title": "Page load is fast enough on mobile networks", @@ -2928,6 +2937,10 @@ "id": "network-requests", "weight": 0 }, + { + "id": "first-contentful-paint-3g", + "weight": 0 + }, { "id": "metrics", "weight": 0 @@ -3582,6 +3595,42 @@ "duration": 100, "entryType": "measure" }, + { + "startTime": 0, + "name": "lh:audit:first-contentful-paint-3g", + "duration": 100, + "entryType": "measure" + }, + { + "startTime": 0, + "name": "lh:computed:FirstContentfulPaint", + "duration": 100, + "entryType": "measure" + }, + { + "startTime": 0, + "name": "lh:computed:LanternFirstContentfulPaint", + "duration": 100, + "entryType": "measure" + }, + { + "startTime": 0, + "name": "lh:computed:PageDependencyGraph", + "duration": 100, + "entryType": "measure" + }, + { + "startTime": 0, + "name": "lh:computed:LoadSimulator", + "duration": 100, + "entryType": "measure" + }, + { + "startTime": 0, + "name": "lh:computed:NetworkAnalysis", + "duration": 100, + "entryType": "measure" + }, { "startTime": 0, "name": "lh:audit:load-fast-enough-for-pwa", @@ -3726,24 +3775,12 @@ "duration": 100, "entryType": "measure" }, - { - "startTime": 0, - "name": "lh:computed:PageDependencyGraph", - "duration": 100, - "entryType": "measure" - }, { "startTime": 0, "name": "lh:computed:LoadSimulator", "duration": 100, "entryType": "measure" }, - { - "startTime": 0, - "name": "lh:computed:NetworkAnalysis", - "duration": 100, - "entryType": "measure" - }, { "startTime": 0, "name": "lh:audit:installable-manifest", @@ -4393,10 +4430,12 @@ }, "icuMessagePaths": { "lighthouse-core/audits/metrics/first-contentful-paint.js | title": [ - "audits[first-contentful-paint].title" + "audits[first-contentful-paint].title", + "audits[first-contentful-paint-3g].title" ], "lighthouse-core/audits/metrics/first-contentful-paint.js | description": [ - "audits[first-contentful-paint].description" + "audits[first-contentful-paint].description", + "audits[first-contentful-paint-3g].description" ], "lighthouse-core/lib/i18n/i18n.js | seconds": [ { @@ -4411,6 +4450,12 @@ }, "path": "audits[first-meaningful-paint].displayValue" }, + { + "values": { + "timeInMs": 8321.9015 + }, + "path": "audits[first-contentful-paint-3g].displayValue" + }, { "values": { "timeInMs": 4417 diff --git a/proto/sample_v2_round_trip.json b/proto/sample_v2_round_trip.json index fa934a87a3a3..41d9c6819e71 100644 --- a/proto/sample_v2_round_trip.json +++ b/proto/sample_v2_round_trip.json @@ -644,6 +644,14 @@ "scoreDisplayMode": "numeric", "title": "First Contentful Paint" }, + "first-contentful-paint-3g": { + "description": "First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).", + "displayValue": "8.3\u00a0s", + "id": "first-contentful-paint-3g", + "score": 0.22, + "scoreDisplayMode": "numeric", + "title": "First Contentful Paint" + }, "first-cpu-idle": { "description": "First CPU Idle marks the first time at which the page's main thread is quiet enough to handle input. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-interactive).", "displayValue": "4.9\u00a0s", @@ -3045,6 +3053,10 @@ "id": "network-requests", "weight": 0.0 }, + { + "id": "first-contentful-paint-3g", + "weight": 0.0 + }, { "id": "metrics", "weight": 0.0 @@ -3442,6 +3454,42 @@ "name": "lh:computed:FirstMeaningfulPaint", "startTime": 0.0 }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:audit:first-contentful-paint-3g", + "startTime": 0.0 + }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:FirstContentfulPaint", + "startTime": 0.0 + }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:LanternFirstContentfulPaint", + "startTime": 0.0 + }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:PageDependencyGraph", + "startTime": 0.0 + }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:LoadSimulator", + "startTime": 0.0 + }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:NetworkAnalysis", + "startTime": 0.0 + }, { "duration": 100.0, "entryType": "measure", @@ -3586,24 +3634,12 @@ "name": "lh:computed:LanternFirstContentfulPaint", "startTime": 0.0 }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:PageDependencyGraph", - "startTime": 0.0 - }, { "duration": 100.0, "entryType": "measure", "name": "lh:computed:LoadSimulator", "startTime": 0.0 }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:NetworkAnalysis", - "startTime": 0.0 - }, { "duration": 100.0, "entryType": "measure", From 425b71e604a5f9a44d4c517d9d897be12a30e935 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Mon, 21 Jan 2019 22:38:49 -0600 Subject: [PATCH 2/4] feedback --- .../test/cli/__snapshots__/index-test.js.snap | 7 -- .../metrics/first-contentful-paint-3g.js | 2 +- lighthouse-core/config/default-config.js | 2 - lighthouse-core/config/lr-desktop-config.js | 2 +- lighthouse-core/config/lr-mobile-config.js | 13 +++- .../metrics/first-contentful-paint-3g-test.js | 37 ++++++++++ lighthouse-core/test/results/sample_v2.json | 73 ++++--------------- proto/sample_v2_round_trip.json | 60 +++------------ 8 files changed, 77 insertions(+), 119 deletions(-) create mode 100644 lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js diff --git a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap index e8c334ac3d94..884aaa7bd912 100644 --- a/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap +++ b/lighthouse-cli/test/cli/__snapshots__/index-test.js.snap @@ -27,9 +27,6 @@ Object { Object { "path": "metrics/first-meaningful-paint", }, - Object { - "path": "metrics/first-contentful-paint-3g", - }, Object { "path": "load-fast-enough-for-pwa", }, @@ -778,10 +775,6 @@ Object { "id": "network-requests", "weight": 0, }, - Object { - "id": "first-contentful-paint-3g", - "weight": 0, - }, Object { "id": "metrics", "weight": 0, diff --git a/lighthouse-core/audits/metrics/first-contentful-paint-3g.js b/lighthouse-core/audits/metrics/first-contentful-paint-3g.js index 123912647dac..a61adb2a88c0 100644 --- a/lighthouse-core/audits/metrics/first-contentful-paint-3g.js +++ b/lighthouse-core/audits/metrics/first-contentful-paint-3g.js @@ -5,7 +5,7 @@ */ 'use strict'; -const Audit = require('../audit'); +const Audit = require('../audit.js'); const regular3G = require('../../config/constants.js').throttling.mobileRegluar3G; const i18n = require('../../lib/i18n/i18n.js'); const FCP = require('./first-contentful-paint.js'); diff --git a/lighthouse-core/config/default-config.js b/lighthouse-core/config/default-config.js index ce39e0e5cb8d..75df84c4609d 100644 --- a/lighthouse-core/config/default-config.js +++ b/lighthouse-core/config/default-config.js @@ -140,7 +140,6 @@ const defaultConfig = { 'without-javascript', 'metrics/first-contentful-paint', 'metrics/first-meaningful-paint', - 'metrics/first-contentful-paint-3g', 'load-fast-enough-for-pwa', 'metrics/speed-index', 'screenshot-thumbnails', @@ -350,7 +349,6 @@ const defaultConfig = { {id: 'dom-size', weight: 0, group: 'diagnostics'}, {id: 'critical-request-chains', weight: 0, group: 'diagnostics'}, {id: 'network-requests', weight: 0}, - {id: 'first-contentful-paint-3g', weight: 0}, {id: 'metrics', weight: 0}, {id: 'user-timings', weight: 0, group: 'diagnostics'}, {id: 'bootup-time', weight: 0, group: 'diagnostics'}, diff --git a/lighthouse-core/config/lr-desktop-config.js b/lighthouse-core/config/lr-desktop-config.js index 11fc64485e0e..8e0aa8f28a3e 100644 --- a/lighthouse-core/config/lr-desktop-config.js +++ b/lighthouse-core/config/lr-desktop-config.js @@ -18,7 +18,7 @@ const config = { throughputKbps: 10 * 1024, cpuSlowdownMultiplier: 1, }, - // Skip the h2 audit so it doesn't lie to us. See #6539 + // Skip the h2 audit so it doesn't lie to us. See https://github.com/GoogleChrome/lighthouse/issues/6539 skipAudits: ['uses-http2'], }, audits: [ diff --git a/lighthouse-core/config/lr-mobile-config.js b/lighthouse-core/config/lr-mobile-config.js index 264663542213..294eccde23ba 100644 --- a/lighthouse-core/config/lr-mobile-config.js +++ b/lighthouse-core/config/lr-mobile-config.js @@ -10,9 +10,20 @@ const config = { extends: 'lighthouse:default', settings: { maxWaitForLoad: 35 * 1000, - // Skip the h2 audit so it doesn't lie to us. See #6539 + // Skip the h2 audit so it doesn't lie to us. See https://github.com/GoogleChrome/lighthouse/issues/6539 skipAudits: ['uses-http2'], }, + audits: [ + 'metrics/first-contentful-paint-3g', + ], + // @ts-ignore TODO(bckenny): type extended Config where e.g. category.title isn't required + categories: { + performance: { + auditRefs: [ + {id: 'first-contentful-paint-3g', weight: 0}, + ], + } + } }; module.exports = config; diff --git a/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js new file mode 100644 index 000000000000..2def59472c2a --- /dev/null +++ b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js @@ -0,0 +1,37 @@ +/** + * @license Copyright 2019 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +'use strict'; + +const Audit = require('../../../audits/metrics/first-contentful-paint-3g.js'); +const assert = require('assert'); +const options = Audit.defaultOptions; + +const pwaTrace = require('../../fixtures/traces/progressive-app-m60.json'); +const pwaDevtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); + +/* eslint-env jest */ + +describe('Performance: first-contentful-paint-3g audit', () => { + it('evaluates valid input correctly', async () => { + const artifacts = { + traces: { + [Audit.DEFAULT_PASS]: pwaTrace, + }, + devtoolsLogs: { + [Audit.DEFAULT_PASS]: pwaDevtoolsLog, + }, + }; + + const result = await Audit.audit(artifacts, {settings: {}, options, computedCache: new Map()}); + // Use InlineSnapshot here so changes to Lantern coefficients can be easily updated en masse + expect({score: result.score, value: Math.round(result.rawValue)}).toMatchInlineSnapshot(` +Object { + "score": 1, + "value": 1661, +} +`); + }); +}); diff --git a/lighthouse-core/test/results/sample_v2.json b/lighthouse-core/test/results/sample_v2.json index b4ca71f621e5..b47b0931de26 100644 --- a/lighthouse-core/test/results/sample_v2.json +++ b/lighthouse-core/test/results/sample_v2.json @@ -99,15 +99,6 @@ "rawValue": 3969.136, "displayValue": "4.0 s" }, - "first-contentful-paint-3g": { - "id": "first-contentful-paint-3g", - "title": "First Contentful Paint", - "description": "First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).", - "score": 0.22, - "scoreDisplayMode": "numeric", - "rawValue": 8321.9015, - "displayValue": "8.3 s" - }, "load-fast-enough-for-pwa": { "id": "load-fast-enough-for-pwa", "title": "Page load is fast enough on mobile networks", @@ -2937,10 +2928,6 @@ "id": "network-requests", "weight": 0 }, - { - "id": "first-contentful-paint-3g", - "weight": 0 - }, { "id": "metrics", "weight": 0 @@ -3595,42 +3582,6 @@ "duration": 100, "entryType": "measure" }, - { - "startTime": 0, - "name": "lh:audit:first-contentful-paint-3g", - "duration": 100, - "entryType": "measure" - }, - { - "startTime": 0, - "name": "lh:computed:FirstContentfulPaint", - "duration": 100, - "entryType": "measure" - }, - { - "startTime": 0, - "name": "lh:computed:LanternFirstContentfulPaint", - "duration": 100, - "entryType": "measure" - }, - { - "startTime": 0, - "name": "lh:computed:PageDependencyGraph", - "duration": 100, - "entryType": "measure" - }, - { - "startTime": 0, - "name": "lh:computed:LoadSimulator", - "duration": 100, - "entryType": "measure" - }, - { - "startTime": 0, - "name": "lh:computed:NetworkAnalysis", - "duration": 100, - "entryType": "measure" - }, { "startTime": 0, "name": "lh:audit:load-fast-enough-for-pwa", @@ -3775,12 +3726,24 @@ "duration": 100, "entryType": "measure" }, + { + "startTime": 0, + "name": "lh:computed:PageDependencyGraph", + "duration": 100, + "entryType": "measure" + }, { "startTime": 0, "name": "lh:computed:LoadSimulator", "duration": 100, "entryType": "measure" }, + { + "startTime": 0, + "name": "lh:computed:NetworkAnalysis", + "duration": 100, + "entryType": "measure" + }, { "startTime": 0, "name": "lh:audit:installable-manifest", @@ -4430,12 +4393,10 @@ }, "icuMessagePaths": { "lighthouse-core/audits/metrics/first-contentful-paint.js | title": [ - "audits[first-contentful-paint].title", - "audits[first-contentful-paint-3g].title" + "audits[first-contentful-paint].title" ], "lighthouse-core/audits/metrics/first-contentful-paint.js | description": [ - "audits[first-contentful-paint].description", - "audits[first-contentful-paint-3g].description" + "audits[first-contentful-paint].description" ], "lighthouse-core/lib/i18n/i18n.js | seconds": [ { @@ -4450,12 +4411,6 @@ }, "path": "audits[first-meaningful-paint].displayValue" }, - { - "values": { - "timeInMs": 8321.9015 - }, - "path": "audits[first-contentful-paint-3g].displayValue" - }, { "values": { "timeInMs": 4417 diff --git a/proto/sample_v2_round_trip.json b/proto/sample_v2_round_trip.json index 41d9c6819e71..fa934a87a3a3 100644 --- a/proto/sample_v2_round_trip.json +++ b/proto/sample_v2_round_trip.json @@ -644,14 +644,6 @@ "scoreDisplayMode": "numeric", "title": "First Contentful Paint" }, - "first-contentful-paint-3g": { - "description": "First Contentful Paint marks the time at which the first text or image is painted. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint).", - "displayValue": "8.3\u00a0s", - "id": "first-contentful-paint-3g", - "score": 0.22, - "scoreDisplayMode": "numeric", - "title": "First Contentful Paint" - }, "first-cpu-idle": { "description": "First CPU Idle marks the first time at which the page's main thread is quiet enough to handle input. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/first-interactive).", "displayValue": "4.9\u00a0s", @@ -3053,10 +3045,6 @@ "id": "network-requests", "weight": 0.0 }, - { - "id": "first-contentful-paint-3g", - "weight": 0.0 - }, { "id": "metrics", "weight": 0.0 @@ -3454,42 +3442,6 @@ "name": "lh:computed:FirstMeaningfulPaint", "startTime": 0.0 }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:audit:first-contentful-paint-3g", - "startTime": 0.0 - }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:FirstContentfulPaint", - "startTime": 0.0 - }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:LanternFirstContentfulPaint", - "startTime": 0.0 - }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:PageDependencyGraph", - "startTime": 0.0 - }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:LoadSimulator", - "startTime": 0.0 - }, - { - "duration": 100.0, - "entryType": "measure", - "name": "lh:computed:NetworkAnalysis", - "startTime": 0.0 - }, { "duration": 100.0, "entryType": "measure", @@ -3634,12 +3586,24 @@ "name": "lh:computed:LanternFirstContentfulPaint", "startTime": 0.0 }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:PageDependencyGraph", + "startTime": 0.0 + }, { "duration": 100.0, "entryType": "measure", "name": "lh:computed:LoadSimulator", "startTime": 0.0 }, + { + "duration": 100.0, + "entryType": "measure", + "name": "lh:computed:NetworkAnalysis", + "startTime": 0.0 + }, { "duration": 100.0, "entryType": "measure", From 2b20989485353ca300c2d79a7b293d6f1d71d980 Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Mon, 21 Jan 2019 22:41:12 -0600 Subject: [PATCH 3/4] lint --- lighthouse-core/config/lr-mobile-config.js | 4 ++-- .../test/audits/metrics/first-contentful-paint-3g-test.js | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lighthouse-core/config/lr-mobile-config.js b/lighthouse-core/config/lr-mobile-config.js index 294eccde23ba..2c689ad1bdae 100644 --- a/lighthouse-core/config/lr-mobile-config.js +++ b/lighthouse-core/config/lr-mobile-config.js @@ -22,8 +22,8 @@ const config = { auditRefs: [ {id: 'first-contentful-paint-3g', weight: 0}, ], - } - } + }, + }, }; module.exports = config; diff --git a/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js index 2def59472c2a..a543190a3797 100644 --- a/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js +++ b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js @@ -6,7 +6,6 @@ 'use strict'; const Audit = require('../../../audits/metrics/first-contentful-paint-3g.js'); -const assert = require('assert'); const options = Audit.defaultOptions; const pwaTrace = require('../../fixtures/traces/progressive-app-m60.json'); From 6f940143ae8823fdc0c70ed2a84afee9745b277a Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Tue, 22 Jan 2019 19:28:36 -0600 Subject: [PATCH 4/4] more feedback --- .../audits/metrics/first-contentful-paint-3g-test.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js index a543190a3797..b569abe2fc5d 100644 --- a/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js +++ b/lighthouse-core/test/audits/metrics/first-contentful-paint-3g-test.js @@ -5,8 +5,8 @@ */ 'use strict'; -const Audit = require('../../../audits/metrics/first-contentful-paint-3g.js'); -const options = Audit.defaultOptions; +const FCP3G = require('../../../audits/metrics/first-contentful-paint-3g.js'); +const options = FCP3G.defaultOptions; const pwaTrace = require('../../fixtures/traces/progressive-app-m60.json'); const pwaDevtoolsLog = require('../../fixtures/traces/progressive-app-m60.devtools.log.json'); @@ -17,14 +17,14 @@ describe('Performance: first-contentful-paint-3g audit', () => { it('evaluates valid input correctly', async () => { const artifacts = { traces: { - [Audit.DEFAULT_PASS]: pwaTrace, + [FCP3G.DEFAULT_PASS]: pwaTrace, }, devtoolsLogs: { - [Audit.DEFAULT_PASS]: pwaDevtoolsLog, + [FCP3G.DEFAULT_PASS]: pwaDevtoolsLog, }, }; - const result = await Audit.audit(artifacts, {settings: {}, options, computedCache: new Map()}); + const result = await FCP3G.audit(artifacts, {settings: {}, options, computedCache: new Map()}); // Use InlineSnapshot here so changes to Lantern coefficients can be easily updated en masse expect({score: result.score, value: Math.round(result.rawValue)}).toMatchInlineSnapshot(` Object {