symbiont 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/HISTORY.md +6 -0
- data/app/app.rb +48 -0
- 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 +290 -0
- data/app/public/css/demo_table_jui.css +471 -0
- data/app/public/css/font/ColabLig-webfont.eot +0 -0
- data/app/public/css/font/ColabLig-webfont.svg +149 -0
- 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 +149 -0
- 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 +149 -0
- 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 +149 -0
- 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 +376 -0
- data/app/public/css/site.css +430 -0
- 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 +359 -0
- data/app/public/fancybox/jquery.fancybox-1.3.4.js +1156 -0
- data/app/public/fancybox/jquery.fancybox-1.3.4.min.js +1 -0
- 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 +11 -0
- data/app/public/js/signup.js +141 -0
- data/app/public/js/site.js +40 -0
- data/app/public/js/stardate.js +35 -0
- data/app/public/js/vendor/html5shiv.js +5 -0
- data/app/public/js/vendor/jquery-1.8.3.min.js +2 -0
- data/app/public/js/vendor/jquery.dataTables.min.js +151 -0
- data/app/public/js/vendor/jquery.validate.min.js +4 -0
- data/app/views/comics.erb +322 -0
- data/app/views/index.erb +7 -0
- data/app/views/layout.erb +72 -0
- data/app/views/layout_small.erb +21 -0
- data/app/views/stardate.erb +5 -0
- data/app/views/stardate_calc.erb +30 -0
- data/app/views/webobject.erb +147 -0
- data/lib/symbiont/enclosers.rb +18 -2
- data/lib/symbiont/evaluators.rb +1 -4
- data/lib/symbiont/generators.rb +22 -56
- data/lib/symbiont/locators.rb +10 -10
- data/lib/symbiont/platform_watir/platform_object.rb +28 -52
- data/lib/symbiont/platform_watir.rb +2 -11
- data/lib/symbiont/platforms.rb +8 -20
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +110 -32
- data/lib/symbiont/web_objects/button.rb +2 -15
- data/lib/symbiont/web_objects/checkbox.rb +11 -17
- data/lib/symbiont/web_objects/div.rb +1 -5
- data/lib/symbiont/web_objects/link.rb +3 -20
- data/lib/symbiont/web_objects/radio.rb +10 -16
- data/lib/symbiont/web_objects/select_list.rb +60 -15
- data/lib/symbiont/web_objects/span.rb +1 -5
- data/lib/symbiont/web_objects/table.rb +22 -12
- data/lib/symbiont/web_objects/table_cell.rb +2 -6
- data/lib/symbiont/web_objects/table_row.rb +24 -13
- data/lib/symbiont/web_objects/text_field.rb +10 -19
- data/lib/symbiont/web_objects.rb +2 -2
- data/lib/symbiont.rb +13 -3
- data/spec/spec_helper.rb +1 -0
- data/spec/symbiont/enclosers_spec.rb +3 -0
- data/spec/symbiont/evaluators_spec.rb +5 -0
- data/spec/symbiont/generators/button_generators_spec.rb +1 -1
- data/spec/symbiont/generators/cell_generators_spec.rb +1 -1
- data/spec/symbiont/generators/checkbox_generators_spec.rb +1 -1
- data/spec/symbiont/generators/div_generators_spec.rb +2 -2
- data/spec/symbiont/generators/link_generators_spec.rb +1 -1
- data/spec/symbiont/generators/paragraph_generators_spec.rb +52 -0
- data/spec/symbiont/generators/radio_generators_spec.rb +1 -2
- data/spec/symbiont/generators/select_list_generators_spec.rb +3 -3
- data/spec/symbiont/generators/span_generators_spec.rb +1 -1
- data/spec/symbiont/generators/table_generators_spec.rb +8 -1
- data/spec/symbiont/generators/text_field_generators_spec.rb +1 -1
- data/spec/symbiont/symbiont_spec.rb +10 -0
- data/spec/symbiont/web_object_spec.rb +71 -10
- data/spec/symbiont/web_objects/paragraph_spec.rb +11 -0
- data/spec/symbiont/web_objects/radio_spec.rb +17 -1
- data/spec/symbiont/web_objects/table_cell_spec.rb +6 -0
- data/spec/symbiont/web_objects/table_row_spec.rb +20 -10
- metadata +94 -20
- data/lib/symbiont/platform_selenium/platform_object.rb +0 -236
- data/lib/symbiont/platform_selenium/web_objects/button.rb +0 -13
- data/lib/symbiont/platform_selenium/web_objects/checkbox.rb +0 -21
- data/lib/symbiont/platform_selenium/web_objects/common.rb +0 -104
- data/lib/symbiont/platform_selenium/web_objects/link.rb +0 -13
- data/lib/symbiont/platform_selenium/web_objects/radio.rb +0 -21
- data/lib/symbiont/platform_selenium/web_objects/select_list.rb +0 -79
- data/lib/symbiont/platform_selenium/web_objects/table.rb +0 -40
- data/lib/symbiont/platform_selenium/web_objects/table_row.rb +0 -36
- data/lib/symbiont/platform_selenium/web_objects/text_field.rb +0 -14
- data/lib/symbiont/platform_selenium.rb +0 -18
- data/lib/symbiont/platform_watir/web_objects/checkbox.rb +0 -21
- data/lib/symbiont/platform_watir/web_objects/common.rb +0 -82
- data/lib/symbiont/platform_watir/web_objects/radio.rb +0 -21
- data/lib/symbiont/platform_watir/web_objects/select_list.rb +0 -67
- data/lib/symbiont/platform_watir/web_objects/table.rb +0 -31
- data/lib/symbiont/platform_watir/web_objects/table_row.rb +0 -31
- data/lib/symbiont/platform_watir/web_objects/text_field.rb +0 -13
@@ -3,30 +3,24 @@ module Symbiont
|
|
3
3
|
|
4
4
|
class Radio < WebObject
|
5
5
|
|
6
|
-
def initialize(web_object
|
6
|
+
def initialize(web_object)
|
7
7
|
@web_object = web_object
|
8
|
-
include_platform_specifics_for(platform)
|
9
8
|
end
|
10
9
|
|
11
|
-
def self.
|
10
|
+
def self.usable_selectors
|
12
11
|
super + [:value]
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
16
|
-
|
14
|
+
def select
|
15
|
+
web_object.set
|
16
|
+
end
|
17
|
+
|
18
|
+
def clear
|
19
|
+
web_object.clear
|
17
20
|
end
|
18
21
|
|
19
|
-
def
|
20
|
-
|
21
|
-
if platform[:platform] == :watir_webdriver
|
22
|
-
require 'symbiont/platform_watir/web_objects/radio'
|
23
|
-
self.class.send :include, Symbiont::Platforms::WatirWebDriver::Radio
|
24
|
-
elsif platform[:platform] == :selenium_webdriver
|
25
|
-
require 'symbiont/platform_selenium/web_objects/radio'
|
26
|
-
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Radio
|
27
|
-
else
|
28
|
-
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
29
|
-
end
|
22
|
+
def selected?
|
23
|
+
web_object.set?
|
30
24
|
end
|
31
25
|
|
32
26
|
end # class: Radio
|
@@ -2,33 +2,78 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class SelectList < WebObject
|
5
|
-
def initialize(web_object
|
5
|
+
def initialize(web_object)
|
6
6
|
@web_object = web_object
|
7
|
-
include_platform_specifics_for(platform)
|
8
7
|
end
|
9
8
|
|
10
|
-
def self.
|
9
|
+
def self.usable_selectors
|
11
10
|
super + [:value, :text]
|
12
11
|
end
|
13
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
|
+
|
14
71
|
protected
|
15
72
|
|
16
73
|
def option_xpath
|
17
74
|
".//child::option"
|
18
75
|
end
|
19
76
|
|
20
|
-
def include_platform_specifics_for(platform)
|
21
|
-
super
|
22
|
-
if platform[:platform] == :watir_webdriver
|
23
|
-
require 'symbiont/platform_watir/web_objects/select_list'
|
24
|
-
self.class.send :include, Symbiont::Platforms::WatirWebDriver::SelectList
|
25
|
-
elsif platform[:platform] == :selenium_webdriver
|
26
|
-
require 'symbiont/platform_selenium/web_objects/select_list'
|
27
|
-
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::SelectList
|
28
|
-
else
|
29
|
-
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
30
|
-
end
|
31
|
-
end
|
32
77
|
end # class: SelectList
|
33
78
|
|
34
79
|
::Symbiont::WebObjects.class_for_tag[:select] = ::Symbiont::WebObjects::SelectList
|
@@ -4,9 +4,18 @@ module Symbiont
|
|
4
4
|
class Table < WebObject
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
def initialize(web_object
|
7
|
+
def initialize(web_object)
|
8
8
|
@web_object = web_object
|
9
|
-
|
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])
|
10
19
|
end
|
11
20
|
|
12
21
|
# This method is an iterator that returns a TableRow object each time through
|
@@ -18,6 +27,11 @@ module Symbiont
|
|
18
27
|
end
|
19
28
|
end
|
20
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
|
+
|
21
35
|
# Returns a reference to the first row web object of a table.
|
22
36
|
# @return [Symbiont::WebObjects::TableRow]
|
23
37
|
def first_row
|
@@ -36,16 +50,12 @@ module Symbiont
|
|
36
50
|
".//child::tr"
|
37
51
|
end
|
38
52
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
require 'symbiont/platform_selenium/web_objects/table'
|
46
|
-
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Table
|
47
|
-
else
|
48
|
-
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
53
|
+
private
|
54
|
+
|
55
|
+
def find_by_title(row_text)
|
56
|
+
#web_object.rows.find_index {|row| row[0].text == row_text}
|
57
|
+
web_object.rows.find_index do |row|
|
58
|
+
row.cells.any? { |col| col.text.include? row_text }
|
49
59
|
end
|
50
60
|
end
|
51
61
|
|
@@ -3,7 +3,7 @@ module Symbiont
|
|
3
3
|
|
4
4
|
class TableCell < WebObject
|
5
5
|
|
6
|
-
def initialize(web_object
|
6
|
+
def initialize(web_object)
|
7
7
|
@web_object = web_object
|
8
8
|
end
|
9
9
|
|
@@ -11,11 +11,7 @@ module Symbiont
|
|
11
11
|
true
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.
|
15
|
-
super + [:text]
|
16
|
-
end
|
17
|
-
|
18
|
-
def self.usable_selectors_for_selenium
|
14
|
+
def self.usable_selectors
|
19
15
|
super + [:text]
|
20
16
|
end
|
21
17
|
|
@@ -4,9 +4,18 @@ module Symbiont
|
|
4
4
|
class TableRow < WebObject
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
def initialize(web_object
|
7
|
+
def initialize(web_object)
|
8
8
|
@web_object = web_object
|
9
|
-
|
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])
|
10
19
|
end
|
11
20
|
|
12
21
|
# This method is an iterator that returns a TableCell object each time through
|
@@ -18,24 +27,26 @@ module Symbiont
|
|
18
27
|
end
|
19
28
|
end
|
20
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
|
+
|
21
35
|
protected
|
22
36
|
|
23
37
|
def cell_xpath
|
24
38
|
".//child::td|th"
|
25
39
|
end
|
26
40
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TableRow
|
35
|
-
else
|
36
|
-
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
37
|
-
end
|
41
|
+
private
|
42
|
+
|
43
|
+
def find_by_title(column_text)
|
44
|
+
table = web_object.parent
|
45
|
+
table = table.parent if table.tag_name == 'tbody'
|
46
|
+
first_row = table[0]
|
47
|
+
first_row.cells.find_index {|column| column.text.include? column_text}
|
38
48
|
end
|
49
|
+
|
39
50
|
end # class: TableRow
|
40
51
|
|
41
52
|
::Symbiont::WebObjects.class_for_tag[:tr] = ::Symbiont::WebObjects::TableRow
|
@@ -2,39 +2,30 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class TextField < WebObject
|
5
|
-
def initialize(web_object
|
5
|
+
def initialize(web_object)
|
6
6
|
@web_object = web_object
|
7
|
-
include_platform_specifics_for(platform)
|
8
7
|
end
|
9
8
|
|
10
|
-
def
|
11
|
-
web_object.
|
9
|
+
def value
|
10
|
+
web_object.value
|
12
11
|
end
|
13
12
|
|
14
|
-
def
|
15
|
-
|
13
|
+
def value=(value)
|
14
|
+
web_object.set value
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
19
|
-
|
17
|
+
def append(text)
|
18
|
+
web_object.send_keys text
|
20
19
|
end
|
21
20
|
|
22
|
-
def
|
23
|
-
super
|
24
|
-
if platform[:platform] == :watir_webdriver
|
25
|
-
require 'symbiont/platform_watir/web_objects/text_field'
|
26
|
-
self.class.send :include, Symbiont::Platforms::WatirWebDriver::TextField
|
27
|
-
elsif platform[:platform] == :selenium_webdriver
|
28
|
-
require 'symbiont/platform_selenium/web_objects/text_field'
|
29
|
-
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TextField
|
30
|
-
else
|
31
|
-
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
32
|
-
end
|
21
|
+
def self.usable_selectors
|
22
|
+
super + [:title, :value, :text, :label]
|
33
23
|
end
|
34
24
|
|
35
25
|
end # class: TextField
|
36
26
|
|
37
27
|
::Symbiont::WebObjects.class_for_type[:text] = ::Symbiont::WebObjects::TextField
|
38
28
|
::Symbiont::WebObjects.class_for_type[:password] = ::Symbiont::WebObjects::TextField
|
29
|
+
|
39
30
|
end # module: WebObjects
|
40
31
|
end # module: Symbiont
|
data/lib/symbiont/web_objects.rb
CHANGED
data/lib/symbiont.rb
CHANGED
@@ -14,9 +14,11 @@ module Symbiont
|
|
14
14
|
include Evaluators
|
15
15
|
include Locators
|
16
16
|
include DataSetter
|
17
|
-
|
17
|
+
|
18
|
+
# Used to make a platform object accessible. Will hold object
|
19
|
+
# references like these:
|
20
|
+
# <Symbiont::Platforms::WatirWebDriver::PlatformObject:0x2cbe8a0>
|
18
21
|
attr_reader :platform
|
19
|
-
attr_reader :browser
|
20
22
|
|
21
23
|
def self.version
|
22
24
|
"Symbiont v#{Symbiont::VERSION}"
|
@@ -39,12 +41,20 @@ module Symbiont
|
|
39
41
|
@page_wait ||= 15
|
40
42
|
end
|
41
43
|
|
44
|
+
def self.page_level_wait=(value)
|
45
|
+
@page_wait = value
|
46
|
+
end
|
47
|
+
|
42
48
|
# Returns the default wait value for elements on a page. This value is
|
43
49
|
# the default value beyond which a timeout is assumed.
|
44
50
|
def self.element_level_wait
|
45
51
|
@element_wait ||= 5
|
46
52
|
end
|
47
53
|
|
54
|
+
def self.element_level_wait=(value)
|
55
|
+
@element_wait = value
|
56
|
+
end
|
57
|
+
|
48
58
|
# The initialize method will be invoked when a page definition includes
|
49
59
|
# Symbiont. Some key things are happening here that are critical to
|
50
60
|
# Symbiont working correctly:
|
@@ -69,7 +79,7 @@ module Symbiont
|
|
69
79
|
#
|
70
80
|
# @param [Object] browser a browser instance with a tool driver
|
71
81
|
def establish_platform_object_for(browser)
|
72
|
-
@platform = get_platform_for(browser
|
82
|
+
@platform = get_platform_for(browser)
|
73
83
|
end
|
74
84
|
|
75
85
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,6 +8,9 @@ describe Symbiont::Enclosers do
|
|
8
8
|
it "should allow frames to act as a context" do
|
9
9
|
watir_browser.should_receive(:frame).with(id: "frame").and_return(watir_browser)
|
10
10
|
watir_browser.should_receive(:text_field).and_return(watir_browser)
|
11
|
+
watir_browser.should_receive(:wd).and_return(watir_browser)
|
12
|
+
watir_browser.should_receive(:switch_to).and_return(watir_browser)
|
13
|
+
watir_browser.should_receive(:default_content).and_return(watir_browser)
|
11
14
|
web_object = watir_definition.framedLoginName_text_field
|
12
15
|
web_object.should_not be_nil
|
13
16
|
web_object.should be_instance_of Symbiont::WebObjects::TextField
|
@@ -65,6 +65,11 @@ describe Symbiont::Enclosers do
|
|
65
65
|
watir_browser.should_receive(:execute_script).with('return jQuery.active').and_return(1)
|
66
66
|
expect { watir_definition.wait_for_pending_requests(1) }.to raise_error
|
67
67
|
end
|
68
|
+
|
69
|
+
it "should be able to go back to a previous page" do
|
70
|
+
watir_browser.should_receive(:back)
|
71
|
+
watir_definition.back
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
end
|
@@ -52,7 +52,7 @@ describe Symbiont::Generators do
|
|
52
52
|
|
53
53
|
it "should determine if a button is visible" do
|
54
54
|
watir_browser.should_receive(:button).twice.and_return(watir_browser)
|
55
|
-
watir_browser.should_receive(:
|
55
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
56
56
|
watir_definition.submit_?.should be_true
|
57
57
|
watir_definition.submit_visible?.should be_true
|
58
58
|
end
|
@@ -37,7 +37,7 @@ describe Symbiont::Generators do
|
|
37
37
|
|
38
38
|
it "should determine if a table cell is visible" do
|
39
39
|
watir_browser.should_receive(:td).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
41
|
watir_definition.totalValue_visible?.should be_true
|
42
42
|
watir_definition.totalValue_?.should be_true
|
43
43
|
end
|
@@ -41,7 +41,7 @@ describe Symbiont::Generators do
|
|
41
41
|
|
42
42
|
it "should determine if a checkbox is visible" do
|
43
43
|
watir_browser.should_receive(:checkbox).twice.and_return(watir_browser)
|
44
|
-
watir_browser.should_receive(:
|
44
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
45
45
|
watir_definition.apply_tax_visible?.should be_true
|
46
46
|
watir_definition.apply_tax_?.should be_true
|
47
47
|
end
|
@@ -37,12 +37,12 @@ describe Symbiont::Generators do
|
|
37
37
|
|
38
38
|
it "should determine if a div is visible" do
|
39
39
|
watir_browser.should_receive(:div).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
41
|
watir_definition.section_visible?.should be_true
|
42
42
|
watir_definition.section_?.should be_true
|
43
43
|
end
|
44
44
|
|
45
|
-
it "should return the text of a
|
45
|
+
it "should return the text of a div" do
|
46
46
|
watir_browser.should_receive(:div).and_return(watir_browser)
|
47
47
|
watir_browser.should_receive(:text).and_return("testing")
|
48
48
|
watir_definition.section.should == "testing"
|
@@ -49,7 +49,7 @@ describe Symbiont::Generators do
|
|
49
49
|
|
50
50
|
it "should determine if a link is visible" do
|
51
51
|
watir_browser.should_receive(:link).twice.and_return(watir_browser)
|
52
|
-
watir_browser.should_receive(:
|
52
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
53
53
|
watir_definition.reset_password_visible?.should be_true
|
54
54
|
watir_definition.reset_password_?.should be_true
|
55
55
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Symbiont::Generators do
|
4
|
+
let(:watir_browser) { mock_browser_for_watir }
|
5
|
+
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
+
|
7
|
+
describe "paragraph web objects" do
|
8
|
+
context "when declared in a definition" do
|
9
|
+
it "should generate methods for referencing the paragraph" do
|
10
|
+
watir_definition.should respond_to(:intro_paragraph)
|
11
|
+
watir_definition.should respond_to(:intro_object)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should generate methods for interacting with the paragraph" do
|
15
|
+
watir_definition.should respond_to(:intro_exists?)
|
16
|
+
watir_definition.should respond_to(:intro_visible?)
|
17
|
+
watir_definition.should respond_to(:intro?)
|
18
|
+
watir_definition.should respond_to(:intro_?)
|
19
|
+
watir_definition.should respond_to(:intro)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "when used by the watir platform" do
|
24
|
+
it "should locate the paragraph" do
|
25
|
+
watir_browser.should_receive(:p).and_return(watir_browser)
|
26
|
+
web_object = watir_definition.intro_paragraph
|
27
|
+
web_object.should_not be_nil
|
28
|
+
web_object.should be_instance_of Symbiont::WebObjects::Paragraph
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should determine if a paragraph exists" do
|
32
|
+
watir_browser.should_receive(:p).twice.and_return(watir_browser)
|
33
|
+
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
34
|
+
watir_definition.intro_exists?.should be_true
|
35
|
+
watir_definition.intro?.should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should determine if a paragraph is visible" do
|
39
|
+
watir_browser.should_receive(:p).twice.and_return(watir_browser)
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
|
+
watir_definition.intro_visible?.should be_true
|
42
|
+
watir_definition.intro_?.should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should return the text of a paragraph" do
|
46
|
+
watir_browser.should_receive(:p).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.intro.should == "testing"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -8,7 +8,6 @@ describe Symbiont::Generators do
|
|
8
8
|
context "when declared in a definition" do
|
9
9
|
it "should generate methods for referencing the radio" do
|
10
10
|
watir_definition.should respond_to(:include_tax_radio)
|
11
|
-
watir_definition.should respond_to(:include_tax_radio_button)
|
12
11
|
watir_definition.should respond_to(:include_tax_object)
|
13
12
|
end
|
14
13
|
|
@@ -42,7 +41,7 @@ describe Symbiont::Generators do
|
|
42
41
|
|
43
42
|
it "should determine if a radio is visible" do
|
44
43
|
watir_browser.should_receive(:radio).twice.and_return(watir_browser)
|
45
|
-
watir_browser.should_receive(:
|
44
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
46
45
|
watir_definition.include_tax_visible?.should be_true
|
47
46
|
watir_definition.include_tax_?.should be_true
|
48
47
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Symbiont::Generators do
|
4
4
|
let(:watir_browser) { mock_browser_for_watir }
|
5
5
|
let(:watir_definition) { DefinitionTest.new(watir_browser) }
|
6
|
-
|
6
|
+
|
7
7
|
describe "select list web objects" do
|
8
8
|
context "when declared in a definition" do
|
9
9
|
it "should generate methods for referencing the select list" do
|
@@ -51,7 +51,7 @@ describe Symbiont::Generators do
|
|
51
51
|
watir_browser.should_receive(:select).with("testing")
|
52
52
|
watir_definition.concepts = "testing"
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
it "should determine if a select list exists" do
|
56
56
|
watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
|
57
57
|
watir_browser.should_receive(:exists?).twice.and_return(watir_browser)
|
@@ -61,7 +61,7 @@ describe Symbiont::Generators do
|
|
61
61
|
|
62
62
|
it "should determine if a select list is visible" do
|
63
63
|
watir_browser.should_receive(:select_list).twice.and_return(watir_browser)
|
64
|
-
watir_browser.should_receive(:
|
64
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
65
65
|
watir_definition.concepts_visible?.should be_true
|
66
66
|
watir_definition.concepts_?.should be_true
|
67
67
|
end
|
@@ -37,7 +37,7 @@ describe Symbiont::Generators do
|
|
37
37
|
|
38
38
|
it "should determine if a span is visible" do
|
39
39
|
watir_browser.should_receive(:span).twice.and_return(watir_browser)
|
40
|
-
watir_browser.should_receive(:
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
41
41
|
watir_definition.inline_visible?.should be_true
|
42
42
|
watir_definition.inline_?.should be_true
|
43
43
|
end
|
@@ -16,6 +16,7 @@ describe Symbiont::Generators do
|
|
16
16
|
watir_definition.should respond_to(:accounts?)
|
17
17
|
watir_definition.should respond_to(:accounts_visible?)
|
18
18
|
watir_definition.should respond_to(:accounts_?)
|
19
|
+
watir_definition.should respond_to(:accounts)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
|
@@ -36,10 +37,16 @@ describe Symbiont::Generators do
|
|
36
37
|
|
37
38
|
it "should determine if a table is visible" do
|
38
39
|
watir_browser.should_receive(:table).twice.and_return(watir_browser)
|
39
|
-
watir_browser.should_receive(:
|
40
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
40
41
|
watir_definition.accounts_visible?.should be_true
|
41
42
|
watir_definition.accounts_?.should be_true
|
42
43
|
end
|
44
|
+
|
45
|
+
it "should return the text of a table" do
|
46
|
+
watir_browser.should_receive(:table).and_return(watir_browser)
|
47
|
+
watir_browser.should_receive(:text).and_return("testing")
|
48
|
+
watir_definition.accounts.should == "testing"
|
49
|
+
end
|
43
50
|
end
|
44
51
|
end
|
45
52
|
end
|
@@ -52,7 +52,7 @@ describe Symbiont::Generators do
|
|
52
52
|
|
53
53
|
it "should determine if a text field is visible" do
|
54
54
|
watir_browser.should_receive(:text_field).twice.and_return(watir_browser)
|
55
|
-
watir_browser.should_receive(:
|
55
|
+
watir_browser.should_receive(:present?).twice.and_return(watir_browser)
|
56
56
|
watir_definition.login_name_visible?.should be_true
|
57
57
|
watir_definition.login_name_?.should be_true
|
58
58
|
end
|
@@ -14,4 +14,14 @@ describe Symbiont do
|
|
14
14
|
Symbiont.instance_variable_set("@page_wait", nil)
|
15
15
|
Symbiont.page_level_wait.should == 15
|
16
16
|
end
|
17
|
+
|
18
|
+
it "should provide an element level wait default" do
|
19
|
+
Symbiont.instance_variable_set("@element_wait", 5)
|
20
|
+
Symbiont.element_level_wait.should == 5
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should set the element level wait default to 5" do
|
24
|
+
Symbiont.instance_variable_set("@element_wait", nil)
|
25
|
+
Symbiont.element_level_wait.should == 5
|
26
|
+
end
|
17
27
|
end
|