Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save_and_open_page / "Show me the page" doesn't include CSS from Rails 3.1 asset pipeline #485

Closed
tracedwax opened this issue Sep 5, 2011 · 17 comments

Comments

@tracedwax
Copy link

I worked around it by including the following gist in an initializer, so it only triggers in the cucumber or test environments.
https://gist.github.com/1144277

Is there an easier or more standard way to get the asset pipeline css to show up?

I have Launchy 2.0.5.

Thanks!

@awt
Copy link

awt commented Sep 5, 2011

I believe there is an issue with javascript as well.

@JangoSteve
Copy link

I couldn't get the workaround linked to above to work for me. Also, taking a look at the code in that gist, I didn't like the way it worked; it was copying all CSS assets to the capybara tmp directory, and it wasn't doing anything for javascripts or images.

So, I created a patch that adds full asset pipeline support (I think), see #500.

@dom1nga
Copy link

dom1nga commented Nov 1, 2011

it makes me cry

@IgorDobryn
Copy link

It's really problem. I can't debug tests in my project.

@ghost
Copy link

ghost commented Nov 1, 2011

+1

@ValeriiVasin
Copy link

Fix it please...

@oleksiilevzhynskyi
Copy link

+1. It's really needed!

@joliss
Copy link
Collaborator

joliss commented Nov 1, 2011

I'm not the maintainer, but ... If your entire team is needing this fixed, why don't you guys get one of you hacking on the source and see if you can come up with a fix? Even if it's not polished, sending a pull request as a discussion starter might be the best way to move this forward (as Jonas tends to be quite a busy guy).

@nruth
Copy link
Contributor

nruth commented Nov 1, 2011

I agree with joliss.

Also, I wonder if it's "really needed"? To my mind it's a quick visual debugging tool; we're testing dom elements not how they are decorated. E.g. "whoops, forgot to log in". Getting the right styling in the dumped html file seems like a luxury.

@tracedwax
Copy link
Author

It's absolutely needed - often tests fail and you need to see at a glance
why they're failing. Much easier to see, debug, and fix it when looking at
it with the proper styling.

On Tue, Nov 1, 2011 at 11:45 AM, Nicholas Rutherford <
reply@reply.github.com>wrote:

I agree with joliss.

Also, I wonder if it's "really needed"? To my mind it's a quick visual
debugging tool; we're testing dom elements not how they are decorated. E.g.
"whoops, forgot to log in". Getting the right styling in the dumped html
file seems like a luxury.

Reply to this email directly or view it on GitHub:
#485 (comment)

@nruth
Copy link
Contributor

nruth commented Nov 1, 2011

While I agree that it's easier I don't agree that it's needed, given that this feature hasn't worked for a far greater period of time than it has. The main benefit is being able to see the page, styled or not, and fire up the browser's dom inspector.

Still, as mentioned, I'm sure it'd be a welcome patch.

@JangoSteve
Copy link

@joliss, I have a pull request already submitted, see #500.

@nruth, I think that it is needed. Capybara comes into play when we're testing content rendered with our views, and at least half the time (for me anyway), it's with js turned on. If I have an action that hides content, and then I have a test that says page.should have_no_content 'blah', and that test is failing, I'm going to put save_and_open_page right before it and see if the content really isn't there, or if maybe it's duplicated elsewhere on the page, or if maybe I used a lowercase instead of uppercase in the test, or whatever.

If my javascript and stylesheets (and images) don't work, then the page often isn't anything near what's actually seen in the app. In other words, save_and_open_page is useless for Rails 3.1 apps using the asset pipeline, which I'm guessing will become more and more relavent as a sizable portion of capybara's users migrate in that direction.

@joliss
Copy link
Collaborator

joliss commented Jan 12, 2012

Related: #609

@kkelly18
Copy link

+1 on JangoSteve's comment "save_and_open_page is useless for Rails 3.1 apps using the asset pipeline, which I'm guessing will become more and more relavent as a sizable portion of capybara's users migrate in that direction"

I just made the jump from 3.0 to 3.2 and ran into same issue.

@ashrocket
Copy link

+1

@jnicklas
Copy link
Collaborator

As I explained on #609, the asset rewriting has got to go. See my comment there for further explanation why I am closing this.

@daveharris
Copy link

I just wanted to say, that if you can't/don't want to specify Capybara.asset_host = "http://localhost:3000"from #958 then you can always have a bookmarklet in your browser's bookmark bar with something like

javascript:(function(){document.getElementsByTagName('link')[0].href='http://localhost:3000/assets/application.css'})();

It's a bit hacky, but you can use it any rails app.

@lock lock bot locked and limited conversation to collaborators Aug 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests