From 26d39aa37e410b85c8ede5a2c64babfdefbfa79d Mon Sep 17 00:00:00 2001 From: Chaitya Shah Date: Fri, 31 May 2019 13:30:30 +0530 Subject: [PATCH 1/4] Fix example --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b61b246..0a5a5a3 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,22 @@ var bs_local_args = { 'key': '' }; // starts the Local instance with the required arguments bs_local.start(bs_local_args, function() { console.log("Started BrowserStackLocal"); -}); -// check if BrowserStack local instance is running -console.log(bs_local.isRunning()); + // check if running + if(bs_local.isRunning()){ + + // run your test here + yourTest().then(function(){ + bs_local.stop(function(){ + console.log("Stopped BrowserStackLocal"); + }); + + }else{ + // Error + console.log("BrowserStack Local didn't run properly"); + } + -// stop the Local instance -bs_local.stop(function() { - console.log("Stopped BrowserStackLocal"); }); ``` From b1dfdcfcfcb0890a71f9b20899af02ac9970ea98 Mon Sep 17 00:00:00 2001 From: Chaitya Shah Date: Fri, 31 May 2019 13:33:01 +0530 Subject: [PATCH 2/4] Fix example --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0a5a5a3..d8c805b 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,11 @@ bs_local.start(bs_local_args, function() { console.log("Stopped BrowserStackLocal"); }); - }else{ - // Error - console.log("BrowserStack Local didn't run properly"); + } + else{ + + // Error + console.log("BrowserStack Local didn't run properly"); } From 746121779b394eb2ca2791ffaca26da3e5b57674 Mon Sep 17 00:00:00 2001 From: Chaitya Shah Date: Wed, 19 Jun 2019 15:13:38 +0530 Subject: [PATCH 3/4] Fix spacing --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0a5a5a3..8c6b5a7 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,18 @@ bs_local.start(bs_local_args, function() { if(bs_local.isRunning()){ // run your test here - yourTest().then(function(){ - bs_local.stop(function(){ - console.log("Stopped BrowserStackLocal"); - }); - - }else{ - // Error - console.log("BrowserStack Local didn't run properly"); - } + yourTest().then(function(){ + bs_local.stop(function(){ + console.log("Stopped BrowserStackLocal"); + }); + }); + }else{ + + // Error + console.log("BrowserStack Local didn't run properly"); + + } }); From 074c73885816469810a81d51467594a6ed163d2d Mon Sep 17 00:00:00 2001 From: Chaitya Shah Date: Mon, 1 Jul 2019 17:39:57 +0530 Subject: [PATCH 4/4] Fix example with callback example --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b9e885a..1ae35b5 100644 --- a/README.md +++ b/README.md @@ -21,21 +21,30 @@ var bs_local = new browserstack.Local(); // replace with your key. You can also set an environment variable - "BROWSERSTACK_ACCESS_KEY". var bs_local_args = { 'key': '' }; + +function yourTest(callback) { + + // your test goes here + + callback() +} + + // starts the Local instance with the required arguments bs_local.start(bs_local_args, function() { console.log("Started BrowserStackLocal"); // check if running - if(bs_local.isRunning()){ + if (bs_local.isRunning()) { // run your test here - yourTest().then(function(){ - bs_local.stop(function(){ + yourTest(function() { + bs_local.stop(function() { console.log("Stopped BrowserStackLocal"); }); }); - }else{ + } else { // Error console.log("BrowserStack Local didn't run properly"); @@ -44,6 +53,8 @@ bs_local.start(bs_local_args, function() { }); + + ``` ## Arguments