capybara-selenium 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -7
- data/lib/capybara_selenium.rb +11 -28
- data/lib/capybara_selenium/selenium_server/configurator.rb +7 -9
- data/lib/capybara_selenium/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: 54318fe730391294e0641cf2de1d6380bd689b3d
|
4
|
+
data.tar.gz: dbdc0c6fa4ab296352d8406e7665914f816aa5cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0029c1a01b9c432722c914dbf261ec60ee879974498704aad105a824ef4f9268f6f6832f456189b49b03d61ff65f03ab3024d8d130ff2fa02d05a33b71267091
|
7
|
+
data.tar.gz: 15d2051feff5361f02624814c378d4577027252bf54e7aeb39d1f18f73872aa79bcd0480d7da96c07e5736c4e1600781b3f2e9e944e60fad2de0f861155054b0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -42,15 +42,15 @@ APP_SERVER_PORT = ENV['CI_APP_SERVER_PORT'] || 8080
|
|
42
42
|
SELENIUM_SERVER_URL = ENV['CI_SELENIUM_SERVER_URL'] ||
|
43
43
|
'http://127.0.0.1:4444/wd/hub'
|
44
44
|
|
45
|
-
CapybaraSelenium
|
46
|
-
app_server.host = APP_SERVER_HOST
|
47
|
-
app_server.port = APP_SERVER_PORT
|
48
|
-
app_server.config_ru_path
|
45
|
+
CapybaraSelenium.configure(:rack, :remote) do |config|
|
46
|
+
config.app_server.host = APP_SERVER_HOST
|
47
|
+
config.app_server.port = APP_SERVER_PORT
|
48
|
+
config.app_server.config_ru_path = File.expand_path(
|
49
49
|
File.join(__FILE__, '../web_app/config.ru'))
|
50
50
|
|
51
|
-
selenium_server.
|
52
|
-
selenium_server.capabilities = { browser_name: browser_name }
|
53
|
-
end
|
51
|
+
config.selenium_server.url = SELENIUM_SERVER_URL
|
52
|
+
config.selenium_server.capabilities = { browser_name: browser_name }
|
53
|
+
end
|
54
54
|
```
|
55
55
|
|
56
56
|
## Contributing
|
data/lib/capybara_selenium.rb
CHANGED
@@ -11,42 +11,25 @@ require 'active_support/inflector'
|
|
11
11
|
module CapybaraSelenium
|
12
12
|
# Class for configuring capybara and selenium in order to instance the
|
13
13
|
# desired driver.
|
14
|
-
class
|
14
|
+
class << self
|
15
15
|
include AppServer
|
16
16
|
include SeleniumServer
|
17
17
|
attr_reader :driver, :app_server, :selenium_server
|
18
18
|
|
19
|
-
# @param [
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
app_server.apply
|
30
|
-
selenium_server.apply
|
31
|
-
end
|
19
|
+
# @param app_server_type [Symbol] The application server type.
|
20
|
+
# Default: :rack
|
21
|
+
# @param selenium_server_type [Symbol The selenium server type.
|
22
|
+
# Default: :remote
|
23
|
+
def configure(app_server_type = :rack, selenium_server_type = :remote)
|
24
|
+
@app_server = configurator :app_server, app_server_type
|
25
|
+
@selenium_server = configurator :selenium_server, selenium_server_type
|
26
|
+
yield self
|
27
|
+
app_server.apply
|
28
|
+
selenium_server.apply
|
32
29
|
end
|
33
30
|
|
34
31
|
private
|
35
32
|
|
36
|
-
# @param [Hash] opts The options for app server
|
37
|
-
# @option opts [Symbol] :app_server The app server type
|
38
|
-
# @return [String] The application server type
|
39
|
-
def app_server_type(opts)
|
40
|
-
opts[:app_server] || :rack
|
41
|
-
end
|
42
|
-
|
43
|
-
# @param [Hash] opts The options for selenium server
|
44
|
-
# @option opts [Symbol] :selenium_server The selenium server type
|
45
|
-
# @return [String] The selenium server type
|
46
|
-
def selenium_server_type(opts)
|
47
|
-
opts[:selenium_server] || :remote
|
48
|
-
end
|
49
|
-
|
50
33
|
def configurator(server_type, configurator_type, &block)
|
51
34
|
server_module = server_type.to_s.classify
|
52
35
|
configurator_klass = configurator_type.to_s.classify
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module CapybaraSelenium
|
2
2
|
module SeleniumServer
|
3
3
|
class BaseConfigurator < Server::Configurator
|
4
|
-
private
|
5
|
-
|
6
|
-
def caps(key)
|
7
|
-
capabilities[key]
|
8
|
-
end
|
9
4
|
end
|
10
5
|
|
11
6
|
class RemoteConfigurator < BaseConfigurator
|
@@ -22,14 +17,17 @@ module CapybaraSelenium
|
|
22
17
|
end
|
23
18
|
|
24
19
|
def driver_name
|
25
|
-
|
20
|
+
browser_name = capabilities[:browser_name]
|
21
|
+
version = capabilities[:version]
|
22
|
+
platform = capabilities[:platform]
|
23
|
+
"#{browser_name}_#{version}_#{platform}"
|
26
24
|
end
|
27
25
|
|
28
26
|
# @return [Hash] The desired capabilities for the browser
|
29
27
|
def desired_capabilities
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
caps = Selenium::WebDriver::Remote::Capabilities.new
|
29
|
+
capabilities.keys.each { |key| caps[key] = capabilities[key] }
|
30
|
+
caps
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|