-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
I2D: mode.isLocalDev #35674
Comments
/cc @jridgewell @samouri @erwinmombay @ampproject/wg-components |
I can't think of any either. I have the same question about
|
Another way of thinking about it is that there are three possible states we care to support:
|
status updateAfter merging #35823, three things blew up. Ideally we (I) would have foreseen the potential breakages before merging, but here we are. Previously to that PR, There are some (not many) checks for 1. amp story shadow dom In prod (and local dev) Since all test of amphtml/extensions/amp-story/1.0/utils.js Line 92 in a41366d
Two potential ways to move forward here would be:
2. Virtual history vs. Natural History During test, HistoryBindingVirtual was always used. During local dev we need HistoryBindingNatural. Fixing in #35889 3. amp-story sticky header Stopped sticking. Following up in #34504 |
Instead of |
Is there a solution to this problem we can address? |
This would be the ideal situation and is the second solution I pointed out. @danielrozenberg was hinting that there exists "dynamic" percy tests which can execute JS instead of needing inert dom. A second possibility would be to use Declarative Shadow DOM. |
After sleeping on it, I realized that the dynamic tests feature is not the best approach here. I thought of a better solution, but first here's the TL;DR of how we execute the tests (skipping details that aren't relevant to this problem):
My proposed solution is to add another "freezing" task to step 3 that converts any shadow DOMs in the page to Declarative Shadow DOM. Is this something we can do? I'm not very familiar with DSD (I did check and DSD is only supported starting Chrome 90. Our Percy project was set to use Chrome 87 but I just changed the settings to update it and sent out PR #35942 to upgrade the local browser we use to match with the new version on their service) For more full context on how visual diff test are written and executed, see the testing docs |
@danielrozenberg: thank you for the explanation of how our visdiff tests are stitched together! instead of an Alternatively the "freezing" technique is likely to be slightly less brittle I believe the DSD serialization API is still experimental (getInnerHTML) |
In reality we just pass a If you want to follow the code: we call
I think this is the only realistic option, or you can propose a solution to Percy directly (I'm sure it'll be appreciated!) |
Judging by this GH Issue it doesn't look like Percy will support DSD/SD Serialization until there is more cross-browser support. On the percy-side, when they load the serialized HTML before taking a screenshot, do you know if they execute the page's JS? If yes, then we could pre-process the document with a new stage that serializes the SD and inserts a DSD polyfill (only a few lines of code) |
Oooh good find, didn't think to look at whether there's already an issue for this :)
Yes, when you create a snapshot you pass an
I don't think we need a DSD polyfill since we now run our Percy tests on Chrome 91 which has built-in, default-on support for DSD. Pre-processing to serialize the SD would probably be enough! |
@danielrozenberg: I've implemented the serialization changes in #35917. In order to complete the change though, there are a few other AIs:
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
The code looks like this:
It's basically always used like
mode.isLocalDev(win) || mode.isTest(win)
I can't think of any environment where
isProd()
is false thatisLocalDev
should also be false. This is causing challenges with testing/running Bento components, sinceAMP_CONFIG
isn't available.Can we drop this entirely and replace all calls with
!mode.isProd()
?The text was updated successfully, but these errors were encountered: