-
-
Notifications
You must be signed in to change notification settings - Fork 143
[wip] use package CSS in percy screenshot tests #312
Conversation
@chriddyp How about we include the CSS in the JS source code? Like in |
@chriddyp Hmm actually the external CSS is a bit more than I thought, might be slightly awkward to have that in a CSS-in-JS solution. But perhaps we can set up some sort of CSS loader to inject it from a |
Yeah, I guess this works. I think I'd prefer an example that could work with Dash's existing system so that we could recommend Percy as a good solution for all component authors, but if we made this the standard way to import CSS then maybe this is OK.
Yeah, I could see a few advantages:
If we figure how to do this, then I'd like to make it a standard so that this repo is following our own conventions. That is, I'd like for us to update our other repos with the same system, our Any other thoughts on this @plotly/dash? |
I think the simplest way to include CSS in the JS source code would be adding something like However, I'm not sure CSS-in-JS is a solution that will really resolve our Percy problems. Percy seems to have just as much trouble loading JS as CSS, even with the somewhat hidden |
@chriddyp Is this PR something that could complement @valentijnnieman's #330? Or does using the |
Yeah, we can close this. I would've liked to know how to properly configure Percy with external, local CSS files since it might come up again in the future in a different project, but for now this gets the job done 🔧 |
Percy works by downloading the HTML on the page, sending that HTML to their server, and then re-rendering that HTML in different browsers and taking screenshots.
Our CSS isn't actually on the page - it's referenced by a
<link ref="stylesheet">
. Percy won't download these links, it needs us to supply their location on the filesystem (a mapping between the URL and the filenames). This PR adds this mapping to our percy setup. So, our screenshots should actually look like the real thing.