-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
tests(lightwallet): add perf-budget smoke test #8853
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!doctype html> | ||
<!-- | ||
* 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. | ||
--> | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> | ||
<style> | ||
@font-face { | ||
font-family: 'Lobster'; | ||
src: local('Lobster'), url('../lobster-v20-latin-regular.woff2') format('woff2'); | ||
} | ||
@font-face { | ||
font-family: 'Lobster Two'; | ||
src: local("Lobster Two"), url("../lobster-two-v10-latin-700.woff2") format('woff2'); | ||
} | ||
.webfont { | ||
font-family: Lobster, sans-serif; | ||
} | ||
strong.webfont { | ||
font-family: Lobster Two, sans-serif; | ||
} | ||
</style> | ||
<link rel="stylesheet" href="http://localhost:10503/perf/cors-fonts.css"> | ||
<script src="big-script.js"></script> | ||
<script> | ||
async function yah() { | ||
// Load file as 'other' resource. | ||
const response = await fetch('http://localhost:10503/preload.html'); | ||
const ab = await response.arrayBuffer(); | ||
document.querySelector('#corsfont').textContent = ab.length; | ||
} | ||
yah(); | ||
</script> | ||
</head> | ||
<body> | ||
<img src="../../dobetterweb/lighthouse-480x318.jpg" width="480" height="57"> | ||
<img style="width: 100px; height: 100px;" src="../../byte-efficiency/large.svg"> | ||
<p class="webfont">Ripping off some webfont smoke tests</p> | ||
<p><strong class="webfont">Do we need such text</strong></p> | ||
<p id="corsfont"></p> | ||
<script src="../level-2.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
'use strict'; | ||
|
||
/** | ||
* Expected Lighthouse audit values for --preset=perf tests | ||
* Expected Lighthouse audit values for perf tests. | ||
*/ | ||
module.exports = [ | ||
{ | ||
|
@@ -65,6 +65,84 @@ module.exports = [ | |
}, | ||
}, | ||
}, | ||
{ | ||
lhr: { | ||
requestedUrl: 'http://localhost:10200/perf/perf-budgets/load-things.html', | ||
finalUrl: 'http://localhost:10200/perf/perf-budgets/load-things.html', | ||
audits: { | ||
'resource-summary': { | ||
score: null, | ||
displayValue: '11 requests • 164 KB', | ||
details: { | ||
items: [ | ||
{resourceType: 'total', requestCount: 11, size: '168000±1000'}, | ||
{resourceType: 'font', requestCount: 2, size: '80000±1000'}, | ||
{resourceType: 'script', requestCount: 3, size: '55000±1000'}, | ||
{resourceType: 'image', requestCount: 2, size: '28000±1000'}, | ||
{resourceType: 'document', requestCount: 1, size: '2100±100'}, | ||
{resourceType: 'other', requestCount: 2, size: '1250±50'}, | ||
{resourceType: 'stylesheet', requestCount: 1, size: '450±100'}, | ||
{resourceType: 'media', requestCount: 0, size: 0}, | ||
{resourceType: 'third-party', requestCount: 0, size: 0}, | ||
], | ||
}, | ||
}, | ||
'performance-budget': { | ||
score: null, | ||
details: { | ||
// Undefined items are asserting that the property isn't included in the table item. | ||
items: [ | ||
{ | ||
resourceType: 'total', | ||
countOverBudget: '3 requests', | ||
sizeOverBudget: '65000±1000', | ||
}, | ||
{ | ||
resourceType: 'script', | ||
countOverBudget: '2 requests', | ||
sizeOverBudget: '25000±1000', | ||
}, | ||
{ | ||
resourceType: 'font', | ||
countOverBudget: undefined, | ||
sizeOverBudget: '4000±500', | ||
}, | ||
{ | ||
resourceType: 'document', | ||
countOverBudget: '1 request', | ||
sizeOverBudget: '1100±50', | ||
}, | ||
{ | ||
resourceType: 'stylesheet', | ||
countOverBudget: undefined, | ||
sizeOverBudget: '450±100', | ||
}, | ||
{ | ||
resourceType: 'image', | ||
countOverBudget: '1 request', | ||
sizeOverBudget: undefined, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Letting If we just left this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we add a comment somewhere to this effect? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
added a comment to make it clear to anyone reading the expectations file |
||
}, | ||
{ | ||
resourceType: 'media', | ||
countOverBudget: undefined, | ||
sizeOverBudget: undefined, | ||
}, | ||
{ | ||
resourceType: 'other', | ||
countOverBudget: '1 request', | ||
sizeOverBudget: undefined, | ||
}, | ||
{ | ||
resourceType: 'third-party', | ||
countOverBudget: undefined, | ||
sizeOverBudget: undefined, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
lhr: { | ||
requestedUrl: 'http://localhost:10200/perf/fonts.html', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* @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'; | ||
|
||
/** @type {LH.Config.Json} */ | ||
const perfConfig = { | ||
extends: 'lighthouse:default', | ||
settings: { | ||
throttlingMethod: 'devtools', | ||
onlyCategories: ['performance'], | ||
|
||
// A mixture of under, over, and meeting budget to exercise all paths. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe include the path to the file where these budgets are being tested so we can look them up for correctness later? it's a bit weird that our "expectations" are basically here in the config that's shared with several other smokes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I could split it into a new smoke |
||
budgets: [{ | ||
resourceCounts: [ | ||
{resourceType: 'total', budget: 8}, | ||
{resourceType: 'stylesheet', budget: 1}, // meets budget | ||
{resourceType: 'image', budget: 1}, | ||
{resourceType: 'media', budget: 0}, | ||
{resourceType: 'font', budget: 2}, // meets budget | ||
{resourceType: 'script', budget: 1}, | ||
{resourceType: 'document', budget: 0}, | ||
{resourceType: 'other', budget: 1}, | ||
{resourceType: 'third-party', budget: 0}, | ||
], | ||
resourceSizes: [ | ||
{resourceType: 'total', budget: 100}, | ||
{resourceType: 'stylesheet', budget: 0}, | ||
{resourceType: 'image', budget: 30}, // meets budget | ||
{resourceType: 'media', budget: 0}, | ||
{resourceType: 'font', budget: 75}, | ||
{resourceType: 'script', budget: 30}, | ||
{resourceType: 'document', budget: 1}, | ||
{resourceType: 'other', budget: 2}, // meets budget | ||
{resourceType: 'third-party', budget: 0}, | ||
], | ||
timings: [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these aren't being used right now, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
right, they're parsed by budget.js, but the audit doesn't check them yet |
||
{metric: 'first-contentful-paint', budget: 2000, tolerance: 100}, | ||
{metric: 'first-cpu-idle', budget: 2000, tolerance: 100}, | ||
{metric: 'interactive', budget: 2000, tolerance: 100}, | ||
{metric: 'first-meaningful-paint', budget: 2000, tolerance: 100}, | ||
{metric: 'estimated-input-latency', budget: 2000, tolerance: 100}, | ||
], | ||
}], | ||
}, | ||
}; | ||
|
||
module.exports = perfConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used ± to leave some leeway on some of the assets because most of them are shared with other smoke tests. This will allow the test to absorb changes to them of a few hundred bytes or so, but we can always make it exact.