test_utils 0.1.2 → 0.1.3

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: cbb5176870f09ae466b4b886d5aa61506ae28f2e
4
- data.tar.gz: 19e6ef95190cfd5a306c5f2989bac64cc06b815d
3
+ metadata.gz: efc53abdaa23c0bacb9fad36392a4913afea15fe
4
+ data.tar.gz: 2f94fd1c65e14256b73037aa8333848e33f47bc3
5
5
  SHA512:
6
- metadata.gz: 833ff1cf55fe0dd0da232c5f6a7e0e3e24be9a6fd155561a30b5c035f1613eed52c0d9c8ffc11d27b4bfc68f01d36c2d15d8aa07818eab250104cafa0ca74708
7
- data.tar.gz: 0c645c1fde916ba8485c994a5ec80796da85b93c2df5e3f75c948b586f3d0c807ebb314ebaa1833a293c96edc33acefa779a47d9c8b6583bcecb14a457af197d
6
+ metadata.gz: f035dcf1409e0a55f9ac930f84034df0de49b715168fc413e1e44002357a2b6d2984b172063cae7866f552ff21c43b7f25953c9653c7ef0a58eb1cab0bf6b6fe
7
+ data.tar.gz: d05faeee91be22efa772fb9173a981881e142f72060427bb8b4d26d94a6883f1f0cf98c56b7d44adef688108a81a938c5f0a067717e85e5788f2028101edcc38
@@ -120,20 +120,29 @@ module BrowserSetup
120
120
 
121
121
  # Closes the browser
122
122
  # Takes screenshot and prints relevant information before closing
123
- def close_browser
124
- unless @browser.nil?
125
- take_screenshot
126
- print_session_storage
127
- print_console_errors
128
- @browser.close
123
+ def close_browser(scenario = nil)
124
+ if !scenario.nil? && !@browser.nil?
125
+ if @current_page.nil?
126
+ file_name = "img-#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
127
+ @browser.screenshot.save file_name
128
+ embed(file_name, 'image/png')
129
+ else
130
+ file_name = "#{@current_page.class}-#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
131
+ @current_page.save_screenshot(file_name)
132
+ embed(file_name, 'image/png')
133
+ end
134
+ if scenario.failed?
135
+ print_session_storage
136
+ print_console_errors
137
+ end
129
138
  end
139
+ @browser.close unless @browser.nil?
130
140
  end
131
141
 
132
142
  # Save screenshot
133
143
  def take_screenshot
134
- file_name = "error-#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
144
+ file_name = "img-#{DateTime.now.strftime("%Y%m%d_%H%M%S")}.png"
135
145
  @browser.screenshot.save file_name
136
- embed(file_name, 'image/png')
137
146
  end
138
147
 
139
148
  # Prints all sessionStorage data
@@ -1,3 +1,3 @@
1
1
  module TestUtils
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cinthya Villalobos