watir 6.13.0 → 6.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +141 -0
- data/.travis.yml +6 -0
- data/CHANGES.md +12 -0
- data/Gemfile +4 -10
- data/README.md +64 -49
- data/Rakefile +28 -16
- data/lib/watir.rb +13 -15
- data/lib/watir/adjacent.rb +15 -13
- data/lib/watir/after_hooks.rb +8 -10
- data/lib/watir/alert.rb +7 -8
- data/lib/watir/aliases.rb +2 -2
- data/lib/watir/attribute_helper.rb +18 -20
- data/lib/watir/browser.rb +42 -75
- data/lib/watir/capabilities.rb +19 -10
- data/lib/watir/cell_container.rb +0 -2
- data/lib/watir/container.rb +4 -4
- data/lib/watir/cookies.rb +7 -8
- data/lib/watir/element_collection.rb +37 -22
- data/lib/watir/elements/area.rb +0 -2
- data/lib/watir/elements/button.rb +1 -3
- data/lib/watir/elements/cell.rb +0 -1
- data/lib/watir/elements/checkbox.rb +5 -7
- data/lib/watir/elements/date_field.rb +5 -9
- data/lib/watir/elements/date_time_field.rb +6 -10
- data/lib/watir/elements/dlist.rb +2 -4
- data/lib/watir/elements/element.rb +201 -99
- data/lib/watir/elements/file_field.rb +3 -4
- data/lib/watir/elements/font.rb +2 -4
- data/lib/watir/elements/form.rb +0 -2
- data/lib/watir/elements/hidden.rb +3 -4
- data/lib/watir/elements/html_elements.rb +24 -76
- data/lib/watir/elements/iframe.rb +57 -71
- data/lib/watir/elements/image.rb +3 -4
- data/lib/watir/elements/input.rb +0 -2
- data/lib/watir/elements/link.rb +2 -5
- data/lib/watir/elements/list.rb +4 -4
- data/lib/watir/elements/option.rb +3 -6
- data/lib/watir/elements/radio.rb +4 -6
- data/lib/watir/elements/row.rb +0 -1
- data/lib/watir/elements/select.rb +41 -43
- data/lib/watir/elements/svg_elements.rb +0 -116
- data/lib/watir/elements/table.rb +1 -2
- data/lib/watir/elements/table_cell.rb +2 -3
- data/lib/watir/elements/text_field.rb +4 -6
- data/lib/watir/exception.rb +0 -1
- data/lib/watir/extensions/nokogiri.rb +2 -4
- data/lib/watir/generator.rb +3 -3
- data/lib/watir/generator/base.rb +10 -10
- data/lib/watir/generator/base/generator.rb +26 -29
- data/lib/watir/generator/base/idl_sorter.rb +34 -32
- data/lib/watir/generator/base/spec_extractor.rb +132 -114
- data/lib/watir/generator/base/util.rb +1 -3
- data/lib/watir/generator/base/visitor.rb +140 -140
- data/lib/watir/generator/html.rb +4 -4
- data/lib/watir/generator/html/generator.rb +2 -4
- data/lib/watir/generator/html/spec_extractor.rb +33 -33
- data/lib/watir/generator/html/visitor.rb +14 -14
- data/lib/watir/generator/svg.rb +3 -3
- data/lib/watir/generator/svg/generator.rb +1 -3
- data/lib/watir/generator/svg/spec_extractor.rb +35 -35
- data/lib/watir/generator/svg/visitor.rb +14 -14
- data/lib/watir/has_window.rb +2 -4
- data/lib/watir/js_execution.rb +7 -9
- data/lib/watir/js_snippets.rb +3 -3
- data/lib/watir/js_snippets/attributeValues.js +11 -0
- data/lib/watir/legacy_wait.rb +7 -12
- data/lib/watir/locators.rb +9 -11
- data/lib/watir/locators/button/locator.rb +2 -3
- data/lib/watir/locators/button/selector_builder.rb +9 -9
- data/lib/watir/locators/button/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/button/validator.rb +2 -2
- data/lib/watir/locators/cell/locator.rb +0 -2
- data/lib/watir/locators/cell/selector_builder.rb +3 -5
- data/lib/watir/locators/element/locator.rb +85 -64
- data/lib/watir/locators/element/selector_builder.rb +40 -38
- data/lib/watir/locators/element/selector_builder/xpath.rb +20 -18
- data/lib/watir/locators/element/validator.rb +1 -1
- data/lib/watir/locators/row/locator.rb +0 -2
- data/lib/watir/locators/row/selector_builder.rb +6 -9
- data/lib/watir/locators/text_area/selector_builder.rb +1 -1
- data/lib/watir/locators/text_field/locator.rb +1 -3
- data/lib/watir/locators/text_field/selector_builder.rb +5 -5
- data/lib/watir/locators/text_field/selector_builder/xpath.rb +1 -1
- data/lib/watir/locators/text_field/validator.rb +3 -2
- data/lib/watir/logger.rb +11 -21
- data/lib/watir/navigation.rb +49 -0
- data/lib/watir/radio_set.rb +17 -18
- data/lib/watir/row_container.rb +3 -5
- data/lib/watir/screenshot.rb +2 -4
- data/lib/watir/user_editable.rb +13 -8
- data/lib/watir/version.rb +3 -0
- data/lib/watir/wait.rb +56 -55
- data/lib/watir/wait/timer.rb +1 -3
- data/lib/watir/window.rb +36 -45
- data/lib/watir/xpath_support.rb +1 -3
- data/lib/watirspec.rb +11 -11
- data/lib/watirspec/guards.rb +10 -7
- data/lib/watirspec/implementation.rb +3 -4
- data/lib/watirspec/rake_tasks.rb +30 -29
- data/lib/watirspec/remote_server.rb +3 -3
- data/lib/watirspec/runner.rb +1 -2
- data/lib/watirspec/server.rb +3 -0
- data/lib/watirspec/server/app.rb +14 -6
- data/spec/implementation_spec.rb +9 -9
- data/spec/locator_spec_helper.rb +3 -4
- data/spec/spec_helper.rb +3 -7
- data/spec/unit/container_spec.rb +9 -10
- data/spec/unit/element_locator_spec.rb +224 -219
- data/spec/unit/logger_spec.rb +4 -4
- data/spec/unit/unit_helper.rb +0 -2
- data/spec/unit/wait_spec.rb +26 -28
- data/spec/watirspec/adjacent_spec.rb +130 -130
- data/spec/watirspec/after_hooks_spec.rb +63 -63
- data/spec/watirspec/alert_spec.rb +6 -6
- data/spec/watirspec/attributes_spec.rb +6 -6
- data/spec/watirspec/browser_spec.rb +161 -162
- data/spec/watirspec/click_spec.rb +9 -9
- data/spec/watirspec/cookies_spec.rb +15 -14
- data/spec/watirspec/drag_and_drop_spec.rb +15 -16
- data/spec/watirspec/element_hidden_spec.rb +19 -21
- data/spec/watirspec/elements/area_spec.rb +18 -21
- data/spec/watirspec/elements/areas_spec.rb +13 -15
- data/spec/watirspec/elements/button_spec.rb +96 -99
- data/spec/watirspec/elements/buttons_spec.rb +17 -19
- data/spec/watirspec/elements/checkbox_spec.rb +102 -100
- data/spec/watirspec/elements/checkboxes_spec.rb +13 -15
- data/spec/watirspec/elements/collections_spec.rb +35 -37
- data/spec/watirspec/elements/date_field_spec.rb +46 -47
- data/spec/watirspec/elements/date_fields_spec.rb +13 -15
- data/spec/watirspec/elements/date_time_field_spec.rb +62 -57
- data/spec/watirspec/elements/date_time_fields_spec.rb +14 -15
- data/spec/watirspec/elements/dd_spec.rb +46 -48
- data/spec/watirspec/elements/dds_spec.rb +13 -15
- data/spec/watirspec/elements/del_spec.rb +27 -28
- data/spec/watirspec/elements/dels_spec.rb +13 -15
- data/spec/watirspec/elements/div_spec.rb +89 -91
- data/spec/watirspec/elements/divs_spec.rb +17 -19
- data/spec/watirspec/elements/dl_spec.rb +52 -54
- data/spec/watirspec/elements/dls_spec.rb +13 -15
- data/spec/watirspec/elements/dt_spec.rb +46 -48
- data/spec/watirspec/elements/dts_spec.rb +13 -15
- data/spec/watirspec/elements/element_spec.rb +240 -189
- data/spec/watirspec/elements/elements_spec.rb +16 -16
- data/spec/watirspec/elements/em_spec.rb +38 -40
- data/spec/watirspec/elements/ems_spec.rb +13 -15
- data/spec/watirspec/elements/filefield_spec.rb +45 -46
- data/spec/watirspec/elements/filefields_spec.rb +13 -15
- data/spec/watirspec/elements/font_spec.rb +11 -13
- data/spec/watirspec/elements/form_spec.rb +13 -15
- data/spec/watirspec/elements/forms_spec.rb +13 -15
- data/spec/watirspec/elements/frame_spec.rb +48 -50
- data/spec/watirspec/elements/frames_spec.rb +13 -15
- data/spec/watirspec/elements/hidden_spec.rb +23 -25
- data/spec/watirspec/elements/hiddens_spec.rb +13 -15
- data/spec/watirspec/elements/hn_spec.rb +22 -24
- data/spec/watirspec/elements/hns_spec.rb +13 -13
- data/spec/watirspec/elements/iframe_spec.rb +106 -74
- data/spec/watirspec/elements/iframes_spec.rb +16 -18
- data/spec/watirspec/elements/image_spec.rb +30 -32
- data/spec/watirspec/elements/images_spec.rb +13 -15
- data/spec/watirspec/elements/input_spec.rb +4 -5
- data/spec/watirspec/elements/ins_spec.rb +27 -29
- data/spec/watirspec/elements/inses_spec.rb +13 -15
- data/spec/watirspec/elements/label_spec.rb +17 -19
- data/spec/watirspec/elements/labels_spec.rb +13 -15
- data/spec/watirspec/elements/li_spec.rb +23 -25
- data/spec/watirspec/elements/link_spec.rb +45 -48
- data/spec/watirspec/elements/links_spec.rb +14 -16
- data/spec/watirspec/elements/lis_spec.rb +13 -15
- data/spec/watirspec/elements/list_spec.rb +14 -15
- data/spec/watirspec/elements/map_spec.rb +19 -20
- data/spec/watirspec/elements/maps_spec.rb +13 -15
- data/spec/watirspec/elements/meta_spec.rb +10 -10
- data/spec/watirspec/elements/metas_spec.rb +13 -15
- data/spec/watirspec/elements/ol_spec.rb +20 -21
- data/spec/watirspec/elements/ols_spec.rb +13 -15
- data/spec/watirspec/elements/option_spec.rb +63 -63
- data/spec/watirspec/elements/p_spec.rb +27 -26
- data/spec/watirspec/elements/pre_spec.rb +24 -25
- data/spec/watirspec/elements/pres_spec.rb +13 -15
- data/spec/watirspec/elements/ps_spec.rb +13 -15
- data/spec/watirspec/elements/radio_spec.rb +96 -97
- data/spec/watirspec/elements/radios_spec.rb +13 -15
- data/spec/watirspec/elements/select_list_spec.rb +244 -237
- data/spec/watirspec/elements/select_lists_spec.rb +15 -16
- data/spec/watirspec/elements/span_spec.rb +32 -31
- data/spec/watirspec/elements/spans_spec.rb +13 -15
- data/spec/watirspec/elements/strong_spec.rb +23 -24
- data/spec/watirspec/elements/strongs_spec.rb +13 -15
- data/spec/watirspec/elements/table_nesting_spec.rb +15 -14
- data/spec/watirspec/elements/table_spec.rb +61 -62
- data/spec/watirspec/elements/tables_spec.rb +15 -17
- data/spec/watirspec/elements/tbody_spec.rb +25 -26
- data/spec/watirspec/elements/tbodys_spec.rb +17 -19
- data/spec/watirspec/elements/td_spec.rb +20 -22
- data/spec/watirspec/elements/tds_spec.rb +9 -11
- data/spec/watirspec/elements/text_field_spec.rb +55 -56
- data/spec/watirspec/elements/text_fields_spec.rb +15 -16
- data/spec/watirspec/elements/textarea_spec.rb +2 -2
- data/spec/watirspec/elements/textareas_spec.rb +1 -1
- data/spec/watirspec/elements/tfoot_spec.rb +22 -23
- data/spec/watirspec/elements/tfoots_spec.rb +19 -19
- data/spec/watirspec/elements/thead_spec.rb +21 -23
- data/spec/watirspec/elements/theads_spec.rb +19 -19
- data/spec/watirspec/elements/tr_spec.rb +20 -22
- data/spec/watirspec/elements/trs_spec.rb +17 -19
- data/spec/watirspec/elements/ul_spec.rb +17 -19
- data/spec/watirspec/elements/uls_spec.rb +13 -14
- data/spec/watirspec/html/data_attributes.html +1 -0
- data/spec/watirspec/radio_set_spec.rb +100 -99
- data/spec/watirspec/relaxed_locate_spec.rb +19 -43
- data/spec/watirspec/screenshot_spec.rb +4 -4
- data/spec/watirspec/special_chars_spec.rb +2 -4
- data/spec/watirspec/support/rspec_matchers.rb +85 -22
- data/spec/watirspec/user_editable_spec.rb +84 -85
- data/spec/watirspec/wait_spec.rb +74 -95
- data/spec/watirspec/window_switching_spec.rb +131 -132
- data/spec/watirspec_helper.rb +12 -9
- data/support/travis.sh +4 -0
- data/support/version_differ.rb +12 -13
- data/watir.gemspec +29 -22
- metadata +76 -50
@@ -1,31 +1,31 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "DateTimeFields" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'DateTimeFields' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
|
7
6
|
end
|
8
7
|
|
9
|
-
describe
|
10
|
-
it
|
11
|
-
|
8
|
+
describe 'with selectors' do
|
9
|
+
it 'returns the matching elements' do
|
10
|
+
list = [browser.date_time_field(name: 'html5_datetime-local')]
|
11
|
+
expect(browser.date_time_fields(name: 'html5_datetime-local').to_a).to eq list
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
describe
|
16
|
-
it
|
15
|
+
describe '#length' do
|
16
|
+
it 'returns the number of date_time_fields' do
|
17
17
|
expect(browser.date_time_fields.length).to eq 1
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
expect(browser.date_time_fields[0].id).to eq
|
21
|
+
describe '#[]' do
|
22
|
+
it 'returns the date_time_field at the given index' do
|
23
|
+
expect(browser.date_time_fields[0].id).to eq 'html5_datetime-local'
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
describe
|
28
|
-
it
|
27
|
+
describe '#each' do
|
28
|
+
it 'iterates through date_time_fields correctly' do
|
29
29
|
count = 0
|
30
30
|
|
31
31
|
browser.date_time_fields.each_with_index do |c, index|
|
@@ -40,5 +40,4 @@ describe "DateTimeFields" do
|
|
40
40
|
expect(count).to be > 0
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
43
|
end
|
@@ -1,26 +1,25 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Dd" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'Dd' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('definition_lists.html'))
|
7
6
|
end
|
8
7
|
|
9
8
|
# Exists method
|
10
|
-
describe
|
11
|
-
it
|
12
|
-
expect(browser.dd(id:
|
13
|
-
expect(browser.dd(class:
|
9
|
+
describe '#exists?' do
|
10
|
+
it 'returns true if the element exists' do
|
11
|
+
expect(browser.dd(id: 'someone')).to exist
|
12
|
+
expect(browser.dd(class: 'name')).to exist
|
14
13
|
expect(browser.dd(xpath: "//dd[@id='someone']")).to exist
|
15
14
|
expect(browser.dd(index: 0)).to exist
|
16
15
|
end
|
17
16
|
|
18
|
-
it
|
17
|
+
it 'returns the first dd if given no args' do
|
19
18
|
expect(browser.dd).to exist
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
23
|
-
expect(browser.dd(id:
|
21
|
+
it 'returns false if the element does not exist' do
|
22
|
+
expect(browser.dd(id: 'no_such_id')).to_not exist
|
24
23
|
end
|
25
24
|
|
26
25
|
it "raises TypeError when 'what' argument is invalid" do
|
@@ -29,66 +28,66 @@ describe "Dd" do
|
|
29
28
|
end
|
30
29
|
|
31
30
|
# Attribute methods
|
32
|
-
describe
|
33
|
-
it
|
34
|
-
expect(browser.dd(id:
|
31
|
+
describe '#class_name' do
|
32
|
+
it 'returns the class attribute if the element exists' do
|
33
|
+
expect(browser.dd(id: 'someone').class_name).to eq 'name'
|
35
34
|
end
|
36
35
|
|
37
36
|
it "returns an empty string if the element exists but the attribute doesn't" do
|
38
|
-
expect(browser.dd(id:
|
37
|
+
expect(browser.dd(id: 'city').class_name).to eq ''
|
39
38
|
end
|
40
39
|
|
41
|
-
it
|
42
|
-
expect { browser.dd(id:
|
43
|
-
expect { browser.dd(title:
|
40
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
41
|
+
expect { browser.dd(id: 'no_such_id').class_name }.to raise_unknown_object_exception
|
42
|
+
expect { browser.dd(title: 'no_such_title').class_name }.to raise_unknown_object_exception
|
44
43
|
expect { browser.dd(index: 1337).class_name }.to raise_unknown_object_exception
|
45
44
|
expect { browser.dd(xpath: "//dd[@id='no_such_id']").class_name }.to raise_unknown_object_exception
|
46
45
|
end
|
47
46
|
end
|
48
47
|
|
49
|
-
describe
|
50
|
-
it
|
51
|
-
expect(browser.dd(class: 'name').id).to eq
|
48
|
+
describe '#id' do
|
49
|
+
it 'returns the id attribute if the element exists' do
|
50
|
+
expect(browser.dd(class: 'name').id).to eq 'someone'
|
52
51
|
end
|
53
52
|
|
54
53
|
it "returns an empty string if the element exists, but the attribute doesn't" do
|
55
|
-
expect(browser.dd(class: 'address').id).to eq
|
54
|
+
expect(browser.dd(class: 'address').id).to eq ''
|
56
55
|
end
|
57
56
|
|
58
|
-
it
|
59
|
-
expect {browser.dd(id:
|
60
|
-
expect {browser.dd(title:
|
61
|
-
expect {browser.dd(index: 1337).id }.to raise_unknown_object_exception
|
57
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
58
|
+
expect { browser.dd(id: 'no_such_id').id }.to raise_unknown_object_exception
|
59
|
+
expect { browser.dd(title: 'no_such_id').id }.to raise_unknown_object_exception
|
60
|
+
expect { browser.dd(index: 1337).id }.to raise_unknown_object_exception
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
|
-
describe
|
66
|
-
it
|
67
|
-
expect(browser.dd(class:
|
64
|
+
describe '#title' do
|
65
|
+
it 'returns the title of the element' do
|
66
|
+
expect(browser.dd(class: 'name').title).to eq 'someone'
|
68
67
|
end
|
69
68
|
end
|
70
69
|
|
71
|
-
describe
|
72
|
-
it
|
73
|
-
expect(browser.dd(id:
|
70
|
+
describe '#text' do
|
71
|
+
it 'returns the text of the element' do
|
72
|
+
expect(browser.dd(id: 'someone').text).to eq 'John Doe'
|
74
73
|
end
|
75
74
|
|
76
|
-
bug
|
77
|
-
it
|
78
|
-
expect(browser.dd(class: 'noop').text).to eq
|
75
|
+
bug 'Safari does not strip text', :safari do
|
76
|
+
it 'returns an empty string if the element exists but contains no text' do
|
77
|
+
expect(browser.dd(class: 'noop').text).to eq ''
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
82
|
-
it
|
83
|
-
expect { browser.dd(id:
|
84
|
-
expect { browser.dd(title:
|
81
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
82
|
+
expect { browser.dd(id: 'no_such_id').text }.to raise_unknown_object_exception
|
83
|
+
expect { browser.dd(title: 'no_such_title').text }.to raise_unknown_object_exception
|
85
84
|
expect { browser.dd(index: 1337).text }.to raise_unknown_object_exception
|
86
85
|
expect { browser.dd(xpath: "//dd[@id='no_such_id']").text }.to raise_unknown_object_exception
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
90
|
-
describe
|
91
|
-
it
|
89
|
+
describe '#respond_to?' do
|
90
|
+
it 'returns true for all attribute methods' do
|
92
91
|
expect(browser.dd(index: 0)).to respond_to(:id)
|
93
92
|
expect(browser.dd(index: 0)).to respond_to(:class_name)
|
94
93
|
expect(browser.dd(index: 0)).to respond_to(:style)
|
@@ -98,27 +97,26 @@ describe "Dd" do
|
|
98
97
|
end
|
99
98
|
|
100
99
|
# Manipulation methods
|
101
|
-
describe
|
102
|
-
it
|
100
|
+
describe '#click' do
|
101
|
+
it 'fires events when clicked' do
|
103
102
|
expect(browser.dd(title: 'education').text).to_not eq 'changed'
|
104
103
|
browser.dd(title: 'education').click
|
105
104
|
expect(browser.dd(title: 'education').text).to eq 'changed'
|
106
105
|
end
|
107
106
|
|
108
|
-
it
|
109
|
-
expect { browser.dd(id:
|
110
|
-
expect { browser.dd(title:
|
107
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
108
|
+
expect { browser.dd(id: 'no_such_id').click }.to raise_unknown_object_exception
|
109
|
+
expect { browser.dd(title: 'no_such_title').click }.to raise_unknown_object_exception
|
111
110
|
expect { browser.dd(index: 1337).click }.to raise_unknown_object_exception
|
112
111
|
expect { browser.dd(xpath: "//dd[@id='no_such_id']").click }.to raise_unknown_object_exception
|
113
112
|
end
|
114
113
|
end
|
115
114
|
|
116
|
-
describe
|
117
|
-
it
|
115
|
+
describe '#html' do
|
116
|
+
it 'returns the HTML of the element' do
|
118
117
|
html = browser.dd(id: 'someone').html
|
119
118
|
expect(html).to match(/John Doe/m)
|
120
119
|
expect(html).to_not include('</body>')
|
121
120
|
end
|
122
121
|
end
|
123
|
-
|
124
122
|
end
|
@@ -1,31 +1,30 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Dds" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'Dds' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('definition_lists.html'))
|
7
6
|
end
|
8
7
|
|
9
|
-
describe
|
10
|
-
it
|
11
|
-
expect(browser.dds(text:
|
8
|
+
describe 'with selectors' do
|
9
|
+
it 'returns the matching elements' do
|
10
|
+
expect(browser.dds(text: '11 years').to_a).to eq [browser.dd(text: '11 years')]
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
describe
|
16
|
-
it
|
14
|
+
describe '#length' do
|
15
|
+
it 'returns the number of dds' do
|
17
16
|
expect(browser.dds.length).to eq 11
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
expect(browser.dds[1].title).to eq
|
20
|
+
describe '#[]' do
|
21
|
+
it 'returns the dd at the given index' do
|
22
|
+
expect(browser.dds[1].title).to eq 'education'
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
describe
|
28
|
-
it
|
26
|
+
describe '#each' do
|
27
|
+
it 'iterates through dds correctly' do
|
29
28
|
count = 0
|
30
29
|
|
31
30
|
browser.dds.each_with_index do |d, index|
|
@@ -38,5 +37,4 @@ describe "Dds" do
|
|
38
37
|
expect(count).to be > 0
|
39
38
|
end
|
40
39
|
end
|
41
|
-
|
42
40
|
end
|
@@ -1,34 +1,33 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Del" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'Del' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('non_control_elements.html'))
|
7
6
|
end
|
8
7
|
|
9
8
|
# Exists method
|
10
|
-
describe
|
9
|
+
describe '#exist?' do
|
11
10
|
it "returns true if the 'del' exists" do
|
12
|
-
expect(browser.del(id:
|
11
|
+
expect(browser.del(id: 'lead')).to exist
|
13
12
|
expect(browser.del(id: /lead/)).to exist
|
14
|
-
expect(browser.del(text:
|
13
|
+
expect(browser.del(text: 'This is a deleted text tag 1')).to exist
|
15
14
|
expect(browser.del(text: /This is a deleted text tag 1/)).to exist
|
16
|
-
expect(browser.del(class:
|
15
|
+
expect(browser.del(class: 'lead')).to exist
|
17
16
|
expect(browser.del(class: /lead/)).to exist
|
18
17
|
expect(browser.del(index: 0)).to exist
|
19
18
|
expect(browser.del(xpath: "//del[@id='lead']")).to exist
|
20
19
|
end
|
21
20
|
|
22
|
-
it
|
21
|
+
it 'returns the first del if given no args' do
|
23
22
|
expect(browser.del).to exist
|
24
23
|
end
|
25
24
|
|
26
25
|
it "returns false if the element doesn't exist" do
|
27
|
-
expect(browser.del(id:
|
26
|
+
expect(browser.del(id: 'no_such_id')).to_not exist
|
28
27
|
expect(browser.del(id: /no_such_id/)).to_not exist
|
29
|
-
expect(browser.del(text:
|
28
|
+
expect(browser.del(text: 'no_such_text')).to_not exist
|
30
29
|
expect(browser.del(text: /no_such_text/)).to_not exist
|
31
|
-
expect(browser.del(class:
|
30
|
+
expect(browser.del(class: 'no_such_class')).to_not exist
|
32
31
|
expect(browser.del(class: /no_such_class/)).to_not exist
|
33
32
|
expect(browser.del(index: 1337)).to_not exist
|
34
33
|
expect(browser.del(xpath: "//del[@id='no_such_id']")).to_not exist
|
@@ -40,8 +39,8 @@ describe "Del" do
|
|
40
39
|
end
|
41
40
|
|
42
41
|
# Attribute methods
|
43
|
-
describe
|
44
|
-
it
|
42
|
+
describe '#class_name' do
|
43
|
+
it 'returns the class attribute' do
|
45
44
|
expect(browser.del(index: 0).class_name).to eq 'lead'
|
46
45
|
end
|
47
46
|
|
@@ -54,9 +53,9 @@ describe "Del" do
|
|
54
53
|
end
|
55
54
|
end
|
56
55
|
|
57
|
-
describe
|
58
|
-
it
|
59
|
-
expect(browser.del(index: 0).id).to eq
|
56
|
+
describe '#id' do
|
57
|
+
it 'returns the id attribute' do
|
58
|
+
expect(browser.del(index: 0).id).to eq 'lead'
|
60
59
|
end
|
61
60
|
|
62
61
|
it "returns an empty string if the element exists and the attribute doesn't" do
|
@@ -64,13 +63,13 @@ describe "Del" do
|
|
64
63
|
end
|
65
64
|
|
66
65
|
it "raises UnknownObjectException if the del doesn't exist" do
|
67
|
-
expect { browser.del(id:
|
66
|
+
expect { browser.del(id: 'no_such_id').id }.to raise_unknown_object_exception
|
68
67
|
expect { browser.del(index: 1337).id }.to raise_unknown_object_exception
|
69
68
|
end
|
70
69
|
end
|
71
70
|
|
72
|
-
describe
|
73
|
-
it
|
71
|
+
describe '#title' do
|
72
|
+
it 'returns the title attribute' do
|
74
73
|
expect(browser.del(index: 0).title).to eq 'Lorem ipsum'
|
75
74
|
end
|
76
75
|
|
@@ -84,8 +83,8 @@ describe "Del" do
|
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
87
|
-
describe
|
88
|
-
it
|
86
|
+
describe '#text' do
|
87
|
+
it 'returns the text of the del' do
|
89
88
|
expect(browser.del(index: 1).text).to eq 'This is a deleted text tag 2'
|
90
89
|
end
|
91
90
|
|
@@ -99,8 +98,8 @@ describe "Del" do
|
|
99
98
|
end
|
100
99
|
end
|
101
100
|
|
102
|
-
describe
|
103
|
-
it
|
101
|
+
describe '#respond_to?' do
|
102
|
+
it 'returns true for all attribute methods' do
|
104
103
|
expect(browser.del(index: 0)).to respond_to(:class_name)
|
105
104
|
expect(browser.del(index: 0)).to respond_to(:id)
|
106
105
|
expect(browser.del(index: 0)).to respond_to(:title)
|
@@ -110,16 +109,16 @@ describe "Del" do
|
|
110
109
|
|
111
110
|
# Other
|
112
111
|
not_compliant_on :headless do
|
113
|
-
describe
|
114
|
-
it
|
112
|
+
describe '#click' do
|
113
|
+
it 'fires events' do
|
115
114
|
expect(browser.del(class: 'footer').text).to_not include('Javascript')
|
116
115
|
browser.del(class: 'footer').click
|
117
116
|
expect(browser.del(class: 'footer').text).to include('Javascript')
|
118
117
|
end
|
119
118
|
|
120
119
|
it "raises UnknownObjectException if the del doesn't exist" do
|
121
|
-
expect { browser.del(id:
|
122
|
-
expect { browser.del(title:
|
120
|
+
expect { browser.del(id: 'no_such_id').click }.to raise_unknown_object_exception
|
121
|
+
expect { browser.del(title: 'no_such_title').click }.to raise_unknown_object_exception
|
123
122
|
end
|
124
123
|
end
|
125
124
|
end
|
@@ -1,31 +1,30 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Dels" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'Dels' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('non_control_elements.html'))
|
7
6
|
end
|
8
7
|
|
9
|
-
describe
|
10
|
-
it
|
11
|
-
expect(browser.dels(class:
|
8
|
+
describe 'with selectors' do
|
9
|
+
it 'returns the matching elements' do
|
10
|
+
expect(browser.dels(class: 'lead').to_a).to eq [browser.del(class: 'lead')]
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
describe
|
16
|
-
it
|
14
|
+
describe '#length' do
|
15
|
+
it 'returns the number of dels' do
|
17
16
|
expect(browser.dels.length).to eq 5
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
describe
|
22
|
-
it
|
23
|
-
expect(browser.dels[0].id).to eq
|
20
|
+
describe '#[]' do
|
21
|
+
it 'returns the del at the given index' do
|
22
|
+
expect(browser.dels[0].id).to eq 'lead'
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
27
|
-
describe
|
28
|
-
it
|
26
|
+
describe '#each' do
|
27
|
+
it 'iterates through dels correctly' do
|
29
28
|
count = 0
|
30
29
|
|
31
30
|
browser.dels.each_with_index do |s, index|
|
@@ -36,5 +35,4 @@ describe "Dels" do
|
|
36
35
|
expect(count).to be > 0
|
37
36
|
end
|
38
37
|
end
|
39
|
-
|
40
38
|
end
|
@@ -1,40 +1,39 @@
|
|
1
|
-
require
|
2
|
-
|
3
|
-
describe "Div" do
|
1
|
+
require 'watirspec_helper'
|
4
2
|
|
3
|
+
describe 'Div' do
|
5
4
|
before :each do
|
6
|
-
browser.goto(WatirSpec.url_for(
|
5
|
+
browser.goto(WatirSpec.url_for('non_control_elements.html'))
|
7
6
|
end
|
8
7
|
|
9
8
|
# Exists method
|
10
|
-
describe
|
11
|
-
it
|
12
|
-
expect(browser.div(id:
|
9
|
+
describe '#exists?' do
|
10
|
+
it 'returns true if the element exists' do
|
11
|
+
expect(browser.div(id: 'header')).to exist
|
13
12
|
expect(browser.div(id: /header/)).to exist
|
14
|
-
expect(browser.div(title:
|
13
|
+
expect(browser.div(title: 'Header and primary navigation')).to exist
|
15
14
|
expect(browser.div(title: /Header and primary navigation/)).to exist
|
16
|
-
expect(browser.div(text:
|
15
|
+
expect(browser.div(text: 'Not shownNot hidden')).to exist
|
17
16
|
expect(browser.div(text: /Not hidden/)).to exist
|
18
|
-
expect(browser.div(class:
|
17
|
+
expect(browser.div(class: 'profile')).to exist
|
19
18
|
expect(browser.div(class: /profile/)).to exist
|
20
19
|
expect(browser.div(index: 0)).to exist
|
21
20
|
expect(browser.div(xpath: "//div[@id='header']")).to exist
|
22
|
-
expect(browser.div(custom_attribute:
|
21
|
+
expect(browser.div(custom_attribute: 'custom')).to exist
|
23
22
|
expect(browser.div(custom_attribute: /custom/)).to exist
|
24
23
|
end
|
25
24
|
|
26
|
-
it
|
25
|
+
it 'returns the first div if given no args' do
|
27
26
|
expect(browser.div).to exist
|
28
27
|
end
|
29
28
|
|
30
|
-
it
|
31
|
-
expect(browser.div(id:
|
29
|
+
it 'returns false if the element does not exist' do
|
30
|
+
expect(browser.div(id: 'no_such_id')).to_not exist
|
32
31
|
expect(browser.div(id: /no_such_id/)).to_not exist
|
33
|
-
expect(browser.div(title:
|
32
|
+
expect(browser.div(title: 'no_such_title')).to_not exist
|
34
33
|
expect(browser.div(title: /no_such_title/)).to_not exist
|
35
|
-
expect(browser.div(text:
|
34
|
+
expect(browser.div(text: 'no_such_text')).to_not exist
|
36
35
|
expect(browser.div(text: /no_such_text/)).to_not exist
|
37
|
-
expect(browser.div(class:
|
36
|
+
expect(browser.div(class: 'no_such_class')).to_not exist
|
38
37
|
expect(browser.div(class: /no_such_class/)).to_not exist
|
39
38
|
expect(browser.div(index: 1337)).to_not exist
|
40
39
|
expect(browser.div(xpath: "//div[@id='no_such_id']")).to_not exist
|
@@ -46,98 +45,98 @@ describe "Div" do
|
|
46
45
|
end
|
47
46
|
|
48
47
|
# Attribute methods
|
49
|
-
describe
|
50
|
-
it
|
51
|
-
expect(browser.div(id:
|
48
|
+
describe '#class_name' do
|
49
|
+
it 'returns the class attribute if the element exists' do
|
50
|
+
expect(browser.div(id: 'footer').class_name).to eq 'profile'
|
52
51
|
end
|
53
52
|
|
54
53
|
it "returns an empty string if the element exists but the attribute doesn't" do
|
55
|
-
expect(browser.div(id:
|
54
|
+
expect(browser.div(id: 'content').class_name).to eq ''
|
56
55
|
end
|
57
56
|
|
58
|
-
it
|
59
|
-
expect { browser.div(id:
|
60
|
-
expect { browser.div(title:
|
57
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
58
|
+
expect { browser.div(id: 'no_such_id').class_name }.to raise_unknown_object_exception
|
59
|
+
expect { browser.div(title: 'no_such_title').class_name }.to raise_unknown_object_exception
|
61
60
|
expect { browser.div(index: 1337).class_name }.to raise_unknown_object_exception
|
62
61
|
expect { browser.div(xpath: "//div[@id='no_such_id']").class_name }.to raise_unknown_object_exception
|
63
62
|
end
|
64
63
|
end
|
65
64
|
|
66
|
-
describe
|
67
|
-
it
|
68
|
-
expect(browser.div(index: 1).id).to eq
|
65
|
+
describe '#id' do
|
66
|
+
it 'returns the id attribute if the element exists' do
|
67
|
+
expect(browser.div(index: 1).id).to eq 'outer_container'
|
69
68
|
end
|
70
69
|
|
71
70
|
it "returns an empty string if the element exists, but the attribute doesn't" do
|
72
|
-
expect(browser.div(index: 0).id).to eq
|
71
|
+
expect(browser.div(index: 0).id).to eq ''
|
73
72
|
end
|
74
73
|
|
75
|
-
it
|
76
|
-
expect { browser.div(id:
|
77
|
-
expect { browser.div(title:
|
74
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
75
|
+
expect { browser.div(id: 'no_such_id').id }.to raise_unknown_object_exception
|
76
|
+
expect { browser.div(title: 'no_such_id').id }.to raise_unknown_object_exception
|
78
77
|
expect { browser.div(index: 1337).id }.to raise_unknown_object_exception
|
79
78
|
end
|
80
79
|
|
81
|
-
it
|
82
|
-
browser.goto WatirSpec.url_for
|
83
|
-
expect(browser.div(id:
|
80
|
+
it 'should take all conditions into account when locating by id' do
|
81
|
+
browser.goto WatirSpec.url_for 'multiple_ids.html'
|
82
|
+
expect(browser.div(id: 'multiple', class: 'bar').class_name).to eq 'bar'
|
84
83
|
end
|
85
84
|
|
86
|
-
it
|
87
|
-
browser.goto WatirSpec.url_for
|
88
|
-
expect(browser.span(id:
|
85
|
+
it 'should find the id with the correct tag name' do
|
86
|
+
browser.goto WatirSpec.url_for 'multiple_ids.html'
|
87
|
+
expect(browser.span(id: 'multiple').class_name).to eq 'foobar'
|
89
88
|
end
|
90
89
|
end
|
91
90
|
|
92
|
-
describe
|
91
|
+
describe '#style' do
|
93
92
|
not_compliant_on :internet_explorer do
|
94
|
-
it
|
95
|
-
expect(browser.div(id: 'best_language').style).to eq
|
93
|
+
it 'returns the style attribute if the element exists' do
|
94
|
+
expect(browser.div(id: 'best_language').style).to eq 'color: red; text-decoration: underline; cursor: pointer;'
|
96
95
|
end
|
97
96
|
end
|
98
97
|
|
99
98
|
it "returns an empty string if the element exists but the attribute doesn't" do
|
100
|
-
expect(browser.div(id: 'promo').style).to eq
|
99
|
+
expect(browser.div(id: 'promo').style).to eq ''
|
101
100
|
end
|
102
101
|
|
103
|
-
it
|
104
|
-
expect {browser.div(id:
|
102
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
103
|
+
expect { browser.div(id: 'no_such_id').style }.to raise_unknown_object_exception
|
105
104
|
end
|
106
105
|
end
|
107
106
|
|
108
|
-
describe
|
109
|
-
it
|
110
|
-
expect(browser.div(id:
|
111
|
-
expect(browser.div(title:
|
112
|
-
expect(browser.div(xpath: "//div[@id='footer']").text.strip).to eq
|
107
|
+
describe '#text' do
|
108
|
+
it 'returns the text of the div' do
|
109
|
+
expect(browser.div(id: 'footer').text.strip).to eq 'This is a footer.'
|
110
|
+
expect(browser.div(title: 'Closing remarks').text.strip).to eq 'This is a footer.'
|
111
|
+
expect(browser.div(xpath: "//div[@id='footer']").text.strip).to eq 'This is a footer.'
|
113
112
|
end
|
114
113
|
|
115
|
-
it
|
116
|
-
expect(browser.div(index: 0).text.strip).to eq
|
114
|
+
it 'returns an empty string if the element exists but contains no text' do
|
115
|
+
expect(browser.div(index: 0).text.strip).to eq ''
|
117
116
|
end
|
118
117
|
|
119
118
|
not_compliant_on :safari do
|
120
|
-
it
|
121
|
-
expect(browser.div(id: 'hidden').text).to eq
|
119
|
+
it 'returns an empty string if the div is hidden' do
|
120
|
+
expect(browser.div(id: 'hidden').text).to eq ''
|
122
121
|
end
|
123
122
|
end
|
124
123
|
|
125
|
-
it
|
126
|
-
expect { browser.div(id:
|
127
|
-
expect { browser.div(title:
|
124
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
125
|
+
expect { browser.div(id: 'no_such_id').text }.to raise_unknown_object_exception
|
126
|
+
expect { browser.div(title: 'no_such_title').text }.to raise_unknown_object_exception
|
128
127
|
expect { browser.div(index: 1337).text }.to raise_unknown_object_exception
|
129
128
|
expect { browser.div(xpath: "//div[@id='no_such_id']").text }.to raise_unknown_object_exception
|
130
129
|
end
|
131
130
|
end
|
132
131
|
|
133
|
-
describe
|
134
|
-
it
|
135
|
-
expect(browser.div(custom_attribute:
|
132
|
+
describe 'custom methods' do
|
133
|
+
it 'returns the custom attribute if the element exists' do
|
134
|
+
expect(browser.div(custom_attribute: 'custom').attribute_value('custom-attribute')).to eq 'custom'
|
136
135
|
end
|
137
136
|
end
|
138
137
|
|
139
|
-
describe
|
140
|
-
it
|
138
|
+
describe '#respond_to?' do
|
139
|
+
it 'returns true for all attribute methods' do
|
141
140
|
expect(browser.div(index: 0)).to respond_to(:class_name)
|
142
141
|
expect(browser.div(index: 0)).to respond_to(:id)
|
143
142
|
expect(browser.div(index: 0)).to respond_to(:style)
|
@@ -145,25 +144,25 @@ describe "Div" do
|
|
145
144
|
end
|
146
145
|
end
|
147
146
|
|
148
|
-
describe
|
149
|
-
describe
|
150
|
-
it
|
147
|
+
describe 'Deprecation Warnings' do
|
148
|
+
describe 'text locator with RegExp values' do
|
149
|
+
it 'does not throw deprecation when still matched by text content' do
|
151
150
|
expect { browser.div(text: /some visible/).exists? }.not_to have_deprecated_text_regexp
|
152
151
|
end
|
153
152
|
|
154
153
|
not_compliant_on :watigiri do
|
155
|
-
it
|
154
|
+
it 'throws deprecation when no longer matched by text content' do
|
156
155
|
expect { browser.div(text: /some visible$/).exists? }.to have_deprecated_text_regexp
|
157
156
|
end
|
158
157
|
end
|
159
158
|
|
160
159
|
not_compliant_on :watigiri do
|
161
|
-
it
|
160
|
+
it 'throws deprecation when begins to be matched by text content' do
|
162
161
|
expect { browser.div(text: /some hidden/).exists? }.to have_deprecated_text_regexp
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
166
|
-
it
|
165
|
+
it 'does not throw deprecation when still not matched by text content' do
|
167
166
|
expect { browser.div(text: /does not exist/).exists? }.not_to have_deprecated_text_regexp
|
168
167
|
end
|
169
168
|
end
|
@@ -171,36 +170,36 @@ describe "Div" do
|
|
171
170
|
|
172
171
|
# Manipulation methods
|
173
172
|
not_compliant_on :headless do
|
174
|
-
describe
|
175
|
-
it
|
173
|
+
describe '#click' do
|
174
|
+
it 'fires events when clicked' do
|
176
175
|
expect(browser.div(id: 'best_language').text).to_not eq 'Ruby!'
|
177
176
|
browser.div(id: 'best_language').click
|
178
177
|
expect(browser.div(id: 'best_language').text).to eq 'Ruby!'
|
179
178
|
end
|
180
179
|
|
181
|
-
it
|
182
|
-
expect { browser.div(id:
|
183
|
-
expect { browser.div(title:
|
180
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
181
|
+
expect { browser.div(id: 'no_such_id').click }.to raise_unknown_object_exception
|
182
|
+
expect { browser.div(title: 'no_such_title').click }.to raise_unknown_object_exception
|
184
183
|
expect { browser.div(index: 1337).click }.to raise_unknown_object_exception
|
185
184
|
expect { browser.div(xpath: "//div[@id='no_such_id']").click }.to raise_unknown_object_exception
|
186
185
|
end
|
187
186
|
|
188
|
-
it
|
187
|
+
it 'includes custom message if element with a custom attribute does not exist' do
|
189
188
|
message = /Watir treated \[\"custom_attribute\"\] as a non-HTML compliant attribute, ensure that was intended/
|
190
|
-
expect { browser.div(custom_attribute:
|
189
|
+
expect { browser.div(custom_attribute: 'not_there').click }.to raise_unknown_object_exception(message)
|
191
190
|
end
|
192
191
|
end
|
193
192
|
|
194
|
-
describe
|
195
|
-
it
|
193
|
+
describe '#click!' do
|
194
|
+
it 'fires events when clicked' do
|
196
195
|
expect(browser.div(id: 'best_language').text).to_not eq 'Ruby!'
|
197
196
|
browser.div(id: 'best_language').click!
|
198
197
|
expect(browser.div(id: 'best_language').text).to eq 'Ruby!'
|
199
198
|
end
|
200
199
|
|
201
|
-
it
|
202
|
-
expect { browser.div(id:
|
203
|
-
expect { browser.div(title:
|
200
|
+
it 'raises UnknownObjectException if the element does not exist' do
|
201
|
+
expect { browser.div(id: 'no_such_id').click! }.to raise_unknown_object_exception
|
202
|
+
expect { browser.div(title: 'no_such_title').click! }.to raise_unknown_object_exception
|
204
203
|
expect { browser.div(index: 1337).click! }.to raise_unknown_object_exception
|
205
204
|
expect { browser.div(xpath: "//div[@id='no_such_id']").click! }.to raise_unknown_object_exception
|
206
205
|
end
|
@@ -208,16 +207,16 @@ describe "Div" do
|
|
208
207
|
end
|
209
208
|
|
210
209
|
not_compliant_on :safari do
|
211
|
-
bug
|
212
|
-
describe
|
213
|
-
it
|
210
|
+
bug 'MoveTargetOutOfBoundsError', :firefox do
|
211
|
+
describe '#double_click' do
|
212
|
+
it 'fires the ondblclick event' do
|
214
213
|
browser.div(id: 'html_test').double_click
|
215
214
|
expect(messages).to include('double clicked')
|
216
215
|
end
|
217
216
|
end
|
218
217
|
|
219
|
-
describe
|
220
|
-
it
|
218
|
+
describe '#double_click!' do
|
219
|
+
it 'fires the ondblclick event' do
|
221
220
|
browser.div(id: 'html_test').double_click!
|
222
221
|
expect(messages).to include('double clicked')
|
223
222
|
end
|
@@ -225,19 +224,19 @@ describe "Div" do
|
|
225
224
|
end
|
226
225
|
|
227
226
|
not_compliant_on :firefox do
|
228
|
-
describe
|
229
|
-
it
|
230
|
-
browser.goto(WatirSpec.url_for(
|
231
|
-
browser.div(id:
|
227
|
+
describe '#right_click' do
|
228
|
+
it 'fires the oncontextmenu event' do
|
229
|
+
browser.goto(WatirSpec.url_for('right_click.html'))
|
230
|
+
browser.div(id: 'click').right_click
|
232
231
|
expect(messages.first).to eq 'right-clicked'
|
233
232
|
end
|
234
233
|
end
|
235
234
|
end
|
236
235
|
end
|
237
236
|
|
238
|
-
describe
|
237
|
+
describe '#html' do
|
239
238
|
not_compliant_on :internet_explorer do
|
240
|
-
it
|
239
|
+
it 'returns the HTML of the element' do
|
241
240
|
html = browser.div(id: 'footer').html.downcase
|
242
241
|
expect(html).to include('id="footer"')
|
243
242
|
expect(html).to include('title="closing remarks"')
|
@@ -249,12 +248,11 @@ describe "Div" do
|
|
249
248
|
end
|
250
249
|
|
251
250
|
deviates_on :internet_explorer do
|
252
|
-
it
|
251
|
+
it 'returns the HTML of the element' do
|
253
252
|
html = browser.div(id: 'footer').html.downcase
|
254
253
|
expect(html).to include('title="closing remarks"')
|
255
254
|
expect(html).to_not include('</body>')
|
256
255
|
end
|
257
256
|
end
|
258
257
|
end
|
259
|
-
|
260
258
|
end
|