frameworks-capybara 0.0.20 → 0.0.22

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.20
1
+ 0.0.22
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{frameworks-capybara}
8
- s.version = "0.0.20"
8
+ s.version = "0.0.22"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["mcrmfc"]
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/frameworks/cucumber.rb",
31
31
  "lib/monkey-patches/capybara-patches.rb",
32
32
  "lib/monkey-patches/cucumber-patches.rb",
33
+ "lib/monkey-patches/send-keys.rb",
33
34
  "lib/monkey-patches/webdriver-patches.rb",
34
35
  "test/helper.rb",
35
36
  "test/test_frameworks-capybara.rb"
@@ -1,5 +1,6 @@
1
1
  require 'monkey-patches/webdriver-patches'
2
2
  require 'monkey-patches/capybara-patches'
3
+ require 'monkey-patches/send-keys'
3
4
  require 'selenium-webdriver'
4
5
 
5
6
  class CapybaraSetup
@@ -0,0 +1,69 @@
1
+ module SendKeys
2
+ def allowed_keys
3
+ @allowed_keys ||= %w(
4
+ option
5
+ null
6
+ cancel
7
+ help
8
+ backspace
9
+ tab
10
+ clear
11
+ return
12
+ enter
13
+ shift
14
+ left_shift
15
+ control
16
+ left_control
17
+ alt
18
+ left_alt
19
+ pause
20
+ escape
21
+ space
22
+ page_up
23
+ page_down
24
+ end
25
+ home
26
+ left
27
+ arrow_left
28
+ arrow_up
29
+ right
30
+ arrow_rightdown
31
+ arrow_down
32
+ insert
33
+ delete
34
+ semicolon
35
+ equals
36
+ numpad0 numpad1 numpad2 numpad3 numpad4 numpad5 numpad6 numpad7 numpad8 numpad9
37
+ multiplyadd
38
+ separator
39
+ subtract
40
+ decimal
41
+ divide
42
+ f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
43
+ )
44
+ end
45
+
46
+ def send_string_of_keys(key)
47
+ send_key = []
48
+
49
+ if matches = key.match(%r{^\[(.*)\]$})
50
+ key = matches[1].split(',').map(&:strip)
51
+ else
52
+ key = [key]
53
+ end
54
+
55
+ key.each do |k|
56
+ if matches = k.match(%r{^['"](.*)['"]$})
57
+ send_key << matches[1]
58
+ elsif allowed_keys.include?(k)
59
+ send_key << k.to_sym
60
+ else
61
+ send_key << k.to_s
62
+ end
63
+ end
64
+
65
+ native.send_keys(send_key)
66
+ end
67
+ end
68
+ #adds methods in this module to the Capybara Element class
69
+ Capybara::Node::Element.send :include, SendKeys
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameworks-capybara
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 51
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 20
10
- version: 0.0.20
9
+ - 22
10
+ version: 0.0.22
11
11
  platform: ruby
12
12
  authors:
13
13
  - mcrmfc
@@ -115,6 +115,7 @@ files:
115
115
  - lib/frameworks/cucumber.rb
116
116
  - lib/monkey-patches/capybara-patches.rb
117
117
  - lib/monkey-patches/cucumber-patches.rb
118
+ - lib/monkey-patches/send-keys.rb
118
119
  - lib/monkey-patches/webdriver-patches.rb
119
120
  - test/helper.rb
120
121
  - test/test_frameworks-capybara.rb