watir 6.19.1 → 7.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -19,6 +19,9 @@ describe 'Div' do
|
|
19
19
|
expect(browser.div(xpath: "//div[@id='header']")).to exist
|
20
20
|
expect(browser.div(custom_attribute: 'custom')).to exist
|
21
21
|
expect(browser.div(custom_attribute: /custom/)).to exist
|
22
|
+
expect(browser.div(text: /some visible/)).to exist
|
23
|
+
expect(browser.div(text: /some (visible|Jeff)/)).to exist
|
24
|
+
expect(browser.div(text: /none visible/)).to exist
|
22
25
|
end
|
23
26
|
|
24
27
|
it 'returns the first div if given no args' do
|
@@ -34,6 +37,7 @@ describe 'Div' do
|
|
34
37
|
expect(browser.div(text: /no_such_text/)).to_not exist
|
35
38
|
expect(browser.div(class: 'no_such_class')).to_not exist
|
36
39
|
expect(browser.div(class: /no_such_class/)).to_not exist
|
40
|
+
expect(browser.div(text: /some visible some hidden/)).to exist
|
37
41
|
expect(browser.div(index: 1337)).to_not exist
|
38
42
|
expect(browser.div(xpath: "//div[@id='no_such_id']")).to_not exist
|
39
43
|
end
|
@@ -126,40 +130,6 @@ describe 'Div' do
|
|
126
130
|
end
|
127
131
|
end
|
128
132
|
|
129
|
-
describe 'Deprecation Warnings' do
|
130
|
-
describe 'text locator with RegExp values' do
|
131
|
-
it 'does not throw deprecation when still matched by text content' do
|
132
|
-
expect { browser.div(text: /some visible/).locate }.not_to have_deprecated_text_regexp
|
133
|
-
end
|
134
|
-
|
135
|
-
it 'does not throw deprecation with complex regexp matched by text content' do
|
136
|
-
expect { browser.div(text: /some (in|)visible/).locate }.not_to have_deprecated_text_regexp
|
137
|
-
end
|
138
|
-
|
139
|
-
not_compliant_on :watigiri do
|
140
|
-
bug 'Safari is not filtering out hidden text', :safari do
|
141
|
-
it 'throws deprecation when no longer matched by text content' do
|
142
|
-
expect { browser.div(text: /some visible$/).locate }.to have_deprecated_text_regexp
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
not_compliant_on :watigiri do
|
148
|
-
it 'does not throw deprecation when element does not exist' do
|
149
|
-
expect { browser.div(text: /definitely not there/).locate }.not_to have_deprecated_text_regexp
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
not_compliant_on :watigiri do
|
154
|
-
bug 'Safari is not filtering out hidden text', :safari do
|
155
|
-
it 'does not locate entire content with regular expressions' do
|
156
|
-
expect(browser.div(text: /some visible some hidden/)).to_not exist
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
133
|
# Manipulation methods
|
164
134
|
describe '#click' do
|
165
135
|
it 'fires events when clicked' do
|
@@ -13,7 +13,7 @@ describe 'Divs' do
|
|
13
13
|
|
14
14
|
describe '#length' do
|
15
15
|
it 'returns the number of divs' do
|
16
|
-
expect(browser.divs.length).to eq
|
16
|
+
expect(browser.divs.length).to eq 20
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -29,7 +29,7 @@ describe 'Divs' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'returns an array of divs with a given range including negative values' do
|
32
|
-
divs = browser.divs[11..-
|
32
|
+
divs = browser.divs[11..-7]
|
33
33
|
ids = divs.map(&:id)
|
34
34
|
expect(ids).to eq %w[messages ins_tag_test del_tag_test]
|
35
35
|
end
|
@@ -20,12 +20,6 @@ describe 'Element' do
|
|
20
20
|
expect { Watir::Element.new(container, 1, 2, 3, 4) }.to raise_error(ArgumentError)
|
21
21
|
expect { Watir::Element.new(container, 'foo') }.to raise_error(ArgumentError)
|
22
22
|
end
|
23
|
-
|
24
|
-
it 'throws deprecation warning when combining element locator with other locators' do
|
25
|
-
element = double Selenium::WebDriver::Element
|
26
|
-
allow(element).to receive(:enabled?).and_return(true)
|
27
|
-
expect { browser.text_field(class_name: 'name', index: 1, element: element) }.to have_deprecated_element_cache
|
28
|
-
end
|
29
23
|
end
|
30
24
|
|
31
25
|
describe '#element_call' do
|
@@ -40,13 +34,11 @@ describe 'Element' do
|
|
40
34
|
expect { element.text }.to_not raise_error
|
41
35
|
end
|
42
36
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
expect { element.click }.not_to raise_exception
|
49
|
-
end
|
37
|
+
it 'relocates stale element when taking an action on it' do
|
38
|
+
browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
|
39
|
+
element = browser.text_field(id: 'new_user_first_name').locate
|
40
|
+
browser.refresh
|
41
|
+
expect { element.click }.not_to raise_exception
|
50
42
|
end
|
51
43
|
end
|
52
44
|
|
@@ -229,56 +221,6 @@ describe 'Element' do
|
|
229
221
|
end
|
230
222
|
end
|
231
223
|
|
232
|
-
describe '#visible?' do
|
233
|
-
it 'returns true if the element is visible' do
|
234
|
-
msg = /WARN Watir \["visible_element"\]/
|
235
|
-
expect {
|
236
|
-
expect(browser.text_field(id: 'new_user_email')).to be_visible
|
237
|
-
}.to output(msg).to_stdout_from_any_process
|
238
|
-
end
|
239
|
-
|
240
|
-
it 'raises UnknownObjectException exception if the element does not exist' do
|
241
|
-
msg = /WARN Watir \["visible_element"\]/
|
242
|
-
expect {
|
243
|
-
expect { browser.text_field(id: 'no_such_id').visible? }.to raise_unknown_object_exception
|
244
|
-
}.to output(msg).to_stdout_from_any_process
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'handles staleness' do
|
248
|
-
element = browser.text_field(id: 'new_user_email').locate
|
249
|
-
|
250
|
-
allow(element).to receive(:stale?).and_return(true)
|
251
|
-
|
252
|
-
expect(element).to be_visible
|
253
|
-
end
|
254
|
-
|
255
|
-
it "returns true if the element has style='visibility: visible' even if parent has style='visibility: hidden'" do
|
256
|
-
msg = /WARN Watir \["visible_element"\]/
|
257
|
-
expect {
|
258
|
-
expect(browser.div(id: 'visible_child')).to be_visible
|
259
|
-
}.to output(msg).to_stdout_from_any_process
|
260
|
-
end
|
261
|
-
|
262
|
-
it "returns false if the element is input element where type eq 'hidden'" do
|
263
|
-
expect(browser.hidden(id: 'new_user_interests_dolls')).to_not be_visible
|
264
|
-
end
|
265
|
-
|
266
|
-
it "returns false if the element has style='display: none;'" do
|
267
|
-
msg = /WARN Watir \["visible_element"\]/
|
268
|
-
expect {
|
269
|
-
expect(browser.div(id: 'changed_language')).to_not be_visible
|
270
|
-
}.to output(msg).to_stdout_from_any_process
|
271
|
-
end
|
272
|
-
|
273
|
-
it "returns false if the element has style='visibility: hidden;" do
|
274
|
-
expect { expect(browser.div(id: 'wants_newsletter')).to_not be_visible }
|
275
|
-
end
|
276
|
-
|
277
|
-
it 'returns false if one of the parent elements is hidden' do
|
278
|
-
expect { expect(browser.div(id: 'hidden_parent')).to_not be_visible }
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
224
|
describe '#cache=' do
|
283
225
|
it 'bypasses selector location' do
|
284
226
|
browser.goto(WatirSpec.url_for('forms_with_input_elements.html'))
|
@@ -307,14 +249,36 @@ describe 'Element' do
|
|
307
249
|
browser.goto WatirSpec.url_for('removed_element.html')
|
308
250
|
end
|
309
251
|
|
310
|
-
it '
|
252
|
+
it 'element from a collection is re-looked up after it becomes stale' do
|
311
253
|
element = browser.divs(id: 'text').first.locate
|
312
254
|
|
313
|
-
|
255
|
+
browser.refresh
|
314
256
|
|
257
|
+
expect(element).to be_stale
|
315
258
|
expect(element).to exist
|
316
259
|
end
|
317
260
|
|
261
|
+
it 'element from a selenium element throws an exception when relocated' do
|
262
|
+
div = browser.div.locate
|
263
|
+
element = browser.element(element: div.wd)
|
264
|
+
|
265
|
+
browser.refresh
|
266
|
+
expect(element).to be_stale
|
267
|
+
|
268
|
+
msg = 'Can not relocate a Watir element initialized by a Selenium element'
|
269
|
+
expect { element.exists? }.to raise_exception(Watir::Exception::LocatorException, msg)
|
270
|
+
end
|
271
|
+
|
272
|
+
it 'element from a selenium element with other locators throws an exception' do
|
273
|
+
div = browser.div.locate
|
274
|
+
element = browser.element(element: div.wd, id: 'foo')
|
275
|
+
|
276
|
+
browser.refresh
|
277
|
+
|
278
|
+
msg = 'Can not relocate a Watir element initialized by a Selenium element'
|
279
|
+
expect { element.exists? }.to raise_exception(Watir::Exception::LocatorException, msg)
|
280
|
+
end
|
281
|
+
|
318
282
|
it 'returns false when tag name does not match id' do
|
319
283
|
watir_element = browser.span(id: 'text')
|
320
284
|
expect(watir_element).to_not exist
|
@@ -374,6 +338,15 @@ describe 'Element' do
|
|
374
338
|
expect(element).to be_stale
|
375
339
|
end
|
376
340
|
|
341
|
+
it 'returns true the second time if the element is stale' do
|
342
|
+
element = browser.div.locate
|
343
|
+
|
344
|
+
browser.refresh
|
345
|
+
|
346
|
+
expect(element).to be_stale
|
347
|
+
expect(element).to be_stale
|
348
|
+
end
|
349
|
+
|
377
350
|
it 'returns false if the element is not stale' do
|
378
351
|
element = browser.button(name: 'new_user_submit_disabled').locate
|
379
352
|
|
@@ -677,25 +650,6 @@ describe 'Element' do
|
|
677
650
|
end
|
678
651
|
end
|
679
652
|
|
680
|
-
describe '#scroll_into_view' do
|
681
|
-
it 'scrolls element into view' do
|
682
|
-
initial_size = browser.window.size
|
683
|
-
browser.window.resize_to(initial_size.width, 800)
|
684
|
-
|
685
|
-
el = browser.button(name: 'new_user_image')
|
686
|
-
element_center = el.center['y']
|
687
|
-
|
688
|
-
bottom_viewport_script = 'return window.pageYOffset + window.innerHeight'
|
689
|
-
expect(browser.execute_script(bottom_viewport_script)).to be < element_center
|
690
|
-
|
691
|
-
expect {
|
692
|
-
expect(el.scroll_into_view).to be_a Selenium::WebDriver::Point
|
693
|
-
}.to have_deprecated_scroll_into_view
|
694
|
-
|
695
|
-
expect(browser.execute_script(bottom_viewport_script)).to be > element_center
|
696
|
-
end
|
697
|
-
end
|
698
|
-
|
699
653
|
describe '#location' do
|
700
654
|
it 'returns coordinates for element location' do
|
701
655
|
location = browser.button(name: 'new_user_image').location
|
@@ -59,10 +59,8 @@ describe 'Form' do
|
|
59
59
|
expect(messages[0]).to eq 'submit'
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
expect { browser.form(name: 'no').submit }.to raise_unknown_object_exception
|
65
|
-
end
|
62
|
+
it 'times out when submitting an element that is not displayed' do
|
63
|
+
expect { browser.form(name: 'no').submit }.to raise_unknown_object_exception
|
66
64
|
end
|
67
65
|
end
|
68
66
|
end
|
@@ -43,7 +43,7 @@ describe 'Links' do
|
|
43
43
|
describe 'visible text' do
|
44
44
|
it 'finds links by visible text' do
|
45
45
|
browser.goto WatirSpec.url_for('non_control_elements.html')
|
46
|
-
container = browser.div(id: '
|
46
|
+
container = browser.div(id: 'visible_link')
|
47
47
|
expect(container.links(visible_text: 'all visible').count).to eq(1)
|
48
48
|
expect(container.links(visible_text: /all visible/).count).to eq(1)
|
49
49
|
expect(container.links(visible_text: /some visible/).count).to eq(1)
|
@@ -54,9 +54,9 @@ describe 'Links' do
|
|
54
54
|
browser.goto WatirSpec.url_for('non_control_elements.html')
|
55
55
|
container = browser.div(id: 'visible_text')
|
56
56
|
|
57
|
-
expect(container.
|
58
|
-
expect(container.
|
59
|
-
expect(container.
|
57
|
+
expect(container.divs(visible_text: 'some visible').count).to eq(1)
|
58
|
+
expect(container.divs(visible_text: 'none visible').count).to eq(0)
|
59
|
+
expect(container.divs(visible_text: /none visible/).count).to eq(0)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -254,10 +254,8 @@ describe 'SelectList' do
|
|
254
254
|
|
255
255
|
it 'selects an option with a Regexp' do
|
256
256
|
browser.select_list(name: 'new_user_languages').clear
|
257
|
-
|
258
|
-
|
259
|
-
}.to have_deprecated_select_by
|
260
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[Danish NO]
|
257
|
+
browser.select_list(name: 'new_user_languages').select(/2|3/)
|
258
|
+
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq %w[EN]
|
261
259
|
end
|
262
260
|
end
|
263
261
|
|
@@ -329,13 +327,11 @@ describe 'SelectList' do
|
|
329
327
|
browser.select_list(id: 'single-quote').select("'foo'")
|
330
328
|
end
|
331
329
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
expect { select_list.select('No') }.to wait_and_raise_no_value_found_exception
|
338
|
-
end
|
330
|
+
it 'waits to select an option' do
|
331
|
+
browser.goto WatirSpec.url_for('wait.html')
|
332
|
+
browser.a(id: 'add_select').click
|
333
|
+
select_list = browser.select_list(id: 'languages')
|
334
|
+
expect { select_list.select('No') }.to wait_and_raise_no_value_found_exception
|
339
335
|
end
|
340
336
|
|
341
337
|
it "raises NoValueFoundException if the option doesn't exist" do
|
@@ -554,101 +550,4 @@ describe 'SelectList' do
|
|
554
550
|
end
|
555
551
|
end
|
556
552
|
end
|
557
|
-
|
558
|
-
describe '#select_all' do
|
559
|
-
it 'selects multiple options based on text' do
|
560
|
-
browser.select_list(name: 'new_user_languages').clear
|
561
|
-
expect {
|
562
|
-
browser.select_list(name: 'new_user_languages').select_all(/ish/)
|
563
|
-
}.to have_deprecated_select_all
|
564
|
-
list = %w[Danish EN Swedish]
|
565
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
566
|
-
end
|
567
|
-
|
568
|
-
it 'selects multiple options based on labels' do
|
569
|
-
browser.select_list(name: 'new_user_languages').clear
|
570
|
-
expect {
|
571
|
-
browser.select_list(name: 'new_user_languages').select_all(/NO|EN/)
|
572
|
-
}.to have_deprecated_select_all
|
573
|
-
list = %w[EN NO]
|
574
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
575
|
-
end
|
576
|
-
|
577
|
-
it 'selects all options in an Array' do
|
578
|
-
browser.select_list(name: 'new_user_languages').clear
|
579
|
-
expect {
|
580
|
-
browser.select_list(name: 'new_user_languages').select_all([/ish/, /Latin/])
|
581
|
-
}.to have_deprecated_select_all
|
582
|
-
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
583
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
584
|
-
end
|
585
|
-
|
586
|
-
it 'selects all options in a parameter list' do
|
587
|
-
browser.select_list(name: 'new_user_languages').clear
|
588
|
-
expect {
|
589
|
-
browser.select_list(name: 'new_user_languages').select_all(/ish/, /Latin/)
|
590
|
-
}.to have_deprecated_select_all
|
591
|
-
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
592
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
593
|
-
end
|
594
|
-
|
595
|
-
it 'returns the first matching value if there are multiple matches' do
|
596
|
-
expect {
|
597
|
-
expect(browser.select_list(name: 'new_user_languages').select_all(/ish/)).to eq 'Danish'
|
598
|
-
}.to have_deprecated_select_all
|
599
|
-
end
|
600
|
-
end
|
601
|
-
|
602
|
-
describe '#select_all!' do
|
603
|
-
it 'selects multiple options based on value' do
|
604
|
-
browser.select_list(name: 'new_user_languages').clear
|
605
|
-
expect {
|
606
|
-
browser.select_list(name: 'new_user_languages').select_all!(/\d+/)
|
607
|
-
}.to have_deprecated_select_all
|
608
|
-
list = %w[Danish EN NO Russian]
|
609
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
610
|
-
end
|
611
|
-
|
612
|
-
it 'selects multiple options based on text' do
|
613
|
-
browser.select_list(name: 'new_user_languages').clear
|
614
|
-
expect {
|
615
|
-
browser.select_list(name: 'new_user_languages').select_all!(/ish/)
|
616
|
-
}.to have_deprecated_select_all
|
617
|
-
list = %w[Danish EN Swedish]
|
618
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
619
|
-
end
|
620
|
-
|
621
|
-
it 'selects multiple options based on labels' do
|
622
|
-
browser.select_list(name: 'new_user_languages').clear
|
623
|
-
expect {
|
624
|
-
browser.select_list(name: 'new_user_languages').select_all!(/NO|EN/)
|
625
|
-
}.to have_deprecated_select_all
|
626
|
-
list = %w[EN NO]
|
627
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
628
|
-
end
|
629
|
-
|
630
|
-
it 'selects all options in an Array' do
|
631
|
-
browser.select_list(name: 'new_user_languages').clear
|
632
|
-
expect {
|
633
|
-
browser.select_list(name: 'new_user_languages').select_all!([/ish/, /Latin/])
|
634
|
-
}.to have_deprecated_select_all
|
635
|
-
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
636
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
637
|
-
end
|
638
|
-
|
639
|
-
it 'selects all options in a parameter list' do
|
640
|
-
browser.select_list(name: 'new_user_languages').clear
|
641
|
-
expect {
|
642
|
-
browser.select_list(name: 'new_user_languages').select_all!(/ish/, /Latin/)
|
643
|
-
}.to have_deprecated_select_all
|
644
|
-
list = ['Danish', 'EN', 'Swedish', 'Azeri - Latin', 'Latin']
|
645
|
-
expect(browser.select_list(name: 'new_user_languages').selected_options.map(&:text)).to eq list
|
646
|
-
end
|
647
|
-
|
648
|
-
it 'returns the first matching value if there are multiple matches' do
|
649
|
-
expect {
|
650
|
-
expect(browser.select_list(name: 'new_user_languages').select_all!(/ish/)).to eq 'Danish'
|
651
|
-
}.to have_deprecated_select_all
|
652
|
-
end
|
653
|
-
end
|
654
553
|
end
|
@@ -17,8 +17,8 @@ describe 'Span' do
|
|
17
17
|
expect(browser.span(xpath: "//span[@id='lead']")).to exist
|
18
18
|
end
|
19
19
|
|
20
|
-
it 'visible text is found by regular expression with text locator' do
|
21
|
-
expect(browser.span(
|
20
|
+
it 'visible text is found by regular expression with visible text locator' do
|
21
|
+
expect(browser.span(visible_text: /Dubito, ergo cogito, ergo sum/)).to exist
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'returns the first span if given no args' do
|
@@ -18,7 +18,7 @@ describe 'Strong' do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'visible text is found by regular expression with text locator' do
|
21
|
-
expect(browser.strong(
|
21
|
+
expect(browser.strong(visible_text: /Dubito, ergo cogito, ergo sum/)).to exist
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'returns the first strong if given no args' do
|
@@ -131,10 +131,15 @@
|
|
131
131
|
<del class="footer" onclick="this.innerHTML = 'This is a del with text set by Javascript.'">This is a del.</del>
|
132
132
|
</div>
|
133
133
|
<div custom-attribute=custom>Custom</div>
|
134
|
+
<div id="visible_link">
|
135
|
+
<a id="all_visible_link">all visible</a>
|
136
|
+
<a id="some_visible_link">some visible<span style="display:none;"> some hidden</span></a>
|
137
|
+
<a id="no_visible_link" style="display:none;">none visible</a>
|
138
|
+
</div>
|
134
139
|
<div id="visible_text">
|
135
|
-
|
136
|
-
|
137
|
-
|
140
|
+
<div id="all_visible_text">all visible</div>
|
141
|
+
<div id="some_visible_text">some visible<span style="display:none;"> some hidden</span></div>
|
142
|
+
<div id="no_visible_text" style="display:none;">none visible</div>
|
138
143
|
</div>
|
139
144
|
</body>
|
140
145
|
</html>
|