SuffolkLITLab / ALKiln

Integrated automated end-to-end testing with docassemble, puppeteer, and cucumber.
https://assemblyline.suffolklitlab.org/docs/alkiln/intro
MIT License
14 stars 4 forks source link

Download the HTML for the page when screenshotting #768

Closed BryceStevenWilley closed 11 months ago

BryceStevenWilley commented 11 months ago

IMO it's best to think of it as a part of the screenshot (enhanced screenshot). We also replace relative URLs for CSS / JS with absolute URLs, adding the server url in front of them. This isn't perfect, as CORS will prevent the page from fully loading, but it's close enough, people will still have the screenshot if they want exactly what the page looked like.

Fixes #763, probably some other related ones as well.

In this PR, I have:

Any manual testing I have done to ensure my PR is working

Have manually run the tests, and have made sure that:

BryceStevenWilley commented 11 months ago

Confirmed that the HTML files are uploaded correctly!

BryceStevenWilley commented 11 months ago

From synchronous discussion: we aren't sure how much performance gain we get from the Promise.all stuff, and it's a bit easier to read/ maintain without it, so going to remove that.

BryceStevenWilley commented 11 months ago

The HTML also comes out a bit weird (I looked specifically at the upload page where there were doubled fields and such)

Yeah, I mentioned that in passing earlier, but most of that is because the javascript on the page can't run. Loading a webpage from a local file that then tries to call a docassemble server will fail for several cascading reasons:

But I agree that it's good enough. Just saying that "it'll be different, still use the screenshots, and only look at the page if something's missing in the screenshot, or you need to examine the HTML code directly (opening in the browser to use inspect tools is helpful here)" should be enough. I'm gonna document a lot of other stuff tomorrow, I'll try to do this one as well.