browserstack / browserstack-local-nodejs

NodeJS bindings for BrowserStack Local
https://www.browserstack.com
MIT License
71 stars 56 forks source link

Binary fails when localIdentifier argument is provided #108

Closed MancLad89 closed 4 years ago

MancLad89 commented 4 years ago

When including the localIdentifier argument the binary does not start

Steps to Reproduce the Problem

var browserstack = require('browserstack-local');

// creates an instance of Local
var bs_local = new browserstack.Local();

// starts the Local instance with the required arguments
bs_local.start({ key: apiKey, forceLocal: 'true', force: 'true', localIdentifier: 'test', verbose: 'true'}, (error) => {
                console.log('Started BrowserStackLocal');
            });

// check if BrowserStack local instance is running
console.log(bs_local.isRunning());

// stop the Local instance
bs_local.stop(function() {
  console.log("Stopped BrowserStackLocal");
});

Expected Behavior

Binary is started and executed against successfully.

Actual Behavior

Binary is not started.

console log

  Error: An error occurred while retrieving a new session: "[browserstack.local] is set to true but local testing through BrowserStack is not connected."
       at endReadableNT (_stream_readable.js:1221:12)
       at processTicksAndRejections (internal/process/task_queues.js:84:21)

local.log

Sat Jul 11 2020 18:36:34 GMT+0100 (BST) -- Setting output as verbose
Sat Jul 11 2020 18:36:35 GMT+0100 (BST) -- [SUCCESS] You can now access your local server(s) in our remote browser

Sat Jul 11 2020 18:36:36 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:36 GMT+0100 (BST) -- Platform supports WebSocket connections.

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Platform supports WebSocket connections.

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Platform supports WebSocket connections.

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Platform supports WebSocket connections.

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Connecting to BrowserStack using WebSocket protocol...
Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Platform supports WebSocket connections.

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Press Ctrl-C to exit

Sat Jul 11 2020 18:36:38 GMT+0100 (BST) -- Platform supports WebSocket connections.

browserstack local arguments

key: apiKey, localIdentifier: 'test', forceLocal: 'true', force: 'true', verbose: 'true'

Platform details

  1. browserstack-local-nodejs version: 1.4.5
  2. node version: v12.18.2
  3. os type and version: MAC OSX 10.15.5
ghost commented 4 years ago

Hi @MancLad89, could you share the input capabilities you are using in your tests?

MancLad89 commented 4 years ago

Hi @HeenaNanwaniGit please see below. If I add the local identifier to this list the binary does not start.

javascriptEnabled: true
browserstack.debug: true
browserstack.networkLogs: true
build: BS
project: test
browser: chrome
selenium_host: hub-cloud.browserstack.com
selenium_port: 80
browser_version: 83.0
os: OS X
os_version: Mojave
resolution: 1920x1080
name: <test name>
chromeOptions: {"args":["start-fullscreen"]}
acceptSslCert: true
realMobile: true
browserstack.seleniumLogs: true
browserstack.console: errors
browserstack.appiumLogs: true
browserName: chrome
browserstack.tunnel: true
browserstack.local: true
shawnlobo96 commented 4 years ago

Hey @MancLad89

When starting a test session on Browserstack with local testing, the error "[browserstack.local] is set to true but local testing through BrowserStack is not connected." is received when the local testing binary is not running or when the local identifier is not provided or does not match the identifier used while starting the binary.

From the capabilities, you shared, since the local identifier is not present in the list but the binary is running with the identifier test, you are receiving the error.

What error do you get when you add the capability "browserstack.localIdentifier" : "test"?

Can you share the exception stack trace?

MancLad89 commented 4 years ago

Resolved as the localIdentifier from both the capabilities and the binary have to be the same but were being supplied as different.