capybara 2.6.2 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +40 -15
  3. data/README.md +45 -38
  4. data/lib/capybara.rb +86 -10
  5. data/lib/capybara/cucumber.rb +1 -0
  6. data/lib/capybara/driver/base.rb +5 -2
  7. data/lib/capybara/driver/node.rb +1 -0
  8. data/lib/capybara/dsl.rb +1 -0
  9. data/lib/capybara/helpers.rb +3 -2
  10. data/lib/capybara/node/actions.rb +6 -0
  11. data/lib/capybara/node/base.rb +1 -0
  12. data/lib/capybara/node/document.rb +1 -0
  13. data/lib/capybara/node/document_matchers.rb +1 -0
  14. data/lib/capybara/node/element.rb +1 -0
  15. data/lib/capybara/node/finders.rb +3 -2
  16. data/lib/capybara/node/matchers.rb +72 -2
  17. data/lib/capybara/node/simple.rb +6 -3
  18. data/lib/capybara/queries/base_query.rb +1 -0
  19. data/lib/capybara/queries/current_path_query.rb +1 -0
  20. data/lib/capybara/queries/match_query.rb +21 -0
  21. data/lib/capybara/queries/selector_query.rb +138 -0
  22. data/lib/capybara/queries/text_query.rb +1 -0
  23. data/lib/capybara/queries/title_query.rb +1 -0
  24. data/lib/capybara/query.rb +3 -131
  25. data/lib/capybara/rack_test/browser.rb +1 -0
  26. data/lib/capybara/rack_test/css_handlers.rb +1 -0
  27. data/lib/capybara/rack_test/driver.rb +6 -4
  28. data/lib/capybara/rack_test/form.rb +1 -0
  29. data/lib/capybara/rack_test/node.rb +1 -0
  30. data/lib/capybara/rails.rb +2 -1
  31. data/lib/capybara/result.rb +1 -0
  32. data/lib/capybara/rspec.rb +1 -0
  33. data/lib/capybara/rspec/features.rb +1 -0
  34. data/lib/capybara/rspec/matchers.rb +54 -3
  35. data/lib/capybara/selector.rb +175 -75
  36. data/lib/capybara/selector/filter.rb +48 -0
  37. data/lib/capybara/selenium/driver.rb +24 -7
  38. data/lib/capybara/selenium/node.rb +1 -0
  39. data/lib/capybara/server.rb +38 -6
  40. data/lib/capybara/session.rb +30 -14
  41. data/lib/capybara/session/matchers.rb +2 -1
  42. data/lib/capybara/spec/public/test.js +6 -0
  43. data/lib/capybara/spec/session/accept_alert_spec.rb +2 -1
  44. data/lib/capybara/spec/session/accept_confirm_spec.rb +2 -1
  45. data/lib/capybara/spec/session/accept_prompt_spec.rb +2 -1
  46. data/lib/capybara/spec/session/all_spec.rb +1 -0
  47. data/lib/capybara/spec/session/assert_current_path.rb +1 -0
  48. data/lib/capybara/spec/session/assert_selector.rb +1 -0
  49. data/lib/capybara/spec/session/assert_text.rb +1 -0
  50. data/lib/capybara/spec/session/assert_title.rb +1 -0
  51. data/lib/capybara/spec/session/attach_file_spec.rb +1 -0
  52. data/lib/capybara/spec/session/body_spec.rb +1 -0
  53. data/lib/capybara/spec/session/check_spec.rb +1 -0
  54. data/lib/capybara/spec/session/choose_spec.rb +1 -0
  55. data/lib/capybara/spec/session/click_button_spec.rb +1 -0
  56. data/lib/capybara/spec/session/click_link_or_button_spec.rb +1 -0
  57. data/lib/capybara/spec/session/click_link_spec.rb +1 -0
  58. data/lib/capybara/spec/session/current_scope_spec.rb +2 -1
  59. data/lib/capybara/spec/session/current_url_spec.rb +1 -0
  60. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +2 -1
  61. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +2 -1
  62. data/lib/capybara/spec/session/element/assert_match_selector.rb +31 -0
  63. data/lib/capybara/spec/session/element/match_css_spec.rb +17 -0
  64. data/lib/capybara/spec/session/element/match_xpath_spec.rb +23 -0
  65. data/lib/capybara/spec/session/element/matches_selector_spec.rb +63 -0
  66. data/lib/capybara/spec/session/evaluate_script_spec.rb +1 -0
  67. data/lib/capybara/spec/session/execute_script_spec.rb +1 -0
  68. data/lib/capybara/spec/session/fill_in_spec.rb +1 -0
  69. data/lib/capybara/spec/session/find_button_spec.rb +1 -0
  70. data/lib/capybara/spec/session/find_by_id_spec.rb +1 -0
  71. data/lib/capybara/spec/session/find_field_spec.rb +1 -0
  72. data/lib/capybara/spec/session/find_link_spec.rb +1 -0
  73. data/lib/capybara/spec/session/find_spec.rb +1 -0
  74. data/lib/capybara/spec/session/first_spec.rb +1 -0
  75. data/lib/capybara/spec/session/go_back_spec.rb +1 -0
  76. data/lib/capybara/spec/session/go_forward_spec.rb +1 -0
  77. data/lib/capybara/spec/session/has_button_spec.rb +1 -0
  78. data/lib/capybara/spec/session/has_css_spec.rb +1 -0
  79. data/lib/capybara/spec/session/has_current_path_spec.rb +1 -0
  80. data/lib/capybara/spec/session/has_field_spec.rb +13 -0
  81. data/lib/capybara/spec/session/has_link_spec.rb +1 -0
  82. data/lib/capybara/spec/session/has_select_spec.rb +19 -0
  83. data/lib/capybara/spec/session/has_selector_spec.rb +6 -0
  84. data/lib/capybara/spec/session/has_table_spec.rb +1 -0
  85. data/lib/capybara/spec/session/has_text_spec.rb +1 -0
  86. data/lib/capybara/spec/session/has_title_spec.rb +1 -0
  87. data/lib/capybara/spec/session/has_xpath_spec.rb +1 -0
  88. data/lib/capybara/spec/session/headers.rb +1 -0
  89. data/lib/capybara/spec/session/html_spec.rb +1 -0
  90. data/lib/capybara/spec/session/node_spec.rb +29 -0
  91. data/lib/capybara/spec/session/reset_session_spec.rb +35 -1
  92. data/lib/capybara/spec/session/response_code.rb +1 -0
  93. data/lib/capybara/spec/session/save_and_open_page_spec.rb +1 -0
  94. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +3 -2
  95. data/lib/capybara/spec/session/save_page_spec.rb +34 -2
  96. data/lib/capybara/spec/session/save_screenshot_spec.rb +31 -1
  97. data/lib/capybara/spec/session/screenshot_spec.rb +3 -1
  98. data/lib/capybara/spec/session/select_spec.rb +1 -0
  99. data/lib/capybara/spec/session/selectors_spec.rb +35 -0
  100. data/lib/capybara/spec/session/text_spec.rb +1 -0
  101. data/lib/capybara/spec/session/title_spec.rb +2 -1
  102. data/lib/capybara/spec/session/uncheck_spec.rb +1 -0
  103. data/lib/capybara/spec/session/unselect_spec.rb +1 -0
  104. data/lib/capybara/spec/session/visit_spec.rb +1 -0
  105. data/lib/capybara/spec/session/window/become_closed_spec.rb +1 -0
  106. data/lib/capybara/spec/session/window/current_window_spec.rb +1 -0
  107. data/lib/capybara/spec/session/window/open_new_window_spec.rb +1 -0
  108. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +1 -0
  109. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +1 -0
  110. data/lib/capybara/spec/session/window/window_spec.rb +1 -8
  111. data/lib/capybara/spec/session/window/windows_spec.rb +1 -0
  112. data/lib/capybara/spec/session/window/within_window_spec.rb +2 -3
  113. data/lib/capybara/spec/session/within_frame_spec.rb +1 -0
  114. data/lib/capybara/spec/session/within_spec.rb +1 -0
  115. data/lib/capybara/spec/spec_helper.rb +2 -0
  116. data/lib/capybara/spec/test_app.rb +1 -0
  117. data/lib/capybara/spec/views/buttons.erb +1 -0
  118. data/lib/capybara/spec/views/fieldsets.erb +2 -1
  119. data/lib/capybara/spec/views/form.erb +24 -0
  120. data/lib/capybara/spec/views/frame_child.erb +2 -1
  121. data/lib/capybara/spec/views/frame_one.erb +2 -1
  122. data/lib/capybara/spec/views/frame_parent.erb +2 -1
  123. data/lib/capybara/spec/views/frame_two.erb +2 -1
  124. data/lib/capybara/spec/views/header_links.erb +1 -0
  125. data/lib/capybara/spec/views/host_links.erb +1 -0
  126. data/lib/capybara/spec/views/path.erb +1 -0
  127. data/lib/capybara/spec/views/popup_one.erb +1 -0
  128. data/lib/capybara/spec/views/popup_two.erb +1 -0
  129. data/lib/capybara/spec/views/postback.erb +2 -1
  130. data/lib/capybara/spec/views/tables.erb +1 -0
  131. data/lib/capybara/spec/views/with_base_tag.erb +1 -0
  132. data/lib/capybara/spec/views/with_count.erb +2 -1
  133. data/lib/capybara/spec/views/with_hover.erb +2 -1
  134. data/lib/capybara/spec/views/with_html.erb +3 -0
  135. data/lib/capybara/spec/views/with_html_entities.erb +1 -0
  136. data/lib/capybara/spec/views/with_js.erb +5 -0
  137. data/lib/capybara/spec/views/with_scope.erb +1 -0
  138. data/lib/capybara/spec/views/with_simple_html.erb +2 -1
  139. data/lib/capybara/spec/views/with_slow_unload.erb +17 -0
  140. data/lib/capybara/spec/views/with_title.erb +2 -1
  141. data/lib/capybara/spec/views/with_unload_alert.erb +12 -0
  142. data/lib/capybara/spec/views/with_windows.erb +1 -0
  143. data/lib/capybara/spec/views/within_frames.erb +2 -1
  144. data/lib/capybara/version.rb +2 -1
  145. data/lib/capybara/window.rb +1 -0
  146. data/spec/basic_node_spec.rb +1 -0
  147. data/spec/capybara_spec.rb +28 -1
  148. data/spec/dsl_spec.rb +1 -0
  149. data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -0
  150. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -0
  151. data/spec/rack_test_spec.rb +1 -0
  152. data/spec/result_spec.rb +1 -0
  153. data/spec/rspec/features_spec.rb +1 -0
  154. data/spec/rspec/matchers_spec.rb +1 -0
  155. data/spec/rspec/scenarios_spec.rb +1 -0
  156. data/spec/rspec/views_spec.rb +1 -0
  157. data/spec/rspec_spec.rb +1 -0
  158. data/spec/selector_spec.rb +55 -1
  159. data/spec/selenium_spec.rb +6 -2
  160. data/spec/selenium_spec_chrome.rb +1 -0
  161. data/spec/server_spec.rb +101 -13
  162. data/spec/spec_helper.rb +1 -0
  163. metadata +16 -6
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+ module Capybara
3
+ class Selector
4
+ class Filter
5
+ def initialize(name, block, options={})
6
+ @name = name
7
+ @block = block
8
+ @options = options
9
+ @options[:valid_values] = [true,false] if options[:boolean]
10
+ end
11
+
12
+ def default?
13
+ @options.has_key?(:default)
14
+ end
15
+
16
+ def default
17
+ @options[:default]
18
+ end
19
+
20
+ def matches?(node, value)
21
+ return true if skip?(value)
22
+
23
+ if !valid_value?(value)
24
+ msg = "Invalid value #{value.inspect} passed to filter #{@name} - "
25
+ if default?
26
+ warn msg + "defaulting to #{default}"
27
+ value = default
28
+ else
29
+ warn msg + "skipping"
30
+ return true
31
+ end
32
+ end
33
+
34
+ @block.call(node, value)
35
+ end
36
+
37
+ def skip?(value)
38
+ @options.has_key?(:skip_if) && value == @options[:skip_if]
39
+ end
40
+
41
+ private
42
+
43
+ def valid_value?(value)
44
+ !@options.has_key?(:valid_values) || Array(@options[:valid_values]).include?(value)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require "uri"
2
3
 
3
4
  class Capybara::Selenium::Driver < Capybara::Driver::Base
@@ -91,20 +92,35 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
91
92
  def reset!
92
93
  # Use instance variable directly so we avoid starting the browser just to reset the session
93
94
  if @browser
95
+ navigated = false
96
+ start_time = Capybara::Helpers.monotonic_time
94
97
  begin
95
- begin @browser.manage.delete_all_cookies
96
- rescue Selenium::WebDriver::Error::UnhandledError
97
- # delete_all_cookies fails when we've previously gone
98
- # to about:blank, so we rescue this error and do nothing
99
- # instead.
98
+ if !navigated
99
+ # Only trigger a navigation if we haven't done it already, otherwise it
100
+ # can trigger an endless series of unload modals
101
+ begin
102
+ @browser.manage.delete_all_cookies
103
+ rescue Selenium::WebDriver::Error::UnhandledError
104
+ # delete_all_cookies fails when we've previously gone
105
+ # to about:blank, so we rescue this error and do nothing
106
+ # instead.
107
+ end
108
+ @browser.navigate.to("about:blank")
109
+ end
110
+ navigated = true
111
+
112
+ #Ensure the page is empty and trigger an UnhandledAlertError for any modals that appear during unload
113
+ until find_xpath("/html/body/*").empty? do
114
+ raise Capybara::ExpectationNotMet.new('Timed out waiting for Selenium session reset') if (Capybara::Helpers.monotonic_time - start_time) >= 10
115
+ sleep 0.05
100
116
  end
101
- @browser.navigate.to("about:blank")
102
117
  rescue Selenium::WebDriver::Error::UnhandledAlertError
103
118
  # This error is thrown if an unhandled alert is on the page
104
119
  # Firefox appears to automatically dismiss this alert, chrome does not
105
120
  # We'll try to accept it
106
121
  begin
107
122
  @browser.switch_to.alert.accept
123
+ sleep 0.25 # allow time for the modal to be handled
108
124
  rescue Selenium::WebDriver::Error::NoAlertPresentError
109
125
  # The alert is now gone - nothing to do
110
126
  end
@@ -247,8 +263,9 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
247
263
  Selenium::WebDriver::Error::NoSuchWindowError
248
264
  end
249
265
 
266
+ # @deprecated This method is being removed
250
267
  def browser_initialized?
251
- !@browser.nil?
268
+ super && !@browser.nil?
252
269
  end
253
270
 
254
271
  private
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  class Capybara::Selenium::Node < Capybara::Driver::Node
2
3
  def visible_text
3
4
  # Selenium doesn't normalize Unicode whitespace.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'uri'
2
3
  require 'net/http'
3
4
  require 'rack'
@@ -5,21 +6,46 @@ require 'rack'
5
6
  module Capybara
6
7
  class Server
7
8
  class Middleware
9
+ class Counter
10
+ attr_reader :value
11
+
12
+ def initialize
13
+ @value = 0
14
+ @mutex = Mutex.new
15
+ end
16
+
17
+ def increment
18
+ @mutex.synchronize { @value += 1 }
19
+ end
20
+
21
+ def decrement
22
+ @mutex.synchronize { @value -= 1 }
23
+ end
24
+ end
25
+
8
26
  attr_accessor :error
9
27
 
10
28
  def initialize(app)
11
29
  @app = app
30
+ @counter = Counter.new
31
+ end
32
+
33
+ def pending_requests?
34
+ @counter.value > 0
12
35
  end
13
36
 
14
37
  def call(env)
15
38
  if env["PATH_INFO"] == "/__identify__"
16
39
  [200, {}, [@app.object_id.to_s]]
17
40
  else
41
+ @counter.increment
18
42
  begin
19
43
  @app.call(env)
20
44
  rescue *Capybara.server_errors => e
21
45
  @error = e unless @error
22
46
  raise e
47
+ ensure
48
+ @counter.decrement
23
49
  end
24
50
  end
25
51
  end
@@ -38,8 +64,8 @@ module Capybara
38
64
  @middleware = Middleware.new(@app)
39
65
  @server_thread = nil # suppress warnings
40
66
  @host, @port = host, port
41
- @port ||= Capybara::Server.ports[@app.object_id]
42
- @port ||= find_available_port
67
+ @port ||= Capybara::Server.ports[Capybara.reuse_server ? @app.object_id : @middleware.object_id]
68
+ @port ||= find_available_port(host)
43
69
  end
44
70
 
45
71
  def reset_error!
@@ -62,12 +88,18 @@ module Capybara
62
88
  return false
63
89
  end
64
90
 
91
+ def wait_for_pending_requests
92
+ Timeout.timeout(60) { sleep(0.01) while @middleware.pending_requests? }
93
+ rescue Timeout::Error
94
+ raise "Requests did not finish in 60 seconds"
95
+ end
96
+
65
97
  def boot
66
98
  unless responsive?
67
- Capybara::Server.ports[@app.object_id] = @port
99
+ Capybara::Server.ports[Capybara.reuse_server ? @app.object_id : @middleware.object_id] = @port
68
100
 
69
101
  @server_thread = Thread.new do
70
- Capybara.server.call(@middleware, @port)
102
+ Capybara.server.call(@middleware, @port, @host)
71
103
  end
72
104
 
73
105
  Timeout.timeout(60) { @server_thread.join(0.1) until responsive? }
@@ -80,8 +112,8 @@ module Capybara
80
112
 
81
113
  private
82
114
 
83
- def find_available_port
84
- server = TCPServer.new('127.0.0.1', 0)
115
+ def find_available_port(host)
116
+ server = TCPServer.new(host, 0)
85
117
  server.addr[1]
86
118
  ensure
87
119
  server.close if server
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'capybara/session/matchers'
2
3
 
3
4
  module Capybara
@@ -106,9 +107,9 @@ module Capybara
106
107
  def reset!
107
108
  if @touched
108
109
  driver.reset!
109
- assert_no_selector :xpath, "/html/body/*" if driver.browser_initialized?
110
110
  @touched = false
111
111
  end
112
+ @server.wait_for_pending_requests if @server
112
113
  raise_server_error!
113
114
  end
114
115
  alias_method :cleanup!, :reset!
@@ -402,7 +403,7 @@ module Capybara
402
403
  driver.switch_to_window(window.handle)
403
404
  window
404
405
  else
405
- wait_time = Capybara::Query.new(options).wait
406
+ wait_time = Capybara::Queries::SelectorQuery.new(options).wait
406
407
  document.synchronize(wait_time, errors: [Capybara::WindowError]) do
407
408
  original_window_handle = driver.current_window_handle
408
409
  begin
@@ -499,7 +500,7 @@ module Capybara
499
500
  old_handles = driver.window_handles
500
501
  block.call
501
502
 
502
- wait_time = Capybara::Query.new(options).wait
503
+ wait_time = Capybara::Queries::SelectorQuery.new(options).wait
503
504
  document.synchronize(wait_time, errors: [Capybara::WindowError]) do
504
505
  opened_handles = (driver.window_handles - old_handles)
505
506
  if opened_handles.size != 1
@@ -619,8 +620,11 @@ module Capybara
619
620
  # Save a snapshot of the page. If `Capybara.asset_host` is set it will inject `base` tag
620
621
  # pointing to `asset_host`.
621
622
  #
622
- # If invoked without arguments it will save file to `Capybara.save_and_open_page_path`
623
- # and file will be given randomly generated filename.
623
+ # If invoked without arguments it will save file to `Capybara.save_path`
624
+ # and file will be given randomly generated filename. If invoked with a relative path
625
+ # the path will be relative to `Capybara.save_path`, which is different from
626
+ # the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
627
+ # relative to Dir.pwd
624
628
  #
625
629
  # @param [String] path the path to where it should be saved
626
630
  # @return [String] the path to which the file was saved
@@ -635,8 +639,11 @@ module Capybara
635
639
  #
636
640
  # Save a snapshot of the page and open it in a browser for inspection.
637
641
  #
638
- # If invoked without arguments it will save file to `Capybara.save_and_open_page_path`
639
- # and file will be given randomly generated filename.
642
+ # If invoked without arguments it will save file to `Capybara.save_path`
643
+ # and file will be given randomly generated filename. If invoked with a relative path
644
+ # the path will be relative to `Capybara.save_path`, which is different from
645
+ # the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
646
+ # relative to Dir.pwd
640
647
  #
641
648
  # @param [String] path the path to where it should be saved
642
649
  #
@@ -649,8 +656,11 @@ module Capybara
649
656
  #
650
657
  # Save a screenshot of page.
651
658
  #
652
- # If invoked without `path` argument it will save file to `Capybara.save_and_open_page_path`
653
- # and file will be given randomly generated filename.
659
+ # If invoked without arguments it will save file to `Capybara.save_path`
660
+ # and file will be given randomly generated filename. If invoked with a relative path
661
+ # the path will be relative to `Capybara.save_path`, which is different from
662
+ # the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
663
+ # relative to Dir.pwd
654
664
  #
655
665
  # @param [String] path the path to where it should be saved
656
666
  # @param [Hash] options a customizable set of options
@@ -665,8 +675,11 @@ module Capybara
665
675
  #
666
676
  # Save a screenshot of the page and open it for inspection.
667
677
  #
668
- # If invoked without `path` argument it will save file to `Capybara.save_and_open_page_path`
669
- # and file will be given randomly generated filename.
678
+ # If invoked without arguments it will save file to `Capybara.save_path`
679
+ # and file will be given randomly generated filename. If invoked with a relative path
680
+ # the path will be relative to `Capybara.save_path`, which is different from
681
+ # the previous behavior with `Capybara.save_and_open_page_path` where the relative path was
682
+ # relative to Dir.pwd
670
683
  #
671
684
  # @param [String] path the path to where it should be saved
672
685
  # @param [Hash] options a customizable set of options
@@ -714,15 +727,18 @@ module Capybara
714
727
  end
715
728
 
716
729
  def prepare_path(path, extension)
717
- path = default_path(extension) if path.nil?
730
+ if Capybara.save_path || Capybara.save_and_open_page_path.nil?
731
+ path = File.expand_path(path || default_fn(extension), Capybara.save_path)
732
+ else
733
+ path = File.expand_path(default_fn(extension), Capybara.save_and_open_page_path) if path.nil?
734
+ end
718
735
  FileUtils.mkdir_p(File.dirname(path))
719
736
  path
720
737
  end
721
738
 
722
- def default_path(extension)
739
+ def default_fn(extension)
723
740
  timestamp = Time.new.strftime("%Y%m%d%H%M%S")
724
741
  path = "capybara-#{timestamp}#{rand(10**10)}.#{extension}"
725
- File.expand_path(path, Capybara.save_and_open_page_path)
726
742
  end
727
743
 
728
744
  def scopes
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Capybara
2
3
  module SessionMatchers
3
4
  ##
@@ -66,4 +67,4 @@ module Capybara
66
67
  return false
67
68
  end
68
69
  end
69
- end
70
+ end
@@ -117,4 +117,10 @@ $(function() {
117
117
  $('#with-key-events').keydown(function(e){
118
118
  $('#key-events-output').append('keydown:'+e.which+' ')
119
119
  });
120
+ $('#disable-on-click').click(function(e){
121
+ var input = this
122
+ setTimeout(function() {
123
+ input.disabled = true;
124
+ }, 500)
125
+ })
120
126
  });
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#accept_alert', :requires => [:modals] do
2
3
  before do
3
4
  @session.visit('/with_js')
@@ -54,4 +55,4 @@ Capybara::SpecHelper.spec '#accept_alert', :requires => [:modals] do
54
55
  expect(@session).to have_xpath("//a[@id='open-slow-alert' and @opened='true']")
55
56
  end
56
57
  end
57
- end
58
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do
2
3
  before do
3
4
  @session.visit('/with_js')
@@ -27,4 +28,4 @@ Capybara::SpecHelper.spec '#accept_confirm', :requires => [:modals] do
27
28
  }.not_to raise_error
28
29
  expect(@session).to have_xpath("//a[@id='open-twice' and @confirmed='false']")
29
30
  end
30
- end
31
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#accept_prompt', :requires => [:modals] do
2
3
  before do
3
4
  @session.visit('/with_js')
@@ -46,4 +47,4 @@ Capybara::SpecHelper.spec '#accept_prompt', :requires => [:modals] do
46
47
  end
47
48
  expect(message).to eq('Prompt opened')
48
49
  end
49
- end
50
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#all" do
2
3
  before do
3
4
  @session.visit('/with_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#assert_current_path' do
2
3
  before do
3
4
  @session.visit('/with_js')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#assert_selector' do
2
3
  before do
3
4
  @session.visit('/with_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#assert_text' do
2
3
  it "should be true if the given text is on the page" do
3
4
  @session.visit('/with_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#assert_title' do
2
3
  before do
3
4
  @session.visit('/with_js')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#attach_file" do
2
3
  before do
3
4
  @test_file_path = File.expand_path('../fixtures/test_file.txt', File.dirname(__FILE__))
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#body' do
2
3
  it "should return the unmodified page body" do
3
4
  @session.visit('/')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#check" do
2
3
  before do
3
4
  @session.visit('/form')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#choose" do
2
3
  before do
3
4
  @session.visit('/form')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#click_button' do
2
3
  before do
3
4
  @session.visit('/form')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#click_link_or_button' do
2
3
  it "should click on a link" do
3
4
  @session.visit('/with_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#click_link' do
2
3
  before do
3
4
  @session.visit('/with_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#current_scope' do
2
3
  before do
3
4
  @session.visit('/with_scope')
@@ -26,4 +27,4 @@ Capybara::SpecHelper.spec '#current_scope' do
26
27
  end
27
28
  end
28
29
  end
29
- end
30
+ end