Issue
We are creatign a POC for running testcafe and browserstack in our jenkins. the jenkins file starts a node instance, starts upp browserstack local, runs the tests and then closes browserstack local. The browserstack local log indicates that it works ok, but the console states "ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure."
i can se in browserstack dashboard that the browser is started and is given an URL (example: http://127.0.0.1:44138/browser/connect/bl5rZIw) but the browser gives a "unable to connect to the page"
if i change from browserstack to a local chrome everything works. and if i run things on my local mashine it works (with browserstack.)
the networkpepole cant find any relevant blocks in the firewall. only calls to githubb. (185.199.110.153, TCP/443,140.82.121.3, TCP/443 - BLOCKERAT,140.82.121.5, TCP/443 - BLOCKERAT, 140.82.121.6, TCP/443 - BLOCKERAT)
any ideas on what is missing or how to digg into this problem.
relevant files ------------jenkins.openshift--------------------------
node('nodejs-14') {
withRepository {
stage('Install dependencies') {
withProxy {
sh 'npm install'
}
}
stage('Test') {
withProxy {
withEnv([
"BROWSERSTACK_LOCAL_IDENTIFIER=${env.BUILD_TAG}",
"BROWSERSTACK_USERNAME=<secret :)>",
"BROWSERSTACK_ACCESS_KEY=<secret :)>"
]) {
try {
sh "src/support/linux/BrowserStackLocal --key ${env.BROWSERSTACK_ACCESS_KEY} --local-identifier ${env.BUILD_TAG} --daemon start --force-local --proxy-host rbp-openshift-registry-001.wa.loc --proxy-port 3128 --local-proxy-host <secter :)> --local-proxy-port 3128 --verbose 2 --log-file ${env.WORKSPACE}/browserstack.log"
sh "npm test"
} finally {
sh "src/support/linux/BrowserStackLocal --key ${env.BROWSERSTACK_ACCESS_KEY} --local-identifier ${env.BUILD_TAG} --daemon stop"
archiveArtifacts artifacts: 'browserstack.log'
}
}
}
}
}
}
--------------------package.json--------------------------------
{
"name": "testcafe-poc",
"version": "1.0.0",
"description": "A Proof of Concept project and template for running testcafe and browserstack. ",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/testcafe 'browserstack:[email protected]:Windows 10' --hostname 127.0.0.1 --proxy rbp-openshift-registry-001.wa.loc:3128 ./src/tests/test1.js"
},
"repository": {
"type": "git",
"url": "ssh://[email protected]:7999/test/testcafe-poc.git"
},
"author": "",
"license": "ISC",
"devDependencies": {
"testcafe": "1.9.4",
"testcafe-browser-provider-browserstack": "1.13.1"
},
"dependencies": {}
}
Solution
The solution was simple and ridiculous.
We used a %
in our sting for --local-identifier
and that makes the BrowserStack local fail to connect.
But it does not tell you this in the logs or documentation.
So the solution is: don't use special characters in the --local-identifier
.
Answered By - Christoffer W