results_keeper 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/results_keeper.rb +25 -16
  3. metadata +11 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb4cf39674ea7612498d4dbda377da0959fa1b14
4
- data.tar.gz: a5664c58b6f4f159537187531f042324a3bc343d
3
+ metadata.gz: 2014c49607ca7a80b89f1c34d4099cfe3d0af599
4
+ data.tar.gz: 51c01ffbf9394ff00f1a8c27691cd3f12e6a6f20
5
5
  SHA512:
6
- metadata.gz: a336ef86192ec2aade0989cb2ac4cf932a2488bbd9a737eb8ead91c379d323264f2a77c6cbbe20354187c7191e4120663dff8b8556befd1877c7b41aafc62ded
7
- data.tar.gz: 119823bf5d6ecfc2637e388209f70f1a7b21acad2210226ec769b5d44eadee3e3a910c7aa7550910c4756002f21b34c3a6f15e046d7f90cb52fb9bb846645506
6
+ metadata.gz: c5ab522ec7823bab3ffab5fe14ac60c5d699792f367bd232cb7707279680425506a28034a6fd35936ee091f611276fc07e7fd37df82a6b72c76a0054767585f0
7
+ data.tar.gz: a00db99e5e713ecd20b8a2265bc198f378ecb173f1b7a47f43028187ea1a9ce74c2c9dc70d8124a3059de7db51c90dd5779c2b0188a94ae6456729758e2fe948
@@ -3,14 +3,15 @@ require 'json'
3
3
  require 'rest_client'
4
4
  require_relative 'string'
5
5
  require 'singleton'
6
+ require 'pry'
6
7
 
7
8
  class ResultsKeeper
8
9
  include Singleton
9
10
 
10
11
  attr_reader :revision_name, :revision_project
11
12
 
12
- DEFAULT_PORT = 80
13
- DEFAULT_HOST = 'results-keeper-api.herokuapp.com'
13
+ DEFAULT_PORT = 3000
14
+ DEFAULT_HOST = 'localhost'
14
15
 
15
16
  def initialize
16
17
  @revision_name = ENV['REVISION_NAME'] || "Result for #{Time.now}"
@@ -27,24 +28,21 @@ class ResultsKeeper
27
28
  send_json(data, 'revisions')
28
29
  end
29
30
 
30
- def test_started(scenarion)
31
- @test_started_at = Time.now
32
- end
33
-
34
31
  def send_test(scenario)
35
32
  test_duration = Time.now - @test_started_at
36
33
  @screenshot_path = save_screenshot(scenario) if ENV['SEND_SCREENSHOTS']
37
- scenario_steps = scenario.test_steps.map(&:name) unless ENV['NO_STEPS']
34
+ scenario_steps = scenario.test_steps.map{|s| "And #{s.to_s}"} unless ENV['NO_STEPS']
38
35
  scenario_error = scenario.exception.message if scenario.exception
39
36
  run_path = "cucumber #{scenario.location.file}:#{scenario.location.line}"
40
37
  data = { name: scenario.name,
41
38
  status: scenario.status,
42
39
  feature_name: scenario.feature.name,
43
40
  run_path: run_path,
41
+ tags: scenario.tags.map(&:name).join(', '),
44
42
  error: scenario_error,
45
43
  revision_id: @revision['revision_id'],
46
- duration: test_duration,
47
- steps: scenario_steps
44
+ steps: scenario_steps,
45
+ duration: test_duration
48
46
  }
49
47
  @test = send_json(data, 'tests')
50
48
  send_screenshot(@screenshot_path) if @screenshot_path
@@ -70,17 +68,24 @@ class ResultsKeeper
70
68
  request = Net::HTTP::Post.new(@path, initheader = {'Content-Type' =>'application/json'})
71
69
  request.body = @body
72
70
  response = Net::HTTP.new(@host, @port).start {|http| http.request(request) }
73
- puts " Results Keeper: #{response.code} - #{response.message}".blue
74
- result_hash = JSON.parse(response.body) rescue console_message('There seems to be a problem. Are you authorized?')
75
- result_hash
71
+ begin
72
+ puts " Results Keeper: #{response.code} - #{response.message}".blue
73
+ result_hash = JSON.parse(response.body)
74
+ result_hash
75
+ rescue
76
+ console_message('There seems to be a problem. Are you authorized?')
77
+ end
76
78
  end
77
79
 
78
80
  def send_screenshot(screenshot_path)
79
81
  if ENV['SEND_SCREENSHOTS']
80
- params = { project: @revision['project_id'], revision: @revision['revision_id'], test: @test['id'] }
81
- RestClient.post("http://#{@host}:#{@port}/api/tests/upload_screenshot",
82
- :name_of_file_param => File.new(screenshot_path), :body => params)
83
- File.delete(screenshot_path)
82
+ t1 = Thread.new do
83
+ params = { project: @revision['project_id'], revision: @revision['revision_id'], test: @test['id'] }
84
+ RestClient.post("http://#{@host}:#{@port}/api/tests/upload_screenshot",
85
+ :name_of_file_param => File.new(screenshot_path), :body => params)
86
+ File.delete(screenshot_path)
87
+ end
88
+ t1.join
84
89
  end
85
90
  end
86
91
 
@@ -91,5 +96,9 @@ class ResultsKeeper
91
96
  def console_message(text)
92
97
  puts " Results Keeper: #{text}".blue
93
98
  end
99
+
100
+ def test_started(scenarion=nil)
101
+ @test_started_at = Time.now
102
+ end
94
103
  end
95
104
 
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: results_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kozakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-29 00:00:00.000000000 Z
11
+ date: 2017-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flickraw
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rest-client
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Results Keeper is a application which can help you to track and manage
42
- your Cucumber test results using this gem as a client.
41
+ description: Results Keeper is an application that helps you to track and manage your
42
+ Cucumber test results using this gem as a client.
43
43
  email: ivankozakov0@gmail.com
44
44
  executables: []
45
45
  extensions: []
@@ -57,17 +57,17 @@ require_paths:
57
57
  - lib
58
58
  required_ruby_version: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  required_rubygems_version: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
69
  rubyforge_project:
70
- rubygems_version: 2.4.8
70
+ rubygems_version: 2.5.1
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: Result Keeper