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

Responsive tests #95

Open
amnesia7 opened this issue Oct 20, 2015 · 3 comments
Open

Responsive tests #95

amnesia7 opened this issue Oct 20, 2015 · 3 comments

Comments

@amnesia7
Copy link

I saw this http://railsware.com/blog/2015/02/11/responsive-layout-tests-with-capybara-and-rspec/ and thought it might be a good addition to the rspec examples.

I'm not entirely sure how it would be best applied because I couldn't actually get it to work when using the poltergeist driver so I assume it relies on the selenium driver which is a shame if it can't be tested headless because that does add a lot of time onto the test run.

@amnesia7
Copy link
Author

Unless there's a way to setup the driver multiple times with different window sizes (mobile, tablet, desktop, default, etc) at the start and then switch to the relevant one similar to what has been done for the date input tests (https://github.com/eliotsykes/rspec-rails-examples/blob/master/spec/features/subscribe_to_newsletter_spec.rb#L5).

@eliotsykes
Copy link
Owner

@amnesia7 good article, thanks for sharing.

If a feature spec with responsive tests like this was added - I'm trying to think of what could be tested - possibly some nav that changes signficantly based on window width.

It looks like the poltergeist driver has a resize method: http://www.rubydoc.info/gems/poltergeist/Capybara/Poltergeist/Driver#resize-instance_method

@amnesia7
Copy link
Author

Yeah, within a scenario you can do page.driver.resize(767, 480). Looks like you can also do page.driver.resize_window(767, 480) I assume this window size change only applies to the current test being run and doesn't need to be reset again.

Navbar would probably be something that a lot of users can relate to that tests for .navbar-toggle hidden and .navbar-collapse visible when desktop and then .navbar-toggle visible and .navbar-collapse hidden when mobile [and tablet, maybe].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants