celerity 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.
- data.tar.gz.sig +0 -0
- data/History.txt +14 -0
- data/Manifest.txt +127 -151
- data/README.txt +15 -20
- data/lib/celerity.rb +13 -5
- data/lib/celerity/browser.rb +296 -0
- data/lib/celerity/clickable_element.rb +1 -0
- data/lib/celerity/collections.rb +4 -0
- data/lib/celerity/container.rb +69 -2
- data/lib/celerity/disabled_element.rb +1 -0
- data/lib/celerity/element.rb +103 -38
- data/lib/celerity/element_collections.rb +14 -8
- data/lib/celerity/element_locator.rb +61 -50
- data/lib/celerity/element_map.rb +51 -0
- data/lib/celerity/elements/button.rb +1 -0
- data/lib/celerity/elements/file_field.rb +3 -2
- data/lib/celerity/elements/form.rb +1 -0
- data/lib/celerity/elements/frame.rb +16 -1
- data/lib/celerity/elements/image.rb +15 -13
- data/lib/celerity/elements/link.rb +4 -1
- data/lib/celerity/elements/option.rb +1 -0
- data/lib/celerity/elements/radio_check.rb +19 -7
- data/lib/celerity/elements/select_list.rb +17 -2
- data/lib/celerity/elements/table.rb +34 -20
- data/lib/celerity/elements/table_body.rb +2 -2
- data/lib/celerity/elements/table_cell.rb +3 -1
- data/lib/celerity/elements/table_footer.rb +2 -2
- data/lib/celerity/elements/table_header.rb +2 -2
- data/lib/celerity/elements/table_row.rb +4 -2
- data/lib/celerity/elements/text_field.rb +20 -9
- data/lib/celerity/exception.rb +11 -18
- data/lib/celerity/extra/method_generator.rb +13 -8
- data/lib/celerity/htmlunit/download.sh +23 -0
- data/lib/celerity/htmlunit/htmlunit-2.2.jar +0 -0
- data/lib/celerity/htmlunit/htmlunit-core-js-2.2.jar +0 -0
- data/lib/celerity/htmlunit/{nekohtml-1.9.7.jar → nekohtml-1.9.8.jar} +0 -0
- data/lib/celerity/input_element.rb +1 -1
- data/lib/celerity/version.rb +1 -1
- data/lib/celerity/watir_compatibility.rb +37 -23
- data/spec/area_spec.rb +19 -4
- data/spec/areas_spec.rb +2 -3
- data/spec/{ie_spec.rb → browser_spec.rb} +66 -15
- data/spec/button_spec.rb +36 -3
- data/spec/buttons_spec.rb +2 -3
- data/spec/checkbox_spec.rb +43 -8
- data/spec/checkboxes_spec.rb +2 -3
- data/spec/div_spec.rb +31 -4
- data/spec/divs_spec.rb +2 -3
- data/spec/element_spec.rb +36 -6
- data/spec/filefield_spec.rb +28 -13
- data/spec/filefields_spec.rb +2 -3
- data/spec/form_spec.rb +6 -3
- data/spec/forms_spec.rb +2 -3
- data/spec/frame_spec.rb +14 -5
- data/spec/frames_spec.rb +71 -0
- data/spec/hidden_spec.rb +21 -3
- data/spec/hiddens_spec.rb +2 -3
- data/spec/hn_spec.rb +30 -12
- data/spec/hns_spec.rb +14 -10
- data/spec/html/form_js_bug.html +11 -0
- data/spec/html/forms_with_input_elements.html +2 -1
- data/spec/html/invalid_js.html +11 -0
- data/spec/html/latin1_text.html +1 -0
- data/spec/html/non_control_elements.html +8 -4
- data/spec/html/simple_ajax.html +22 -0
- data/spec/htmlunit_spec.rb +4 -5
- data/spec/image_spec.rb +33 -3
- data/spec/images_spec.rb +2 -3
- data/spec/label_spec.rb +16 -3
- data/spec/labels_spec.rb +2 -3
- data/spec/li_spec.rb +25 -3
- data/spec/link_spec.rb +35 -3
- data/spec/links_spec.rb +2 -3
- data/spec/lis_spec.rb +2 -3
- data/spec/map_spec.rb +19 -3
- data/spec/maps_spec.rb +2 -3
- data/spec/meta_spec.rb +3 -1
- data/spec/ol_spec.rb +17 -3
- data/spec/ols_spec.rb +2 -3
- data/spec/option_spec.rb +28 -3
- data/spec/p_spec.rb +30 -2
- data/spec/pre_spec.rb +25 -3
- data/spec/pres_spec.rb +2 -3
- data/spec/ps_spec.rb +2 -3
- data/spec/radio_spec.rb +47 -3
- data/spec/radios_spec.rb +2 -3
- data/spec/select_list_spec.rb +42 -3
- data/spec/select_lists_spec.rb +2 -3
- data/spec/span_spec.rb +32 -7
- data/spec/spans_spec.rb +2 -4
- data/spec/spec_helper.rb +5 -25
- data/spec/table_bodies_spec.rb +7 -5
- data/spec/table_body_spec.rb +11 -4
- data/spec/table_cell_spec.rb +15 -4
- data/spec/table_cells_spec.rb +3 -4
- data/spec/table_footer_spec.rb +11 -4
- data/spec/table_footers_spec.rb +7 -5
- data/spec/table_header_spec.rb +11 -4
- data/spec/table_headers_spec.rb +7 -5
- data/spec/table_row_spec.rb +31 -7
- data/spec/table_rows_spec.rb +5 -4
- data/spec/table_spec.rb +36 -7
- data/spec/tables_spec.rb +2 -3
- data/spec/text_field_spec.rb +51 -13
- data/spec/text_fields_spec.rb +2 -3
- data/spec/ul_spec.rb +18 -3
- data/spec/uls_spec.rb +2 -3
- data/spec/{watir_compatability_spec.rb → watir_compatibility_spec.rb} +42 -35
- data/support/spec_server.rb +9 -0
- metadata +167 -161
- metadata.gz.sig +0 -0
- data/benchmark/bm_2000_spans.rb +0 -48
- data/benchmark/bm_digg.rb +0 -26
- data/benchmark/bm_google_images.rb +0 -36
- data/benchmark/bm_input_locator.rb +0 -69
- data/benchmark/loader.rb +0 -9
- data/config/hoe.rb +0 -68
- data/config/requirements.rb +0 -15
- data/lib/celerity/htmlunit/htmlunit-2.2-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/js-1.7R1.jar +0 -0
- data/lib/celerity/ie.rb +0 -195
- data/setup.rb +0 -1583
- data/support/celerity_viewer/rubycocoa/CelerityViewer.icns +0 -0
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/classes.nib +0 -37
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/info.nib +0 -19
- data/support/celerity_viewer/rubycocoa/English.lproj/Main.nib/keyedobjects.nib +0 -0
- data/support/celerity_viewer/rubycocoa/Info.plist.erb +0 -28
- data/support/celerity_viewer/rubycocoa/MainController.rb +0 -23
- data/support/celerity_viewer/rubycocoa/README +0 -94
- data/support/celerity_viewer/rubycocoa/Rakefile +0 -100
- data/support/celerity_viewer/rubycocoa/distributed_viewer.rb +0 -86
- data/support/celerity_viewer/rubycocoa/main.m +0 -7
- data/support/celerity_viewer/rubycocoa/main.rb +0 -27
- data/tasks/benchmark.rake +0 -4
- data/tasks/environment.rake +0 -7
- data/tasks/simple_ci.rake +0 -94
|
@@ -8,21 +8,29 @@ module Celerity
|
|
|
8
8
|
TAGS = [ Identifier.new('select') ]
|
|
9
9
|
DEFAULT_HOW = :name
|
|
10
10
|
|
|
11
|
+
# Returns an array strings representing the text value of the select list's options.
|
|
11
12
|
def get_all_contents
|
|
12
13
|
assert_exists
|
|
13
14
|
@object.getOptions.map { |e| e.asText }
|
|
14
15
|
end
|
|
15
|
-
|
|
16
|
+
|
|
17
|
+
# Returns an array strings representing the text value of the currently selected options.
|
|
16
18
|
def get_selected_items
|
|
17
19
|
assert_exists
|
|
18
20
|
@object.getSelectedOptions.map { |e| e.asText }
|
|
19
21
|
end
|
|
20
22
|
|
|
23
|
+
# Clear all selected options
|
|
24
|
+
# FIXME: should update page for each option changed?
|
|
21
25
|
def clear_selection
|
|
22
26
|
# assert_exists called by SelectList#type here
|
|
23
27
|
@object.getSelectedOptions.each { |e| e.setSelected(false) } unless type() == 'select-one'
|
|
24
28
|
end
|
|
25
29
|
|
|
30
|
+
# Select the option(s) matching the given value.
|
|
31
|
+
# value can be a String or Regexp.
|
|
32
|
+
#
|
|
33
|
+
# If several options match the value given, all will be selected.
|
|
26
34
|
def select(value)
|
|
27
35
|
assert_exists
|
|
28
36
|
raise NoValueFoundException, "unknown option with value #{value.inspect}" unless include?(value)
|
|
@@ -32,24 +40,31 @@ module Celerity
|
|
|
32
40
|
end
|
|
33
41
|
alias_method :set, :select
|
|
34
42
|
|
|
43
|
+
# Returns true if the select list has one or more options matching the given value.
|
|
44
|
+
# value can be a String or Regexp.
|
|
35
45
|
def include?(value)
|
|
36
46
|
assert_exists
|
|
37
47
|
!!@object.getOptions.find { |e| matches?(e.asText, value) }
|
|
38
48
|
end
|
|
39
|
-
alias_method :includes?, :include?
|
|
40
49
|
|
|
50
|
+
# Returns true if any of the selected options match the given value.
|
|
51
|
+
# value can be a String or Regexp.
|
|
41
52
|
def selected?(value)
|
|
42
53
|
assert_exists
|
|
43
54
|
raise UnknownObjectException, "unknown option with value #{value.inspect}" unless include?(value)
|
|
44
55
|
!!@object.getOptions.find { |e| matches?(e.asText, value) && e.isSelected }
|
|
45
56
|
end
|
|
46
57
|
|
|
58
|
+
# Returns 'select-multiple' if the select list has the 'multiple' attribute defined.
|
|
59
|
+
# Retunrs 'select-one' otherwise.
|
|
47
60
|
# TODO: Move to watir_compatibility or delete it 2008-05-23 Alexander
|
|
48
61
|
def type
|
|
49
62
|
assert_exists
|
|
50
63
|
'select-' + (@object.isAttributeDefined('multiple') ? 'multiple' : 'one')
|
|
51
64
|
end
|
|
52
65
|
|
|
66
|
+
# Returns the value of the first selected option in the select list.
|
|
67
|
+
# Returns nil if no option is selected.
|
|
53
68
|
def value
|
|
54
69
|
assert_exists
|
|
55
70
|
if (optn = @object.getSelectedOptions.to_a.first)
|
|
@@ -5,7 +5,8 @@ module Celerity
|
|
|
5
5
|
include Container
|
|
6
6
|
|
|
7
7
|
TAGS = [ Identifier.new('table') ]
|
|
8
|
-
ATTRIBUTES = BASE_ATTRIBUTES | [:summary, :width, :border, :frame, :rules,
|
|
8
|
+
ATTRIBUTES = BASE_ATTRIBUTES | [:summary, :width, :border, :frame, :rules,
|
|
9
|
+
:cellspacing, :cellpadding, :align, :bgcolor]
|
|
9
10
|
DEFAULT_HOW = :id
|
|
10
11
|
|
|
11
12
|
def locate
|
|
@@ -21,58 +22,71 @@ module Celerity
|
|
|
21
22
|
end
|
|
22
23
|
end
|
|
23
24
|
|
|
25
|
+
# Returns a TableRows object.
|
|
24
26
|
def rows
|
|
25
27
|
assert_exists
|
|
26
|
-
|
|
28
|
+
TableRows.new(self, :object, @rows)
|
|
27
29
|
end
|
|
28
30
|
|
|
31
|
+
# Returns a TableCells object.
|
|
29
32
|
def cells
|
|
30
33
|
assert_exists
|
|
31
|
-
|
|
34
|
+
TableCells.new(self, :object, @cells)
|
|
32
35
|
end
|
|
33
36
|
|
|
37
|
+
# Iterates through each row in the table, passing TableRow objects to the given block.
|
|
34
38
|
def each
|
|
35
39
|
assert_exists
|
|
36
40
|
@rows.each { |row| yield TableRow.new(self, :object, row) }
|
|
37
41
|
end
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
# Returns the TableRow at the given index (1-indexed).
|
|
44
|
+
#
|
|
45
|
+
# browser.table(:foo, 'bar')[1] # => #<TableRow...>
|
|
46
|
+
# browser.table(:foo, 'bar').child_row[1] # => #<TableRow...>
|
|
47
|
+
def child_row(index)
|
|
40
48
|
assert_exists
|
|
41
|
-
|
|
49
|
+
raise UnknownRowException, "Unable to locate a row at index #{index}" if @cells.length < index
|
|
50
|
+
TableRow.new(self, :object, @rows[index-1])
|
|
42
51
|
end
|
|
52
|
+
alias_method :[], :child_row
|
|
43
53
|
|
|
54
|
+
# Returns the TableCell at the given index (1-indexed).
|
|
55
|
+
#
|
|
56
|
+
# In a 10-column row, table.child_cell[11] will return the first cell on the second row.
|
|
57
|
+
def child_cell(index)
|
|
58
|
+
assert_exists
|
|
59
|
+
raise UnknownCellException, "Unable to locate a cell at index #{index}" if @cells.length < index
|
|
60
|
+
TableCell.new(self, :object, @cells[index-1])
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# The number of rows in the table
|
|
44
64
|
def row_count
|
|
45
65
|
assert_exists
|
|
46
66
|
@object.getRowCount
|
|
47
67
|
end
|
|
48
68
|
|
|
69
|
+
# Returns the number of columns on the row at the given index. (1-indexed)
|
|
70
|
+
# Default is the number of columns on the first row
|
|
49
71
|
def column_count(index = 1)
|
|
50
72
|
assert_exists
|
|
51
73
|
@object.getRow(index-1).getCells.length
|
|
52
74
|
end
|
|
53
75
|
|
|
54
|
-
#
|
|
55
|
-
# Raises an UnknownObjectException if the table doesn't exist.
|
|
76
|
+
# Returns the text of each cell in the the table as a two-dimensional array.
|
|
56
77
|
def to_a
|
|
57
78
|
assert_exists
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
for table_row in table_rows
|
|
61
|
-
x = []
|
|
62
|
-
for td in table_row.getCells
|
|
63
|
-
x << td.asText
|
|
64
|
-
end
|
|
65
|
-
y << x
|
|
79
|
+
@object.getRows.map do |table_row|
|
|
80
|
+
table_row.getCells.map { |td| td.asText }
|
|
66
81
|
end
|
|
67
|
-
return y
|
|
68
82
|
end
|
|
69
83
|
|
|
70
|
-
def column_values(
|
|
71
|
-
(1..row_count).
|
|
84
|
+
def column_values(column_number)
|
|
85
|
+
(1..row_count).map { |index| self[index][column_number].text }
|
|
72
86
|
end
|
|
73
87
|
|
|
74
|
-
def row_values(
|
|
75
|
-
(1..column_count(
|
|
88
|
+
def row_values(row_number)
|
|
89
|
+
(1..column_count(row_number)).map { |index| self[row_number][index].text }
|
|
76
90
|
end
|
|
77
91
|
|
|
78
92
|
end
|
|
@@ -13,12 +13,12 @@ module Celerity
|
|
|
13
13
|
|
|
14
14
|
def [](index)
|
|
15
15
|
assert_exists
|
|
16
|
-
|
|
16
|
+
TableRow.new(self, :object, @rows[index-1])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def length
|
|
20
20
|
assert_exists
|
|
21
|
-
|
|
21
|
+
@object.getRows.length
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def each
|
|
@@ -5,7 +5,9 @@ module Celerity
|
|
|
5
5
|
include Container
|
|
6
6
|
|
|
7
7
|
TAGS = [ Identifier.new('td') ]
|
|
8
|
-
ATTRIBUTES = BASE_ATTRIBUTES |
|
|
8
|
+
ATTRIBUTES = BASE_ATTRIBUTES | CELLHALIGN_ATTRIBUTES | CELLVALIGN_ATTRIBUTES |
|
|
9
|
+
[:abbr, :axis, :headers, :scope, :rowspan, :colspan]
|
|
10
|
+
|
|
9
11
|
DEFAULT_HOW = :id
|
|
10
12
|
|
|
11
13
|
alias_method :to_s, :text
|
|
@@ -13,12 +13,12 @@ module Celerity
|
|
|
13
13
|
|
|
14
14
|
def [](index)
|
|
15
15
|
assert_exists
|
|
16
|
-
|
|
16
|
+
TableRow.new(self, :object, @rows[index-1])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def length
|
|
20
20
|
assert_exists
|
|
21
|
-
|
|
21
|
+
@object.getRows.length
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def each
|
|
@@ -13,12 +13,12 @@ module Celerity
|
|
|
13
13
|
|
|
14
14
|
def [](index)
|
|
15
15
|
assert_exists
|
|
16
|
-
|
|
16
|
+
TableRow.new(self, :object, @rows[index-1])
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def length
|
|
20
20
|
assert_exists
|
|
21
|
-
|
|
21
|
+
@object.getRows.length
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def each
|
|
@@ -15,11 +15,13 @@ module Celerity
|
|
|
15
15
|
@cells.each { |cell| yield TableCell.new(self, :object, cell) }
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
def
|
|
18
|
+
def child_cell(index)
|
|
19
19
|
assert_exists
|
|
20
20
|
raise UnknownCellException, "Unable to locate a cell at index #{index}" if @cells.length < index
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
TableCell.new(self, :object, @cells[index-1])
|
|
22
23
|
end
|
|
24
|
+
alias_method :[], :child_cell
|
|
23
25
|
|
|
24
26
|
def column_count
|
|
25
27
|
assert_exists
|
|
@@ -9,6 +9,7 @@ module Celerity
|
|
|
9
9
|
Identifier.new('input', :type => ["text", "password", /^(?!(file|radio|checkbox|submit|reset|image|button|hidden)$)/]) ]
|
|
10
10
|
DEFAULT_HOW = :name
|
|
11
11
|
|
|
12
|
+
# Clear the text field.
|
|
12
13
|
def clear
|
|
13
14
|
assert_exists
|
|
14
15
|
case @object.getTagName
|
|
@@ -19,6 +20,8 @@ module Celerity
|
|
|
19
20
|
end
|
|
20
21
|
end
|
|
21
22
|
|
|
23
|
+
# Set the text field to the given value.
|
|
24
|
+
# This ensures execution of JavaScript events (onkeypress etc.), but is slower than +value=+
|
|
22
25
|
def set(value)
|
|
23
26
|
assert_enabled
|
|
24
27
|
assert_not_readonly
|
|
@@ -26,6 +29,8 @@ module Celerity
|
|
|
26
29
|
type_string(value.to_s)
|
|
27
30
|
end
|
|
28
31
|
|
|
32
|
+
# This directly sets the text field to the given value, skipping exectuion of JavaScript events.
|
|
33
|
+
# Use +set+ if you want to run events on text fields.
|
|
29
34
|
def value=(value)
|
|
30
35
|
assert_enabled
|
|
31
36
|
assert_not_readonly
|
|
@@ -36,8 +41,11 @@ module Celerity
|
|
|
36
41
|
when 'input'
|
|
37
42
|
@object.setValueAttribute(value.to_s)
|
|
38
43
|
end
|
|
44
|
+
|
|
45
|
+
value
|
|
39
46
|
end
|
|
40
47
|
|
|
48
|
+
# Returns the text in the text field.
|
|
41
49
|
def value
|
|
42
50
|
assert_exists
|
|
43
51
|
case @object.getTagName
|
|
@@ -47,7 +55,9 @@ module Celerity
|
|
|
47
55
|
@object.getValueAttribute
|
|
48
56
|
end
|
|
49
57
|
end
|
|
58
|
+
alias_method :get_contents, :value
|
|
50
59
|
|
|
60
|
+
# Append the given value to the text in the text field.
|
|
51
61
|
def append(value)
|
|
52
62
|
assert_enabled
|
|
53
63
|
assert_not_readonly
|
|
@@ -57,7 +67,12 @@ module Celerity
|
|
|
57
67
|
def type
|
|
58
68
|
assert_exists
|
|
59
69
|
type = @object.getAttributeValue('type')
|
|
60
|
-
|
|
70
|
+
|
|
71
|
+
if ['file', 'radio', 'checkbox', 'submit', 'reset', 'image', 'button', 'hidden'].include?(type)
|
|
72
|
+
type
|
|
73
|
+
else
|
|
74
|
+
'text'
|
|
75
|
+
end
|
|
61
76
|
end
|
|
62
77
|
|
|
63
78
|
# This bascially just moves the text to the other text field using TextField#append
|
|
@@ -68,17 +83,13 @@ module Celerity
|
|
|
68
83
|
self.value = ''
|
|
69
84
|
@container.text_field(how, what).append(val)
|
|
70
85
|
end
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
self.value
|
|
74
|
-
end
|
|
75
|
-
|
|
86
|
+
|
|
87
|
+
# A boolean version of Element#contains_text :P
|
|
76
88
|
def verify_contains(expected)
|
|
77
|
-
assert_exists
|
|
89
|
+
# assert_exists called by contains_text
|
|
78
90
|
!!contains_text(expected)
|
|
79
91
|
end
|
|
80
92
|
|
|
81
|
-
|
|
82
93
|
private
|
|
83
94
|
def type_string(value)
|
|
84
95
|
JavaString.new(value.to_java_bytes, @container.page.getPageEncoding).toCharArray.each do |char|
|
|
@@ -88,7 +99,7 @@ module Celerity
|
|
|
88
99
|
end
|
|
89
100
|
|
|
90
101
|
# this class can be used to access hidden field objects
|
|
91
|
-
# Normally a user would not need to create this object as it is returned by the
|
|
102
|
+
# Normally a user would not need to create this object as it is returned by the Celerity::Container#hidden method
|
|
92
103
|
class Hidden < TextField
|
|
93
104
|
TAGS = [ Identifier.new('input', :type => %w(hidden)) ]
|
|
94
105
|
DEFAULT_HOW = :name
|
data/lib/celerity/exception.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Celerity
|
|
2
2
|
module Exception
|
|
3
3
|
|
|
4
|
-
#
|
|
5
|
-
class CelerityException <
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
# Superclass for all Celerity exceptions.
|
|
5
|
+
class CelerityException < StandardError
|
|
6
|
+
def initialize(message="")
|
|
7
|
+
super(message)
|
|
8
|
+
end
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
# This exception is thrown if an attempt is made to access an object that doesn't exist
|
|
@@ -20,29 +20,22 @@ module Celerity
|
|
|
20
20
|
# This exception is thrown if an attempt is made to access a form that cannot be found
|
|
21
21
|
class UnknownFormException < CelerityException; end
|
|
22
22
|
|
|
23
|
-
# This exception is thrown if an attempt is made to access an object that is in a read
|
|
23
|
+
# This exception is thrown if an attempt is made to access an object that is in a read-only state
|
|
24
24
|
class ObjectReadOnlyException < CelerityException; end
|
|
25
25
|
|
|
26
26
|
# This exception is thrown if an attempt is made to access an object when the specified value cannot be found
|
|
27
27
|
class NoValueFoundException < CelerityException; end
|
|
28
28
|
|
|
29
|
-
# This exception gets raised if
|
|
29
|
+
# This exception gets raised if the how argument is wrong.
|
|
30
30
|
class MissingWayOfFindingObjectException < CelerityException; end
|
|
31
|
+
|
|
32
|
+
# This exception is raised if an attempt is made to access a table row that doesn't exist
|
|
33
|
+
class UnknownRowException < CelerityException; end
|
|
31
34
|
|
|
32
|
-
#
|
|
35
|
+
# This exception is raised if an attempt is made to access a table cell that doesn't exist
|
|
33
36
|
class UnknownCellException < CelerityException; end
|
|
34
37
|
|
|
35
38
|
# This exception is thrown if an http error, such as a 404, 500 etc is encountered while navigating
|
|
36
39
|
class NavigationException < CelerityException; end
|
|
37
|
-
|
|
38
|
-
# # This exception is raised if a timeout is exceeded
|
|
39
|
-
# class TimeOutException < CelerityException
|
|
40
|
-
# def initialize(duration, timeout)
|
|
41
|
-
# @duration, @timeout = duration, timeout
|
|
42
|
-
# super
|
|
43
|
-
# end
|
|
44
|
-
# attr_reader :duration, :timeout
|
|
45
|
-
# end
|
|
46
|
-
|
|
47
40
|
end
|
|
48
41
|
end
|
|
@@ -5,8 +5,7 @@ require "active_support"
|
|
|
5
5
|
#--
|
|
6
6
|
# http://api.rubyonrails.com/classes/Inflector.html#M001621
|
|
7
7
|
#++
|
|
8
|
-
|
|
9
|
-
class String
|
|
8
|
+
class String # :nodoc:
|
|
10
9
|
def underscore
|
|
11
10
|
gsub(/::/, '/').
|
|
12
11
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
|
@@ -17,10 +16,11 @@ class String
|
|
|
17
16
|
end
|
|
18
17
|
|
|
19
18
|
module Celerity
|
|
19
|
+
# Experimental
|
|
20
20
|
class MethodGenerator
|
|
21
21
|
|
|
22
|
-
ELEMENTS = %w
|
|
23
|
-
BUGGY_ELEMENTS = %w
|
|
22
|
+
ELEMENTS = %w[text_field select_list radio checkbox button].map { |e| e.to_sym }
|
|
23
|
+
BUGGY_ELEMENTS = %w[radio checkbox].map { |e| e.to_sym }
|
|
24
24
|
|
|
25
25
|
def initialize(ie, opts = {})
|
|
26
26
|
@ie = ie
|
|
@@ -108,8 +108,13 @@ module Celerity
|
|
|
108
108
|
how, what = :index, (idx + 1).to_s
|
|
109
109
|
else
|
|
110
110
|
how = :url
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
|
|
112
|
+
begin
|
|
113
|
+
uri = URI.parse(href)
|
|
114
|
+
what = Regexp.new(Regexp.escape(uri.to_s.sub(/.*#{uri.host}\//, '')))
|
|
115
|
+
rescue URI::InvalidURIError
|
|
116
|
+
what = href
|
|
117
|
+
end
|
|
113
118
|
end
|
|
114
119
|
@method << " #{@browser}.link(#{how.inspect}, #{what.inspect}).click\n"
|
|
115
120
|
end
|
|
@@ -125,7 +130,7 @@ module Celerity
|
|
|
125
130
|
|
|
126
131
|
end # MethodGenerator
|
|
127
132
|
|
|
128
|
-
class
|
|
133
|
+
class Browser
|
|
129
134
|
def generate_method(opts = {})
|
|
130
135
|
MethodGenerator.new(self, opts).parse
|
|
131
136
|
end
|
|
@@ -138,7 +143,7 @@ end # Celerity
|
|
|
138
143
|
# if __FILE__ == $0
|
|
139
144
|
# require File.dirname(__FILE__) + "/../spec/spec_helper"
|
|
140
145
|
# $stdout.sync = true
|
|
141
|
-
# @ie =
|
|
146
|
+
# @ie = Browser.new
|
|
142
147
|
# @ie.goto(TEST_HOST + "/forms_with_input_elements.html")
|
|
143
148
|
#
|
|
144
149
|
# puts MethodGenerator.new(@ie).parse
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
wget http://mirrors.sunsite.dk/maven2/commons-codec/commons-codec/1.3/commons-codec-1.3.jar
|
|
2
|
+
wget http://mirrors.sunsite.dk/maven2/commons-collections/commons-collections/3.2/commons-collections-3.2.jar
|
|
3
|
+
# wget http://mirrors.sunsite.dk/maven2/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar
|
|
4
|
+
wget http://mirrors.sunsite.dk/maven2/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar
|
|
5
|
+
wget http://mirrors.sunsite.dk/maven2/commons-io/commons-io/1.4/commons-io-1.4.jar
|
|
6
|
+
wget http://mirrors.sunsite.dk/maven2/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
|
|
7
|
+
wget http://mirrors.sunsite.dk/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
|
|
8
|
+
wget http://mirrors.sunsite.dk/maven2/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar
|
|
9
|
+
# wget http://mirrors.sunsite.dk/maven2/gsbase/gsbase/2.0.1/gsbase-2.0.1.jar
|
|
10
|
+
wget http://mirrors.sunsite.dk/maven2/net/sourceforge/htmlunit/htmlunit-core-js/0.1-SNAPSHOT/htmlunit-core-js-0.1-SNAPSHOT.jar
|
|
11
|
+
# wget http://mirrors.sunsite.dk/maven2/org/mortbay/jetty/jetty/6.1.9/jetty-6.1.9.jar
|
|
12
|
+
# wget http://mirrors.sunsite.dk/maven2/org/mortbay/jetty/jetty-util/6.1.9/jetty-util-6.1.9.jar
|
|
13
|
+
# wget http://mirrors.sunsite.dk/maven2/junit/junit/4.4/junit-4.4.jar
|
|
14
|
+
# wget http://mirrors.sunsite.dk/maven2/junitperf/junitperf/1.8/junitperf-1.8.jar
|
|
15
|
+
# wget http://mirrors.sunsite.dk/maven2/log4j/log4j/1.2.14/log4j-1.2.14.jar
|
|
16
|
+
wget http://mirrors.sunsite.dk/maven2/net/sourceforge/nekohtml/nekohtml/1.9.8-SNAPSHOT/nekohtml-1.9.8-SNAPSHOT.jar
|
|
17
|
+
wget http://mirrors.sunsite.dk/maven2/org/w3c/css/sac/1.3/sac-1.3.jar
|
|
18
|
+
# wget http://mirrors.sunsite.dk/maven2/org/mortbay/jetty/servlet-api-2.5/6.1.9/servlet-api-2.5-6.1.9.jar
|
|
19
|
+
# wget http://mirrors.sunsite.dk/maven2/org/slf4j/slf4j-api/1.4.3/slf4j-api-1.4.3.jar
|
|
20
|
+
# wget http://mirrors.sunsite.dk/maven2/org/slf4j/slf4j-log4j12/1.4.3/slf4j-log4j12-1.4.3.jar
|
|
21
|
+
wget http://mirrors.sunsite.dk/maven2/xalan/xalan/2.7.0/xalan-2.7.0.jar
|
|
22
|
+
wget http://mirrors.sunsite.dk/maven2/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar
|
|
23
|
+
wget http://mirrors.sunsite.dk/maven2/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
|