capybara 2.14.0 → 2.14.1

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/capybara.rb +16 -15
  5. data/lib/capybara/minitest.rb +92 -113
  6. data/lib/capybara/minitest/spec.rb +12 -37
  7. data/lib/capybara/node/matchers.rb +6 -5
  8. data/lib/capybara/queries/base_query.rb +4 -0
  9. data/lib/capybara/queries/current_path_query.rb +1 -0
  10. data/lib/capybara/queries/selector_query.rb +39 -12
  11. data/lib/capybara/queries/text_query.rb +1 -1
  12. data/lib/capybara/queries/title_query.rb +1 -0
  13. data/lib/capybara/rack_test/driver.rb +1 -0
  14. data/lib/capybara/rspec/matcher_proxies.rb +10 -6
  15. data/lib/capybara/rspec/matchers.rb +29 -0
  16. data/lib/capybara/selector.rb +61 -50
  17. data/lib/capybara/selector/expression_filter.rb +40 -0
  18. data/lib/capybara/selector/filter_set.rb +22 -3
  19. data/lib/capybara/selector/selector.rb +33 -12
  20. data/lib/capybara/selenium/driver.rb +130 -25
  21. data/lib/capybara/selenium/node.rb +3 -3
  22. data/lib/capybara/session/config.rb +29 -23
  23. data/lib/capybara/session/matchers.rb +3 -0
  24. data/lib/capybara/spec/session/accept_alert_spec.rb +1 -1
  25. data/lib/capybara/spec/session/all_spec.rb +2 -1
  26. data/lib/capybara/spec/session/assert_selector.rb +1 -1
  27. data/lib/capybara/spec/session/assert_title.rb +22 -9
  28. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +3 -3
  29. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +1 -1
  30. data/lib/capybara/spec/session/find_spec.rb +3 -2
  31. data/lib/capybara/spec/session/first_spec.rb +10 -5
  32. data/lib/capybara/spec/session/has_css_spec.rb +11 -0
  33. data/lib/capybara/spec/session/has_current_path_spec.rb +5 -3
  34. data/lib/capybara/spec/session/has_select_spec.rb +62 -4
  35. data/lib/capybara/spec/session/has_text_spec.rb +5 -3
  36. data/lib/capybara/spec/session/has_title_spec.rb +4 -2
  37. data/lib/capybara/spec/session/has_xpath_spec.rb +5 -3
  38. data/lib/capybara/spec/session/node_spec.rb +8 -4
  39. data/lib/capybara/spec/session/window/become_closed_spec.rb +4 -4
  40. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +4 -4
  41. data/lib/capybara/spec/spec_helper.rb +1 -1
  42. data/lib/capybara/spec/views/form.erb +22 -1
  43. data/lib/capybara/spec/views/with_html.erb +1 -1
  44. data/lib/capybara/version.rb +1 -1
  45. data/spec/capybara_spec.rb +16 -0
  46. data/spec/filter_set_spec.rb +28 -0
  47. data/spec/minitest_spec_spec.rb +4 -4
  48. data/spec/per_session_config_spec.rb +4 -4
  49. data/spec/result_spec.rb +20 -0
  50. data/spec/selector_spec.rb +2 -1
  51. data/spec/selenium_spec_chrome.rb +12 -1
  52. data/spec/selenium_spec_firefox.rb +2 -1
  53. data/spec/selenium_spec_marionette.rb +4 -3
  54. data/spec/shared_selenium_session.rb +14 -7
  55. metadata +18 -2
@@ -22,6 +22,7 @@ module Capybara
22
22
 
23
23
  ##
24
24
  # Asserts that the page doesn't have the given path.
25
+ # By default this will compare against the path+query portion of the full url
25
26
  #
26
27
  # @macro current_path_query_params
27
28
  # @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time
@@ -33,6 +34,7 @@ module Capybara
33
34
 
34
35
  ##
35
36
  # Checks if the page has the given path.
37
+ # By default this will compare against the path+query portion of the full url
36
38
  #
37
39
  # @macro current_path_query_params
38
40
  # @return [Boolean]
@@ -45,6 +47,7 @@ module Capybara
45
47
 
46
48
  ##
47
49
  # Checks if the page doesn't have the given path.
50
+ # By default this will compare against the path+query portion of the full url
48
51
  #
49
52
  # @macro current_path_query_params
50
53
  # @return [Boolean]
@@ -63,7 +63,7 @@ Capybara::SpecHelper.spec '#accept_alert', requires: [:modals] do
63
63
  end
64
64
 
65
65
  it "should allow to adjust the delay" do
66
- @session.accept_alert wait: 4 do
66
+ @session.accept_alert wait: 10 do
67
67
  @session.click_link('Open slow alert')
68
68
  end
69
69
  expect(@session).to have_xpath("//a[@id='open-slow-alert' and @opened='true']")
@@ -16,7 +16,8 @@ Capybara::SpecHelper.spec "#all" do
16
16
 
17
17
  it "should accept an XPath instance" do
18
18
  @session.visit('/form')
19
- @xpath = XPath::HTML.fillable_field('Name')
19
+ @xpath = Capybara::Selector.all[:fillable_field].call('Name')
20
+ expect(@xpath).to be_a(::XPath::Union)
20
21
  @result = @session.all(@xpath).map { |r| r.value }
21
22
  expect(@result).to include('Smith', 'John', 'John Smith')
22
23
  end
@@ -65,7 +65,7 @@ Capybara::SpecHelper.spec '#assert_selector' do
65
65
  Capybara.using_wait_time(0.1) do
66
66
  @session.visit('/with_js')
67
67
  @session.click_link('Click me')
68
- @session.assert_selector(:css, "a#has-been-clicked", text: "Has been clicked", wait: 0.9)
68
+ @session.assert_selector(:css, "a#has-been-clicked", text: "Has been clicked", wait: 2)
69
69
  end
70
70
  end
71
71
  end
@@ -4,16 +4,23 @@ Capybara::SpecHelper.spec '#assert_title' do
4
4
  @session.visit('/with_js')
5
5
  end
6
6
 
7
- it "should be true if the page's title contains the given string" do
8
- expect(@session.assert_title('js')).to eq(true)
7
+ it "should not raise if the page's title contains the given string" do
8
+ expect do
9
+ @session.assert_title('js')
10
+ end.not_to raise_error
9
11
  end
10
12
 
11
- it "should be true when given an empty string" do
12
- expect(@session.assert_title('')).to eq(true)
13
+ it "should not raise when given an empty string" do
14
+ expect do
15
+ @session.assert_title('')
16
+ end.not_to raise_error
13
17
  end
14
18
 
15
19
  it "should allow regexp matches" do
16
- expect(@session.assert_title(/w[a-z]{3}_js/)).to eq(true)
20
+ expect do
21
+ @session.assert_title(/w[a-z]{3}_js/)
22
+ end.not_to raise_error
23
+
17
24
  expect do
18
25
  @session.assert_title(/w[a-z]{10}_js/)
19
26
  end.to raise_error(Capybara::ExpectationNotMet, 'expected "with_js" to match /w[a-z]{10}_js/')
@@ -21,7 +28,9 @@ Capybara::SpecHelper.spec '#assert_title' do
21
28
 
22
29
  it "should wait for title", requires: [:js] do
23
30
  @session.click_link("Change title")
24
- expect(@session.assert_title("changed title")).to eq(true)
31
+ expect do
32
+ @session.assert_title("changed title", wait: 3)
33
+ end.not_to raise_error
25
34
  end
26
35
 
27
36
  it "should raise error if the title doesn't contain the given string" do
@@ -61,10 +70,14 @@ Capybara::SpecHelper.spec '#assert_no_title' do
61
70
 
62
71
  it "should wait for title to disappear", requires: [:js] do
63
72
  @session.click_link("Change title")
64
- expect(@session.assert_no_title('with_js')).to eq(true)
73
+ expect do
74
+ @session.assert_no_title('with_js', wait: 3)
75
+ end.not_to raise_error
65
76
  end
66
77
 
67
- it "should be true if the title doesn't contain the given string" do
68
- expect(@session.assert_no_title('monkey')).to eq(true)
78
+ it "should not raise if the title doesn't contain the given string" do
79
+ expect do
80
+ @session.assert_no_title('monkey')
81
+ end.not_to raise_error
69
82
  end
70
83
  end
@@ -10,14 +10,14 @@ Capybara::SpecHelper.spec '#dismiss_confirm', requires: [:modals] do
10
10
  end
11
11
  expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='false']")
12
12
  end
13
-
13
+
14
14
  it "should dismiss the confirm if the message matches" do
15
15
  @session.dismiss_confirm 'Confirm opened' do
16
16
  @session.click_link('Open confirm')
17
17
  end
18
18
  expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='false']")
19
19
  end
20
-
20
+
21
21
  it "should not dismiss the confirm if the message doesn't match" do
22
22
  expect do
23
23
  @session.dismiss_confirm 'Incorrect Text' do
@@ -25,7 +25,7 @@ Capybara::SpecHelper.spec '#dismiss_confirm', requires: [:modals] do
25
25
  end
26
26
  end.to raise_error(Capybara::ModalNotFound)
27
27
  end
28
-
28
+
29
29
 
30
30
  it "should return the message presented" do
31
31
  message = @session.dismiss_confirm do
@@ -10,7 +10,7 @@ Capybara::SpecHelper.spec '#dismiss_prompt', requires: [:modals] do
10
10
  end
11
11
  expect(@session).to have_xpath("//a[@id='open-prompt' and @response='dismissed']")
12
12
  end
13
-
13
+
14
14
  it "should return the message presented" do
15
15
  message = @session.dismiss_prompt do
16
16
  @session.click_link('Open prompt')
@@ -54,7 +54,7 @@ Capybara::SpecHelper.spec '#find' do
54
54
  it "should find element if it appears before given wait duration" do
55
55
  @session.visit('/with_js')
56
56
  @session.click_link('Click me')
57
- expect(@session.find(:css, "a#has-been-clicked", wait: 0.9).text).to include('Has been clicked')
57
+ expect(@session.find(:css, "a#has-been-clicked", wait: 2.0).text).to include('Has been clicked')
58
58
  end
59
59
  end
60
60
 
@@ -210,7 +210,8 @@ Capybara::SpecHelper.spec '#find' do
210
210
 
211
211
  it "should accept an XPath instance" do
212
212
  @session.visit('/form')
213
- @xpath = XPath::HTML.fillable_field('First Name')
213
+ @xpath = Capybara::Selector.all[:fillable_field].call('First Name')
214
+ expect(@xpath).to be_a(::XPath::Union)
214
215
  expect(@session.find(@xpath).value).to eq('John')
215
216
  end
216
217
 
@@ -15,7 +15,8 @@ Capybara::SpecHelper.spec '#first' do
15
15
 
16
16
  it "should accept an XPath instance" do
17
17
  @session.visit('/form')
18
- @xpath = XPath::HTML.fillable_field('First Name')
18
+ @xpath = Capybara::Selector.all[:fillable_field].call('First Name')
19
+ expect(@xpath).to be_a(::XPath::Union)
19
20
  expect(@session.first(@xpath).value).to eq('John')
20
21
  end
21
22
 
@@ -110,14 +111,18 @@ Capybara::SpecHelper.spec '#first' do
110
111
 
111
112
  it "should wait for at least one match if true" do
112
113
  Capybara.wait_on_first_by_default = true
113
- @session.click_link('clickable')
114
- expect(@session.first(:css, 'a#has-been-clicked')).not_to be_nil
114
+ Capybara.using_wait_time(3) do
115
+ @session.click_link('clickable')
116
+ expect(@session.first(:css, 'a#has-been-clicked')).not_to be_nil
117
+ end
115
118
  end
116
119
 
117
120
  it "should return nil after waiting if no match" do
118
121
  Capybara.wait_on_first_by_default = true
119
- @session.click_link('clickable')
120
- expect(@session.first(:css, 'a#not-a-real-link')).to be_nil
122
+ Capybara.using_wait_time(3) do
123
+ @session.click_link('clickable')
124
+ expect(@session.first(:css, 'a#not-a-real-link')).to be_nil
125
+ end
121
126
  end
122
127
  end
123
128
  end
@@ -112,6 +112,17 @@ Capybara::SpecHelper.spec '#has_css?' do
112
112
  expect(@session).not_to have_css("p a", text: /Red$/)
113
113
  end
114
114
  end
115
+
116
+ it "should allow escapes in the CSS selector" do
117
+ if (defined?(TestClass) && @session.is_a?(TestClass)) || @session.driver.is_a?(Capybara::RackTest::Driver)
118
+ # Nokogiri doesn't unescape CSS selectors when converting from CSS to XPath
119
+ # See: https://github.com/teamcapybara/capybara/issues/1866
120
+ # Also: https://github.com/sparklemotion/nokogiri/pull/1646
121
+ pending "Current Nokogiri doesn't handle escapes in CSS attribute selectors correctly"
122
+ end
123
+ expect(@session).to have_css('p[data-random="abc\\\\def"]')
124
+ expect(@session).to have_css("p[data-random='#{Capybara::Selector::CSS.escape('abc\def')}']")
125
+ end
115
126
  end
116
127
 
117
128
  Capybara::SpecHelper.spec '#has_no_css?' do
@@ -25,7 +25,7 @@ Capybara::SpecHelper.spec '#has_current_path?' do
25
25
 
26
26
  it "should wait for current_path", requires: [:js] do
27
27
  @session.click_link("Change page")
28
- expect(@session).to have_current_path("/with_html")
28
+ expect(@session).to have_current_path("/with_html", wait: 3)
29
29
  end
30
30
 
31
31
  it "should be false if the page has not the given current_path" do
@@ -83,8 +83,10 @@ Capybara::SpecHelper.spec '#has_no_current_path?' do
83
83
  end
84
84
 
85
85
  it "should wait for current_path to disappear", requires: [:js] do
86
- @session.click_link("Change page")
87
- expect(@session).to have_no_current_path('/with_js')
86
+ Capybara.using_wait_time(3) do
87
+ @session.click_link("Change page")
88
+ expect(@session).to have_no_current_path('/with_js')
89
+ end
88
90
  end
89
91
 
90
92
  it "should be true if the page has not the given current_path" do
@@ -67,6 +67,36 @@ Capybara::SpecHelper.spec '#has_select?' do
67
67
  end
68
68
  end
69
69
 
70
+ context 'with partial select' do
71
+ it "should be true if a field with the given partial values is on the page" do
72
+ expect(@session).to have_select('Underwear', with_selected: ['Boxerbriefs', 'Briefs'])
73
+ end
74
+
75
+ it "should be false if a field with the given partial values is not on the page" do
76
+ expect(@session).not_to have_select('Underwear', with_selected: ['Boxerbriefs', 'Boxers'])
77
+ end
78
+
79
+ it "should be true after the given partial value is selected" do
80
+ @session.select('Boxers', from: 'Underwear')
81
+ expect(@session).to have_select('Underwear', with_selected: ['Boxerbriefs', 'Boxers'])
82
+ end
83
+
84
+ it "should be false after one of the given partial values is unselected" do
85
+ @session.unselect('Briefs', from: 'Underwear')
86
+ expect(@session).not_to have_select('Underwear', with_selected: ['Boxerbriefs', 'Briefs'])
87
+ end
88
+
89
+ it "should be true even when the selected values are invisible, regardless of the select's visibility" do
90
+ expect(@session).to have_select('Dessert', visible: false, with_options: ['Pudding', 'Tiramisu'])
91
+ expect(@session).to have_select('Cake', with_selected: ['Chocolate Cake', 'Sponge Cake'])
92
+ end
93
+
94
+ it "should support non array partial values" do
95
+ expect(@session).to have_select('Underwear', with_selected: 'Briefs')
96
+ expect(@session).not_to have_select('Underwear', with_selected: 'Boxers')
97
+ end
98
+ end
99
+
70
100
  context 'with exact options' do
71
101
  it "should be true if a field with the given options is on the page" do
72
102
  expect(@session).to have_select('Region', options: ['Norway', 'Sweden', 'Finland'])
@@ -81,10 +111,9 @@ Capybara::SpecHelper.spec '#has_select?' do
81
111
  expect(@session).not_to have_select('Region', options: ['Norway', 'Norway', 'Norway'])
82
112
  end
83
113
 
84
- it" should be true even when the options are invisible, if the select itself is invisible" do
114
+ it "should be true even when the options are invisible, if the select itself is invisible" do
85
115
  expect(@session).to have_select("Icecream", visible: false, options: ['Chocolate', 'Vanilla', 'Strawberry'])
86
116
  end
87
-
88
117
  end
89
118
 
90
119
  context 'with partial options' do
@@ -99,7 +128,7 @@ Capybara::SpecHelper.spec '#has_select?' do
99
128
  expect(@session).not_to have_select('Region', with_options: ['Norway', 'Sweden', 'Finland', 'Latvia'])
100
129
  end
101
130
 
102
- it" should be true even when the options are invisible, if the select itself is invisible" do
131
+ it "should be true even when the options are invisible, if the select itself is invisible" do
103
132
  expect(@session).to have_select("Icecream", visible: false, with_options: ['Vanilla', 'Strawberry'])
104
133
  end
105
134
  end
@@ -123,7 +152,9 @@ Capybara::SpecHelper.spec '#has_select?' do
123
152
 
124
153
  it "should support locator-less usage" do
125
154
  expect(@session.has_select?(with_options: ['Norway', 'Sweden'])).to eq true
126
- expect(@session).to have_select(with_options: ['London'] )
155
+ expect(@session).to have_select(with_options: ['London'])
156
+ expect(@session.has_select?(with_selected: ['Commando', 'Boxerbriefs'])).to eq true
157
+ expect(@session).to have_select(with_selected: ['Briefs'])
127
158
  end
128
159
  end
129
160
 
@@ -189,6 +220,31 @@ Capybara::SpecHelper.spec '#has_no_select?' do
189
220
  end
190
221
  end
191
222
 
223
+ context 'with partial select' do
224
+ it "should be false if a field with the given partial values is on the page" do
225
+ expect(@session).not_to have_no_select('Underwear', with_selected: ['Boxerbriefs', 'Briefs'])
226
+ end
227
+
228
+ it "should be true if a field with the given partial values is not on the page" do
229
+ expect(@session).to have_no_select('Underwear', with_selected: ['Boxerbriefs', 'Boxers'])
230
+ end
231
+
232
+ it "should be false after the given partial value is selected" do
233
+ @session.select('Boxers', from: 'Underwear')
234
+ expect(@session).not_to have_no_select('Underwear', with_selected: ['Boxerbriefs', 'Boxers'])
235
+ end
236
+
237
+ it "should be true after one of the given partial values is unselected" do
238
+ @session.unselect('Briefs', from: 'Underwear')
239
+ expect(@session).to have_no_select('Underwear', with_selected: ['Boxerbriefs', 'Briefs'])
240
+ end
241
+
242
+ it "should support non array partial values" do
243
+ expect(@session).not_to have_no_select('Underwear', with_selected: 'Briefs')
244
+ expect(@session).to have_no_select('Underwear', with_selected: 'Boxers')
245
+ end
246
+ end
247
+
192
248
  context 'with exact options' do
193
249
  it "should be false if a field with the given options is on the page" do
194
250
  expect(@session).not_to have_no_select('Region', options: ['Norway', 'Sweden', 'Finland'])
@@ -219,5 +275,7 @@ Capybara::SpecHelper.spec '#has_no_select?' do
219
275
  it "should support locator-less usage" do
220
276
  expect(@session.has_no_select?(with_options: ['Norway', 'Sweden', 'Finland', 'Latvia'])).to eq true
221
277
  expect(@session).to have_no_select(with_options: ['New London'] )
278
+ expect(@session.has_no_select?(with_selected: ['Boxers'])).to eq true
279
+ expect(@session).to have_no_select(with_selected: ['Commando', 'Boxers'])
222
280
  end
223
281
  end
@@ -125,9 +125,11 @@ Capybara::SpecHelper.spec '#has_text?' do
125
125
  end
126
126
 
127
127
  it "should wait for text to appear", requires: [:js] do
128
- @session.visit('/with_js')
129
- @session.click_link('Click me')
130
- expect(@session).to have_text("Has been clicked")
128
+ Capybara.using_wait_time(3) do
129
+ @session.visit('/with_js')
130
+ @session.click_link('Click me')
131
+ expect(@session).to have_text("Has been clicked")
132
+ end
131
133
  end
132
134
 
133
135
  context "with between" do
@@ -53,8 +53,10 @@ Capybara::SpecHelper.spec '#has_no_title?' do
53
53
  end
54
54
 
55
55
  it "should wait for title to disappear", requires: [:js] do
56
- @session.click_link("Change title")
57
- expect(@session).to have_no_title('with_js')
56
+ Capybara.using_wait_time(5) do
57
+ @session.click_link("Change title") # triggers title change after 400ms
58
+ expect(@session).to have_no_title('with_js')
59
+ end
58
60
  end
59
61
 
60
62
  it "should be true if the page has not the given title" do
@@ -29,9 +29,11 @@ Capybara::SpecHelper.spec '#has_xpath?' do
29
29
  end
30
30
 
31
31
  it "should wait for content to appear", requires: [:js] do
32
- @session.visit('/with_js')
33
- @session.click_link('Click me')
34
- expect(@session).to have_xpath("//input[@type='submit' and @value='New Here']")
32
+ Capybara.using_wait_time(3) do
33
+ @session.visit('/with_js')
34
+ @session.click_link('Click me') # updates page after 500ms
35
+ expect(@session).to have_xpath("//input[@type='submit' and @value='New Here']")
36
+ end
35
37
  end
36
38
 
37
39
  context "with count" do
@@ -428,11 +428,15 @@ Capybara::SpecHelper.spec "node" do
428
428
  end
429
429
 
430
430
  context "with automatic reload" do
431
+ before do
432
+ Capybara.default_max_wait_time = 4
433
+ end
434
+
431
435
  it "should reload the current context of the node automatically" do
432
436
  @session.visit('/with_js')
433
437
  node = @session.find(:css, '#reload-me')
434
438
  @session.click_link('Reload!')
435
- sleep(0.3)
439
+ sleep(1)
436
440
  expect(node.text).to eq('has been reloaded')
437
441
  end
438
442
 
@@ -440,7 +444,7 @@ Capybara::SpecHelper.spec "node" do
440
444
  @session.visit('/with_js')
441
445
  node = @session.find(:css, '#reload-me').find(:css, 'em')
442
446
  @session.click_link('Reload!')
443
- sleep(0.3)
447
+ sleep(1)
444
448
  expect(node.text).to eq('has been reloaded')
445
449
  end
446
450
 
@@ -448,7 +452,7 @@ Capybara::SpecHelper.spec "node" do
448
452
  @session.visit('/with_js')
449
453
  node = @session.find(:css, '#reload-me')
450
454
  @session.click_link('Reload!')
451
- sleep(0.3)
455
+ sleep(1)
452
456
  expect(node.find(:css, 'a').text).to eq('has been reloaded')
453
457
  end
454
458
 
@@ -456,7 +460,7 @@ Capybara::SpecHelper.spec "node" do
456
460
  @session.visit('/with_js')
457
461
  node = @session.all(:css, '#the-list li')[1]
458
462
  @session.click_link('Fetch new list!')
459
- sleep(0.3)
463
+ sleep(1)
460
464
 
461
465
  expect do
462
466
  expect(node).to have_text('Foo')
@@ -21,7 +21,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
21
21
  @session.execute_script('setTimeout(function(){ window.close(); }, 500);')
22
22
  end
23
23
  Capybara.using_wait_time 0.1 do
24
- expect(@other_window).to become_closed(wait: 2)
24
+ expect(@other_window).to become_closed(wait: 5)
25
25
  end
26
26
  end
27
27
 
@@ -42,7 +42,7 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
42
42
  @session.within_window @other_window do
43
43
  @session.execute_script('setTimeout(function(){ window.close(); }, 500);')
44
44
  end
45
- Capybara.using_wait_time 1.5 do
45
+ Capybara.using_wait_time 5 do
46
46
  expect(@other_window).to become_closed
47
47
  end
48
48
  end
@@ -75,10 +75,10 @@ Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
75
75
  @session.within_window @other_window do
76
76
  @session.execute_script('setTimeout(function(){ window.close(); }, 700);')
77
77
  end
78
- Capybara.using_wait_time 1.1 do
78
+ Capybara.using_wait_time 3.1 do
79
79
  expect do
80
80
  expect(@other_window).not_to become_closed
81
- end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /\Aexpected #<Window @handle=".+"> not to become closed after 1.1 seconds\Z/)
81
+ end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /\Aexpected #<Window @handle=".+"> not to become closed after 3.1 seconds\Z/)
82
82
  end
83
83
  end
84
84
  end