browserstack / browserstack-local-nodejs

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

Problem with the Local Bindings for Nodejs while using a Windows system locally. #29

Open shanep2300 opened 7 years ago

shanep2300 commented 7 years ago

Started a ticket with support but I figured I'd add an issue here.

It's inconsistent but the error is: "[browserstack.local] is set to true but local testing through BrowserStack is not connected".

nakula commented 7 years ago

can you provide more details. ?

silicakes commented 6 years ago

I'm having the same issue:

system

nodejs: 8.5.0 os: MacOS sierra

config

const browserstack = require('browserstack-local');
const baseConfig = require("./base.wdio.conf").config;

const availableBrowsers = ['iPhone6', 'iPhone5', 'Chrome', 'Firefox', 'Safari'];

const capabilities = availableBrowsers.map(browser => {
    const capability = {
        name: browser,
        build: "BUILD_ID",
        project: "PROJECT",
        'browserstack.local': true,
        'browserstack.debug': true
    };

    if(!browser.toLocaleLowerCase().includes("iphone")) {
        capability.resolution = '1920x1080';
        capability.browserName = browser.toLowerCase();

    }
    return capability;
});

exports.config = Object.assign({}, baseConfig, {
    user: BS_USER,
    key: BS_KEY,
    updateJob: false,
    browserstackLocal: true,
    maxInstances: 5,
    capabilities,
    services: ['browserstack'],
    jasmineNodeOpts: {
        defaultTimeoutInterval: 10000,
        expectationResultHandler: function (passed, assertion) {
        }
    },
    onPrepare: (config, capabilities) => {
        console.log("Connecting local");
        return new Promise(function (resolve, reject) {
            exports.bs_local = new browserstack.Local();
            exports.bs_local.start({ 'key': config.key}, function (error) {
                if (error) return reject(error);
                console.log('Connected. Now testing...');
                resolve();
            });
        });
    },
    onComplete: (capabilties, specs) => {
        exports.bs_local.stop(function () { console.log("ARGS::",arguments) });
    },
    beforeSuite: () => {
        console.log("suite");
    },
    beforeTest: test => {
        console.log(test);
    }
});
patthiel commented 6 years ago

We're encountering the same issue when attempting to use wdio-browserstack-service with browserstack.local set to true on windows. Any updates on this?

irbrownie commented 5 years ago

I figured out that their documentation is wrong. the keys for this are actually

 const browserStackConfig = {
        'browserstackUser': BROWSERSTACK_USER,
        'browserstackKey': BROWSERSTACK_KEY,
        commonCapabilities: {  
            'browserstack.debug': true,
            'browserstack.local': true,
            'acceptSslCerts': 'true',
            'browserstack.ie.enablePopups': true,
            'browserstack.edge.enablePopups': true,
        },
       }

user/key fall under the toplevel config and shouldn't be added to capabilities. It also seems like adding localIdentifier to capabilites breaks it as well. Also notice that the creds aren't dot separated like on their site. They are camelCase.