Skip to content
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

Feat/append env postfix to localidentifier #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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: 4 additions & 0 deletions lib/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module.exports = function(gemini, opts) {
var browserStack = BrowserStack();

expandCredentials(opts);

if (process.env.BS_LOCALIDENTIFIER_POSTFIX && opts.localIdentifier) {
opts.localIdentifier += '-' + process.env.BS_LOCALIDENTIFIER_POSTFIX;
}

gemini.on('startRunner', function(runner) {
var deferred = Q.defer();
Expand Down
34 changes: 34 additions & 0 deletions test/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,40 @@ describe('plugin', function() {
expect(gemini.config._browsers.chrome.desiredCapabilities['browserstack.localIdentifier']).to.equal('abc123');
});

it ('should read localIdentifier postfix from env', function() {
process.env.BS_LOCALIDENTIFIER_POSTFIX = 'foo';

var opts = {username: 'foo', accessKey: 'bar', localIdentifier: "abc123"};
gemini.config._browsers = {'chrome': {desiredCapabilities: {platform: 'Windows'}}};

plugin(gemini, opts);

browserstack.start = function(opts, cb) {
cb(null, {});
};

gemini['startRunner']()

expect(gemini.config._browsers.chrome.desiredCapabilities['browserstack.localIdentifier']).to.equal('abc123-foo');
});

it ('should not use localIdentifier postfix from env when localIdentifier in configuration is not set', function() {
process.env.BS_LOCALIDENTIFIER_POSTFIX = 'foo';

var opts = {username: 'foo', accessKey: 'bar'};
gemini.config._browsers = {'chrome': {desiredCapabilities: {platform: 'Windows'}}};

plugin(gemini, opts);

browserstack.start = function(opts, cb) {
cb(null, {});
};

gemini['startRunner']()

expect(gemini.config._browsers.chrome.desiredCapabilities['browserstack.localIdentifier']).to.be.undefined;
});

function init() {
plugin(gemini, {username: 'foo', accessKey: 'bar'});
};
Expand Down