Skip to content

[Issue #11] Support for localIdentifier capability #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ This will create a sample `browserstack.json` file. This file can be used to con
"customBuildName": "build 1"
},
"connection_settings": {
"local": false
"local": false,
"localIdentifier": null
}
}
```
Expand All @@ -80,6 +81,7 @@ The following table provides a reference for all the options that can be provide
| `project` | Name of your project. This will be displayed in your Automate dashboard, and you'll be able to search & filter your tests based on the project name. | A string providing the name of the project |
| `customBuildName` | Helps in providing a custom name for the build. This will be displayed in your Automate dashboard, and you'll be able to search & filter your tests based on the build name. | A string providing the name of the build |
| `local` | Helps in testing websites that cannot be accessed in public network. If you set this to `true`, please download the Local binary and establish a local connection first (you can learn how to do so [here](https://www.browserstack.com/local-testing/automate#command-line)) | Boolean: `true` / `false`. Set this to `true` if you need to test a local website. Set this to `false` if the website is accessible publicly. |
| `localIdentifier` | The BrowserStack Local tunnel that should be used to resolve requests. This is applicable only when you start a Local binary with a local identifier. Your tests might fail if you use an invalid local identifier. This option will be ignored if `local` option is set to `false`. | A string if a tunnel identified by the Local identifier should be used (should be same as the one used to start the Local binary). Set this to `null` (default value) to resolve requests using Local without a Local identifier. |

### Running the tests
You can start running your test build using the following command.
Expand Down
8 changes: 8 additions & 0 deletions bin/helpers/capabilityHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const caps = (bsConfig, zip) => {
if (bsConfig.connection_settings.local === true) obj.local = true;
logger.log(`Local is set to: ${obj.local}`);

// Local Identifier
obj.localIdentifier = null;
if (obj.local === true && bsConfig.connection_settings.localIdentifier)
{
obj.localIdentifier = bsConfig.connection_settings.localIdentifier;
logger.log(`Local Identifier is set to: ${obj.localIdentifier}`);
}

// Project name
obj.project = bsConfig.run_settings.project
if (!obj.project) logger.log(`Project name is: ${obj.project}`);
Expand Down
3 changes: 2 additions & 1 deletion bin/templates/configTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = function () {
"customBuildName": "build-name"
},
"connection_settings": {
"local": false
"local": false,
"localIdentifier": null
}
}
var EOL = require('os').EOL
Expand Down