browser_shooter 0.3.7 → 0.3.9
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.
- data/README.md +8 -1
- data/lib/browser_shooter/base.rb +4 -4
- data/lib/browser_shooter/configurator.rb +2 -1
- data/lib/browser_shooter/version.rb +1 -1
- data/test/base_test.rb +21 -9
- data/test/configurator_test.rb +18 -1
- data/test/fixtures/config_empty.yml +3 -0
- data/test/fixtures/config_simple.yml +7 -5
- metadata +14 -12
data/README.md
CHANGED
@@ -37,7 +37,8 @@ Repeat these steps in every VM.
|
|
37
37
|
Create a YAML file like this:
|
38
38
|
|
39
39
|
# myconfig.yml
|
40
|
-
output_path: "
|
40
|
+
output_path: "~/browser_shooter"
|
41
|
+
timeout: 40
|
41
42
|
extensions:
|
42
43
|
- ~/browser_shooter/my_extension_1.rb
|
43
44
|
- ~/browser_shooter/my_extension_2.rb
|
@@ -87,6 +88,12 @@ Create a YAML file like this:
|
|
87
88
|
|
88
89
|
Look in the [examples folder](https://github.com/fguillen/BrowserShooter/tree/master/examples) for more complete examples.
|
89
90
|
|
91
|
+
##### Root section
|
92
|
+
|
93
|
+
* **output_path**: Root folder for the _logs_ and _screenshots_. Optional, showing the default value.
|
94
|
+
* **timeout**: WebDriver global timeout for all commands. Optional. showing the default value.
|
95
|
+
* **extensions**: List of files with _Custom Extended Commands_ implementations. Optional, empty is default. Please check the section _Custom Extended Commands_ for more information.
|
96
|
+
|
90
97
|
##### Tests section
|
91
98
|
|
92
99
|
###### WebDriver commands
|
data/lib/browser_shooter/base.rb
CHANGED
@@ -20,7 +20,7 @@ module BrowserShooter
|
|
20
20
|
suite,
|
21
21
|
test,
|
22
22
|
browser,
|
23
|
-
config
|
23
|
+
config
|
24
24
|
)
|
25
25
|
end
|
26
26
|
end
|
@@ -31,9 +31,9 @@ module BrowserShooter
|
|
31
31
|
BrowserShooter::Logger.log( "BYE!" )
|
32
32
|
end
|
33
33
|
|
34
|
-
def self.run_test( suite, test, browser,
|
34
|
+
def self.run_test( suite, test, browser, config )
|
35
35
|
BrowserShooter::Logger.log( "Executing #{suite.name} | #{test.name} | #{browser.name}", true )
|
36
|
-
output_path = "#{output_path}/#{suite.name}/#{test.name}/#{browser.name}"
|
36
|
+
output_path = "#{config["output_path"]}/#{suite.name}/#{test.name}/#{browser.name}"
|
37
37
|
|
38
38
|
driver = nil
|
39
39
|
|
@@ -45,7 +45,7 @@ module BrowserShooter
|
|
45
45
|
:desired_capabilities => browser.type.to_sym
|
46
46
|
)
|
47
47
|
|
48
|
-
driver.manage.timeouts.implicit_wait =
|
48
|
+
driver.manage.timeouts.implicit_wait = config["timeout"]
|
49
49
|
|
50
50
|
logs =
|
51
51
|
BrowserShooter::Commander.script(
|
data/test/base_test.rb
CHANGED
@@ -26,10 +26,10 @@ class BaseTest < Test::Unit::TestCase
|
|
26
26
|
config_mock.stubs( :[] ).returns( "config_value" )
|
27
27
|
config_mock.expects( :suites ).returns( [@suite1] )
|
28
28
|
|
29
|
-
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser1,
|
30
|
-
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser2,
|
31
|
-
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser1,
|
32
|
-
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser2,
|
29
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser1, config_mock )
|
30
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test1, @browser2, config_mock )
|
31
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser1, config_mock )
|
32
|
+
BrowserShooter::Base.expects( :run_test ).with( @suite1, @test2, @browser2, config_mock )
|
33
33
|
|
34
34
|
BrowserShooter::Base.new( opts ).run
|
35
35
|
end
|
@@ -40,12 +40,24 @@ class BaseTest < Test::Unit::TestCase
|
|
40
40
|
:desired_capabilities => "type1".to_sym
|
41
41
|
}
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
config = {
|
44
|
+
"output_path" => "output_path",
|
45
|
+
"timeout" => 66
|
46
|
+
}
|
47
|
+
|
48
|
+
timeouts_mock = mock()
|
49
|
+
manage_mock = mock()
|
50
|
+
driver_mock = mock()
|
51
|
+
|
52
|
+
driver_mock.stubs( :manage ).returns( manage_mock )
|
53
|
+
manage_mock.stubs( :timeouts ).returns( timeouts_mock )
|
54
|
+
|
55
|
+
timeouts_mock.expects( :implicit_wait= ).with( 66 )
|
56
|
+
driver_mock.expects( :quit )
|
57
|
+
Selenium::WebDriver.expects( :for ).with( :remote, expected_opts ).returns( driver_mock )
|
58
|
+
BrowserShooter::Commander.expects( :script ).with( @test1.commands, driver_mock, @browser1, "output_path/suite1/test1/browser1" ).returns( "log1" )
|
47
59
|
BrowserShooter::LogExporter.expects( :export ).with( "log1", "output_path/suite1/test1/browser1/logs" )
|
48
60
|
|
49
|
-
BrowserShooter::Base.run_test( @suite1, @test1, @browser1,
|
61
|
+
BrowserShooter::Base.run_test( @suite1, @test1, @browser1, config )
|
50
62
|
end
|
51
63
|
end
|
data/test/configurator_test.rb
CHANGED
@@ -55,6 +55,13 @@ class ConfiguratorTest < Test::Unit::TestCase
|
|
55
55
|
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
56
56
|
assert_equal( 2, suites.size )
|
57
57
|
|
58
|
+
opts = { :suite => "suite1" }
|
59
|
+
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
60
|
+
assert_equal( 1, suites.size )
|
61
|
+
assert_equal( 2, suites.first.tests.size )
|
62
|
+
assert_equal( "google", suites.first.tests.first.name )
|
63
|
+
assert_equal( "miniclip", suites.first.tests.last.name )
|
64
|
+
|
58
65
|
opts = { :suite => "suite2" }
|
59
66
|
suites = BrowserShooter::Configurator.filter_suites( models, opts )
|
60
67
|
assert_equal( 1, suites.size )
|
@@ -84,10 +91,20 @@ class ConfiguratorTest < Test::Unit::TestCase
|
|
84
91
|
config = BrowserShooter::Configurator.load_config( "#{FIXTURES}/config_simple.yml" )
|
85
92
|
|
86
93
|
assert_equal( "/output_path/timestamp", config["output_path"] )
|
87
|
-
assert_equal(
|
94
|
+
assert_equal( 20, config["timeout"] )
|
95
|
+
assert_equal( "script-one", config["tests"]["script-one"] )
|
88
96
|
assert_equal( "browser-one", config["browsers"]["browser-one"] )
|
89
97
|
end
|
90
98
|
|
99
|
+
def test_load_config_with_defaults
|
100
|
+
BrowserShooter::Configurator.expects( :timestamp ).returns( "timestamp" )
|
101
|
+
|
102
|
+
config = BrowserShooter::Configurator.load_config( "#{FIXTURES}/config_empty.yml" )
|
103
|
+
|
104
|
+
assert_equal( File.expand_path( "~/browser_shooter/timestamp" ), config["output_path"] )
|
105
|
+
assert_equal( 40, config["timeout"] )
|
106
|
+
end
|
107
|
+
|
91
108
|
def test_load_extensions
|
92
109
|
Kernel.expects( :require ).with( File.expand_path( "extension1.rb" ) )
|
93
110
|
Kernel.expects( :require ).with( File.expand_path( "extension2.rb" ) )
|
@@ -1,13 +1,15 @@
|
|
1
1
|
output_path: "/output_path"
|
2
|
+
timeout: 20
|
2
3
|
|
3
|
-
|
4
|
+
tests:
|
4
5
|
script-one: "script-one"
|
5
6
|
script-two: "script-two"
|
6
7
|
|
7
|
-
suites:
|
8
|
-
suite-one: "suite-one"
|
9
|
-
|
10
8
|
browsers:
|
11
9
|
browser-one: "browser-one"
|
12
10
|
browser-two: "browser-two"
|
13
|
-
browser-three: "browser-three"
|
11
|
+
browser-three: "browser-three"
|
12
|
+
|
13
|
+
suites:
|
14
|
+
suite-one: "suite-one"
|
15
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browser_shooter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-02 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &70301246657780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.0.rc.6
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70301246657780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70301246657280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - =
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.9.2.2
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70301246657280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mocha
|
38
|
-
requirement: &
|
38
|
+
requirement: &70301246656900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70301246656900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: selenium-webdriver
|
49
|
-
requirement: &
|
49
|
+
requirement: &70301246656440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70301246656440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mixlib-cli
|
60
|
-
requirement: &
|
60
|
+
requirement: &70301246656020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70301246656020
|
69
69
|
description: Selenium RC wraper to create browser screenshots
|
70
70
|
email:
|
71
71
|
- fguillen.mail@gmail.com
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- test/commands/screenshots_test.rb
|
111
111
|
- test/configurator_test.rb
|
112
112
|
- test/fixtures/config.yml
|
113
|
+
- test/fixtures/config_empty.yml
|
113
114
|
- test/fixtures/config_simple.yml
|
114
115
|
- test/fixtures/logs/log.csv
|
115
116
|
- test/fixtures/screenshot.base64
|
@@ -151,6 +152,7 @@ test_files:
|
|
151
152
|
- test/commands/screenshots_test.rb
|
152
153
|
- test/configurator_test.rb
|
153
154
|
- test/fixtures/config.yml
|
155
|
+
- test/fixtures/config_empty.yml
|
154
156
|
- test/fixtures/config_simple.yml
|
155
157
|
- test/fixtures/logs/log.csv
|
156
158
|
- test/fixtures/screenshot.base64
|