percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
70 stars 43 forks source link

iFrame missing css #1189

Closed esetnik closed 1 year ago

esetnik commented 1 year ago

The problem

After upgrading to v1.19.2 the snapshots of iframed content does not render any CSS.

See https://percy.io/283b5e1b/ProdigyEMS/builds/25284757/changed/1410160725?browser=chrome&browser_ids=33%2C34&subcategories=unreviewed%2Cchanges_requested&viewLayout=side-by-side&viewMode=new&width=1280&widths=375%2C1280

Environment

Details

I believe it could be related to #1165

Debug logs

If you are reporting a bug, always include logs! Give the "Debugging SDKs" document a quick read for how to gather logs

Please do not trim or edit these logs, often times there are hints in the full logs that help debug what is going on.

Code to reproduce issue

Given the nature of testing/environment bugs, it’s best to try and isolate the issue in a reproducible repo. This will make it much easier for us to diagnose and fix.

itsjwala commented 1 year ago

Hey @esetnik 👋

I checked the build and could see the style sheets are being discovered as text/html instead of text/css causing it to not load it.

image image

you can verify it on your end by checking --verbose logs of the CLI for asset discovery browser.

esetnik commented 1 year ago

@itsjwala but those paths are not the correct paths to the css files in the iframe. It looks like percy is rewriting the paths for iframed content for some reason to use a relative path on the parent page. This is new behavior as of v1.19.2 (the iframed snapshots are working correctly in real tests as well as in percy v1.18.0 and earlier).

esetnik commented 1 year ago
image
itsjwala commented 1 year ago

@esetnik

esetnik commented 1 year ago

@esetnik

  • yes we override the parent base URL with our own domain, but the iframe URL for the styles seems to be the same for styles.css

I'm not understanding what you mean by this. Percy is using the domain https://frontend.local.prodigyems.com to resolve those assets but they are actually hosted under https://local.prodigyems.com. See my screenshot above. The url is https://local.prodigyems.com/css/line-icons/style.css not https://frontend.local.prodigyems.com/css/line-icons/style.css and they do return the correct content-type header.

itsjwala commented 1 year ago

Hey @esetnik