Testing on Internal Networks
Run Capybara tests on your privately hosted websites using BrowserStack Automate
BrowserStack enables you to run your Capybara automated tests on your internal development environments, on localhost, and from behind a corporate firewall. This feature is called “Local Testing”.
Local Testing establishes a secure connection between your machine and the BrowserStack cloud. Once you set up Local Testing, all URLs work out of the box, including HTTPS URLs and those behind a proxy or firewall.
Configuring your Capybara tests for Local Testing takes just a few simple steps:
-
Install local bindings:
gem install browserstack-local
-
Next, you need to update your Capybara config file,
capybara-browserstack/config/local.config.yml
and set thebrowserstack.local
capability totrue
:server: "hub-cloud.browserstack.com" user: "YOUR_USERNAME" key: "YOUR_ACCESS_KEY" common_caps: "browserstack.local": true browser_caps: - "browser": "chrome"
-
Run a sample test case to check whether the Local test connection has been setup properly. You can use the following sample test case, which can be found in the repo under
capybara-browserstack/features/
directory:local.feature# Local Feature Feature: BrowserStack Local Testing Background: Given I am on http://bs-local.com:45691/check Scenario: Can check tunnel working Then I should see "Up and running"
local_steps.rb# Local Steps Given /^I am on (.*)$/ do |url| visit url end Then /^I should see "([^\"]*)"$/ do |body| expect(page).to have_text body end
-
You can now run your Capybara test using BrowserStack Local with the following command:
# Run using rake bundle exec rake local
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!