-
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(tags-blocking-first-paint): alternate stylesheets are not blocking #9248
Conversation
…t considered blocking
@@ -16,6 +16,9 @@ module.exports = [ | |||
}, { | |||
id: 'wordpress', | |||
}], | |||
TagsBlockingFirstPaint: { | |||
length: 7, |
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.
should i be more explicit here?
[
{
"tag": {
"tagName": "LINK",
"url": "http://localhost:10200/dobetterweb/dobetterweb/dbw_tester.css?delay=100",
"href": "http://localhost:10200/dobetterweb/dobetterweb/dbw_tester.css?delay=100",
"rel": "stylesheet",
"media": "",
"disabled": false,
"mediaChanges": []
},
},
{
"tag": {
"tagName": "LINK",
"url": "http://localhost:10200/dobetterweb/unknown404.css?delay=200",
"href": "http://localhost:10200/dobetterweb/unknown404.css?delay=200",
"rel": "stylesheet",
"media": "",
"disabled": false,
"mediaChanges": []
},
},
{
"tag": {
"tagName": "LINK",
"url": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=2200",
"href": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=2200",
"rel": "stylesheet",
"media": "",
"disabled": false,
"mediaChanges": []
},
},
{
"tag": {
"tagName": "LINK",
"url": "http://localhost:10200/dobetterweb/dbw_partial_a.html?delay=200",
"href": "http://localhost:10200/dobetterweb/dbw_partial_a.html?delay=200",
"rel": "import",
"media": "",
"disabled": false,
"mediaChanges": []
},
},
{
"tag": {
"tagName": "LINK",
"url": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=3000&capped",
"href": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=3000&capped",
"rel": "stylesheet",
"media": "screen",
"disabled": false,
"mediaChanges": [
{
"href": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=3000&capped",
"media": "not-matching",
"matches": false
},
{
"href": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=3000&capped",
"media": "screen",
"matches": true
}
]
},
},
{
"tag": {
"tagName": "SCRIPT",
"url": "http://localhost:10200/dobetterweb/dbw_tester.js",
"src": "http://localhost:10200/dobetterweb/dbw_tester.js",
"mediaChanges": []
},
},
{
"tag": {
"tagName": "SCRIPT",
"url": "http://localhost:10200/dobetterweb/fcp-delayer.js?delay=5000",
"src": "http://localhost:10200/dobetterweb/fcp-delayer.js?delay=5000",
"mediaChanges": []
},
}
]
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.
I think we should include the URL at least otherwise debugging this is going to be a nightmare, are they in a predictable order? should we sort by URL or something?
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.
we do have an existing assertion for the tags blocking first paint, in the render-blocking-resources
audit, and that's probably a better one to sort (I'm kind of surprised it's not sorted by wastedMs
already)
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.
using that audit for the assertion is problematic b/c it also ignores resources that don't meet a minimum threshold.
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.
yeah I agree with @connorjclark it's worth asserting these artifacts directly, and if we're asserting the length we should make it debuggable by asserting the URLs
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.
Fair enough! I guess should say the audit(s) should also be updated, then, so we aren't neglecting the "to end" part of end-to-end testing :)
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.
always love more tests! ❤️
@@ -16,6 +16,9 @@ module.exports = [ | |||
}, { | |||
id: 'wordpress', | |||
}], | |||
TagsBlockingFirstPaint: { | |||
length: 7, |
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.
I think we should include the URL at least otherwise debugging this is going to be a nightmare, are they in a predictable order? should we sort by URL or something?
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.
you must install an extension in Chrome to use alternate stylesheets. Firefox has it built in.
like, it won't load at all? Or there's no UI support? Or...?
@@ -16,6 +16,9 @@ module.exports = [ | |||
}, { | |||
id: 'wordpress', | |||
}], | |||
TagsBlockingFirstPaint: { | |||
length: 7, |
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.
we do have an existing assertion for the tags blocking first paint, in the render-blocking-resources
audit, and that's probably a better one to sort (I'm kind of surprised it's not sorted by wastedMs
already)
Oops, I forgot to share the surge I made: https://lh-alt-styles.surge.sh/ Chrome offers no UI. it still downloads the stylesheet. Firefox allows you to select which alternate to use (View -> Page Style). |
}, | ||
undefined, // marks end of array | ||
], | ||
// TagsBlockingFirstPaint: { |
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.
which one?
I very much dislike both, but I dislike the first one less, even though it would technically pass something like [Object,Object,Object,undefined,Object,Object]
...
Was considering doing something like [..., Symbol('end')]
instead of [..., undefined]
and adding a customer checker in the assertions, but that would be too far for just this one thing.
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.
option c: we could start asserting the array length in our smokes :)
I'm fine with the first one though, definitely not a huge fan of option 2
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.
i like c
. I can follow up after this PR.
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.
cool beans want to remove the dead weight ones for now then? :)
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.
done
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.
LGTM
@@ -16,6 +16,64 @@ module.exports = [ | |||
}, { | |||
id: 'wordpress', | |||
}], | |||
TagsBlockingFirstPaint: [ |
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.
the user-observable behavior here is in the render-blocking-resources
audit (though TagsBlockingFirstPaint
will enter our PublicGathererArtifacts
someday).
There is a balance to strike when testing internal state when it's difficult to test otherwise, so I understand the argument for capturing it here, but if we accept that and that this data is important to assert, then we should assert it in the audit as well.
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.
would you prefer I change the alternate request to a large stylesheet so we can assert in the audit too?
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.
would you prefer I change the alternate request to a large stylesheet so we can assert in the audit too?
that might make the alternate stylesheet test more realistic, but not being included there is also a signal that the audit is working as expected
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.
sorry, but what's the requested change here?
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.
sorry, but what's the requested change here?
if whatever items you don't want to see regress (e.g. the urls, etc) are important enough to add to a smoke test, they should be asserted where they are actually observable by a user? The artifact can be asserted all day but that doesn't matter if the audit is mismatched to it.
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.
talked offline - didn't realize his suggestions are independent of the specific alternate-stylesheet I added. should expand the render-blocking-resources
audit expectation to be more than "detail.items
is array of 7 items".
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.
yeah, sorry, we were having two different conversations :)
FYI the reason I want this test is to avoid regressions from any action taken on #2065 |
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.
LGTM
While investigating #2065, I learned
alternate
stylesheets are never considered blocking. We do handle these correctly, but we had no test cases, so I added one.Must be in the smoke test, as the unit test completely mocks out the code under test (it's mostly in a page function).
fyi: apparently, you must install an extension in Chrome to use alternate stylesheets. Firefox has it built in.