cucumber_steps 0.0.3 → 0.0.4
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/VERSION +1 -1
- data/lib/cucumber_steps/browser/{instance/defaults.rb → defaults.rb} +2 -2
- data/lib/cucumber_steps/browser/{instance/scope_handler.rb → scope_handler.rb} +1 -1
- data/lib/cucumber_steps/browser.rb +11 -41
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/click_steps.rb +0 -0
- data/lib/cucumber_steps/{browser/browser_steps.rb → declarations/browser_steps/configure_steps.rb} +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/expect_steps.rb +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/hover_steps.rb +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/locating_scope_steps.rb +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/sketch_steps.rb +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/typing_steps.rb +0 -0
- data/lib/cucumber_steps/{browser → declarations/browser_steps}/visit_steps.rb +0 -0
- data/lib/cucumber_steps/declarations/browser_steps.rb +10 -0
- data/lib/cucumber_steps/{debug.rb → declarations/debug_steps.rb} +0 -0
- data/lib/cucumber_steps/declarations.rb +4 -0
- data/lib/cucumber_steps/env_fetcher.rb +15 -13
- data/lib/cucumber_steps/world_extensions/browser_methods.rb +35 -0
- data/lib/cucumber_steps/world_extensions.rb +3 -0
- data/lib/cucumber_steps.rb +4 -6
- metadata +17 -14
- data/lib/cucumber_steps/browser/instance.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10cb4c2203d3df16dd2a65008dc5693125cc9f4d
|
4
|
+
data.tar.gz: e413e8198aee140cf3a40a2ce0bd67698eb06d16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c015ae1dd4c2154aed89cca87fee41800908f0186fc5d7f9b8250a6adfb870c6df0720b30528db1c1d79af8cb5ceaf34e23bd4d38826d222ce6eacb06925956
|
7
|
+
data.tar.gz: 5b006f1961491378dfb06bdbffbb9eda3b4596410db0d68bffd4a2260e1bc3206e547774ac10db9e3e60315b387d725a3df1f98d2a970f351382108a44c17662
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module CucumberSteps::Browser::
|
1
|
+
module CucumberSteps::Browser::Defaults
|
2
2
|
|
3
3
|
BROWSER_ARGUMENTS = {
|
4
4
|
'phantomjs' => {
|
@@ -22,7 +22,7 @@ module CucumberSteps::Browser::Instance::Defaults
|
|
22
22
|
|
23
23
|
options = args.find { |e| e.is_a?(Hash) }
|
24
24
|
|
25
|
-
pare_defined_options = ::CucumberSteps::Browser::
|
25
|
+
pare_defined_options = ::CucumberSteps::Browser::Defaults::BROWSER_ARGUMENTS[browser_name.to_s] || {}
|
26
26
|
options.merge!(pare_defined_options) if pare_defined_options.is_a?(Hash)
|
27
27
|
|
28
28
|
return args
|
@@ -1,47 +1,17 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'cucumber_steps/browser/expect_steps'
|
4
|
-
require 'cucumber_steps/browser/hover_steps'
|
5
|
-
require 'cucumber_steps/browser/sketch_steps'
|
6
|
-
require 'cucumber_steps/browser/typing_steps'
|
7
|
-
require 'cucumber_steps/browser/visit_steps'
|
1
|
+
require 'watir'
|
2
|
+
class CucumberSteps::Browser < Watir::Browser
|
8
3
|
|
9
|
-
|
4
|
+
require 'cucumber_steps/browser/defaults'
|
5
|
+
extend CucumberSteps::Browser::Defaults
|
10
6
|
|
11
|
-
require 'cucumber_steps/browser/
|
7
|
+
require 'cucumber_steps/browser/scope_handler'
|
8
|
+
include CucumberSteps::Browser::ScopeHandler
|
12
9
|
|
13
|
-
|
14
|
-
@browser || reopen_browser!
|
15
|
-
end
|
16
|
-
|
17
|
-
def reopen_browser!
|
18
|
-
|
19
|
-
if @browser.is_a?(::CucumberSteps::Browser::Instance)
|
20
|
-
@browser.close
|
21
|
-
end
|
22
|
-
|
23
|
-
browser = ::CucumberSteps::Browser::Instance.new(browser_name)
|
24
|
-
@browser = browser
|
10
|
+
protected
|
25
11
|
|
12
|
+
def initialize(browser_name, *args)
|
13
|
+
super(browser_name, *self.class.args_with_default_options(browser_name, *args))
|
14
|
+
Kernel.at_exit { self.close rescue nil } if CucumberSteps::ENVFetcher.close_browser_at_exit?
|
26
15
|
end
|
27
16
|
|
28
|
-
|
29
|
-
@browser_name = new_browser_name.to_s.strip
|
30
|
-
end
|
31
|
-
|
32
|
-
def browser_name
|
33
|
-
CucumberSteps::ENVFetcher.browser_name || @browser_name || 'phantomjs'
|
34
|
-
end
|
35
|
-
|
36
|
-
def parse_html_attributes(raw_attributes)
|
37
|
-
raw_attributes.scan(/(\w+)="([^"]+)"/).reduce({}) do |all_matcher, (attr_name, value)|
|
38
|
-
all_matcher[attr_name.downcase.to_sym]=value
|
39
|
-
all_matcher
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
World(CucumberSteps::Browser)
|
46
|
-
|
47
|
-
|
17
|
+
end
|
File without changes
|
data/lib/cucumber_steps/{browser/browser_steps.rb → declarations/browser_steps/configure_steps.rb}
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'cucumber_steps/declarations/browser_steps/configure_steps'
|
2
|
+
require 'cucumber_steps/declarations/browser_steps/click_steps'
|
3
|
+
require 'cucumber_steps/declarations/browser_steps/expect_steps'
|
4
|
+
require 'cucumber_steps/declarations/browser_steps/hover_steps'
|
5
|
+
require 'cucumber_steps/declarations/browser_steps/sketch_steps'
|
6
|
+
require 'cucumber_steps/declarations/browser_steps/typing_steps'
|
7
|
+
require 'cucumber_steps/declarations/browser_steps/visit_steps'
|
8
|
+
|
9
|
+
require 'cucumber_steps/world_extensions/browser_methods'
|
10
|
+
World(CucumberSteps::WorldExtensions::BrowserMethods)
|
File without changes
|
@@ -1,39 +1,41 @@
|
|
1
1
|
module CucumberSteps::ENVFetcher
|
2
2
|
extend self
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
TRANSLATE_TABLE = {
|
5
|
+
'yes' => true,
|
6
|
+
'true' => true,
|
7
|
+
'no' => false,
|
8
|
+
'false' => false
|
9
|
+
}
|
6
10
|
|
7
11
|
def development?
|
8
|
-
|
12
|
+
lookup_for true, 'DEVELOPER_ENV'
|
9
13
|
end
|
10
14
|
|
11
15
|
def close_browser_at_exit?
|
12
|
-
|
13
|
-
not lookup_for_false_case('BROWSER_NOT_EXIT_AFTER_TEST', 'BROWSER_NOT_EXIT_AT_EXIT')
|
16
|
+
not lookup_for(false, 'CLOSE_BROWSER_AT_EXIT', 'BROWSER_CLOSE_AT_EXIT', 'CLOSE_BROWSER')
|
14
17
|
end
|
15
18
|
|
16
19
|
def browser_name
|
17
|
-
lookup_value_by('BROWSER','BROWSER_NAME')
|
20
|
+
lookup_value_by('BROWSER', 'BROWSER_NAME')
|
18
21
|
end
|
19
22
|
|
20
23
|
protected
|
21
24
|
|
22
|
-
def
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def lookup_for_false_case(*env_keys)
|
27
|
-
filtered_env(env_keys).any? { |k, v| CLI_ALIASES_FOR_FALSE.include?(v.to_s.downcase) }
|
25
|
+
def lookup_for(boolean, *env_keys)
|
26
|
+
formatted_env(env_keys).any? { |k, v| v == boolean }
|
28
27
|
end
|
29
28
|
|
30
29
|
def lookup_value_by(*env_keys)
|
31
30
|
filtered_env(env_keys).values.first
|
32
31
|
end
|
33
32
|
|
33
|
+
def formatted_env(filtered_env)
|
34
|
+
filtered_env.reduce({}) { |m, (k, v)| m.merge!({k => TRANSLATE_TABLE[v]}); m }
|
35
|
+
end
|
36
|
+
|
34
37
|
def filtered_env(env_keys)
|
35
38
|
lookup_env_keys = env_keys.map(&:to_s).map(&:upcase)
|
36
|
-
|
37
39
|
ENV.select { |env_key, value| lookup_env_keys.include?(env_key) }
|
38
40
|
end
|
39
41
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module CucumberSteps::WorldExtensions::BrowserMethods
|
2
|
+
|
3
|
+
require 'cucumber_steps/browser'
|
4
|
+
|
5
|
+
def browser
|
6
|
+
@browser || reopen_browser!
|
7
|
+
end
|
8
|
+
|
9
|
+
def reopen_browser!
|
10
|
+
|
11
|
+
if @browser.is_a?(::CucumberSteps::Browser)
|
12
|
+
@browser.close
|
13
|
+
end
|
14
|
+
|
15
|
+
browser = ::CucumberSteps::Browser.new(browser_name)
|
16
|
+
@browser = browser
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
def browser_name=(new_browser_name)
|
21
|
+
@browser_name = new_browser_name.to_s.strip
|
22
|
+
end
|
23
|
+
|
24
|
+
def browser_name
|
25
|
+
CucumberSteps::ENVFetcher.browser_name || @browser_name || 'phantomjs'
|
26
|
+
end
|
27
|
+
|
28
|
+
def parse_html_attributes(raw_attributes)
|
29
|
+
raw_attributes.scan(/(\w+)="([^"]+)"/).reduce({}) do |all_matcher, (attr_name, value)|
|
30
|
+
all_matcher[attr_name.downcase.to_sym]=value
|
31
|
+
all_matcher
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/cucumber_steps.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
module CucumberSteps
|
2
2
|
|
3
|
-
require 'cucumber_steps/env_fetcher'
|
4
|
-
|
5
|
-
require 'cucumber_steps/debug' if CucumberSteps::ENVFetcher.development?
|
6
|
-
|
7
3
|
require 'cucumber'
|
8
|
-
require 'cucumber/rb_support/rb_dsl'
|
4
|
+
# require 'cucumber/rb_support/rb_dsl'
|
9
5
|
|
10
6
|
require 'cucumber_steps/browser'
|
7
|
+
require 'cucumber_steps/env_fetcher'
|
8
|
+
require 'cucumber_steps/world_extensions'
|
11
9
|
|
12
|
-
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber_steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -111,19 +111,22 @@ files:
|
|
111
111
|
- cucumber_steps.gemspec
|
112
112
|
- lib/cucumber_steps.rb
|
113
113
|
- lib/cucumber_steps/browser.rb
|
114
|
-
- lib/cucumber_steps/browser/
|
115
|
-
- lib/cucumber_steps/browser/
|
116
|
-
- lib/cucumber_steps/
|
117
|
-
- lib/cucumber_steps/
|
118
|
-
- lib/cucumber_steps/
|
119
|
-
- lib/cucumber_steps/
|
120
|
-
- lib/cucumber_steps/
|
121
|
-
- lib/cucumber_steps/
|
122
|
-
- lib/cucumber_steps/
|
123
|
-
- lib/cucumber_steps/
|
124
|
-
- lib/cucumber_steps/
|
125
|
-
- lib/cucumber_steps/
|
114
|
+
- lib/cucumber_steps/browser/defaults.rb
|
115
|
+
- lib/cucumber_steps/browser/scope_handler.rb
|
116
|
+
- lib/cucumber_steps/declarations.rb
|
117
|
+
- lib/cucumber_steps/declarations/browser_steps.rb
|
118
|
+
- lib/cucumber_steps/declarations/browser_steps/click_steps.rb
|
119
|
+
- lib/cucumber_steps/declarations/browser_steps/configure_steps.rb
|
120
|
+
- lib/cucumber_steps/declarations/browser_steps/expect_steps.rb
|
121
|
+
- lib/cucumber_steps/declarations/browser_steps/hover_steps.rb
|
122
|
+
- lib/cucumber_steps/declarations/browser_steps/locating_scope_steps.rb
|
123
|
+
- lib/cucumber_steps/declarations/browser_steps/sketch_steps.rb
|
124
|
+
- lib/cucumber_steps/declarations/browser_steps/typing_steps.rb
|
125
|
+
- lib/cucumber_steps/declarations/browser_steps/visit_steps.rb
|
126
|
+
- lib/cucumber_steps/declarations/debug_steps.rb
|
126
127
|
- lib/cucumber_steps/env_fetcher.rb
|
128
|
+
- lib/cucumber_steps/world_extensions.rb
|
129
|
+
- lib/cucumber_steps/world_extensions/browser_methods.rb
|
127
130
|
homepage: ''
|
128
131
|
licenses:
|
129
132
|
- MIT
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'watir'
|
2
|
-
class CucumberSteps::Browser::Instance < Watir::Browser
|
3
|
-
|
4
|
-
require 'cucumber_steps/browser/instance/defaults'
|
5
|
-
extend CucumberSteps::Browser::Instance::Defaults
|
6
|
-
|
7
|
-
require 'cucumber_steps/browser/instance/scope_handler'
|
8
|
-
include CucumberSteps::Browser::Instance::ScopeHandler
|
9
|
-
|
10
|
-
protected
|
11
|
-
|
12
|
-
def initialize(browser_name, *args)
|
13
|
-
super(browser_name, *self.class.args_with_default_options(browser_name, *args))
|
14
|
-
Kernel.at_exit { self.close rescue nil } if CucumberSteps::ENVFetcher.close_browser_at_exit?
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|