mattheworiordan / capybara-screenshot

Automatically save screen shots when a Capybara scenario fails
MIT License
1.02k stars 168 forks source link

asset_host with webpacker generated css and Rails 6 #265

Open axlekb opened 5 years ago

axlekb commented 5 years ago

With Rails 6, I'm struggling getting "good-looking" (with css styles) HTML screenshots when running my specs without JS. Anyone solve this problem?

I run a bunch of specs without JS on because it they run faster but the default setting for webpacker in a test environment is to "inject" the CSS into the HTML. The injection does not happen if you're not running with JS.

You can change webpacker.yml to extract_css: true, and that allows you to generate the css file before running the suite, but I can't figure out why my development environment does not want to serve anything from public/packs-test when I load the html screenshot in a browser: Cannot GET /packs-test/css/application-d7079357.css

Anyone else have this use case?