Module: BrowserStack

Defined in:
lib/browserstack-automate.rb

Constant Summary collapse

@@framework =
'rubyFramework'
@@bs_local =
nil
@@bstack_identifier =
"bstack_patches_#{(0...16).map { ('a'..'z').to_a[rand(26)] }.join}"

Class Method Summary collapse

Class Method Details

.for(framework) ⇒ Object



18
19
20
# File 'lib/browserstack-automate.rb', line 18

def self.for(framework)
  @@framework = framework
end

.get_frameworkObject



22
23
24
# File 'lib/browserstack-automate.rb', line 22

def self.get_framework
  @@framework
end

.get_framework_versionObject



26
27
28
29
30
# File 'lib/browserstack-automate.rb', line 26

def self.get_framework_version
  if @@framework.match(/cucumber/i)
    return Cucumber::VERSION
  end
end

.get_identifierObject



32
33
34
# File 'lib/browserstack-automate.rb', line 32

def self.get_identifier
  @@bstack_identifier
end

.track_environment(track_hash) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/browserstack-automate.rb', line 36

def self.track_environment(track_hash)
  if ENV['TRAVIS'] && ENV['TRAVIS'].match(/true/i)
    track_hash['ci_env'] = 'travis'
    track_hash['ci_env.travis.build_id'] = ENV['TRAVIS_BUILD_ID']
    track_hash['ci_env.travis.build_number'] = ENV['process.env.TRAVIS_BUILD_NUMBER']
    track_hash['ci_env.travis.repo_slug'] = ENV['process.env.TRAVIS_REPO_SLUG']
    track_hash['ci_env.travis.test_result'] = ENV['process.env.TRAVIS_TEST_RESULT']
  elsif ENV['BUILD_TAG'] && ENV['BUILD_TAG'].match(/jenkins/i)
    track_hash['ci_env'] = ENV['jenkins']
    track_hash['ci_env.jenkins.build_id'] = ENV['process.env.BUILD_ID']
    track_hash['ci_env.jenkins.build_number'] = ENV['process.env.BUILD_NUMBER']
    track_hash['ci_env.jenkins.job_name'] = ENV['process.env.JOB_NAME']
    track_hash['ci_env.jenkins.build_tag'] = ENV['process.env.BUILD_TAG']
    track_hash['ci_env.jenkins.git_url'] = ENV['process.env.GIT_URL']
  end
end