Skip to content

Commit

Permalink
use first navstart, not last
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed May 24, 2017
1 parent 25f157c commit ea619df
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions lighthouse-core/gather/computed/trace-of-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class TraceOfTab extends ComputedArtifact {
// Filter to just events matching the frame ID for sanity
const frameEvents = keyEvents.filter(e => e.args.frame === startedInPageEvt.args.data.page);

// Our navStart will be the last frame navigation in the trace
const navigationStart = frameEvents.filter(e => e.name === 'navigationStart').pop();
// Our navStart will be the first frame navigation in the trace
const navigationStart = frameEvents.filter(e => e.name === 'navigationStart').shift();
if (!navigationStart) throw new Error('navigationStart was not found in the trace');

// Find our first paint of this frame
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/test/audits/consistently-interactive-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ describe('Performance: consistently-interactive audit', () => {
}, Runner.instantiateComputedArtifacts());

return ConsistentlyInteractive.audit(artifacts).then(output => {
assert.equal(output.score, 95);
assert.equal(Math.round(output.rawValue), 2712);
assert.equal(output.displayValue, '2,710\xa0ms');
assert.equal(output.score, 72);
assert.equal(Math.round(output.rawValue), 6274);
assert.equal(output.displayValue, '6,270\xa0ms');
});
});

Expand Down
14 changes: 7 additions & 7 deletions lighthouse-core/test/audits/first-meaningful-paint-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ describe('Performance: first-meaningful-paint audit', () => {
it('if there was a tracingStartedInPage after the frame\'s navStart', () => {
return FMPAudit.audit(generateArtifactsWithTrace(lateTracingStartedTrace)).then(result => {
assert.equal(result.displayValue, '530\xa0ms');
assert.equal(result.rawValue, 529.9);
assert.equal(result.extendedInfo.value.timestamps.navStart, 29343540951);
assert.equal(result.extendedInfo.value.timings.fCP, 80.054);
assert.equal(result.rawValue, 530.7);
assert.equal(result.extendedInfo.value.timestamps.navStart, 29343540184);
assert.equal(result.extendedInfo.value.timings.fCP, 80.821);
assert.ok(!result.debugString);
});
});

it('if there was a tracingStartedInPage after the frame\'s navStart #2', () => {
return FMPAudit.audit(generateArtifactsWithTrace(badNavStartTrace)).then(result => {
assert.equal(result.displayValue, '630\xa0ms');
assert.equal(result.rawValue, 632.4);
assert.equal(result.extendedInfo.value.timestamps.navStart, 8885424467);
assert.equal(result.extendedInfo.value.timings.fCP, 632.419);
assert.equal(result.displayValue, '770\xa0ms');
assert.equal(result.rawValue, 773.6);
assert.equal(result.extendedInfo.value.timestamps.navStart, 8885283274);
assert.equal(result.extendedInfo.value.timings.fCP, 773.612);
assert.ok(!result.debugString);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('FirstInteractive computed artifact:', () => {

it('should compute firstInteractive on pages with redirect', () => {
return computedArtifacts.requestFirstInteractive(redirectTrace).then(output => {
assert.equal(Math.round(output.timeInMs), 2712);
assert.equal(Math.round(output.timeInMs), 6274);
assert.ok(output.timestamp, 'output is missing timestamp');
});
});
Expand Down
14 changes: 7 additions & 7 deletions lighthouse-core/test/gather/computed/trace-of-tab-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ describe('Trace of Tab computed artifact:', () => {
it('computes timings of each event', () => {
const trace = traceOfTab.compute_(lateTracingStartedTrace);
assert.equal(Math.round(trace.timings.navigationStart), 0);
assert.equal(Math.round(trace.timings.firstPaint), 80);
assert.equal(Math.round(trace.timings.firstContentfulPaint), 80);
assert.equal(Math.round(trace.timings.firstMeaningfulPaint), 530);
assert.equal(Math.round(trace.timings.traceEnd), 649);
assert.equal(Math.round(trace.timings.firstPaint), 81);
assert.equal(Math.round(trace.timings.firstContentfulPaint), 81);
assert.equal(Math.round(trace.timings.firstMeaningfulPaint), 531);
assert.equal(Math.round(trace.timings.traceEnd), 650);
});

it('computes timestamps of each event', () => {
const trace = traceOfTab.compute_(lateTracingStartedTrace);
assert.equal(Math.round(trace.timestamps.navigationStart), 29343541);
assert.equal(Math.round(trace.timestamps.navigationStart), 29343540);
assert.equal(Math.round(trace.timestamps.firstPaint), 29343621);
assert.equal(Math.round(trace.timestamps.firstContentfulPaint), 29343621);
assert.equal(Math.round(trace.timestamps.firstMeaningfulPaint), 29344071);
Expand All @@ -64,15 +64,15 @@ describe('Trace of Tab computed artifact:', () => {
it('if there was a tracingStartedInPage after the frame\'s navStart', () => {
const trace = traceOfTab.compute_(lateTracingStartedTrace);
assert.equal(trace.startedInPageEvt.ts, 29343544280);
assert.equal(trace.navigationStartEvt.ts, 29343540951);
assert.equal(trace.navigationStartEvt.ts, 29343540184);
assert.equal(trace.firstContentfulPaintEvt.ts, 29343621005);
assert.equal(trace.firstMeaningfulPaintEvt.ts, 29344070867);
});

it('if there was a tracingStartedInPage after the frame\'s navStart #2', () => {
const trace = traceOfTab.compute_(badNavStartTrace);
assert.equal(trace.startedInPageEvt.ts, 8885435611);
assert.equal(trace.navigationStartEvt.ts, 8885424467);
assert.equal(trace.navigationStartEvt.ts, 8885283274);
assert.equal(trace.firstContentfulPaintEvt.ts, 8886056886);
assert.equal(trace.firstMeaningfulPaintEvt.ts, 8886056891);
});
Expand Down

0 comments on commit ea619df

Please sign in to comment.