Could I use Capybara on frameworks outside Rails (PHP)?

I would like to test my php web app (specifically Magento) with Capybara. I've used Capybara with success when I used rails before so I want to replicate the success. Does anyone know if this is possible or maybe there is a Capybara for php?

-------------Problems Reply------------

Yes this is possible. You have to define the url where your server serves the pages you want to test. For example, if you use rspec simply do it in the spec_helper.rb. Additionally you have to specify a different driver that does not want to start the app (which is not present), for example selenium:

Capybara.app_host = '' # where your site lives
Capybara.default_driver = :selenium # use selenium to control the external browsers

A basic Gemfile would look like this:

source ''

gem "rspec", '~> 3.0'
gem "capybara"
gem "selenium-webdriver", '~> 2.45'

If you run your tests, it will fire up the browser window (if your browser is installed in some non default path you will have to configure this, too), will open your page and interact with it.

Category:php Views:3 Time:2018-06-13

Related post

  • Why use a web framework (like rails) over php? 2009-05-16

    This isn't a question about what framework to use. I've learned both Rails and Django, and I write all of my webapps in PHP. My question is why bother with the frameworks? It's always taken me longer to use a framework than to reuse old MySQL code an

  • What does Steak add beyond just using Capybara and RSpec in Rails testing? 2011-01-23

    I'm trying to understand the need for Steak. I get that its like Cucumber, except that you can use pure ruby instead of mapping your english language specs to ruby like in Cucumber, but it says that it mainly adds a wrapper around the RSpec DSL, and

  • Are There Any Other Web Programming Languages That Can Be Used Without A Framework Aside From PHP? 2010-04-06

    Python needs a framework, so does Java (for the web). I don't know much about Ruby or Coldfusion. But is there another language out there for the web that can stand alone as it is without a need for a framework or without strict adherence to a design

  • Are there any potential disadvantages in using a Ruby framework other than Rails? 2009-05-03

    I would like to use a lighter framework than Rails (Sinatra/Ramaze/Camping) but am concerned that by doing so I will not be able to use a lot of shared libraries that have been tailored to Rails in the form of plugins. Is this a major concern or are

  • Is there any use for Flex + Python/Ruby without a web framework (Django/Rails)? 2009-03-26

    I often hear about Flex being combined with web frameworks on the backend. The idea being that Flex serves as the presentation framework while the web framework (Django/Rails) does the database lookups and sends the data to Flex to present in the for

  • Can somebody help me understand node.js and how & why I might use it with a framework like rails? 2010-11-07

    I'm trying to write a scalable interactive chat application for an existing high traffic website. It needs to be scalable on day 1, and chat's concurrency and multi-broadcast issues make it a tricky thing to scale. My initial plan was to write the wh

  • how to use capybara on your rails controller? 2011-01-26

    Basically i wanted to scrape a site, eg i want my app to go to, do a search then get the total number of results. So I'd use capybara to do that - but it seems I can't get it to work inside my rails controllers. So either i use capybara to

  • Get rails exceptions to show using capybara and selenium 2011-01-07

    In using capybara and selenium to run integration tests in rails, if an exception is raised a blank white page is shown instead of the usual exception screen with the stack trace. Is there a way to get capybara to show the stack trace pages? --------

  • Unable to add Compass to a Rails 3.1 app using the Less Framework 2011-07-05

    I have been unable to add Compass using the Less Framework to my Rails 3.1 app. Both the compass and compass-less-plugin gems are installed and are included in the gemfile as well as the gemfile.lock file under "Dependencies". I run the following com

  • How to use Capybara for IE8 in pure Ruby (without Rails)? 2011-07-15

    I've been using the following code to test run using Capybara with IE8 in pure Ruby, i.e. NOT a rails app but every time I run the script IE8 pops up but then Firefox pops up and the tests run through Firefox leaving IE8 sitting in the background: $:

  • How to click on the second link with the same text using Capybara in Rails 3? 2011-07-18

    In a view file I have: = link_to 'View', post = link_to 'View', comment In a spec file (I'm using Capybara): click_on 'View' It clicks on the first link, but I want it to click on the second one. How can I do it? --------------Solutions-------------

  • Rails acceptance testing without using rspec but using capybara 2011-09-04

    I am looking for an example of acceptance testing in Rails without using rspec. My current client uses ruby 1.9.2 and all the tests are written using minitest and they are concerned about the slowness of rspec. Anyways that discussion is over. I need

  • What's the proper way of using Capybara in Rails 3.x functional tests? 2012-02-20

    So Rails generates some functional tests for controllers in the test/functional directory. These tests are extending from ActionController::TestCase. But in Capybara's web site, they only show how to prepare the integration tests by monkey patching A

  • How to write integration test using capybara for rails 2.3.11? 2012-02-21

    Hi friends I am writing integration test for Rails 2.3.11 application.I have found many tutorials for Rails 3 RSpec 2 Capybara 1.1.2

  • Simulating a keypress using capybara-webkit in rails 2012-03-01

    I'm using capybara-webkit to test a form where the fields are populated using jquery-tokeninput ( The problem is that using fill_in does not work with this. Is there anyway to test this automatically? Thank

  • Why do I need to use a popular framework? 2008-11-10

    I've been a PHP developer for many years now, with many tools under my belt; tools that I've either developed myself, or free-to-use solutions that I have learned to trust. I looked into CodeIgniter recently, and discovered that they have many classe

  • Recommended testing frameworks for Rails 2 app with randomness 2011-06-06

    I have a Rails 2.3.5 app which is serving a card game. I've been a bit lax in writing tests for it (read: I haven't written any :embarrassed:), and I'd like to make a start now. From reading other questions, I think I probably want to be using Should

  • Anyone NOT using a Web Framework? Why? 2009-06-05

    I'm well aware of the many reasons to use a web framework. I'm just wondering whether anyone out there is using absolutely no web framework whatsoever to develop their web projects. I would really love to know the reason(s) why you're not using a web

  • Use Google AppEngine datastore outside of AppEngine project 2009-07-19

    For my little framework Pyxer I would like to to be able to use the Google AppEngine datastores also outside of AppEngine projects, because I'm now used to this ORM pattern and for little quick hacks this is nice. I can not use Google AppEngine for a

  • Using Gems with Ruby On Rails: Undefined method? 2011-03-17

    There's this snazzy captcha that asks questions rather than displaying pictures. You can read about it at Anyway. I want to use that with Ruby on Rails. A developer by the name of Matt Hutchinson wrote a Gem for easily connecting to

  • path not working properly when using capybara 2011-03-22

    I'm using rails 3.0.5, rspec2 with latest capybara. Routes setup like: scope "(:locale)", :locale => /de|fr|it|en/ do resources :dossiers end In application_controller I have this: def default_url_options(options={}) options[:locale] = "es" option

  • Best javascript frameworks for rails app backend UI design 2012-01-24

    Which are the best frameworks that better integrates with Rails to easily develop RIA backends? In different projects I've used, beside others, jQuery and Sencha Extjs (with various working or nearly working gems that tried to integrate rails and the

  • rubymine error - Could not find capybara-webkit-0.9.0 in any of the sources 2012-02-20

    When I try to run my application within rubyMine I get an error about capybara-webkit - ... in `block in materialize': Could not find capybara-webkit-0.9.0 in any of the sources (Bundler::GemNotFound) But I don't get it when running the app via the c

  • Where to start with my first real project using the Towerjs framework? 2012-04-17

    I'm a total noob. Over the last three or four months, I've worked through a dozen books, dozens of online tutorials, and watched hundreds of screencasts teaching myself first Rails (along with html, css, etc), Node, JS and my favorite Coffeescript. I

  • Using - inside namespace or outside namespace 2008-09-24

    I have been running StyleCop over some C# code, and it keeps reporting that my using statements should be inside the namespace. Is there a technical reason for putting the using statements inside instead of outside the namespace? --------------Soluti

Copyright (C), All Rights Reserved.

processed in 0.166 (s). 11 q(s)