Test on Internal Networks
Run Cucumber NodeJS tests on your privately hosted websites using BrowserStack Automate
BrowserStack enables you to run your Cucumber NodeJS 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 Cucumber JS tests for Local Testing takes just a few simple steps:
-
Download and run the BrowserStack Local binary:
npm install browserstack-local
-
Next, you need to update your Cucumber JS config file,
cucumber-js-browserstack/conf/local.conf.js
(in sample repo), and set thebrowserstack.local
capability totrue
:exports.config = { user: 'YOUR_USERNAME', key: 'YOUR_ACCESS_KEY', server: 'hub-cloud.browserstack.com', capabilities: [{ browserName: 'chrome', 'browserstack.local': true }] }
-
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
cucumber-js-browserstack/features/
directory:local.feature// Local Feature Feature: BrowserStack Local Testing Scenario: Can check tunnel working When I open health check Then I should see "Up and running"
local-steps.js// Local Steps 'use strict'; var assert = require('cucumber-assert'); var webdriver = require('selenium-webdriver'); module.exports = function() { this.When(/^I open health check$/, function (next) { this.driver.get('http://bs-local.com:45691/check'); next(); }); this.Then(/^I should see "([^"]*)"$/, function (sourceMatch, next) { this.driver.getPageSource() .then(function(source) { assert.equal(source.indexOf(sourceMatch) > -1, true, next, 'Expected source to contain ' + sourceMatch); }); }); };
-
You can now run your Cucumber JS test using BrowserStack Local with the following command:
npm run 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!