Closed chrismaximin closed 8 years ago
First, thanks for this! And for adding tests and all the things, this is great. Does it work when rendered in Percy? :)
Two quick thoughts (just at very quick glance, I will do a more thorough review this week):
SprocketsLoader
(and, if you feel up to it, shared in NativeLoader
as well—but I'm fine with not having support for it there as that is a less common path).within_frame
and see if it does what we want? Just need to find a way to get the source while within the frame context, and if Selenium has a native way to do that then it probably will let us dramatically simplify this code and probably not require JavaScript at all — http://stackoverflow.com/a/11910060/1285970- It does work when rendered in Percy! (example, root page has a black bg overlay)
1- I'll look into it for SprocketsLoader
2- I'll look into it.
3- I'll look into it.
:)
Updates:
1- Now integrated by default in SprocketsLoader
and NativeLoader
2- Added same-origin
domain check
3- Now using within_frame
instead of evaluate_script
to get iframe body
Back to you @christophemaximin, this is fantastic.
Thanks so much for contributing this.
Released as 2.3.0.pre.beta
of the gem. Having a few customers test it out before tagging as 2.3.0.
Thank you for your help and responsiveness! Love Percy, been looking for an easy-to-integrate service like that for years, as I've always believed in the crucial importance of integrated visual testing; so I'm happy to do what I can to help :)
Note:
SprocketsLoader
.SprocketsLoader
because it's not directly using sprockets, but it does depend on it to load the iframe content assets; also because it uses javascript to load the iframe contents, which can be potentially slow.Percy::Capybara.use_loader(Percy::Capybara::Loaders::SprocketsWithIframesLoader)
SprocketsLoader
, say the word.