test_object_test_result_watcher 1.0.1 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d58e3402351c1ae95bd5b2da5938cff519ddcadf
4
- data.tar.gz: 5c19d2d778f109199b3a77b2814b118de8c8c652
3
+ metadata.gz: 2079657ee2f3dbee40731e322860bbda4d4c710a
4
+ data.tar.gz: b43a21343390d0835f2f14329a1ec4db74aaffb9
5
5
  SHA512:
6
- metadata.gz: d856a71775562c43b08e3dc1ec17d43faa5a87bbc9a0ec348ccf8a03eb4783815a3b67571bb28941cc4acfce150d7d7c2c1639d0dec8b195140616b993e98666
7
- data.tar.gz: 325892d81d6b876fe41dcd2437c88f1bc6eb9d84875605a5202519aa75721dc39af27f8a5ac826b376f3263390f0c38733653617ebd106d55442742d29181ac9
6
+ metadata.gz: 8ca543f96dab0e2623b1750e36c3b05d524d558315e446c586d21854b70416c9691171f39e9ad5707b7da2a688d6336bd5b41fd563cb405b48d4674683acd697
7
+ data.tar.gz: 2f3f7f84c0afa2cd005f79f54382015eeb513255b1b42ac1f0769df4541820476ab6c0a0a9b11b5c29489bfb2d3c03037dc1fa636dc5795c9d0566d88d977c33
@@ -1,6 +1,6 @@
1
1
  module AppiumResource
2
- def AppiumResource.update_test_report_status( session_id, passed, client )
3
- client.build_path( session_id )
2
+ def self.update_test_report_status(session_id, passed, client)
3
+ client.build_path(session_id)
4
4
  client.put_test_outcome(passed)
5
5
  end
6
- end
6
+ end
@@ -1,7 +1,8 @@
1
1
  require 'httparty'
2
2
  require 'json'
3
3
 
4
- class RestClient
4
+ class TestObjectRestClient
5
+
5
6
  def initialize(parameters)
6
7
  @api_url = parameters[:api_url]
7
8
  @api_key = parameters[:api_key]
@@ -16,10 +17,11 @@ class RestClient
16
17
  end
17
18
 
18
19
  def basic_authorization
19
- {username: @api_key, password: ""}
20
+ { username: @api_key, password: '' }
20
21
  end
21
22
 
22
23
  def headers
23
- { "Content-Type" => "application/json"}
24
+ { 'Content-Type' => 'application/json' }
24
25
  end
25
- end
26
+
27
+ end
@@ -1,6 +1,6 @@
1
1
  require 'json'
2
- require_relative './appium_resource.rb'
3
- require_relative './rest_client.rb'
2
+ require_relative 'appium_resource.rb'
3
+ require_relative 'test_object_rest_client'
4
4
 
5
5
  class TestObjectTestResultWatcher
6
6
 
@@ -8,31 +8,22 @@ class TestObjectTestResultWatcher
8
8
  @desired_capabilities = desired_capabilities
9
9
  @driver = driver
10
10
  @report_results = @desired_capabilities[:caps][:testobject_report_results]
11
- if @report_results
12
- set_client
13
- end
11
+ set_client if @report_results
14
12
  end
15
13
 
16
14
  def set_client
17
- relative_url = "/api/rest/appium/v1/"
18
- base_url = base_url(@desired_capabilities[:appium_lib][:server_url])
15
+ rest_api_url = 'https://app.testobject.com/api/rest/v2/appium/'
19
16
  testobject_api_key = @desired_capabilities[:caps][:testobject_api_key]
20
- api_url = base_url + relative_url
21
- @client = RestClient.new(api_url: api_url, api_key: testobject_api_key)
22
- end
23
-
24
- def base_url(server_url)
25
- server_url.match(/^https?:\/\/(www.)?\S+.com(:\d+)?/)[0]
17
+ @client = TestObjectRestClient.new(api_url: rest_api_url, api_key: testobject_api_key)
26
18
  end
27
19
 
28
20
  def report_results_and_cleanup(passed)
29
- if @report_results
30
- report_results(passed)
31
- end
21
+ report_results(passed) if @report_results
32
22
  @driver.quit
33
23
  end
34
24
 
35
25
  def report_results(passed)
36
26
  AppiumResource.update_test_report_status(@driver.session_id, passed, @client)
37
27
  end
38
- end
28
+
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_object_test_result_watcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TestObject
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-20 00:00:00.000000000 Z
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -31,7 +31,7 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - lib/appium_resource.rb
34
- - lib/rest_client.rb
34
+ - lib/test_object_rest_client.rb
35
35
  - lib/test_object_test_result_watcher.rb
36
36
  homepage: http://www.testobject.com
37
37
  licenses: []