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 +4 -4
- data/lib/test_utils/browser_tests/browser_setup.rb +17 -8
- data/lib/test_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efc53abdaa23c0bacb9fad36392a4913afea15fe
|
4
|
+
data.tar.gz: 2f94fd1c65e14256b73037aa8333848e33f47bc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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 = "
|
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
|
data/lib/test_utils/version.rb
CHANGED