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

misc: the great sample rebaseline #12932

Merged
merged 30 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
30b0f89
misc: the great sample rebaseline
connorjclark Aug 18, 2021
f446ef5
fix swap locale test
connorjclark Aug 18, 2021
d489397
fix report-ui-features
connorjclark Aug 19, 2021
2c16891
fix category renderer test
connorjclark Aug 19, 2021
dd1e6c1
fix perf cat rend
connorjclark Aug 19, 2021
4704b01
Merge remote-tracking branch 'origin/master' into great-rebaselines
connorjclark Aug 23, 2021
abdc7d2
inject fake events
connorjclark Aug 23, 2021
9509c43
Merge remote-tracking branch 'origin/master' into great-rebaselines
connorjclark Aug 23, 2021
b1c5468
update sample json after merge
connorjclark Aug 23, 2021
82d6291
fix swap locale test
connorjclark Aug 23, 2021
2ba1f70
update artifacts and json
connorjclark Aug 24, 2021
7dc9756
fix
connorjclark Aug 25, 2021
0d5846c
Merge remote-tracking branch 'origin/master' into great-rebaselines
connorjclark Aug 31, 2021
0f44a8f
update
connorjclark Aug 31, 2021
28feda3
deletecode
connorjclark Aug 31, 2021
ea580d9
update sample json
connorjclark Aug 31, 2021
82f018f
lol
connorjclark Aug 31, 2021
5d48bde
ugh
connorjclark Aug 31, 2021
2f3385e
lol i was on node 12 fml
connorjclark Aug 31, 2021
eae0a09
Merge remote-tracking branch 'origin/master' into great-rebaselines
connorjclark Sep 2, 2021
b561f4d
update
connorjclark Sep 2, 2021
8d73a5f
ahhhhh node 14
connorjclark Sep 2, 2021
bd1376e
lazy
connorjclark Sep 7, 2021
c0ea80c
lazy update
connorjclark Sep 7, 2021
0d6bdf4
animation
connorjclark Sep 7, 2021
39feab1
normalize timing artifact
connorjclark Sep 7, 2021
c08e49a
update
connorjclark Sep 7, 2021
320edf9
smoke
connorjclark Sep 7, 2021
0ba9d46
Merge remote-tracking branch 'origin/master' into great-rebaselines
connorjclark Sep 7, 2021
06f1510
smoke
connorjclark Sep 7, 2021
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
33 changes: 32 additions & 1 deletion lighthouse-cli/test/fixtures/dobetterweb/dbw_tester.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@
</head>
<body>

<div class="shifter">Shifter</div>
<script>
setTimeout(() => {
document.querySelector('.shifter').style.fontSize = '50px';
}, 1000);
setTimeout(() => {
document.querySelector('.shifter').style.display = 'none';
}, 2000);
</script>

<!-- Various sites like to assign HTMLElements a custom `matches` property. See issue #5934 -->

<!-- EmbeddedContent will process these elements -->
Expand Down Expand Up @@ -201,7 +211,8 @@ <h2>Do better web tester page</h2>
<!-- FAIL(image-aspect-ratio): image is naturally 480x318 -->
<img src="lighthouse-480x318.jpg?iar1" width="120" height="15">
<!-- PASS(image-aspect-ratio) -->
<img src="lighthouse-480x318.jpg?iar2" width="120" height="80">
<!-- FAIL(lcp-lazy-loaded) -->
<img loading="lazy" src="lighthouse-480x318.jpg?iar2" width="120" height="80">

<!-- FAIL(image-size-responsive): image is naturally 480x318 -->
<img src="lighthouse-480x318.jpg?isr1" width="360" height="240" style="position: absolute;">
Expand Down Expand Up @@ -473,5 +484,25 @@ <h2>Do better web tester page</h2>
console.error('Error! Error!');
</script>

<style>
#animated-boi {
animation: 3s badanim;
border: 1px solid black;
}

@keyframes badanim {
from {
margin-left: 100%;
height: 50px;
}

to {
margin-left: 0%;
height: 200px;
}
}
</style>
<div id="animated-boi">hi</div>

</body>
</html>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ const expectations = {
},
'dom-size': {
score: 1,
numericValue: 149,
numericValue: 153,
details: {
items: [
{statistic: 'Total DOM Elements', value: 149},
{statistic: 'Total DOM Elements', value: 153},
{statistic: 'Maximum DOM Depth', value: 4},
{
statistic: 'Maximum Child Elements',
Expand Down Expand Up @@ -411,7 +411,7 @@ const expectations = {
screenshot: {
width: 360,
// Allow for differences in platforms.
height: '1350±20',
height: '1350±100',
data: /^data:image\/jpeg;.{500,}/,
},
nodes: {
Expand Down
23 changes: 20 additions & 3 deletions lighthouse-core/scripts/update-report-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
*/
'use strict';

const fs = require('fs');
const cli = require('../../lighthouse-cli/run.js');
const cliFlags = require('../../lighthouse-cli/cli-flags.js');
const assetSaver = require('../lib/asset-saver.js');
const artifactPath = 'lighthouse-core/test/results/artifacts';

const {server} = require('../../lighthouse-cli/test/fixtures/static-server.js');
const budgetedConfig = require('../test/results/sample-config.js');
const {LH_ROOT} = require('../../root.js');

// All artifacts must have resources from a consistent port, to ensure reproducibility. https://github.com/GoogleChrome/lighthouse/issues/11776
const artifactPath = 'lighthouse-core/test/results/artifacts';
// All artifacts must have resources from a consistent port, to ensure reproducibility.
// https://github.com/GoogleChrome/lighthouse/issues/11776
const MAGIC_SERVER_PORT = 10200;

/**
* Update the report artifacts. If artifactName is set only that artifact will be updated.
* @param {keyof LH.Artifacts=} artifactName
Expand Down Expand Up @@ -45,6 +48,20 @@ async function update(artifactName) {
finalArtifacts[artifactName] = newArtifact;
await assetSaver.saveArtifacts(finalArtifacts, artifactPath);
}

// Normalize some data.
const artifactsFile = `${LH_ROOT}/${artifactPath}/artifacts.json`;
/** @type {LH.Artifacts} */
const artifacts = JSON.parse(fs.readFileSync(artifactsFile, 'utf-8'));

for (const timing of artifacts.Timing) {
// @ts-expect-error: Value actually is writeable at this point.
timing.startTime = 0;
// @ts-expect-error: Value actually is writeable at this point.
timing.duration = 1;
}

fs.writeFileSync(artifactsFile, JSON.stringify(artifacts, null, 2));
}

update(/** @type {keyof LH.Artifacts | undefined} */ (process.argv[2]));
14 changes: 8 additions & 6 deletions lighthouse-core/test/lib/i18n/swap-locale-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,20 @@ describe('swap-locale', () => {
expect(lhrDe.audits.plugins.title).toEqual('Dokument verwendet keine Plug-ins');

// With ICU string argument values
expect(lhrEn.audits['dom-size'].displayValue).toEqual('148 elements');
expect(lhrDe.audits['dom-size'].displayValue).toEqual('148 Elemente');
expect(lhrEn.audits['dom-size'].displayValue).toMatchInlineSnapshot(`"153 elements"`);
/* eslint-disable no-irregular-whitespace */
expect(lhrDe.audits['dom-size'].displayValue).toMatchInlineSnapshot(`"153 Elemente"`);

// Renderer formatted strings
expect(lhrEn.i18n.rendererFormattedStrings.labDataTitle).toEqual('Lab Data');
expect(lhrDe.i18n.rendererFormattedStrings.labDataTitle).toEqual('Labdaten');

// Formatted numbers in placeholders.
expect(lhrEn.audits['mainthread-work-breakdown'].displayValue)
.toEqual('1.5 s');
expect(lhrDe.audits['mainthread-work-breakdown'].displayValue)
.toEqual('1,5 s');
expect(lhrEn.audits['mainthread-work-breakdown'].displayValue).
toMatchInlineSnapshot(`"2.2 s"`);
expect(lhrDe.audits['mainthread-work-breakdown'].displayValue).
toMatchInlineSnapshot(`"2,2 s"`);
/* eslint-enable no-irregular-whitespace */
});

it('can roundtrip back to english correctly', () => {
Expand Down
Loading