kookaburra 0.10.0 → 0.11.0
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/.yardopts +1 -0
- data/VERSION +1 -1
- data/kookaburra.gemspec +2 -1
- data/lib/kookaburra/ui_driver/ui_component.rb +30 -15
- data/test/kookaburra/ui_driver/ui_component_test.rb +29 -0
- metadata +4 -3
data/.yardopts
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.11.0
|
data/kookaburra.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "kookaburra"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.11.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Renewable Funding, LLC"]
|
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
"test/helper.rb",
|
42
42
|
"test/kookaburra/assertion_test.rb",
|
43
43
|
"test/kookaburra/test_data_test.rb",
|
44
|
+
"test/kookaburra/ui_driver/ui_component_test.rb",
|
44
45
|
"test/kookaburra/ui_driver_test.rb",
|
45
46
|
"test/kookaburra_test.rb"
|
46
47
|
]
|
@@ -46,8 +46,8 @@ module Kookaburra
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Default implementation navigates directly to this UIComponent's
|
49
|
-
#
|
50
|
-
# will be made with the resulting querystring on the URL.
|
49
|
+
# `#component_path`. If `opts[:query_params]` is set to a Hash, the
|
50
|
+
# request will be made with the resulting querystring on the URL.
|
51
51
|
def show(opts = {})
|
52
52
|
unless respond_to?(:component_path)
|
53
53
|
raise "You must either set component_path or redefine the #show method in UIComponent subclasses!"
|
@@ -80,27 +80,42 @@ module Kookaburra
|
|
80
80
|
[]
|
81
81
|
end
|
82
82
|
|
83
|
-
|
83
|
+
protected
|
84
|
+
|
85
|
+
# Methods provided by `browser` that will be scoped to this UIComponent.
|
86
|
+
#
|
87
|
+
# These methods are defined on UIComponent and will be delegated to
|
88
|
+
# `browser` after being wrapped with `#in_component` calls.
|
89
|
+
SCOPED_BROWSER_METHODS = :all, :attach_file, :check, :choose, :click_button,
|
90
|
+
:click_link, :click_link_or_button, :click_on, :field_labeled, :fill_in,
|
91
|
+
:find, :find_button, :find_by_id, :find_field, :find_link, :first,
|
92
|
+
:has_button?, :has_checked_field?, :has_content?, :has_css?, :has_field?,
|
93
|
+
:has_link?, :has_no_button?, :has_no_checked_field?, :has_no_content?,
|
94
|
+
:has_no_css?, :has_no_field?, :has_no_link?, :has_no_select?,
|
95
|
+
:has_no_selector?, :has_no_table?, :has_no_text?,
|
96
|
+
:has_no_unchecked_field?, :has_no_xpath?, :has_select?, :has_selector?,
|
97
|
+
:has_table?, :has_text?, :has_unchecked_field?, :has_xpath?, :select,
|
98
|
+
:text, :uncheck, :unselect
|
99
|
+
|
100
|
+
SCOPED_BROWSER_METHODS.each do |method|
|
101
|
+
define_method(method) do |args|
|
102
|
+
in_component { browser.send(method, *args) }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
84
106
|
def id_from_path
|
85
107
|
browser.current_path =~ path_id_regex
|
86
108
|
$1.present? ? $1.to_i : nil
|
87
109
|
end
|
88
110
|
|
89
|
-
def fill_in(locator, options)
|
90
|
-
in_component { browser.fill_in(locator, options) }
|
91
|
-
end
|
92
|
-
|
93
|
-
def click_on(locator)
|
94
|
-
in_component { browser.find(locator).click }
|
95
|
-
end
|
96
|
-
|
97
|
-
def choose(locator)
|
98
|
-
in_component { browser.choose(locator) }
|
99
|
-
end
|
100
|
-
|
101
111
|
def in_component(&blk)
|
102
112
|
browser.within(component_locator, &blk)
|
103
113
|
end
|
114
|
+
|
115
|
+
# Returns the number of elements found by `#all` for the specified criteria
|
116
|
+
def count(*args)
|
117
|
+
all(*args).size
|
118
|
+
end
|
104
119
|
end
|
105
120
|
end
|
106
121
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'minitest/mock'
|
3
|
+
|
4
|
+
describe Kookaburra::UIDriver::UIComponent do
|
5
|
+
let(:component_class) do
|
6
|
+
Class.new(Kookaburra::UIDriver::UIComponent) do
|
7
|
+
component_locator '#my_component'
|
8
|
+
public :count
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#count' do
|
13
|
+
it 'returns the number of elements found within the component' do
|
14
|
+
browser = Object.new.tap do |b|
|
15
|
+
def b.within(*args)
|
16
|
+
@context_set = true
|
17
|
+
yield self
|
18
|
+
end
|
19
|
+
|
20
|
+
def b.all(*args)
|
21
|
+
return unless @context_set
|
22
|
+
Array.new(3)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
component = component_class.new(:browser => browser)
|
26
|
+
assert_equal 3, component.count('.element')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kookaburra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 11
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.11.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Renewable Funding, LLC
|
@@ -193,6 +193,7 @@ files:
|
|
193
193
|
- test/helper.rb
|
194
194
|
- test/kookaburra/assertion_test.rb
|
195
195
|
- test/kookaburra/test_data_test.rb
|
196
|
+
- test/kookaburra/ui_driver/ui_component_test.rb
|
196
197
|
- test/kookaburra/ui_driver_test.rb
|
197
198
|
- test/kookaburra_test.rb
|
198
199
|
homepage: http://github.com/projectdx/kookaburra
|