Top Level Namespace
Defined Under Namespace
Modules: HTMLReport, ParallelTests, Utilities
Classes: CapybaraHtmlFormatter, CustomParallelHtmlFormatter, ParallelHtmlFormatter
Instance Method Summary
collapse
Instance Method Details
#alphabetize_names(filename) ⇒ Object
5
6
7
|
# File 'lib/sim/support/rspec_util.rb', line 5
def alphabetize_names(filename)
example.metadata[:snapshot_count] + '-' + filename
end
|
#dealphabetize_names(filename) ⇒ Object
9
10
11
|
# File 'lib/sim/support/rspec_util.rb', line 9
def dealphabetize_names(filename)
filename[4..filename.length]
end
|
#is_cucumber ⇒ Object
1
2
3
|
# File 'lib/sim/support/sim_util.rb', line 1
def is_cucumber()
respond_to? :After
end
|
#is_rspec ⇒ Object
5
6
7
|
# File 'lib/sim/support/sim_util.rb', line 5
def is_rspec()
RSpec.respond_to? :configure
end
|
#path_of_example_groups(example, desc) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/sim/support/rspec_util.rb', line 49
def path_of_example_groups(example, desc)
groups = []
groups << desc
current_group = example.metadata[:example_group]
while (!current_group.nil?) do
groups << current_group[:description]
current_group = current_group[:example_group]
end
groups << $base_screenshot_dir
groups.reverse.join('/')
end
|
#path_to_screenshot(example) ⇒ Object
40
41
42
43
44
45
46
47
|
# File 'lib/sim/support/rspec_util.rb', line 40
def path_to_screenshot(example)
if example.metadata[:screenshot_path]
return example.metadata[:screenshot_path]
end
desc = example.metadata[:description_args].empty? ? example.metadata[:id] : example.metadata[:description_args].first.gsub('"',"'").gsub('|', '')
example.metadata[:screenshot_path] = path_of_example_groups(example, desc)
example.metadata[:screenshot_path]
end
|
#path_to_tmp(example) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/sim/support/rspec_util.rb', line 32
def path_to_tmp(example)
if example.metadata[:tmp_path]
return example.metadata[:tmp_path]
end
example.metadata[:tmp_path] = path_to_screenshot(example)
example.metadata[:tmp_path]
end
|
#save_html_to_file(example, filename) ⇒ Object
24
25
26
|
# File 'lib/sim/support/rspec_util.rb', line 24
def save_html_to_file(example, filename)
File.open("#{path_to_tmp(example)}/#{filename}.html", 'w') {|f| f.write(page.html) }
end
|
#save_screenshot_to_file(example, filename) ⇒ Object
28
29
30
|
# File 'lib/sim/support/rspec_util.rb', line 28
def save_screenshot_to_file(example, filename)
page.save_screenshot("#{path_to_tmp(example)}/#{filename}.png")
end
|
#save_snapshot(example, filename) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/sim/support/rspec_util.rb', line 13
def save_snapshot(example,filename)
ordered_filename = alphabetize_names(filename)
save_html_to_file(example, ordered_filename)
if example.metadata[:js]
save_screenshot_to_file(example, ordered_filename)
end
example.metadata[:snapshot_count] = (example.metadata[:snapshot_count].to_i + 1).to_s.rjust($filename_padding, '0')
end
|
#set_app_address ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/sim/remote.rb', line 9
def set_app_address()
require 'system/getifaddrs'
ip = $webserver_ip != nil ? $webserver_ip : System.get_ifaddrs.find{ |socket| socket[1][:inet_addr] != "127.0.0.1" } [1][:inet_addr]
port = $webserver_port != nil ? $webserver_port : Capybara.current_session.server.port
Capybara.app_host = "http://#{ip}:#{port}"
puts "Registering http://#{ip}:#{port} as root server"
end
|