Class: Applitools::TestResults
- Inherits:
-
Object
- Object
- Applitools::TestResults
- Defined in:
- lib/applitools/core/test_results.rb
Instance Attribute Summary collapse
-
#is_new ⇒ Object
Returns the value of attribute is_new.
-
#matches ⇒ Object
readonly
Returns the value of attribute matches.
-
#mismatches ⇒ Object
readonly
Returns the value of attribute mismatches.
-
#missing ⇒ Object
readonly
Returns the value of attribute missing.
-
#original_results ⇒ Object
readonly
Returns the value of attribute original_results.
-
#screenshot ⇒ Object
Returns the value of attribute screenshot.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #aborted? ⇒ Boolean
- #api_session_url ⇒ Object
- #different? ⇒ Boolean
- #failed? ⇒ Boolean
-
#initialize(results = {}) ⇒ TestResults
constructor
A new instance of TestResults.
- #new? ⇒ Boolean
- #passed? ⇒ Boolean (also: #is_passed, #as_expected?)
- #secret_token ⇒ Object
- #to_s(advanced = false) ⇒ Object
- #unresolved? ⇒ Boolean
Constructor Details
#initialize(results = {}) ⇒ TestResults
Returns a new instance of TestResults.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/applitools/core/test_results.rb', line 10 def initialize(results = {}) @original_results = results @steps = results.fetch('steps', 0) @matches = results.fetch('matches', 0) @mismatches = results.fetch('mismatches', 0) @missing = results.fetch('missing', 0) @status = results.fetch('status', 0) @is_new = nil @url = nil end |
Instance Attribute Details
#is_new ⇒ Object
Returns the value of attribute is_new.
7 8 9 |
# File 'lib/applitools/core/test_results.rb', line 7 def is_new @is_new end |
#matches ⇒ Object (readonly)
Returns the value of attribute matches.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def matches @matches end |
#mismatches ⇒ Object (readonly)
Returns the value of attribute mismatches.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def mismatches @mismatches end |
#missing ⇒ Object (readonly)
Returns the value of attribute missing.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def missing @missing end |
#original_results ⇒ Object (readonly)
Returns the value of attribute original_results.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def original_results @original_results end |
#screenshot ⇒ Object
Returns the value of attribute screenshot.
7 8 9 |
# File 'lib/applitools/core/test_results.rb', line 7 def screenshot @screenshot end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def status @status end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
8 9 10 |
# File 'lib/applitools/core/test_results.rb', line 8 def steps @steps end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/applitools/core/test_results.rb', line 7 def url @url end |
Instance Method Details
#==(other) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/applitools/core/test_results.rb', line 53 def ==(other) if other.is_a? self.class result = true %w(is_new url steps matches mismatches missing).each do |field| result &&= send(field) == other.send(field) end return result if result end false end |
#aborted? ⇒ Boolean
41 42 43 |
# File 'lib/applitools/core/test_results.rb', line 41 def aborted? original_results['isAborted'] end |
#api_session_url ⇒ Object
45 46 47 |
# File 'lib/applitools/core/test_results.rb', line 45 def api_session_url original_results['apiUrls']['session'] end |
#different? ⇒ Boolean
37 38 39 |
# File 'lib/applitools/core/test_results.rb', line 37 def different? original_results['isDifferent'] end |
#failed? ⇒ Boolean
25 26 27 |
# File 'lib/applitools/core/test_results.rb', line 25 def failed? status == 'Failed' end |
#new? ⇒ Boolean
33 34 35 |
# File 'lib/applitools/core/test_results.rb', line 33 def new? original_results['isNew'] end |
#passed? ⇒ Boolean Also known as: is_passed, as_expected?
21 22 23 |
# File 'lib/applitools/core/test_results.rb', line 21 def passed? status == 'Passed' end |
#secret_token ⇒ Object
49 50 51 |
# File 'lib/applitools/core/test_results.rb', line 49 def secret_token original_results['secretToken'] end |
#to_s(advanced = false) ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/applitools/core/test_results.rb', line 68 def to_s(advanced = false) is_new_str = '' is_new_str = is_new ? 'New test' : 'Existing test' unless is_new.nil? return @original_results.to_yaml if advanced "#{is_new_str} [ steps: #{steps}, matches: #{matches}, mismatches: #{mismatches}, missing: #{missing} ], " \ "URL: #{url}" end |
#unresolved? ⇒ Boolean
29 30 31 |
# File 'lib/applitools/core/test_results.rb', line 29 def unresolved? status == 'Unresolved' end |