symbiont 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +22 -22
- data/.travis.yml +25 -14
- data/Gemfile +4 -2
- data/{LICENSE → LICENSE.txt} +22 -22
- data/README.md +57 -65
- data/Rakefile +28 -34
- data/lib/symbiont/accessor.rb +7 -0
- data/lib/symbiont/assertions.rb +33 -0
- data/lib/symbiont/elements.rb +69 -0
- data/lib/symbiont/errors.rb +7 -0
- data/lib/symbiont/factory.rb +75 -46
- data/lib/symbiont/helpers.rb +49 -0
- data/lib/symbiont/logging.rb +5 -0
- data/lib/symbiont/pages.rb +32 -0
- data/lib/symbiont/platform.rb +12 -0
- data/lib/symbiont/version.rb +3 -3
- data/lib/symbiont.rb +34 -92
- data/spec/fixtures/element_definitions.rb +32 -0
- data/spec/fixtures/mock_drivers.rb +8 -0
- data/spec/fixtures/page_definitions.rb +36 -0
- data/spec/spec_helper.rb +31 -80
- data/spec/symbiont/assertion_spec.rb +88 -0
- data/spec/symbiont/driver_spec.rb +41 -0
- data/spec/symbiont/element_spec.rb +8 -0
- data/spec/symbiont/factory_spec.rb +70 -130
- data/spec/symbiont/page_spec.rb +50 -0
- data/symbiont.gemspec +52 -27
- data/test/symbiont-script.rb +97 -0
- metadata +89 -230
- data/Gemfile.lock +0 -44
- data/HISTORY.md +0 -99
- data/app/app.rb +0 -48
- data/app/public/css/cupertino/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_flat_15_cd0a0a_40x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_100_e4f1fb_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_50_3baae3_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_glass_80_d7ebf9_1x400.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_100_f2f5f7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-hard_70_000000_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_100_deedf7_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-bg_highlight-soft_25_ffef8f_1x100.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2694e8_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_3d80b3_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_72a7cf_256x240.png +0 -0
- data/app/public/css/cupertino/images/ui-icons_ffffff_256x240.png +0 -0
- data/app/public/css/cupertino/jquery-ui-1.8.16.custom.css +0 -290
- data/app/public/css/demo_table_jui.css +0 -471
- data/app/public/css/font/ColabLig-webfont.eot +0 -0
- data/app/public/css/font/ColabLig-webfont.svg +0 -149
- data/app/public/css/font/ColabLig-webfont.ttf +0 -0
- data/app/public/css/font/ColabLig-webfont.woff +0 -0
- data/app/public/css/font/ColabMed-webfont.eot +0 -0
- data/app/public/css/font/ColabMed-webfont.svg +0 -149
- data/app/public/css/font/ColabMed-webfont.ttf +0 -0
- data/app/public/css/font/ColabMed-webfont.woff +0 -0
- data/app/public/css/font/ColabReg-webfont.eot +0 -0
- data/app/public/css/font/ColabReg-webfont.svg +0 -149
- data/app/public/css/font/ColabReg-webfont.ttf +0 -0
- data/app/public/css/font/ColabReg-webfont.woff +0 -0
- data/app/public/css/font/ColabThi-webfont.eot +0 -0
- data/app/public/css/font/ColabThi-webfont.svg +0 -149
- data/app/public/css/font/ColabThi-webfont.ttf +0 -0
- data/app/public/css/font/ColabThi-webfont.woff +0 -0
- data/app/public/css/normalize.css +0 -376
- data/app/public/css/site.css +0 -446
- data/app/public/fancybox/blank.gif +0 -0
- data/app/public/fancybox/fancy_close.png +0 -0
- data/app/public/fancybox/fancy_loading.png +0 -0
- data/app/public/fancybox/fancy_nav_left.png +0 -0
- data/app/public/fancybox/fancy_nav_right.png +0 -0
- data/app/public/fancybox/fancy_shadow_e.png +0 -0
- data/app/public/fancybox/fancy_shadow_n.png +0 -0
- data/app/public/fancybox/fancy_shadow_ne.png +0 -0
- data/app/public/fancybox/fancy_shadow_nw.png +0 -0
- data/app/public/fancybox/fancy_shadow_s.png +0 -0
- data/app/public/fancybox/fancy_shadow_se.png +0 -0
- data/app/public/fancybox/fancy_shadow_sw.png +0 -0
- data/app/public/fancybox/fancy_shadow_w.png +0 -0
- data/app/public/fancybox/fancy_title_left.png +0 -0
- data/app/public/fancybox/fancy_title_main.png +0 -0
- data/app/public/fancybox/fancy_title_over.png +0 -0
- data/app/public/fancybox/fancy_title_right.png +0 -0
- data/app/public/fancybox/fancybox-x.png +0 -0
- data/app/public/fancybox/fancybox-y.png +0 -0
- data/app/public/fancybox/fancybox.png +0 -0
- data/app/public/fancybox/jquery.fancybox-1.3.4.css +0 -359
- data/app/public/fancybox/jquery.fancybox-1.3.4.js +0 -1156
- data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +0 -1
- data/app/public/img/Sorting icons.psd +0 -0
- data/app/public/img/back_disabled.png +0 -0
- data/app/public/img/back_enabled.png +0 -0
- data/app/public/img/back_enabled_hover.png +0 -0
- data/app/public/img/close.png +0 -0
- data/app/public/img/favicon.ico +0 -0
- data/app/public/img/forward_disabled.png +0 -0
- data/app/public/img/forward_enabled.png +0 -0
- data/app/public/img/forward_enabled_hover.png +0 -0
- data/app/public/img/lucid-bg.png +0 -0
- data/app/public/img/lucid-ft.png +0 -0
- data/app/public/img/open.png +0 -0
- data/app/public/img/sort_asc.png +0 -0
- data/app/public/img/sort_asc_disabled.png +0 -0
- data/app/public/img/sort_both.png +0 -0
- data/app/public/img/sort_desc.png +0 -0
- data/app/public/img/sort_desc_disabled.png +0 -0
- data/app/public/js/comics.js +0 -11
- data/app/public/js/signup.js +0 -141
- data/app/public/js/site.js +0 -42
- data/app/public/js/stardate.js +0 -35
- data/app/public/js/vendor/html5shiv.js +0 -5
- data/app/public/js/vendor/jquery-1.8.3.min.js +0 -2
- data/app/public/js/vendor/jquery.dataTables.min.js +0 -151
- data/app/public/js/vendor/jquery.validate.min.js +0 -4
- data/app/views/comics.erb +0 -344
- data/app/views/index.erb +0 -7
- data/app/views/layout.erb +0 -72
- data/app/views/layout_small.erb +0 -21
- data/app/views/stardate.erb +0 -5
- data/app/views/stardate_calc.erb +0 -30
- data/app/views/webobject.erb +0 -147
- data/lib/symbiont/data_setter.rb +0 -53
- data/lib/symbiont/enclosers.rb +0 -118
- data/lib/symbiont/evaluators.rb +0 -92
- data/lib/symbiont/generators.rb +0 -331
- data/lib/symbiont/locators.rb +0 -43
- data/lib/symbiont/logger.rb +0 -5
- data/lib/symbiont/platform_watir/platform_object.rb +0 -466
- data/lib/symbiont/platform_watir.rb +0 -9
- data/lib/symbiont/platforms.rb +0 -23
- data/lib/symbiont/web_objects/_common.rb +0 -174
- data/lib/symbiont/web_objects/button.rb +0 -22
- data/lib/symbiont/web_objects/checkbox.rb +0 -31
- data/lib/symbiont/web_objects/div.rb +0 -15
- data/lib/symbiont/web_objects/heading.rb +0 -12
- data/lib/symbiont/web_objects/hidden_field.rb +0 -19
- data/lib/symbiont/web_objects/label.rb +0 -15
- data/lib/symbiont/web_objects/link.rb +0 -23
- data/lib/symbiont/web_objects/list_item.rb +0 -13
- data/lib/symbiont/web_objects/option.rb +0 -10
- data/lib/symbiont/web_objects/ordered_list.rb +0 -49
- data/lib/symbiont/web_objects/paragraph.rb +0 -11
- data/lib/symbiont/web_objects/radio.rb +0 -31
- data/lib/symbiont/web_objects/select_list.rb +0 -82
- data/lib/symbiont/web_objects/span.rb +0 -15
- data/lib/symbiont/web_objects/table.rb +0 -71
- data/lib/symbiont/web_objects/table_cell.rb +0 -24
- data/lib/symbiont/web_objects/table_row.rb +0 -59
- data/lib/symbiont/web_objects/text_area.rb +0 -26
- data/lib/symbiont/web_objects/text_field.rb +0 -31
- data/lib/symbiont/web_objects/unordered_list.rb +0 -49
- data/lib/symbiont/web_objects.rb +0 -22
- data/lucid.yml +0 -6
- data/spec/symbiont/data_setter_spec.rb +0 -65
- data/spec/symbiont/enclosers_spec.rb +0 -76
- data/spec/symbiont/evaluators_spec.rb +0 -95
- data/spec/symbiont/generators/button_generators_spec.rb +0 -72
- data/spec/symbiont/generators/checkbox_generators_spec.rb +0 -79
- data/spec/symbiont/generators/div_generators_spec.rb +0 -56
- data/spec/symbiont/generators/hidden_field_generators_spec.rb +0 -65
- data/spec/symbiont/generators/link_generators_spec.rb +0 -62
- data/spec/symbiont/generators/paragraph_generators_spec.rb +0 -57
- data/spec/symbiont/generators/radio_generators_spec.rb +0 -76
- data/spec/symbiont/generators/select_list_generators_spec.rb +0 -93
- data/spec/symbiont/generators/span_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_cell_generators_spec.rb +0 -56
- data/spec/symbiont/generators/table_generators_spec.rb +0 -56
- data/spec/symbiont/generators/text_area_generators_spec.rb +0 -72
- data/spec/symbiont/generators/text_field_generators_spec.rb +0 -72
- data/spec/symbiont/generators_spec.rb +0 -59
- data/spec/symbiont/locators_spec.rb +0 -68
- data/spec/symbiont/platform_object_spec.rb +0 -18
- data/spec/symbiont/symbiont_spec.rb +0 -29
- data/spec/symbiont/web_object_spec.rb +0 -194
- data/spec/symbiont/web_objects/button_spec.rb +0 -38
- data/spec/symbiont/web_objects/checkbox_spec.rb +0 -27
- data/spec/symbiont/web_objects/div_spec.rb +0 -18
- data/spec/symbiont/web_objects/heading_spec.rb +0 -22
- data/spec/symbiont/web_objects/hidden_field_spec.rb +0 -18
- data/spec/symbiont/web_objects/label_spec.rb +0 -18
- data/spec/symbiont/web_objects/link_spec.rb +0 -33
- data/spec/symbiont/web_objects/list_item_spec.rb +0 -18
- data/spec/symbiont/web_objects/option_spec.rb +0 -9
- data/spec/symbiont/web_objects/ordered_list_spec.rb +0 -53
- data/spec/symbiont/web_objects/paragraph_spec.rb +0 -18
- data/spec/symbiont/web_objects/radio_spec.rb +0 -27
- data/spec/symbiont/web_objects/select_list_spec.rb +0 -69
- data/spec/symbiont/web_objects/span_spec.rb +0 -18
- data/spec/symbiont/web_objects/table_cell_spec.rb +0 -19
- data/spec/symbiont/web_objects/table_row_spec.rb +0 -58
- data/spec/symbiont/web_objects/table_spec.rb +0 -61
- data/spec/symbiont/web_objects/text_area_spec.rb +0 -18
- data/spec/symbiont/web_objects/text_field_spec.rb +0 -39
- data/spec/symbiont/web_objects/unordered_list_spec.rb +0 -51
- data/specs/common/support/browser.rb +0 -25
- data/specs/common/support/env.rb +0 -6
- data/specs/common/support/events.rb +0 -15
- data/specs/enclosers.feature +0 -9
- data/specs/evaluators.feature +0 -26
- data/specs/pages/characters.rb +0 -22
- data/specs/pages/home.rb +0 -9
- data/specs/pages/stardate.rb +0 -23
- data/specs/pages/web_objects.rb +0 -77
- data/specs/select_list.feature +0 -53
- data/specs/steps/enclosers_steps.rb +0 -17
- data/specs/steps/evaluators_steps.rb +0 -44
- data/specs/steps/navigation_steps.rb +0 -14
- data/specs/steps/select_list_steps.rb +0 -94
- data/specs/steps/table_cell_steps.rb +0 -31
- data/specs/steps/table_steps.rb +0 -87
- data/specs/table.feature +0 -49
- data/specs/table_cell.feature +0 -27
@@ -1,31 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class CheckBox < WebObject
|
5
|
-
|
6
|
-
def initialize(web_object)
|
7
|
-
@web_object = web_object
|
8
|
-
end
|
9
|
-
|
10
|
-
def check
|
11
|
-
web_object.set
|
12
|
-
end
|
13
|
-
|
14
|
-
def uncheck
|
15
|
-
web_object.clear
|
16
|
-
end
|
17
|
-
|
18
|
-
def checked?
|
19
|
-
web_object.set?
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.usable_selectors
|
23
|
-
super + [:value, :label]
|
24
|
-
end
|
25
|
-
|
26
|
-
end # class: CheckBox
|
27
|
-
|
28
|
-
::Symbiont::WebObjects.class_for_type[:checkbox] = ::Symbiont::WebObjects::CheckBox
|
29
|
-
|
30
|
-
end # module: WebObjects
|
31
|
-
end # module: Symbiont
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Div < WebObject
|
5
|
-
|
6
|
-
def self.usable_selectors
|
7
|
-
super + [:text, :title]
|
8
|
-
end
|
9
|
-
|
10
|
-
end # class: Div
|
11
|
-
|
12
|
-
::Symbiont::WebObjects.class_for_tag[:div] = ::Symbiont::WebObjects::Div
|
13
|
-
|
14
|
-
end # module: WebObjects
|
15
|
-
end # module: Symbiont
|
@@ -1,12 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Heading < WebObject
|
5
|
-
|
6
|
-
end # class: Heading
|
7
|
-
|
8
|
-
::Symbiont::WebObjects.class_for_tag[:h1] = ::Symbiont::WebObjects::Heading
|
9
|
-
::Symbiont::WebObjects.class_for_tag[:h2] = ::Symbiont::WebObjects::Heading
|
10
|
-
|
11
|
-
end # module: WebObjects
|
12
|
-
end # module: Symbiont
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class HiddenField < WebObject
|
5
|
-
|
6
|
-
def initialize(web_object)
|
7
|
-
@web_object = web_object
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.usable_selectors
|
11
|
-
super + [:text, :value]
|
12
|
-
end
|
13
|
-
|
14
|
-
end # class: HiddenField
|
15
|
-
|
16
|
-
::Symbiont::WebObjects.class_for_tag[:hidden] = ::Symbiont::WebObjects::HiddenField
|
17
|
-
|
18
|
-
end # module: WebObjects
|
19
|
-
end # module: Symbiont
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Label < WebObject
|
5
|
-
|
6
|
-
def self.usable_selectors
|
7
|
-
super + [:text]
|
8
|
-
end
|
9
|
-
|
10
|
-
end # class: Label
|
11
|
-
|
12
|
-
::Symbiont::WebObjects.class_for_tag[:label] = ::Symbiont::WebObjects::Label
|
13
|
-
|
14
|
-
end # module: WebObjects
|
15
|
-
end # module: Symbiont
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Link < WebObject
|
5
|
-
|
6
|
-
def initialize(web_object)
|
7
|
-
@web_object = web_object
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.usable_selectors
|
11
|
-
super + [:href, :text, :title, :css]
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.selector_mapping
|
15
|
-
super.merge({:link => :text, :link_text => :text})
|
16
|
-
end
|
17
|
-
|
18
|
-
end # class: Link
|
19
|
-
|
20
|
-
::Symbiont::WebObjects.class_for_tag[:a] = ::Symbiont::WebObjects::Link
|
21
|
-
|
22
|
-
end # module: WebObjects
|
23
|
-
end # module: Symbiont
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class ListItem < WebObject
|
5
|
-
def self.usable_selectors
|
6
|
-
super + [:text]
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
::Symbiont::WebObjects.class_for_tag[:li] = ::Symbiont::WebObjects::ListItem
|
11
|
-
|
12
|
-
end # module: WebObjects
|
13
|
-
end # module: Symbiont
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class OrderedList < WebObject
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
def initialize(web_object)
|
8
|
-
@web_object = web_object
|
9
|
-
end
|
10
|
-
|
11
|
-
# @return [Symbiont::WebObjects::ListItem]
|
12
|
-
def [](index)
|
13
|
-
::Symbiont::WebObjects::ListItem.new(children[index])
|
14
|
-
end
|
15
|
-
|
16
|
-
# Return the number of list items contained in the ordered list.
|
17
|
-
def items
|
18
|
-
children.size
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [Symbiont::WebObjects::ListItem]
|
22
|
-
def each
|
23
|
-
for index in 1..self.items do
|
24
|
-
yield self[index - 1]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
def list_item_xpath
|
31
|
-
".//child::li"
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def children
|
37
|
-
list_items.find_all { |item| item.parent == web_object }
|
38
|
-
end
|
39
|
-
|
40
|
-
def list_items
|
41
|
-
web_object.ols(:xpath => list_item_xpath)
|
42
|
-
end
|
43
|
-
|
44
|
-
end # class: OrderedList
|
45
|
-
|
46
|
-
::Symbiont::WebObjects.class_for_tag[:ol] = ::Symbiont::WebObjects::OrderedList
|
47
|
-
|
48
|
-
end # module: WebObjects
|
49
|
-
end # module: Symbiont
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Radio < WebObject
|
5
|
-
|
6
|
-
def initialize(web_object)
|
7
|
-
@web_object = web_object
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.usable_selectors
|
11
|
-
super + [:value, :label]
|
12
|
-
end
|
13
|
-
|
14
|
-
def select
|
15
|
-
web_object.set
|
16
|
-
end
|
17
|
-
|
18
|
-
def clear
|
19
|
-
web_object.clear
|
20
|
-
end
|
21
|
-
|
22
|
-
def selected?
|
23
|
-
web_object.set?
|
24
|
-
end
|
25
|
-
|
26
|
-
end # class: Radio
|
27
|
-
|
28
|
-
::Symbiont::WebObjects.class_for_type[:radio] = ::Symbiont::WebObjects::Radio
|
29
|
-
|
30
|
-
end # module: WebObjects
|
31
|
-
end # module: Symbiont
|
@@ -1,82 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class SelectList < WebObject
|
5
|
-
def initialize(web_object)
|
6
|
-
@web_object = web_object
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.usable_selectors
|
10
|
-
super + [:value, :text, :label]
|
11
|
-
end
|
12
|
-
|
13
|
-
# This method is used to return an Option object based on the index provided.
|
14
|
-
# @return [Symbiont::WebObjects::Option]
|
15
|
-
def [](idx)
|
16
|
-
::Symbiont::WebObjects::Option.new(options[idx])
|
17
|
-
end
|
18
|
-
|
19
|
-
# Selects an option from the select list.
|
20
|
-
def select(value)
|
21
|
-
web_object.select(value)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Selects the option whose value attribute matches the provided string.
|
25
|
-
def select_value(value)
|
26
|
-
web_object.select_value(value)
|
27
|
-
end
|
28
|
-
|
29
|
-
# This method returns an array of Option objects that are contained within
|
30
|
-
# a select list object.
|
31
|
-
# @return [array of Symbiont::WebObjects::Option]
|
32
|
-
def options
|
33
|
-
web_objects = []
|
34
|
-
options = web_object.wd.find_elements(:xpath, option_xpath)
|
35
|
-
options.each do |opt|
|
36
|
-
web_objects << ::Symbiont::WebObjects::Option.new(opt)
|
37
|
-
end
|
38
|
-
web_objects
|
39
|
-
end
|
40
|
-
|
41
|
-
# This method returns an array of strings that contain the text of the
|
42
|
-
# currently selected options in a select list.
|
43
|
-
# @return [Array<String>]
|
44
|
-
def selected_options
|
45
|
-
web_object.selected_options.map { |e| e.text }.compact
|
46
|
-
end
|
47
|
-
|
48
|
-
# This method returns an array of strings that contain the values of the
|
49
|
-
# currently selected options in a select list.
|
50
|
-
# @return [Array<String>]
|
51
|
-
def selected_values
|
52
|
-
web_object.selected_options.map { |e| e.value }.compact
|
53
|
-
end
|
54
|
-
|
55
|
-
# This method returns true if any of the text or the label of any option
|
56
|
-
# that is selected matches the provided value.
|
57
|
-
# @param [String, Regexp] value A value to check for
|
58
|
-
# @return [Boolean]
|
59
|
-
def selected?(value)
|
60
|
-
web_object.selected? value
|
61
|
-
end
|
62
|
-
|
63
|
-
# This method checks to see if the select list has one or more options
|
64
|
-
# where the text or the label matches the provided value.
|
65
|
-
# @param [String, Regexp] value A value to check for.
|
66
|
-
# @return [Boolean]
|
67
|
-
def include?(value)
|
68
|
-
web_object.include? value
|
69
|
-
end
|
70
|
-
|
71
|
-
protected
|
72
|
-
|
73
|
-
def option_xpath
|
74
|
-
".//child::option"
|
75
|
-
end
|
76
|
-
|
77
|
-
end # class: SelectList
|
78
|
-
|
79
|
-
::Symbiont::WebObjects.class_for_tag[:select] = ::Symbiont::WebObjects::SelectList
|
80
|
-
|
81
|
-
end # module: WebObjects
|
82
|
-
end # module: Symbiont
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Span < WebObject
|
5
|
-
|
6
|
-
def self.usable_selectors
|
7
|
-
super + [:text, :title]
|
8
|
-
end
|
9
|
-
|
10
|
-
end # class: Span
|
11
|
-
|
12
|
-
::Symbiont::WebObjects.class_for_tag[:span] = ::Symbiont::WebObjects::Span
|
13
|
-
|
14
|
-
end # module: WebObjects
|
15
|
-
end # module: Symbiont
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class Table < WebObject
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
def initialize(web_object)
|
8
|
-
@web_object = web_object
|
9
|
-
end
|
10
|
-
|
11
|
-
# This method is used to return a TableRow object based on the index provided. When
|
12
|
-
# the index provided is a string, the text will be matched with the text from the first
|
13
|
-
# column.
|
14
|
-
# @return [Symbiont::WebObjects::TableRow]
|
15
|
-
def [](index)
|
16
|
-
index = find_by_title(index) if index.kind_of?(String)
|
17
|
-
return nil unless index
|
18
|
-
::Symbiont::WebObjects::TableRow.new(web_object[index])
|
19
|
-
end
|
20
|
-
|
21
|
-
# This method is an iterator that returns a TableRow object each time through
|
22
|
-
# the loop.
|
23
|
-
# @return [Symbiont::WebObjects::TableRow]
|
24
|
-
def each
|
25
|
-
for index in 1..self.rows do
|
26
|
-
yield self[index - 1]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# This method will return the number of rows in a table.
|
31
|
-
def rows
|
32
|
-
web_object.wd.find_elements(:xpath, row_xpath).size
|
33
|
-
end
|
34
|
-
|
35
|
-
# Returns a reference to the first row web object of a table.
|
36
|
-
# @return [Symbiont::WebObjects::TableRow]
|
37
|
-
def first_row
|
38
|
-
self[0]
|
39
|
-
end
|
40
|
-
|
41
|
-
# Returns a reference to the last row web object of a table.
|
42
|
-
# @return [Symbiont::WebObjects::TableRow]
|
43
|
-
def last_row
|
44
|
-
self[-1]
|
45
|
-
end
|
46
|
-
|
47
|
-
protected
|
48
|
-
|
49
|
-
def row_xpath
|
50
|
-
".//child::tr"
|
51
|
-
end
|
52
|
-
|
53
|
-
def initialize_row(element)
|
54
|
-
::Symbiont::WebObjects::TableRow.new(element)
|
55
|
-
end
|
56
|
-
|
57
|
-
private
|
58
|
-
|
59
|
-
def find_by_title(row_text)
|
60
|
-
#web_object.rows.find_index {|row| row[0].text == row_text}
|
61
|
-
web_object.rows.find_index do |row|
|
62
|
-
row.cells.any? { |col| col.text.include? row_text }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end # class: Table
|
67
|
-
|
68
|
-
::Symbiont::WebObjects.class_for_tag[:table] = ::Symbiont::WebObjects::Table
|
69
|
-
|
70
|
-
end # module: WebObjects
|
71
|
-
end # module: Symbiont
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class TableCell < WebObject
|
5
|
-
|
6
|
-
def initialize(web_object)
|
7
|
-
@web_object = web_object
|
8
|
-
end
|
9
|
-
|
10
|
-
def enabled?
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.usable_selectors
|
15
|
-
super + [:text]
|
16
|
-
end
|
17
|
-
|
18
|
-
end # class: TableCell
|
19
|
-
|
20
|
-
::Symbiont::WebObjects.class_for_tag[:td] = ::Symbiont::WebObjects::TableCell
|
21
|
-
::Symbiont::WebObjects.class_for_tag[:th] = ::Symbiont::WebObjects::TableCell
|
22
|
-
|
23
|
-
end # module: WebObjects
|
24
|
-
end # module: Symbiont
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class TableRow < WebObject
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
def initialize(web_object)
|
8
|
-
@web_object = web_object
|
9
|
-
end
|
10
|
-
|
11
|
-
# This method is used to return a TableCell object based on the index provided. When
|
12
|
-
# the index provided is a string, the text will be matched with the text from the
|
13
|
-
# columns in the first row.
|
14
|
-
# @return [Symbiont::WebObjects::TableCell]
|
15
|
-
def [](index)
|
16
|
-
index = find_by_title(index) if index.kind_of?(String)
|
17
|
-
return nil unless index && columns >= index + 1
|
18
|
-
::Symbiont::WebObjects::TableCell.new(web_object[index])
|
19
|
-
end
|
20
|
-
|
21
|
-
# This method is an iterator that returns a TableCell object each time through
|
22
|
-
# the loop.
|
23
|
-
# @return [Symbiont::WebObjects::TableCell]
|
24
|
-
def each
|
25
|
-
for index in 1..self.columns do
|
26
|
-
yield self[index - 1]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# This method returns the number of columns in a table object.
|
31
|
-
def columns
|
32
|
-
web_object.wd.find_elements(:xpath, cell_xpath).size
|
33
|
-
end
|
34
|
-
|
35
|
-
protected
|
36
|
-
|
37
|
-
def cell_xpath
|
38
|
-
".//child::td|th"
|
39
|
-
end
|
40
|
-
|
41
|
-
def initialize_cell(element)
|
42
|
-
::Symbiont::WebObjects::TableCell.new(element)
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
|
47
|
-
def find_by_title(column_text)
|
48
|
-
table = web_object.parent
|
49
|
-
table = table.parent if table.tag_name == 'tbody'
|
50
|
-
first_row = table[0]
|
51
|
-
first_row.cells.find_index {|column| column.text.include? column_text}
|
52
|
-
end
|
53
|
-
|
54
|
-
end # class: TableRow
|
55
|
-
|
56
|
-
::Symbiont::WebObjects.class_for_tag[:tr] = ::Symbiont::WebObjects::TableRow
|
57
|
-
|
58
|
-
end # module: WebObjects
|
59
|
-
end # module: Symbiont
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class TextArea < WebObject
|
5
|
-
def initialize(web_object)
|
6
|
-
@web_object = web_object
|
7
|
-
end
|
8
|
-
|
9
|
-
def value=(value)
|
10
|
-
web_object.set value
|
11
|
-
end
|
12
|
-
|
13
|
-
def clear
|
14
|
-
web_object.wd.clear
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.usable_selectors
|
18
|
-
super + [:title, :value, :text, :label]
|
19
|
-
end
|
20
|
-
|
21
|
-
end # class: TextArea
|
22
|
-
|
23
|
-
::Symbiont::WebObjects.class_for_tag[:textarea] = ::Symbiont::WebObjects::TextArea
|
24
|
-
|
25
|
-
end # module: WebObjects
|
26
|
-
end # module: Symbiont
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class TextField < WebObject
|
5
|
-
def initialize(web_object)
|
6
|
-
@web_object = web_object
|
7
|
-
end
|
8
|
-
|
9
|
-
def value
|
10
|
-
web_object.value
|
11
|
-
end
|
12
|
-
|
13
|
-
def value=(value)
|
14
|
-
web_object.set value
|
15
|
-
end
|
16
|
-
|
17
|
-
def append(text)
|
18
|
-
web_object.send_keys text
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.usable_selectors
|
22
|
-
super + [:title, :value, :text, :label]
|
23
|
-
end
|
24
|
-
|
25
|
-
end # class: TextField
|
26
|
-
|
27
|
-
::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField
|
28
|
-
::Symbiont::WebObjects.class_for_type[:password] = ::Symbiont::WebObjects::TextField
|
29
|
-
|
30
|
-
end # module: WebObjects
|
31
|
-
end # module: Symbiont
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class UnorderedList < WebObject
|
5
|
-
include Enumerable
|
6
|
-
|
7
|
-
def initialize(web_object)
|
8
|
-
@web_object = web_object
|
9
|
-
end
|
10
|
-
|
11
|
-
# @return [Symbiont::WebObjects::ListItem]
|
12
|
-
def [](index)
|
13
|
-
::Symbiont::WebObjects::ListItem.new(children[index])
|
14
|
-
end
|
15
|
-
|
16
|
-
# Return the number of list items contained in the ordered list.
|
17
|
-
def items
|
18
|
-
children.size
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [Symbiont::WebObjects::ListItem]
|
22
|
-
def each
|
23
|
-
for index in 1..self.items do
|
24
|
-
yield self[index - 1]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
def list_item_xpath
|
31
|
-
".//child::li"
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def children
|
37
|
-
list_items.find_all { |item| item.parent == web_object }
|
38
|
-
end
|
39
|
-
|
40
|
-
def list_items
|
41
|
-
web_object.uls(:xpath => list_item_xpath)
|
42
|
-
end
|
43
|
-
|
44
|
-
end # class: UnorderedList
|
45
|
-
|
46
|
-
::Symbiont::WebObjects.class_for_tag[:ul] = ::Symbiont::WebObjects::UnorderedList
|
47
|
-
|
48
|
-
end # module: WebObjects
|
49
|
-
end # module: Symbiont
|
data/lib/symbiont/web_objects.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
module Symbiont
|
2
|
-
module WebObjects
|
3
|
-
|
4
|
-
class << self
|
5
|
-
def class_for_tag
|
6
|
-
@class_for_tag ||= {}
|
7
|
-
end
|
8
|
-
|
9
|
-
def class_for_type
|
10
|
-
@class_for_type ||= {}
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_class_for(tag, type=nil)
|
14
|
-
return class_for_type[type.to_sym] if type
|
15
|
-
class_for_tag[tag.to_sym] || ::Symbiont::WebObjects::WebObject
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
require 'symbiont/web_objects/_common'
|