-
-
Notifications
You must be signed in to change notification settings - Fork 428
resize_window has no effect on save_screenshot #354
Comments
The |
Here is the example code. The only code executed before is to create some records. it "should display only the automobile brands" do
page.driver.resize_window 1200, 1200
visit '/data_sheets'
find('a[data-type=automobile]').click
page.driver.resize_window 1200, 1200
page.should have_content(automobile_brand.label_fr)
page.should have_content(other_automobile_brand.label_fr)
page.should_not have_content(motorcycle_brand.label_fr)
page.driver.resize_window 1200, 1200
page.driver.render 'tmp/screenshots/list-of-brands.png'
end The screenshot size remains |
Your code looks fine to me. Maybe there's an issue where the browser refuses to set a height larger than what it thinks the page height is. I'll take a look when I can. On Monday, July 2, 2012 at 7:22 AM, Romain Tribes wrote:
|
Thanks @jferris. :) |
Any update on this? I'm having the same exact issue. Trying to test an infinite scrolling UI, but the browser height is too tall at the start of my test. |
@swiego I haven't gotten to look into this yet. I'm still working on Qt 4.8 issues, then load issues, and then I'll start going through bugs like this. |
I tested both smaller and larger sizes. Regardless of what I give to resize_window the saved screenshots look the same. |
Any update on this? |
I'm experiencing the same problem. I've tried also, the values returned by |
The screenshot code uses the passed-in resolution (or default of 1000x10) as the viewport size, and then enlarges the image to the current frame's |
@mhoran could you show some example code that should successfully resize a window? |
Check out https://github.com/thoughtbot/capybara-webkit/blob/master/spec/driver_resize_window_spec.rb. We test resize using innerWidth and height without issue. I'm not sure why this isn't working for you. |
Looking through the current code, it seems like we:
I'm not sure if resizing the viewport could have an affect on the size of the contents. If there's JavaScript or responsive CSS, I could see resizing the window having an effect. I'm also not sure what the most likely expectation is: a screenshot of the current viewport, or a screenshot of the entire page based on the viewport width. It's possible that the minimum size code predates the @jjb could you open a new issue for your specific issue? If you could include a log from @mhoran any thoughts on this screenshot sizing issue? |
@jferris, I think the least surprising behavior would be to preserve the size of the viewport. However, it looks like Selenium prefers to render the entire page when possible. I've been thrown off by this before when a test has failed and I've looked at a screenshot of a responsive page and found unexpected content. I then have to remember that the screenshot is not of the failure, but of a different layout due to responsiveness. Perhaps less surprising behavior would be to use the viewport width if it is greater than the content width, or the content width if it is greater than the viewport width. The same for height. We could still support user provided width and height for screenshots, and set the width and height to those exact values if they are provided. |
fwiw, i've found that the same version of capybara-webkit (1.3.1) works fine when resizing the window, if build against qt4 but fails if built against qt5 (on Mavericks, using Homebrew) |
There haven't been any updates here. I think a few different bugs have been discussed, and there are some issues regarding Qt 4 vs Qt 5. Given the age of the issue, the fact that Capybara doesn't really have a spec for exactly how screenshots should work, and that we're phasing out Qt 4, I think it makes the most sense to close this issue. If anybody is still having trouble with the way screenshots work, please open a new issue for your particular bug. I'm also open to pull requests that change the way this works if somebody thinks the current behavior is unintuitive. |
Hi,
I'm testing an app using modals (via Twitter Bootstrap) but I can't see al the modal on the page since the page height is too low. The
resize_window
method has no effect on the height.Example: http://img29.imageshack.us/img29/6224/suggestedfixes.png
How can I change the size of the windows?
Thanks.
The text was updated successfully, but these errors were encountered: