Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: make INP non-experimental #15285

Merged
merged 2 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const str_ = i18n.createIcuMessageFn(import.meta.url, UIStrings);
/**
* @fileoverview This metric gives a high-percentile measure of responsiveness to input.
*/
class ExperimentalInteractionToNextPaint extends Audit {
class InteractionToNextPaint extends Audit {
/**
* @return {LH.Audit.Meta}
*/
static get meta() {
return {
id: 'experimental-interaction-to-next-paint',
id: 'interaction-to-next-paint',
title: str_(i18n.UIStrings.interactionToNextPaint),
description: str_(UIStrings.description),
scoreDisplayMode: Audit.SCORING_MODES.NUMERIC,
Expand Down Expand Up @@ -84,5 +84,5 @@ class ExperimentalInteractionToNextPaint extends Audit {
}
}

export default ExperimentalInteractionToNextPaint;
export default InteractionToNextPaint;
export {UIStrings};
4 changes: 2 additions & 2 deletions core/audits/work-during-interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {MainThreadTasks} from '../lib/tracehouse/main-thread-tasks.js';
import {taskGroups} from '../lib/tracehouse/task-groups.js';
import {TraceProcessor} from '../lib/tracehouse/trace-processor.js';
import {getExecutionTimingsByURL} from '../lib/tracehouse/task-summary.js';
import ExperimentalInteractionToNextPaint from './metrics/experimental-interaction-to-next-paint.js';
import InteractionToNextPaint from './metrics/interaction-to-next-paint.js';
import {LighthouseError} from '../lib/lh-error.js';

/** @typedef {import('../computed/metrics/responsiveness.js').EventTimingEvent} EventTimingEvent */
Expand Down Expand Up @@ -273,7 +273,7 @@ class WorkDuringInteraction extends Audit {
const duration = interactionEvent.args.data.duration;
const displayValue = str_(UIStrings.displayValue, {timeInMs: duration, interactionType});
return {
score: duration < ExperimentalInteractionToNextPaint.defaultOptions.p10 ? 1 : 0,
score: duration < InteractionToNextPaint.defaultOptions.p10 ? 1 : 0,
displayValue,
details: {
type: 'list',
Expand Down
4 changes: 2 additions & 2 deletions core/config/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const defaultConfig = {
'metrics/total-blocking-time',
'metrics/max-potential-fid',
'metrics/cumulative-layout-shift',
'metrics/experimental-interaction-to-next-paint',
'metrics/interaction-to-next-paint',
'errors-in-console',
'server-response-time',
'metrics/interactive',
Expand Down Expand Up @@ -431,7 +431,7 @@ const defaultConfig = {
{id: 'total-blocking-time', weight: 30, group: 'metrics', acronym: 'TBT', relevantAudits: metricsToAudits.tbtRelevantAudits},
{id: 'cumulative-layout-shift', weight: 25, group: 'metrics', acronym: 'CLS', relevantAudits: metricsToAudits.clsRelevantAudits},
{id: 'speed-index', weight: 10, group: 'metrics', acronym: 'SI'},
{id: 'experimental-interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP', relevantAudits: metricsToAudits.inpRelevantAudits},
{id: 'interaction-to-next-paint', weight: 0, group: 'metrics', acronym: 'INP', relevantAudits: metricsToAudits.inpRelevantAudits},

// These are our "invisible" metrics. Not displayed, but still in the LHR.
{id: 'interactive', weight: 0, group: 'hidden', acronym: 'TTI'},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 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.
*/

import ExperimentalInteractionToNextPaint from '../../../audits/metrics/experimental-interaction-to-next-paint.js';
import InteractionToNextPaint from '../../../audits/metrics/interaction-to-next-paint.js';
import {readJson} from '../../test-utils.js';

const interactionTrace = readJson('../../fixtures/traces/timespan-responsiveness-m103.trace.json', import.meta);
Expand All @@ -14,22 +14,22 @@ describe('Interaction to Next Paint', () => {
function getTestData() {
const artifacts = {
traces: {
[ExperimentalInteractionToNextPaint.DEFAULT_PASS]: interactionTrace,
[InteractionToNextPaint.DEFAULT_PASS]: interactionTrace,
},
};

const context = {
settings: {throttlingMethod: 'devtools'},
computedCache: new Map(),
options: ExperimentalInteractionToNextPaint.defaultOptions,
options: InteractionToNextPaint.defaultOptions,
};

return {artifacts, context};
}

it('evaluates INP correctly', async () => {
const {artifacts, context} = getTestData();
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
const result = await InteractionToNextPaint.audit(artifacts, context);
expect(result).toEqual({
score: 0.66,
numericValue: 368,
Expand All @@ -47,7 +47,7 @@ describe('Interaction to Next Paint', () => {
}
artifacts.traces.defaultPass = clonedTrace;

const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
const result = await InteractionToNextPaint.audit(artifacts, context);
// Conveniently, the matching responsiveness event has slightly different
// duration than the matching interaction event so can be tested against.
expect(result).toEqual({
Expand All @@ -61,7 +61,7 @@ describe('Interaction to Next Paint', () => {
it('is not applicable if using simulated throttling', async () => {
const {artifacts, context} = getTestData();
context.settings.throttlingMethod = 'simulate';
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
const result = await InteractionToNextPaint.audit(artifacts, context);
expect(result).toMatchObject({
score: null,
notApplicable: true,
Expand All @@ -70,8 +70,8 @@ describe('Interaction to Next Paint', () => {

it('is not applicable if no interactions occurred in trace', async () => {
const {artifacts, context} = getTestData();
artifacts.traces[ExperimentalInteractionToNextPaint.DEFAULT_PASS] = noInteractionTrace;
const result = await ExperimentalInteractionToNextPaint.audit(artifacts, context);
artifacts.traces[InteractionToNextPaint.DEFAULT_PASS] = noInteractionTrace;
const result = await InteractionToNextPaint.audit(artifacts, context);
expect(result).toMatchObject({
score: null,
notApplicable: true,
Expand Down
16 changes: 8 additions & 8 deletions core/test/fixtures/user-flows/reports/sample-flow-result.json
Original file line number Diff line number Diff line change
Expand Up @@ -8376,8 +8376,8 @@
]
}
},
"experimental-interaction-to-next-paint": {
"id": "experimental-interaction-to-next-paint",
"interaction-to-next-paint": {
"id": "interaction-to-next-paint",
"title": "Interaction to Next Paint",
"description": "Interaction to Next Paint measures page responsiveness, how long it takes the page to visibly respond to user input. [Learn more about the Interaction to Next Paint metric](https://web.dev/inp/).",
"score": 1,
Expand Down Expand Up @@ -10542,7 +10542,7 @@
]
},
{
"id": "experimental-interaction-to-next-paint",
"id": "interaction-to-next-paint",
"weight": 0,
"group": "metrics",
"acronym": "INP",
Expand Down Expand Up @@ -11298,7 +11298,7 @@
},
{
"startTime": 48,
"name": "lh:audit:experimental-interaction-to-next-paint",
"name": "lh:audit:interaction-to-next-paint",
"duration": 1,
"entryType": "measure"
},
Expand Down Expand Up @@ -11712,7 +11712,7 @@
"values": {
"timeInMs": 64
},
"path": "audits[experimental-interaction-to-next-paint].displayValue"
"path": "audits[interaction-to-next-paint].displayValue"
},
{
"values": {
Expand All @@ -11734,10 +11734,10 @@
"audits[cumulative-layout-shift].description"
],
"core/lib/i18n/i18n.js | interactionToNextPaint": [
"audits[experimental-interaction-to-next-paint].title"
"audits[interaction-to-next-paint].title"
],
"core/audits/metrics/experimental-interaction-to-next-paint.js | description": [
"audits[experimental-interaction-to-next-paint].description"
"core/audits/metrics/interaction-to-next-paint.js | description": [
"audits[interaction-to-next-paint].description"
],
"core/audits/errors-in-console.js | title": [
"audits[errors-in-console].title"
Expand Down
4 changes: 2 additions & 2 deletions core/test/scenarios/__snapshots__/api-test-pptr.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,11 @@ Array [
"duplicated-javascript",
"efficient-animated-content",
"errors-in-console",
"experimental-interaction-to-next-paint",
"final-screenshot",
"image-aspect-ratio",
"image-size-responsive",
"inspector-issues",
"interaction-to-next-paint",
"is-on-https",
"layout-shift-elements",
"legacy-javascript",
Expand Down Expand Up @@ -490,11 +490,11 @@ Array [
"duplicated-javascript",
"efficient-animated-content",
"errors-in-console",
"experimental-interaction-to-next-paint",
"final-screenshot",
"image-aspect-ratio",
"image-size-responsive",
"inspector-issues",
"interaction-to-next-paint",
"is-on-https",
"layout-shift-elements",
"legacy-javascript",
Expand Down
3 changes: 0 additions & 3 deletions shared/localization/locales/ar-XB.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/bg.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/ca.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/cs.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/da.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/de.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/el.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions shared/localization/locales/en-GB.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading