watir 6.19.1 → 7.0.0.beta1
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.
- checksums.yaml +4 -4
- data/.github/actions/install-chrome/action.yml +1 -0
- data/.github/actions/setup-linux/action.yml +8 -0
- data/.github/workflows/tests.yml +100 -0
- data/CHANGES.md +7 -0
- data/README.md +1 -4
- data/Rakefile +1 -1
- data/lib/watir.rb +1 -45
- data/lib/watir/alert.rb +3 -8
- data/lib/watir/capabilities.rb +54 -230
- data/lib/watir/cell_container.rb +4 -4
- data/lib/watir/container.rb +4 -26
- data/lib/watir/elements/checkbox.rb +4 -4
- data/lib/watir/elements/date_field.rb +4 -4
- data/lib/watir/elements/date_time_field.rb +4 -4
- data/lib/watir/elements/element.rb +12 -49
- data/lib/watir/elements/file_field.rb +4 -4
- data/lib/watir/elements/font.rb +4 -4
- data/lib/watir/elements/hidden.rb +4 -4
- data/lib/watir/elements/html_elements.rb +444 -445
- data/lib/watir/elements/iframe.rb +4 -4
- data/lib/watir/elements/radio.rb +4 -4
- data/lib/watir/elements/select.rb +12 -78
- data/lib/watir/elements/svg_elements.rb +96 -96
- data/lib/watir/elements/text_field.rb +4 -4
- data/lib/watir/generator/base/generator.rb +4 -4
- data/lib/watir/generator/base/visitor.rb +0 -29
- data/lib/watir/generator/html/generator.rb +2 -1
- data/lib/watir/has_window.rb +4 -4
- data/lib/watir/http_client.rb +0 -8
- data/lib/watir/locators.rb +1 -5
- data/lib/watir/locators/button/matcher.rb +0 -23
- data/lib/watir/locators/button/selector_builder/xpath.rb +4 -15
- data/lib/watir/locators/element/matcher.rb +4 -19
- data/lib/watir/locators/element/selector_builder.rb +2 -37
- data/lib/watir/locators/element/selector_builder/xpath.rb +26 -41
- data/lib/watir/radio_set.rb +2 -2
- data/lib/watir/row_container.rb +4 -4
- data/lib/watir/version.rb +1 -1
- data/lib/watir/wait.rb +4 -74
- data/lib/watir/window.rb +6 -22
- data/lib/watir/window_collection.rb +5 -49
- data/lib/watirspec/implementation.rb +4 -0
- data/spec/spec_helper.rb +2 -7
- data/spec/unit/capabilities_spec.rb +196 -929
- data/spec/unit/match_elements/button_spec.rb +0 -13
- data/spec/unit/match_elements/element_spec.rb +38 -47
- data/spec/unit/match_elements/text_field_spec.rb +6 -6
- data/spec/unit/selector_builder/element_spec.rb +6 -23
- data/spec/unit/selector_builder/text_field_spec.rb +6 -7
- data/spec/watirspec/alert_spec.rb +4 -21
- data/spec/watirspec/browser_spec.rb +2 -2
- data/spec/watirspec/cookies_spec.rb +1 -1
- data/spec/watirspec/elements/button_spec.rb +0 -10
- data/spec/watirspec/elements/checkbox_spec.rb +10 -22
- data/spec/watirspec/elements/div_spec.rb +4 -34
- data/spec/watirspec/elements/divs_spec.rb +2 -2
- data/spec/watirspec/elements/element_spec.rb +38 -84
- data/spec/watirspec/elements/form_spec.rb +2 -4
- data/spec/watirspec/elements/links_spec.rb +4 -4
- data/spec/watirspec/elements/select_list_spec.rb +7 -108
- data/spec/watirspec/elements/span_spec.rb +2 -2
- data/spec/watirspec/elements/spans_spec.rb +1 -1
- data/spec/watirspec/elements/strong_spec.rb +1 -1
- data/spec/watirspec/html/non_control_elements.html +8 -3
- data/spec/watirspec/support/rspec_matchers.rb +1 -32
- data/spec/watirspec/window_switching_spec.rb +2 -49
- data/spec/watirspec_helper.rb +6 -1
- data/watir.gemspec +3 -4
- metadata +11 -32
- data/.github/workflows/linux.yml +0 -61
- data/.github/workflows/mac.yml +0 -55
- data/.github/workflows/unit.yml +0 -37
- data/.github/workflows/windows.yml +0 -39
- data/lib/watir/legacy_wait.rb +0 -123
- data/spec/unit/container_spec.rb +0 -35
- data/spec/watirspec/legacy_wait_spec.rb +0 -216
|
@@ -16,19 +16,6 @@ describe Watir::Locators::Button::Matcher do
|
|
|
16
16
|
expect(matcher.match(elements, values_to_match, :all)).to eq [elements[2]]
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
it 'value attribute matches text' do
|
|
20
|
-
elements = [wd_element(text: 'foo', attributes: {value: 'foo'}),
|
|
21
|
-
wd_element(text: 'bar', attributes: {value: 'bar'}),
|
|
22
|
-
wd_element(text: 'foobar')]
|
|
23
|
-
values_to_match = {value: 'foobar'}
|
|
24
|
-
|
|
25
|
-
expect(elements[2]).not_to receive(:attribute)
|
|
26
|
-
|
|
27
|
-
expect {
|
|
28
|
-
expect(matcher.match(elements, values_to_match, :all)).to eq [elements[2]]
|
|
29
|
-
}.to have_deprecated_value_button
|
|
30
|
-
end
|
|
31
|
-
|
|
32
19
|
it 'returns empty array if neither value nor text match' do
|
|
33
20
|
elements = [wd_element(text: 'foo', attributes: {value: 'foo'}),
|
|
34
21
|
wd_element(text: 'bar', attributes: {value: 'bar'}),
|
|
@@ -14,9 +14,11 @@ describe Watir::Locators::Element::Matcher do
|
|
|
14
14
|
wd_element(tag_name: 'input', attributes: {id: 'bfoo_id'}),
|
|
15
15
|
wd_element(tag_name: 'input', attributes: {id: 'foo_id'})]
|
|
16
16
|
|
|
17
|
-
label_wds = [wd_element(tag_name: 'label'
|
|
18
|
-
wd_element(tag_name: 'label'
|
|
19
|
-
wd_element(tag_name: 'label'
|
|
17
|
+
label_wds = [wd_element(tag_name: 'label'),
|
|
18
|
+
wd_element(tag_name: 'label'),
|
|
19
|
+
wd_element(tag_name: 'label')]
|
|
20
|
+
|
|
21
|
+
allow(browser).to receive(:execute_script).and_return('foob', 'Foo', 'foo')
|
|
20
22
|
|
|
21
23
|
labels = [element(watir_element: Watir::Label, wd: label_wds[0], for: 'foob_id'),
|
|
22
24
|
element(watir_element: Watir::Label, wd: label_wds[1], for: 'bfoo_id'),
|
|
@@ -27,7 +29,6 @@ describe Watir::Locators::Element::Matcher do
|
|
|
27
29
|
expect(labels[1]).not_to receive(:for)
|
|
28
30
|
|
|
29
31
|
allow(query_scope).to receive(:labels).and_return(labels)
|
|
30
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(3).times
|
|
31
32
|
allow_any_instance_of(Watir::Input).to receive(:wd).and_return(input_wds[2], input_wds[2])
|
|
32
33
|
|
|
33
34
|
values_to_match = {label_element: 'foo'}
|
|
@@ -44,9 +45,11 @@ describe Watir::Locators::Element::Matcher do
|
|
|
44
45
|
element(watir_element: Watir::Input, wd: input_wds[1]),
|
|
45
46
|
element(watir_element: Watir::Input, wd: input_wds[2])]
|
|
46
47
|
|
|
47
|
-
label_wds = [wd_element(tag_name: 'label'
|
|
48
|
-
wd_element(tag_name: 'label'
|
|
49
|
-
wd_element(tag_name: 'label'
|
|
48
|
+
label_wds = [wd_element(tag_name: 'label'),
|
|
49
|
+
wd_element(tag_name: 'label'),
|
|
50
|
+
wd_element(tag_name: 'label')]
|
|
51
|
+
|
|
52
|
+
allow(browser).to receive(:execute_script).and_return('foob', 'Foo', 'foo')
|
|
50
53
|
|
|
51
54
|
labels = [element(watir_element: Watir::Label, wd: label_wds[0], for: '', input: inputs[0]),
|
|
52
55
|
element(watir_element: Watir::Label, wd: label_wds[1], for: '', input: inputs[1]),
|
|
@@ -57,7 +60,6 @@ describe Watir::Locators::Element::Matcher do
|
|
|
57
60
|
expect(labels[1]).not_to receive(:for)
|
|
58
61
|
|
|
59
62
|
allow(query_scope).to receive(:labels).and_return(labels)
|
|
60
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(3).times
|
|
61
63
|
|
|
62
64
|
values_to_match = {label_element: 'foo'}
|
|
63
65
|
|
|
@@ -71,14 +73,16 @@ describe Watir::Locators::Element::Matcher do
|
|
|
71
73
|
inputs = [element(watir_element: Watir::Input, wd: wd_element(tag_name: 'input')),
|
|
72
74
|
element(watir_element: Watir::Input, wd: input_wds[1])]
|
|
73
75
|
|
|
74
|
-
label_wds = [wd_element(tag_name: 'label'
|
|
75
|
-
wd_element(tag_name: 'label',
|
|
76
|
+
label_wds = [wd_element(tag_name: 'label'),
|
|
77
|
+
wd_element(tag_name: 'label'),
|
|
78
|
+
wd_element(tag_name: 'label')]
|
|
79
|
+
|
|
80
|
+
allow(browser).to receive(:execute_script).and_return('foo', 'foo')
|
|
76
81
|
|
|
77
82
|
labels = [element(watir_element: Watir::Label, wd: label_wds[0], for: '', input: inputs[0]),
|
|
78
83
|
element(watir_element: Watir::Label, wd: label_wds[1], for: '', input: inputs[1])]
|
|
79
84
|
|
|
80
85
|
allow(query_scope).to receive(:labels).and_return(labels)
|
|
81
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(2).times
|
|
82
86
|
|
|
83
87
|
values_to_match = {label_element: 'foo'}
|
|
84
88
|
|
|
@@ -89,14 +93,16 @@ describe Watir::Locators::Element::Matcher do
|
|
|
89
93
|
input_wds = [wd_element(tag_name: 'input', attributes: {id: 'foo'}),
|
|
90
94
|
wd_element(tag_name: 'input', attributes: {id: 'bfoo'})]
|
|
91
95
|
|
|
92
|
-
label_wds = [wd_element(tag_name: 'label'
|
|
93
|
-
wd_element(tag_name: 'label',
|
|
96
|
+
label_wds = [wd_element(tag_name: 'label'),
|
|
97
|
+
wd_element(tag_name: 'label'),
|
|
98
|
+
wd_element(tag_name: 'label')]
|
|
99
|
+
|
|
100
|
+
allow(browser).to receive(:execute_script).and_return('Not this', 'or this')
|
|
94
101
|
|
|
95
102
|
labels = [element(watir_element: Watir::Label, wd: label_wds[0], for: 'foo'),
|
|
96
103
|
element(watir_element: Watir::Label, wd: label_wds[1], for: 'bfoo')]
|
|
97
104
|
|
|
98
105
|
allow(query_scope).to receive(:labels).and_return(labels)
|
|
99
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(2).times
|
|
100
106
|
|
|
101
107
|
values_to_match = {label_element: 'foo'}
|
|
102
108
|
|
|
@@ -110,14 +116,15 @@ describe Watir::Locators::Element::Matcher do
|
|
|
110
116
|
inputs = [element(watir_element: Watir::Input, wd: wd_element(tag_name: 'input')),
|
|
111
117
|
element(watir_element: Watir::Input, wd: wd_element(tag_name: 'input'))]
|
|
112
118
|
|
|
113
|
-
label_wds = [wd_element(tag_name: 'label'
|
|
114
|
-
wd_element(tag_name: 'label'
|
|
119
|
+
label_wds = [wd_element(tag_name: 'label'),
|
|
120
|
+
wd_element(tag_name: 'label')]
|
|
121
|
+
|
|
122
|
+
allow(browser).to receive(:execute_script).and_return('foob', 'foo')
|
|
115
123
|
|
|
116
124
|
labels = [element(watir_element: Watir::Label, wd: label_wds[0], for: '', input: inputs[0]),
|
|
117
125
|
element(watir_element: Watir::Label, wd: label_wds[1], for: '', input: inputs[1])]
|
|
118
126
|
|
|
119
127
|
allow(query_scope).to receive(:labels).and_return(labels)
|
|
120
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(2).times
|
|
121
128
|
|
|
122
129
|
values_to_match = {label_element: 'foo'}
|
|
123
130
|
|
|
@@ -191,11 +198,10 @@ describe Watir::Locators::Element::Matcher do
|
|
|
191
198
|
end
|
|
192
199
|
|
|
193
200
|
it 'by text' do
|
|
194
|
-
elements = [wd_element
|
|
195
|
-
wd_element(text: 'Foob')]
|
|
201
|
+
elements = [wd_element, wd_element]
|
|
196
202
|
@values_to_match = {text: 'Foob'}
|
|
197
203
|
|
|
198
|
-
allow(
|
|
204
|
+
allow(browser).to receive(:execute_script).and_return('foo', 'Foob')
|
|
199
205
|
|
|
200
206
|
expect(matcher.match(elements, values_to_match, @filter)).to eq elements[1]
|
|
201
207
|
end
|
|
@@ -290,12 +296,10 @@ describe Watir::Locators::Element::Matcher do
|
|
|
290
296
|
end
|
|
291
297
|
|
|
292
298
|
it 'by text' do
|
|
293
|
-
elements = [wd_element
|
|
294
|
-
wd_element(text: 'Foob'),
|
|
295
|
-
wd_element(text: 'bBarb')]
|
|
299
|
+
elements = [wd_element, wd_element, wd_element]
|
|
296
300
|
@values_to_match = {text: /Foo|Bar/}
|
|
297
301
|
|
|
298
|
-
allow(
|
|
302
|
+
allow(browser).to receive(:execute_script).and_return('foo', 'Foob', 'bBarb')
|
|
299
303
|
|
|
300
304
|
expect(matcher.match(elements, values_to_match, @filter)).to eq [elements[1], elements[2]]
|
|
301
305
|
end
|
|
@@ -369,55 +373,42 @@ describe Watir::Locators::Element::Matcher do
|
|
|
369
373
|
# See equivalent tests in checkbox_spec
|
|
370
374
|
context 'text_regexp deprecations' do
|
|
371
375
|
let(:filter) { :first }
|
|
372
|
-
let(:elements)
|
|
373
|
-
[wd_element(text: 'all visible'),
|
|
374
|
-
wd_element(text: 'some visible')]
|
|
375
|
-
end
|
|
376
|
+
let(:elements) { [wd_element, wd_element] }
|
|
376
377
|
|
|
377
378
|
it 'not thrown when still matched by text content' do
|
|
378
379
|
@values_to_match = {text: /some visible/}
|
|
379
|
-
allow(browser).to receive(:execute_script).and_return('
|
|
380
|
-
allow(browser).to receive(:timer).and_return(Watir::Wait::Timer.new)
|
|
381
|
-
allow(browser).to receive(:timer=).and_return(Watir::Wait::Timer.new)
|
|
380
|
+
allow(browser).to receive(:execute_script).and_return('all visible', 'some visible')
|
|
382
381
|
|
|
383
|
-
expect
|
|
384
|
-
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
385
|
-
}.not_to have_deprecated_text_regexp
|
|
382
|
+
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
386
383
|
end
|
|
387
384
|
|
|
388
385
|
it 'not thrown with complex regexp matched by text content' do
|
|
389
386
|
@values_to_match = {text: /some (in|)visible/}
|
|
390
|
-
allow(browser).to receive(:execute_script).and_return('
|
|
391
|
-
allow(browser).to receive(:timer).and_return(Watir::Wait::Timer.new)
|
|
392
|
-
allow(browser).to receive(:timer=).and_return(Watir::Wait::Timer.new)
|
|
387
|
+
allow(browser).to receive(:execute_script).and_return('all visible', 'some visible')
|
|
393
388
|
|
|
394
|
-
expect
|
|
395
|
-
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
396
|
-
}.not_to have_deprecated_text_regexp
|
|
389
|
+
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
397
390
|
end
|
|
398
391
|
|
|
399
392
|
it 'thrown when no longer matched by text content' do
|
|
400
393
|
@values_to_match = {text: /some visible$/}
|
|
401
|
-
allow(browser).to receive(:execute_script).and_return('
|
|
394
|
+
allow(browser).to receive(:execute_script).and_return('all visible', 'some visible')
|
|
402
395
|
allow(browser).to receive(:timer).and_return(Watir::Wait::Timer.new)
|
|
403
396
|
allow(browser).to receive(:timer=).and_return(Watir::Wait::Timer.new)
|
|
404
397
|
|
|
405
|
-
expect
|
|
406
|
-
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
407
|
-
}.to have_deprecated_text_regexp
|
|
398
|
+
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
408
399
|
end
|
|
409
400
|
|
|
410
401
|
it 'not thrown when element does not exist' do
|
|
411
402
|
@values_to_match = {text: /definitely not there/}
|
|
403
|
+
allow(browser).to receive(:execute_script).and_return('all visible', 'some visible')
|
|
412
404
|
|
|
413
|
-
expect
|
|
414
|
-
expect(matcher.match(elements, values_to_match, filter)).to eq elements[1]
|
|
415
|
-
}.to_not have_deprecated_text_regexp
|
|
405
|
+
expect(matcher.match(elements, values_to_match, filter)).to eq nil
|
|
416
406
|
end
|
|
417
407
|
|
|
418
408
|
# Note: This will work after:text_regexp deprecation removed
|
|
419
409
|
it 'keeps element from being located' do
|
|
420
410
|
@values_to_match = {text: /some visible some hidden/}
|
|
411
|
+
allow(browser).to receive(:execute_script).and_return('all visible', 'some visible')
|
|
421
412
|
|
|
422
413
|
expect(matcher.match(elements, values_to_match, filter)).to be_nil
|
|
423
414
|
end
|
|
@@ -44,25 +44,25 @@ describe Watir::Locators::TextField::Matcher do
|
|
|
44
44
|
|
|
45
45
|
context 'when label element' do
|
|
46
46
|
it 'converts value to text' do
|
|
47
|
-
elements = [wd_element(tag_name: 'label'
|
|
48
|
-
wd_element(tag_name: 'label'
|
|
47
|
+
elements = [wd_element(tag_name: 'label'),
|
|
48
|
+
wd_element(tag_name: 'label')]
|
|
49
49
|
values_to_match = {value: 'Foob'}
|
|
50
50
|
|
|
51
|
+
allow(query_scope).to receive(:execute_script).and_return('foo', 'Foob')
|
|
51
52
|
expect(elements[0]).not_to receive(:attribute).with(values_to_match)
|
|
52
53
|
expect(elements[1]).not_to receive(:attribute).with(values_to_match)
|
|
53
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(2).times
|
|
54
54
|
|
|
55
55
|
expect(matcher.match(elements, values_to_match, :all)).to eq [elements[1]]
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it 'converts label to text' do
|
|
59
|
-
elements = [wd_element(tag_name: 'label'
|
|
60
|
-
wd_element(tag_name: 'label'
|
|
59
|
+
elements = [wd_element(tag_name: 'label'),
|
|
60
|
+
wd_element(tag_name: 'label')]
|
|
61
61
|
values_to_match = {label: 'Foob'}
|
|
62
62
|
|
|
63
|
+
allow(query_scope).to receive(:execute_script).and_return('foo', 'Foob')
|
|
63
64
|
expect(elements[0]).not_to receive(:attribute).with(values_to_match)
|
|
64
65
|
expect(elements[1]).not_to receive(:attribute).with(values_to_match)
|
|
65
|
-
allow(matcher).to receive(:deprecate_text_regexp).exactly(2).times
|
|
66
66
|
|
|
67
67
|
expect(matcher.match(elements, values_to_match, :all)).to eq [elements[1]]
|
|
68
68
|
end
|
|
@@ -95,15 +95,6 @@ describe Watir::Locators::Element::SelectorBuilder do
|
|
|
95
95
|
expect(selector_builder.build(selector)).to eq built
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
-
it 'values with spaces' do
|
|
99
|
-
selector = {class_name: 'multiple classes here'}
|
|
100
|
-
built = {xpath: ".//*[contains(concat(' ', @class, ' '), ' multiple classes here ')]"}
|
|
101
|
-
|
|
102
|
-
expect {
|
|
103
|
-
expect(selector_builder.build(selector)).to eq built
|
|
104
|
-
}.to have_deprecated_class_array
|
|
105
|
-
end
|
|
106
|
-
|
|
107
98
|
it 'single String concatenates' do
|
|
108
99
|
selector = {class: 'user'}
|
|
109
100
|
built = {xpath: ".//*[contains(concat(' ', @class, ' '), ' user ')]"}
|
|
@@ -281,13 +272,11 @@ describe Watir::Locators::Element::SelectorBuilder do
|
|
|
281
272
|
expect(selector_builder.build(selector)).to eq built
|
|
282
273
|
end
|
|
283
274
|
|
|
284
|
-
it '
|
|
285
|
-
selector = {
|
|
286
|
-
built = {xpath: ".//*[normalize-space()
|
|
275
|
+
it 'Regexp uses contains normalize space' do
|
|
276
|
+
selector = {text: /Add/}
|
|
277
|
+
built = {xpath: ".//*[contains(normalize-space(), 'Add')]"}
|
|
287
278
|
|
|
288
|
-
expect
|
|
289
|
-
expect(selector_builder.build(selector)).to eq built
|
|
290
|
-
}.to have_deprecated_caption
|
|
279
|
+
expect(selector_builder.build(selector)).to eq built
|
|
291
280
|
end
|
|
292
281
|
|
|
293
282
|
it 'raises exception when text is not a String or Regexp' do
|
|
@@ -346,7 +335,8 @@ describe Watir::Locators::Element::SelectorBuilder do
|
|
|
346
335
|
|
|
347
336
|
it 'returns a label_element if complex' do
|
|
348
337
|
selector = {label: /Ca|rs/}
|
|
349
|
-
|
|
338
|
+
xpath = './/*[@id=//label[normalize-space()]/@for or parent::label[normalize-space()]]'
|
|
339
|
+
built = {xpath: xpath, label_element: /Ca|rs/}
|
|
350
340
|
|
|
351
341
|
expect(selector_builder.build(selector)).to eq built
|
|
352
342
|
end
|
|
@@ -628,13 +618,6 @@ describe Watir::Locators::Element::SelectorBuilder do
|
|
|
628
618
|
expect(selector_builder.build(selector)).to eq built
|
|
629
619
|
end
|
|
630
620
|
|
|
631
|
-
it 'text with any Regexp' do
|
|
632
|
-
selector = {text: /Add/}
|
|
633
|
-
built = {xpath: './/*', text: /Add/}
|
|
634
|
-
|
|
635
|
-
expect(selector_builder.build(selector)).to eq built
|
|
636
|
-
end
|
|
637
|
-
|
|
638
621
|
it 'visible' do
|
|
639
622
|
selector = {tag_name: 'div', visible: true}
|
|
640
623
|
built = {xpath: ".//*[local-name()='div']", visible: true}
|
|
@@ -156,21 +156,20 @@ describe Watir::Locators::TextField::SelectorBuilder do
|
|
|
156
156
|
expect(selector_builder.build(selector)).to eq built
|
|
157
157
|
end
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
xit 'using simple Regexp' do
|
|
159
|
+
it 'using simple Regexp' do
|
|
161
160
|
selector = {label: /First/}
|
|
162
161
|
built = {xpath: ".//*[local-name()='input'][not(@type) or (#{negative_types})]" \
|
|
163
|
-
"[@id=//label[contains(
|
|
162
|
+
"[@id=//label[contains(normalize-space(), 'First')]/@for or parent::label[contains(normalize-space(), 'First')]]"}
|
|
164
163
|
|
|
165
164
|
expect(selector_builder.build(selector)).to eq built
|
|
166
165
|
end
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
xit 'using complex Regexp' do
|
|
167
|
+
it 'using complex Regexp' do
|
|
170
168
|
selector = {label: /([qa])st? name/}
|
|
171
169
|
built = {xpath: ".//*[local-name()='input'][not(@type) or (#{negative_types})]" \
|
|
172
|
-
"[@id=//label[contains(
|
|
173
|
-
"parent::label[contains(
|
|
170
|
+
"[@id=//label[contains(normalize-space(), 's') and contains(normalize-space(), ' name')]/@for or " \
|
|
171
|
+
"parent::label[contains(normalize-space(), 's') and contains(normalize-space(), ' name')]]",
|
|
172
|
+
label_element: /([qa])st? name/}
|
|
174
173
|
|
|
175
174
|
expect(selector_builder.build(selector)).to eq built
|
|
176
175
|
end
|
|
@@ -9,12 +9,10 @@ describe 'Alert API' do
|
|
|
9
9
|
browser.alert.ok if browser.alert.exists?
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
context '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
expect { browser.alert.text }.to wait_and_raise_unknown_object_exception
|
|
17
|
-
end
|
|
12
|
+
context 'Waits' do
|
|
13
|
+
context 'when acting on an alert' do
|
|
14
|
+
it 'raises exception after timing out' do
|
|
15
|
+
expect { browser.alert.text }.to wait_and_raise_unknown_object_exception
|
|
18
16
|
end
|
|
19
17
|
end
|
|
20
18
|
end
|
|
@@ -53,21 +51,6 @@ describe 'Alert API' do
|
|
|
53
51
|
expect(browser.alert).to_not exist
|
|
54
52
|
end
|
|
55
53
|
end
|
|
56
|
-
|
|
57
|
-
not_compliant_on :relaxed_locate do
|
|
58
|
-
describe 'wait_until_present' do
|
|
59
|
-
it 'waits until alert is present and goes on' do
|
|
60
|
-
browser.button(id: 'timeout-alert').click
|
|
61
|
-
browser.alert.wait_until_present.ok
|
|
62
|
-
|
|
63
|
-
expect(browser.alert).to_not exist
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
it 'raises error if alert is not present after timeout' do
|
|
67
|
-
expect { browser.alert.wait_until_present.ok }.to raise_timeout_exception
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
54
|
end
|
|
72
55
|
|
|
73
56
|
context 'confirm' do
|
|
@@ -75,7 +75,7 @@ describe 'Browser' do
|
|
|
75
75
|
bug 'Capitalization issue', :safari do
|
|
76
76
|
describe '#name' do
|
|
77
77
|
it 'returns browser name' do
|
|
78
|
-
expect(browser.name).to eq(WatirSpec.implementation.
|
|
78
|
+
expect(browser.name).to eq(WatirSpec.implementation.browser_name)
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
81
|
end
|
|
@@ -519,7 +519,7 @@ describe 'Browser' do
|
|
|
519
519
|
browser.close
|
|
520
520
|
@opts = WatirSpec.implementation.browser_args.last
|
|
521
521
|
|
|
522
|
-
@opts[:
|
|
522
|
+
@opts[:options] = {page_load_strategy: :none}
|
|
523
523
|
browser = WatirSpec.new_browser
|
|
524
524
|
|
|
525
525
|
start_time = Time.now
|
|
@@ -93,7 +93,7 @@ describe 'Browser#cookies' do
|
|
|
93
93
|
expect((cookie[:expires]).to_i).to be_within(2).of(expires.to_i)
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
-
bug 'https://bugs.chromium.org/p/chromedriver/issues/detail?id=2727', :chrome, :safari do
|
|
96
|
+
bug 'https://bugs.chromium.org/p/chromedriver/issues/detail?id=2727', :chrome, :safari, :edge do
|
|
97
97
|
it 'adds a cookie with security' do
|
|
98
98
|
browser.goto set_cookie_url
|
|
99
99
|
|
|
@@ -41,16 +41,6 @@ describe 'Button' do
|
|
|
41
41
|
expect(browser.button(value: /Button 4 With Child Text/)).to exist
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
it 'returns true if the button exists (how = :caption)' do
|
|
45
|
-
expect {
|
|
46
|
-
expect(browser.button(caption: 'Button 2')).to exist
|
|
47
|
-
}.to have_deprecated_caption
|
|
48
|
-
|
|
49
|
-
expect {
|
|
50
|
-
expect(browser.button(caption: /Button 2/)).to exist
|
|
51
|
-
}.to have_deprecated_caption
|
|
52
|
-
end
|
|
53
|
-
|
|
54
44
|
it 'returns the first button if given no args' do
|
|
55
45
|
expect(browser.button).to exist
|
|
56
46
|
end
|
|
@@ -26,29 +26,17 @@ describe 'CheckBox' do
|
|
|
26
26
|
expect(browser.checkbox(xpath: "//input[@id='new_user_interests_books']")).to exist
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect(browser.checkbox(label: /some (visible|Jeff)/)).to exist
|
|
37
|
-
}.to_not have_deprecated_text_regexp
|
|
38
|
-
|
|
39
|
-
expect {
|
|
40
|
-
expect(browser.checkbox(label: /this will not match/)).to exist
|
|
41
|
-
}.to_not have_deprecated_text_regexp
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
bug 'Safari is not filtering out hidden text', :safari do
|
|
45
|
-
it 'handles text_regexp deprecation in spite of hidden text' do
|
|
46
|
-
expect(browser.checkbox(label: /some visible some hidden/)).to_not exist
|
|
29
|
+
# TODO: More of this for text & labels somewhere central
|
|
30
|
+
it 'handles text_regexp deprecations for label locators' do
|
|
31
|
+
expect(browser.checkbox(label: /some visible/)).to exist
|
|
32
|
+
expect(browser.checkbox(label: /some (visible|Jeff)/)).to exist
|
|
33
|
+
expect(browser.checkbox(label: /none visible/)).to exist
|
|
34
|
+
expect(browser.checkbox(label: /this will not match/)).to_not exist
|
|
35
|
+
end
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
end
|
|
37
|
+
bug 'Safari is not filtering out hidden text', :safari do
|
|
38
|
+
it 'handles text_regexp deprecation in spite of hidden text' do
|
|
39
|
+
expect(browser.checkbox(label: /some visible some hidden/)).to exist
|
|
52
40
|
end
|
|
53
41
|
end
|
|
54
42
|
|