browser_shooter 0.2.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +78 -28
- data/Rakefile +1 -1
- data/bin/browser_shooter +4 -8
- data/browser_shoter.gemspec +1 -2
- data/examples/config0.yml +35 -0
- data/examples/config1.yml +24 -21
- data/examples/config2.yml +48 -28
- data/lib/browser_shooter.rb +10 -34
- data/lib/browser_shooter/argv_parser.rb +54 -0
- data/lib/browser_shooter/base.rb +65 -0
- data/lib/browser_shooter/commander.rb +109 -107
- data/lib/browser_shooter/configurator.rb +77 -6
- data/lib/browser_shooter/log_exporter.rb +11 -17
- data/lib/browser_shooter/logger.rb +20 -3
- data/lib/browser_shooter/models/browser.rb +6 -0
- data/lib/browser_shooter/models/suite.rb +6 -0
- data/lib/browser_shooter/models/test.rb +6 -0
- data/lib/browser_shooter/version.rb +2 -2
- data/test/argv_parser_test.rb +15 -0
- data/test/base_test.rb +51 -0
- data/test/commander_test.rb +45 -68
- data/test/configurator_test.rb +69 -3
- data/test/fixtures/config.yml +30 -21
- data/test/fixtures/config_simple.yml +3 -0
- data/test/fixtures/logs/{script1.csv → log.csv} +1 -1
- data/test/log_exporter_test.rb +23 -41
- data/test/logger_test.rb +51 -0
- data/test/models/browser_test.rb +10 -0
- data/test/models/suite_test.rb +10 -0
- data/test/models/test_test.rb +9 -0
- metadata +33 -35
- data/lib/browser_shooter/driver.rb +0 -33
- data/test/browser_shooter_test.rb +0 -23
- data/test/driver_test.rb +0 -34
- data/test/fixtures/logs/logs.json +0 -24
- data/test/fixtures/logs/script2.csv +0 -2
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.
|
1
|
+
module BrowserShooter
|
2
|
+
VERSION = "0.3.1"
|
3
3
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class ARGVParserTest < Test::Unit::TestCase
|
4
|
+
def test_parse_options
|
5
|
+
argvs = "-c my/file/path.yml -v -s my_suite -t my_test -b browser1,browser2"
|
6
|
+
argv_parser = BrowserShooter::ARGVParsers.new
|
7
|
+
argv_parser.parse_options( argvs.split )
|
8
|
+
|
9
|
+
assert_equal( "my/file/path.yml", argv_parser.config[:config_file] )
|
10
|
+
assert_equal( "my_suite", argv_parser.config[:suite] )
|
11
|
+
assert_equal( "my_test", argv_parser.config[:test] )
|
12
|
+
assert_equal( ["browser1", "browser2"], argv_parser.config[:browsers] )
|
13
|
+
assert_equal( true, argv_parser.config[:verbose] )
|
14
|
+
end
|
15
|
+
end
|
data/test/base_test.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class BaseTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
super
|
6
|
+
|
7
|
+
@test1 = BrowserShooter::Models::Test.new( "test1", ["command1", "command2"] )
|
8
|
+
@test2 = BrowserShooter::Models::Test.new( "test2", ["command3"] )
|
9
|
+
@browser1 = BrowserShooter::Models::Browser.new( "browser1", "url1", "type1" )
|
10
|
+
@browser2 = BrowserShooter::Models::Browser.new( "browser2", "url2", "type2" )
|
11
|
+
@suite1 = BrowserShooter::Models::Suite.new( "suite1", [@test1, @test2], [@browser1, @browser2] )
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_initialize
|
15
|
+
assert_equal( "opts", BrowserShooter::Base.new( "opts" ).opts )
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_run
|
19
|
+
BrowserShooter::Configurator.stubs( :set_up_output_path )
|
20
|
+
|
21
|
+
opts = {}
|
22
|
+
|
23
|
+
config_mock = mock()
|
24
|
+
BrowserShooter::Configurator.expects( :new ).with( opts ).returns( config_mock )
|
25
|
+
|
26
|
+
config_mock.stubs( :[] ).returns( "config_value" )
|
27
|
+
config_mock.expects( :suites ).returns( [@suite1] )
|
28
|
+
|
29
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser1, "config_value" )
|
30
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser2, "config_value" )
|
31
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser1, "config_value" )
|
32
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser2, "config_value" )
|
33
|
+
|
34
|
+
BrowserShooter::Base.new( opts ).run
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_run_script
|
38
|
+
expected_opts = {
|
39
|
+
:url => "url1",
|
40
|
+
:desired_capabilities => "type1".to_sym
|
41
|
+
}
|
42
|
+
|
43
|
+
driver = mock()
|
44
|
+
driver.expects( :quit )
|
45
|
+
Selenium::WebDriver.expects( :for ).with( :remote, expected_opts ).returns( driver )
|
46
|
+
BrowserShooter::Commander.expects( :script ).with( @test1.commands, driver, "output_path/suite1/test1/browser1" ).returns( "log1" )
|
47
|
+
BrowserShooter::LogExporter.expects( :export ).with( "log1", "output_path/suite1/test1/browser1/logs" )
|
48
|
+
|
49
|
+
BrowserShooter::Base.run_test( @suite1, @test1, @browser1, "output_path" )
|
50
|
+
end
|
51
|
+
end
|
data/test/commander_test.rb
CHANGED
@@ -1,54 +1,61 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
3
|
class CommanderTest < Test::Unit::TestCase
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def test_script
|
5
|
+
commands = [
|
6
|
+
"command1",
|
7
|
+
" command2 "
|
8
|
+
]
|
8
9
|
|
9
|
-
|
10
|
-
BrowserShooter::Commander.expects( :
|
11
|
-
BrowserShooter::
|
10
|
+
BrowserShooter::Commander.expects( :wrapper_execute ).with( "command1", "driver", "output_path" ).returns( "result1" )
|
11
|
+
BrowserShooter::Commander.expects( :wrapper_execute ).with( "command2", "driver", "output_path" ).returns( "result2" )
|
12
|
+
BrowserShooter::Logger.expects( :command_result ).twice
|
13
|
+
BrowserShooter::Logger.expects( :test_result )
|
14
|
+
|
15
|
+
result = BrowserShooter::Commander.script( commands, "driver", "output_path" )
|
16
|
+
|
17
|
+
assert_equal( ["result1", "result2"], result )
|
12
18
|
end
|
13
19
|
|
14
|
-
def
|
15
|
-
BrowserShooter::Commander.expects( :
|
16
|
-
BrowserShooter::Commander.execute( "
|
20
|
+
def test_execute_when_shot_with_sufix
|
21
|
+
BrowserShooter::Commander.expects( :shot ).with( "driver", "shoot-path", "sufix" )
|
22
|
+
BrowserShooter::Commander.execute( "shot sufix", "driver", "shoot-path" )
|
17
23
|
end
|
18
24
|
|
19
|
-
def
|
20
|
-
BrowserShooter::Commander.expects( :
|
21
|
-
BrowserShooter::Commander.execute( "
|
25
|
+
def test_execute_when_shot_without_sufix
|
26
|
+
BrowserShooter::Commander.expects( :shot ).with( "driver", "shoot-path", nil )
|
27
|
+
BrowserShooter::Commander.execute( "shot", "driver", "shoot-path" )
|
22
28
|
end
|
23
29
|
|
24
30
|
def test_execute_when_pause
|
25
31
|
BrowserShooter::Commander.expects( :pause ).with( 10 )
|
26
|
-
BrowserShooter::Commander.execute( "pause 10", "
|
32
|
+
BrowserShooter::Commander.execute( "pause 10", "driver", "shoot-path" )
|
27
33
|
end
|
28
34
|
|
29
35
|
def test_execute_when_wait_for_element
|
30
|
-
BrowserShooter::Commander.expects( :wait_for_element ).with( "
|
31
|
-
BrowserShooter::Commander.execute( "wait_for_element \"css_selector\", 10", "
|
36
|
+
BrowserShooter::Commander.expects( :wait_for_element ).with( "driver", "css_selector", 10 )
|
37
|
+
BrowserShooter::Commander.execute( "wait_for_element \"css_selector\", 10", "driver", nil )
|
32
38
|
end
|
33
39
|
|
34
40
|
def test_execute_when_click
|
35
|
-
BrowserShooter::Commander.expects( :click ).with( "
|
36
|
-
BrowserShooter::Commander.execute( "click \"css_selector\"", "
|
41
|
+
BrowserShooter::Commander.expects( :click ).with( "driver", "css_selector" )
|
42
|
+
BrowserShooter::Commander.execute( "click \"css_selector\"", "driver", nil )
|
37
43
|
end
|
38
44
|
|
39
45
|
def test_execute_when_type
|
40
|
-
BrowserShooter::Commander.expects( :type ).with( "
|
41
|
-
BrowserShooter::Commander.execute( "type \"css_selector\", \"message a b\"", "
|
46
|
+
BrowserShooter::Commander.expects( :type ).with( "driver", "css_selector", "message a b" )
|
47
|
+
BrowserShooter::Commander.execute( "type \"css_selector\", \"message a b\"", "driver", nil )
|
42
48
|
end
|
43
49
|
|
44
50
|
def test_shot_with_sufix
|
45
51
|
in_tmpdir do |tmpdir|
|
46
|
-
|
47
|
-
|
52
|
+
driver = mock()
|
53
|
+
output_path = tmpdir
|
48
54
|
|
49
|
-
|
55
|
+
FileUtils.expects( :mkdir_p ).with( "#{output_path}/shots" )
|
56
|
+
driver.expects( :save_screenshot ).with( "#{output_path}/shots/sufix.png" )
|
50
57
|
|
51
|
-
BrowserShooter::Commander.shot(
|
58
|
+
BrowserShooter::Commander.shot( driver, output_path, "sufix" )
|
52
59
|
end
|
53
60
|
end
|
54
61
|
|
@@ -56,75 +63,45 @@ class CommanderTest < Test::Unit::TestCase
|
|
56
63
|
BrowserShooter::Commander.stubs( :timestamp ).returns( "timestamp" )
|
57
64
|
|
58
65
|
in_tmpdir do |tmpdir|
|
59
|
-
|
60
|
-
|
66
|
+
driver = mock()
|
67
|
+
output_path = tmpdir
|
61
68
|
|
62
|
-
|
69
|
+
FileUtils.expects( :mkdir_p ).with( "#{output_path}/shots" )
|
70
|
+
driver.expects( :save_screenshot ).with( "#{output_path}/shots/timestamp.png" )
|
63
71
|
|
64
|
-
BrowserShooter::Commander.shot(
|
72
|
+
BrowserShooter::Commander.shot( driver, output_path, nil )
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
68
|
-
# FIXME: shot_system not supported in WebDriver
|
69
|
-
# def test_shot_system_with_sufix
|
70
|
-
# in_tmpdir do |tmpdir|
|
71
|
-
# client = stub( :capture_screenshot_to_string => read_fixture( "screenshot.base64" ) )
|
72
|
-
# path = "#{tmpdir}/myfile"
|
73
|
-
|
74
|
-
# BrowserShooter::Commander.shot_system( client, path, "sufix" )
|
75
|
-
|
76
|
-
# assert_equal(
|
77
|
-
# Digest::MD5.hexdigest( Base64.decode64( read_fixture( "screenshot.base64" ) ) ),
|
78
|
-
# Digest::MD5.hexdigest( File.read( "#{path}_sufix.system.png" ) )
|
79
|
-
# )
|
80
|
-
# end
|
81
|
-
# end
|
82
|
-
|
83
|
-
# def test_shot_system_without_sufix
|
84
|
-
# BrowserShooter::Commander.stubs( :timestamp ).returns( "timestamp" )
|
85
|
-
|
86
|
-
# in_tmpdir do |tmpdir|
|
87
|
-
# client = stub( :capture_screenshot_to_string => read_fixture( "screenshot.base64" ) )
|
88
|
-
# path = "#{tmpdir}/myfile"
|
89
|
-
|
90
|
-
# BrowserShooter::Commander.shot_system( client, path, nil )
|
91
|
-
|
92
|
-
# assert_equal(
|
93
|
-
# Digest::MD5.hexdigest( Base64.decode64( read_fixture( "screenshot.base64" ) ) ),
|
94
|
-
# Digest::MD5.hexdigest( File.read( "#{path}_timestamp.system.png" ) )
|
95
|
-
# )
|
96
|
-
# end
|
97
|
-
# end
|
98
|
-
|
99
76
|
def test_wait_for_element
|
100
77
|
wait = mock()
|
101
|
-
|
78
|
+
driver = mock()
|
102
79
|
|
103
80
|
Selenium::WebDriver::Wait.expects( :new ).with( :timeout => 10 ).returns( wait )
|
104
81
|
wait.expects( :until ).yields
|
105
|
-
|
82
|
+
driver.expects( :find_element ).with( "css", "css_selector" )
|
106
83
|
|
107
|
-
BrowserShooter::Commander.wait_for_element(
|
84
|
+
BrowserShooter::Commander.wait_for_element( driver, "css_selector", 10 )
|
108
85
|
end
|
109
86
|
|
110
87
|
def test_click
|
111
|
-
|
88
|
+
driver = mock()
|
112
89
|
element = mock()
|
113
90
|
|
114
|
-
|
91
|
+
driver.expects( :find_element ).with( "css", "css_selector" ).returns( element )
|
115
92
|
element.expects( :click )
|
116
93
|
|
117
|
-
BrowserShooter::Commander.click(
|
94
|
+
BrowserShooter::Commander.click( driver, "css_selector" )
|
118
95
|
end
|
119
96
|
|
120
97
|
def test_type
|
121
|
-
|
98
|
+
driver = mock()
|
122
99
|
element = mock()
|
123
100
|
|
124
|
-
|
101
|
+
driver.expects( :find_element ).with( "css", "css_selector" ).returns( element )
|
125
102
|
element.expects( :send_keys ).with( "message" )
|
126
103
|
|
127
|
-
BrowserShooter::Commander.type(
|
104
|
+
BrowserShooter::Commander.type( driver, "css_selector", "message" )
|
128
105
|
end
|
129
106
|
|
130
107
|
def test_pause
|
data/test/configurator_test.rb
CHANGED
@@ -1,11 +1,77 @@
|
|
1
1
|
require_relative "test_helper"
|
2
2
|
|
3
3
|
class ConfiguratorTest < Test::Unit::TestCase
|
4
|
+
def test_initialize
|
5
|
+
opts = { :config_file => "config_file" }
|
6
|
+
config = { :key1 => "value1" }
|
7
|
+
|
8
|
+
BrowserShooter::Configurator.expects( :load_config ).with( "config_file" ).returns( config )
|
9
|
+
BrowserShooter::Configurator.expects( :build_models ).with( config ).returns( "models" )
|
10
|
+
BrowserShooter::Configurator.expects( :filter_suites ).with( "models", opts ).returns( "suites" )
|
11
|
+
|
12
|
+
configurator = BrowserShooter::Configurator.new( opts )
|
13
|
+
|
14
|
+
assert_equal( "value1", configurator[:key1] )
|
15
|
+
assert_equal( "suites", configurator.suites )
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_build_models
|
19
|
+
BrowserShooter::Configurator.stubs( :set_up_output_path )
|
20
|
+
config = BrowserShooter::Configurator.load_config( "#{FIXTURES}/config.yml" )
|
21
|
+
models = BrowserShooter::Configurator.build_models( config )
|
22
|
+
|
23
|
+
assert_equal( 2, models[:tests].size )
|
24
|
+
assert_equal( "google", models[:tests].first.name )
|
25
|
+
assert_equal( 6, models[:tests].first.commands.size )
|
26
|
+
assert_equal( "navigate.to \"http://www.google.de\"", models[:tests].first.commands.first )
|
27
|
+
|
28
|
+
assert_equal( 3, models[:browsers].size )
|
29
|
+
assert_equal( "windows-firefox", models[:browsers].first.name )
|
30
|
+
assert_equal( "http://10.211.55.4:4444/wd/hub", models[:browsers].first.url )
|
31
|
+
assert_equal( "firefox", models[:browsers].first.type )
|
32
|
+
|
33
|
+
assert_equal( 2, models[:suites].size )
|
34
|
+
assert_equal( "suite1", models[:suites].first.name )
|
35
|
+
assert_equal( 2, models[:suites].first.tests.size )
|
36
|
+
assert_equal( models[:tests].first, models[:suites].first.tests.first )
|
37
|
+
assert_equal( 2, models[:suites].first.browsers.size )
|
38
|
+
assert_equal( models[:browsers].first, models[:suites].first.browsers.first )
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_filter_suites
|
42
|
+
BrowserShooter::Configurator.stubs( :set_up_output_path )
|
43
|
+
config = BrowserShooter::Configurator.load_config( "#{FIXTURES}/config.yml" )
|
44
|
+
models = BrowserShooter::Configurator.build_models( config )
|
45
|
+
|
46
|
+
opts = {}
|
47
|
+
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
48
|
+
assert_equal( 2, suites.size )
|
49
|
+
|
50
|
+
opts = { :suite => "suite2" }
|
51
|
+
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
52
|
+
assert_equal( 1, suites.size )
|
53
|
+
assert_equal( "suite2", suites.first.name )
|
54
|
+
|
55
|
+
opts = { :test => "google" }
|
56
|
+
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
57
|
+
assert_equal( 1, suites.size )
|
58
|
+
assert_equal( "anonymous", suites.first.name )
|
59
|
+
assert_equal( 1, suites.first.tests.size )
|
60
|
+
assert_equal( "google", suites.first.tests.first.name )
|
61
|
+
assert_equal( 3, suites.first.browsers.size )
|
62
|
+
|
63
|
+
opts = { :test => "google", :browsers => ["windows-firefox", "windows-iexplore"] }
|
64
|
+
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
65
|
+
assert_equal( 1, suites.size )
|
66
|
+
assert_equal( "anonymous", suites.first.name )
|
67
|
+
assert_equal( 1, suites.first.tests.size )
|
68
|
+
assert_equal( "google", suites.first.tests.first.name )
|
69
|
+
assert_equal( 2, suites.first.browsers.size )
|
70
|
+
assert_equal( "windows-firefox", suites.first.browsers.first.name )
|
71
|
+
end
|
72
|
+
|
4
73
|
def test_load_config
|
5
74
|
BrowserShooter::Configurator.expects( :timestamp ).returns( "timestamp" )
|
6
|
-
FileUtils.expects( :mkdir_p ).with( "/output_path/timestamp" )
|
7
|
-
FileUtils.expects( :mkdir ).with( "/output_path/timestamp/shots" )
|
8
|
-
FileUtils.expects( :mkdir ).with( "/output_path/timestamp/logs" )
|
9
75
|
|
10
76
|
config = BrowserShooter::Configurator.load_config( "#{FIXTURES}/config_simple.yml" )
|
11
77
|
|
data/test/fixtures/config.yml
CHANGED
@@ -1,34 +1,43 @@
|
|
1
1
|
output_path: "/tmp/output"
|
2
2
|
|
3
|
-
|
4
|
-
google:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
pause 3
|
12
|
-
shot 02_after
|
3
|
+
tests:
|
4
|
+
google: |
|
5
|
+
navigate.to "http://www.google.de"
|
6
|
+
shot 01_before
|
7
|
+
type "id=lst-ib", "fernando guillen"
|
8
|
+
click "name=btnG", wait_for :page
|
9
|
+
pause 3
|
10
|
+
shot 02_after
|
13
11
|
|
14
|
-
miniclip:
|
15
|
-
|
16
|
-
|
17
|
-
navigate.to "http://www.miniclip.com/games/de/"
|
18
|
-
shot
|
12
|
+
miniclip: |
|
13
|
+
navigate.to "http://www.miniclip.com/games/de/"
|
14
|
+
shot
|
19
15
|
|
20
16
|
browsers:
|
21
17
|
windows-firefox:
|
22
|
-
name: "windows-firefox"
|
23
18
|
url: "http://10.211.55.4:4444/wd/hub"
|
24
|
-
|
19
|
+
type: "firefox"
|
25
20
|
|
26
21
|
windows-iexplore:
|
27
|
-
name: "windows-iexploreproxy"
|
28
22
|
url: "http://10.211.55.4:4444/wd/hub"
|
29
|
-
|
23
|
+
type: "iexploreproxy"
|
30
24
|
|
31
25
|
linux-firefox:
|
32
|
-
name: "linux-firefox"
|
33
26
|
url: "http://10.211.55.4:4444/wd/hub"
|
34
|
-
|
27
|
+
type: "firefox"
|
28
|
+
|
29
|
+
suites:
|
30
|
+
suite1:
|
31
|
+
tests:
|
32
|
+
- google
|
33
|
+
- miniclip
|
34
|
+
browsers:
|
35
|
+
- windows-firefox
|
36
|
+
- windows-iexplore
|
37
|
+
|
38
|
+
suite2:
|
39
|
+
tests:
|
40
|
+
- miniclip
|
41
|
+
browsers:
|
42
|
+
- windows-firefox
|
43
|
+
- linux-firefox
|
data/test/log_exporter_test.rb
CHANGED
@@ -4,59 +4,41 @@ class LogExporterTest < Test::Unit::TestCase
|
|
4
4
|
def setup
|
5
5
|
super
|
6
6
|
|
7
|
-
@logs =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
],
|
22
|
-
"script2" => [
|
23
|
-
{
|
24
|
-
:time => "the time 3",
|
25
|
-
:success => true,
|
26
|
-
:command => "the command 3",
|
27
|
-
:message => "the message 3"
|
28
|
-
}
|
29
|
-
]
|
30
|
-
}
|
7
|
+
@logs = [
|
8
|
+
{
|
9
|
+
:time => "the time 1",
|
10
|
+
:success => true,
|
11
|
+
:command => "the command 1",
|
12
|
+
:message => "the message 1 \n with 2 lines"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
:time => "the time 2",
|
16
|
+
:success => false,
|
17
|
+
:command => "the command 2",
|
18
|
+
:message => "the message 2"
|
19
|
+
}
|
20
|
+
]
|
31
21
|
end
|
32
22
|
|
33
23
|
def test_export_should_call_sub_methods
|
34
|
-
BrowserShooter::LogExporter.expects( :
|
24
|
+
BrowserShooter::LogExporter.expects( :export_to_format ).with( "logs", File.expand_path( "path/log.format" ) )
|
35
25
|
BrowserShooter::LogExporter.export( "logs", "path", "format" )
|
36
26
|
end
|
37
27
|
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
# File.open( "#{FIXTURES}/logs/logs.json", "w" ) { |f| f.write result }
|
44
|
-
|
45
|
-
assert_equal( read_fixture( "logs/logs.json" ), result )
|
46
|
-
end
|
28
|
+
def the_export_should_create_dir
|
29
|
+
BrowserShooter::LogExporter.stubs( :export_to_format )
|
30
|
+
FileUtils.expects( :mkdir_p ).with( File.expand_path( "output_path/log.format" ) )
|
31
|
+
BrowserShooter::LogExporter.export( "logs", "output_path", "format" )
|
47
32
|
end
|
48
33
|
|
49
34
|
def test_export_to_csv
|
50
35
|
in_tmpdir do |path|
|
51
|
-
BrowserShooter::LogExporter.export_to_csv( @logs, path )
|
52
|
-
|
53
|
-
result2 = File.read( "#{path}/script2.csv" )
|
36
|
+
BrowserShooter::LogExporter.export_to_csv( @logs, "#{path}/log.csv" )
|
37
|
+
result = File.read( "#{path}/log.csv" )
|
54
38
|
|
55
|
-
# File.open( "#{FIXTURES}/logs/
|
56
|
-
# File.open( "#{FIXTURES}/logs/script2.csv", "w" ) { |f| f.write result2 }
|
39
|
+
# File.open( "#{FIXTURES}/logs/log.csv", "w" ) { |f| f.write result }
|
57
40
|
|
58
|
-
assert_equal( read_fixture( "logs/
|
59
|
-
assert_equal( read_fixture( "logs/script2.csv" ), result2 )
|
41
|
+
assert_equal( read_fixture( "logs/log.csv" ), result )
|
60
42
|
end
|
61
43
|
end
|
62
44
|
end
|