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

tests: support artifact assertions in smoke tests #8044

Merged
merged 15 commits into from
Apr 11, 2019
2 changes: 2 additions & 0 deletions lighthouse-cli/test/smokehouse/a11y/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/a11y/a11y_tester.html',
finalUrl: 'http://localhost:10200/a11y/a11y_tester.html',
audits: {
Expand Down Expand Up @@ -239,4 +240,5 @@ module.exports = [
},
},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/byte-efficiency/tester.html',
finalUrl: 'http://localhost:10200/byte-efficiency/tester.html',
audits: {
Expand Down Expand Up @@ -117,7 +118,9 @@ module.exports = [
},
},
},
},
{
lhr: {
requestedUrl: 'http://localhost:10200/byte-efficiency/gzip.html',
finalUrl: 'http://localhost:10200/byte-efficiency/gzip.html',
audits: {
Expand All @@ -142,4 +145,5 @@ module.exports = [
},
},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/dobetterweb/dbw_tester.html',
finalUrl: 'http://localhost:10200/dobetterweb/dbw_tester.html',
audits: {
Expand Down Expand Up @@ -144,4 +145,5 @@ module.exports = [
},
},
},
},
];
8 changes: 6 additions & 2 deletions lighthouse-cli/test/smokehouse/error-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@
*/
module.exports = [
{
errorCode: 'PAGE_HUNG',
lhr: {
requestedUrl: 'http://localhost:10200/infinite-loop.html',
finalUrl: 'http://localhost:10200/infinite-loop.html',
errorCode: 'PAGE_HUNG',
audits: {},
},
},
{
errorCode: 'INSECURE_DOCUMENT_REQUEST',
lhr: {
requestedUrl: 'https://expired.badssl.com',
finalUrl: 'https://expired.badssl.com',
errorCode: 'INSECURE_DOCUMENT_REQUEST',
audits: {},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/online-only.html',
finalUrl: 'http://localhost:10200/online-only.html',
audits: {
Expand Down Expand Up @@ -97,8 +98,9 @@ module.exports = [
},
},
},

},
{
lhr: {
requestedUrl: 'http://localhost:10503/offline-ready.html',
finalUrl: 'http://localhost:10503/offline-ready.html',
audits: {
Expand Down Expand Up @@ -158,8 +160,10 @@ module.exports = [
},
},
},
},

{
lhr: {
requestedUrl: 'http://localhost:10503/offline-ready.html?slow',
finalUrl: 'http://localhost:10503/offline-ready.html?slow',
audits: {
Expand All @@ -171,4 +175,5 @@ module.exports = [
},
},
},
},
];
2 changes: 2 additions & 0 deletions lighthouse-cli/test/smokehouse/oopif-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/oopif.html',
finalUrl: 'http://localhost:10200/oopif.html',
audits: {
Expand All @@ -26,4 +27,5 @@ module.exports = [
},
},
},
},
];
4 changes: 4 additions & 0 deletions lighthouse-cli/test/smokehouse/perf/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/preload.html',
finalUrl: 'http://localhost:10200/preload.html',
audits: {
Expand Down Expand Up @@ -63,7 +64,9 @@ module.exports = [
},
},
},
},
{
lhr: {
requestedUrl: 'http://localhost:10200/perf/fonts.html',
finalUrl: 'http://localhost:10200/perf/fonts.html',
audits: {
Expand All @@ -77,4 +80,5 @@ module.exports = [
},
},
},
},
];
2 changes: 2 additions & 0 deletions lighthouse-cli/test/smokehouse/perf/lantern-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
module.exports = [
{
lhr: {
requestedUrl: 'http://localhost:10200/online-only.html',
finalUrl: 'http://localhost:10200/online-only.html',
audits: {
Expand All @@ -24,4 +25,5 @@ module.exports = [
},
},
},
},
];
4 changes: 4 additions & 0 deletions lighthouse-cli/test/smokehouse/pwa-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const pwaDetailsExpectations = {
*/
module.exports = [
{
lhr: {
requestedUrl: 'https://airhorner.com',
finalUrl: 'https://airhorner.com/',
audits: {
Expand Down Expand Up @@ -81,8 +82,10 @@ module.exports = [
},
},
},
},

{
lhr: {
requestedUrl: 'https://www.chromestatus.com/',
finalUrl: 'https://www.chromestatus.com/features',
audits: {
Expand Down Expand Up @@ -141,6 +144,7 @@ module.exports = [
},
},
},
},
];

module.exports.PWA_DETAILS_EXPECTATIONS = pwaDetailsExpectations;
4 changes: 4 additions & 0 deletions lighthouse-cli/test/smokehouse/pwa2-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const jakeExpectations = {...pwaDetailsExpectations, hasShortName: false};
*/
module.exports = [
{
lhr: {
requestedUrl: 'https://jakearchibald.github.io/svgomg/',
finalUrl: 'https://jakearchibald.github.io/svgomg/',
audits: {
Expand Down Expand Up @@ -76,8 +77,10 @@ module.exports = [
},
},
},
},

{
lhr: {
requestedUrl: 'https://shop.polymer-project.org/',
finalUrl: 'https://shop.polymer-project.org/',
audits: {
Expand Down Expand Up @@ -136,4 +139,5 @@ module.exports = [
},
},
},
},
];
2 changes: 2 additions & 0 deletions lighthouse-cli/test/smokehouse/pwa3-expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const pwaRocksExpectations = {...pwaDetailsExpectations, hasIconsAtLeast512px: f
*/
module.exports = [
{
lhr: {
requestedUrl: 'https://pwa.rocks',
finalUrl: 'https://pwa.rocks/',
audits: {
Expand Down Expand Up @@ -73,4 +74,5 @@ module.exports = [
},
},
},
},
];
4 changes: 4 additions & 0 deletions lighthouse-cli/test/smokehouse/redirects/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const cacheBuster = Number(new Date());

module.exports = [
{
lhr: {
requestedUrl: `http://localhost:10200/online-only.html?delay=500&redirect=%2Foffline-only.html%3Fcb=${cacheBuster}%26delay=500%26redirect%3D%2Fredirects-final.html`,
finalUrl: 'http://localhost:10200/redirects-final.html',
audits: {
Expand All @@ -26,7 +27,9 @@ module.exports = [
},
},
},
},
{
lhr: {
requestedUrl: `http://localhost:10200/online-only.html?delay=300&redirect=%2Fredirects-final.html`,
finalUrl: 'http://localhost:10200/redirects-final.html',
audits: {
Expand All @@ -41,4 +44,5 @@ module.exports = [
},
},
},
},
];
17 changes: 14 additions & 3 deletions lighthouse-cli/test/smokehouse/seo/expectations.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const passHeaders = headersParam([[
*/
module.exports = [
{
lhr: {
requestedUrl: BASE_URL + 'seo-tester.html?' + passHeaders,
finalUrl: BASE_URL + 'seo-tester.html?' + passHeaders,
audits: {
Expand Down Expand Up @@ -80,8 +81,9 @@ module.exports = [
scoreDisplayMode: 'notApplicable',
},
},
},
}},
{
lhr: {
requestedUrl: BASE_URL + 'seo-failure-cases.html?' + failureHeaders,
finalUrl: BASE_URL + 'seo-failure-cases.html?' + failureHeaders,
audits: {
Expand Down Expand Up @@ -141,7 +143,9 @@ module.exports = [
},
},
},
},
{
lhr: {
// Note: most scores are null (audit error) because the page 403ed.
requestedUrl: BASE_URL + 'seo-failure-cases.html?status_code=403',
finalUrl: BASE_URL + 'seo-failure-cases.html?status_code=403',
Expand Down Expand Up @@ -178,10 +182,11 @@ module.exports = [
score: null,
},
},
},
}},
{
requestedUrl: BASE_URL + 'seo-tap-targets.html',
lhr: {
finalUrl: BASE_URL + 'seo-tap-targets.html',
requestedUrl: BASE_URL + 'seo-tap-targets.html',
audits: {
'tap-targets': {
score: (() => {
Expand Down Expand Up @@ -221,4 +226,10 @@ module.exports = [
},
},
},
artifacts: {
TapTargets: {
length: 11,
},
},
},
];
2 changes: 1 addition & 1 deletion lighthouse-cli/test/smokehouse/smoke-test-dfns.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function loadConfig(configPath) {

/**
* @param {string} expectationsPath
* @return {Smokehouse.ExpectedLHR[]}
* @return {Smokehouse.ExpectedRunnerResult[]}
*/
function loadExpectations(expectationsPath) {
return require(expectationsPath);
Expand Down
Loading