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
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#status_code' do
2
3
  it "should return response codes", :requires => [:status_code] do
3
4
  @session.visit('/with_simple_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'launchy'
2
3
 
3
4
  Capybara::SpecHelper.spec '#save_and_open_page' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'launchy'
2
3
 
3
4
  Capybara::SpecHelper.spec '#save_and_open_screenshot' do
@@ -25,8 +26,8 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
25
26
  @session.save_and_open_screenshot(custom_path)
26
27
 
27
28
  expect(@session.driver).to have_received(:save_screenshot).
28
- with(custom_path, {})
29
- expect(Launchy).to have_received(:open).with(custom_path)
29
+ with(/#{custom_path}$/, {})
30
+ expect(Launchy).to have_received(:open).with(/#{custom_path}$/)
30
31
  end
31
32
 
32
33
  context 'when launchy cannot be required' do
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#save_page' do
2
3
  let(:alternative_path) { File.join(Dir.pwd, "save_and_open_page_tmp") }
3
4
  before do
@@ -6,6 +7,7 @@ Capybara::SpecHelper.spec '#save_page' do
6
7
 
7
8
  after do
8
9
  Capybara.save_and_open_page_path = nil
10
+ Capybara.save_path = nil
9
11
  Dir.glob("capybara-*.html").each do |file|
10
12
  FileUtils.rm(file)
11
13
  end
@@ -25,7 +27,7 @@ Capybara::SpecHelper.spec '#save_page' do
25
27
  end
26
28
 
27
29
  it "can store files in a specified directory" do
28
- Capybara.save_and_open_page_path = alternative_path
30
+ Capybara.save_path = alternative_path
29
31
  @session.save_page
30
32
  path = Dir.glob(alternative_path + "/capybara-*.html").first
31
33
  expect(File.read(path)).to include("Another World")
@@ -36,6 +38,20 @@ Capybara::SpecHelper.spec '#save_page' do
36
38
  expect(File.read("capybara-001122.html")).to include("Another World")
37
39
  end
38
40
 
41
+ it "can store files in a specified directory with a given filename" do
42
+ Capybara.save_path = alternative_path
43
+ @session.save_page("capybara-001133.html")
44
+ path = alternative_path + "/capybara-001133.html"
45
+ expect(File.read(path)).to include("Another World")
46
+ end
47
+
48
+ it "can store files in a specified directory with a given relative filename" do
49
+ Capybara.save_path = alternative_path
50
+ @session.save_page("tmp/capybara-001144.html")
51
+ path = alternative_path + "/tmp/capybara-001144.html"
52
+ expect(File.read(path)).to include("Another World")
53
+ end
54
+
39
55
  it "returns an absolute path in pwd" do
40
56
  result = @session.save_page
41
57
  path = File.expand_path(Dir.glob("capybara-*.html").first, Dir.pwd)
@@ -43,7 +59,7 @@ Capybara::SpecHelper.spec '#save_page' do
43
59
  end
44
60
 
45
61
  it "returns an absolute path in given directory" do
46
- Capybara.save_and_open_page_path = alternative_path
62
+ Capybara.save_path = alternative_path
47
63
  result = @session.save_page
48
64
  path = File.expand_path(Dir.glob(alternative_path + "/capybara-*.html").first, alternative_path)
49
65
  expect(result).to eq(path)
@@ -88,4 +104,20 @@ Capybara::SpecHelper.spec '#save_page' do
88
104
  expect(result).to include("Bar")
89
105
  end
90
106
  end
107
+
108
+ context "with deprecated save_and_open_page_path" do
109
+ it "can store files in a specified directory" do
110
+ Capybara.save_and_open_page_path = alternative_path
111
+ @session.save_page
112
+ path = Dir.glob(alternative_path + "/capybara-*.html").first
113
+ expect(File.read(path)).to include("Another World")
114
+ end
115
+
116
+ it "returns an absolute path in given directory" do
117
+ Capybara.save_and_open_page_path = alternative_path
118
+ result = @session.save_page
119
+ path = File.expand_path(Dir.glob(alternative_path + "/capybara-*.html").first, alternative_path)
120
+ expect(result).to eq(path)
121
+ end
122
+ end
91
123
  end
@@ -1,8 +1,16 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
3
+ let(:alternative_path) { File.join(Dir.pwd, "save_screenshot_tmp") }
2
4
  before do
3
5
  @session.visit '/foo'
4
6
  end
5
7
 
8
+ after do
9
+ Capybara.save_and_open_page_path = nil
10
+ Capybara.save_path = nil
11
+ FileUtils.rm_rf alternative_path
12
+ end
13
+
6
14
  it "generates sensible filename" do
7
15
  allow(@session.driver).to receive(:save_screenshot)
8
16
 
@@ -18,6 +26,28 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
18
26
  custom_path = 'screenshots/1.png'
19
27
  @session.save_screenshot(custom_path)
20
28
 
21
- expect(@session.driver).to have_received(:save_screenshot).with(custom_path, {})
29
+ expect(@session.driver).to have_received(:save_screenshot).with(/#{custom_path}$/, {})
30
+ end
31
+
32
+ context "with Capybara.save_path" do
33
+ it "file is generated in the correct location" do
34
+ Capybara.save_path = alternative_path
35
+ allow(@session.driver).to receive(:save_screenshot)
36
+
37
+ @session.save_screenshot
38
+
39
+ regexp = Regexp.new(File.expand_path('capybara-\d+\.png', alternative_path))
40
+ expect(@session.driver).to have_received(:save_screenshot).with(regexp, {})
41
+ end
42
+
43
+ it "relative paths are relative to save_path" do
44
+ Capybara.save_path = alternative_path
45
+ allow(@session.driver).to receive(:save_screenshot)
46
+
47
+ custom_path = 'screenshots/2.png'
48
+ @session.save_screenshot(custom_path)
49
+
50
+ expect(@session.driver).to have_received(:save_screenshot).with(File.expand_path(custom_path, alternative_path), {})
51
+ end
22
52
  end
23
53
  end
@@ -1,4 +1,6 @@
1
- #coding: US-ASCII
1
+ # coding: US-ASCII
2
+ # frozen_string_literal: true
3
+
2
4
  Capybara::SpecHelper.spec "#save_screenshot" do
3
5
  let(:image_path) { File.join(Dir.tmpdir, 'capybara-screenshot.png') }
4
6
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#select" do
2
3
  before do
3
4
  @session.visit('/form')
@@ -0,0 +1,35 @@
1
+ Capybara::SpecHelper.spec Capybara::Selector do
2
+ before do
3
+ @session.visit('/form')
4
+ end
5
+
6
+ describe ":label selector" do
7
+ it "finds a label by text" do
8
+ expect(@session.find(:label, 'Customer Name').text).to eq 'Customer Name'
9
+ end
10
+
11
+ it "finds a label by for attribute string" do
12
+ expect(@session.find(:label, for: 'form_other_title')['for']).to eq 'form_other_title'
13
+ end
14
+
15
+ it "finds a label from nested input using :for filter" do
16
+ input = @session.find(:id, 'nested_label')
17
+ expect(@session.find(:label, for: input).text).to eq 'Nested Label'
18
+ end
19
+
20
+ it "finds the label for an non-nested element when using :for filter" do
21
+ select = @session.find(:id, 'form_other_title')
22
+ expect(@session.find(:label, for: select)['for']).to eq 'form_other_title'
23
+ end
24
+
25
+ context "with exact option" do
26
+ it "matches substrings" do
27
+ expect(@session.find(:label, 'Customer Na', exact: false).text).to eq 'Customer Name'
28
+ end
29
+
30
+ it "doesn't match substrings" do
31
+ expect { @session.find(:label, 'Customer Na', exact: true) }.to raise_error(Capybara::ElementNotFound)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#text' do
2
3
  it "should print the text of the page" do
3
4
  @session.visit('/with_simple_html')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#title' do
2
3
 
3
4
  it "should get the title of the page" do
@@ -13,4 +14,4 @@ Capybara::SpecHelper.spec '#title' do
13
14
  end
14
15
  after { Capybara.default_selector = :xpath }
15
16
  end
16
- end
17
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#uncheck" do
2
3
  before do
3
4
  @session.visit('/form')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec "#unselect" do
2
3
  before do
3
4
  @session.visit('/form')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#visit' do
2
3
  it "should fetch a response from the driver with a relative url" do
3
4
  @session.visit('/')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#become_closed', requires: [:windows, :js] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#current_window', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#open_new_window', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#switch_to_window', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#window_opened_by', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -86,14 +87,10 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
86
87
 
87
88
  describe '#size' do
88
89
  it 'should return size of whole window', requires: [:windows, :js] do
89
- skip "Chromedriver returns a size larger than outerWidth, outerHeight???" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_chrome)
90
-
91
90
  expect(@session.current_window.size).to eq @session.evaluate_script("[window.outerWidth, window.outerHeight];")
92
91
  end
93
92
 
94
93
  it 'should switch to original window if invoked not for current window' do
95
- skip "Chromedriver returns a size larger than outerWidth, outerHeight???" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_chrome)
96
-
97
94
  @other_window = @session.window_opened_by do
98
95
  @session.find(:css, '#openWindow').click
99
96
  end
@@ -132,8 +129,6 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
132
129
 
133
130
  describe '#maximize' do
134
131
  it 'should be able to maximize window', requires: [:windows, :js] do
135
- skip "This test fails when run with Firefox on Travis - see issue #1493 - skipping for now" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_focus)
136
-
137
132
  screen_width, screen_height = @session.evaluate_script("[window.screen.availWidth, window.screen.availHeight];")
138
133
  window = @session.current_window
139
134
  window.resize_to(screen_width-100, screen_height-100)
@@ -144,8 +139,6 @@ Capybara::SpecHelper.spec Capybara::Window, requires: [:windows] do
144
139
  end
145
140
 
146
141
  it 'should stay on current window if invoked not for current window', requires: [:windows, :js] do
147
- skip "This test fails when run with Firefox on Travis - see issue #1493 - skipping for now" if ENV['TRAVIS'] && @session.respond_to?(:mode) && (@session.mode == :selenium_focus)
148
-
149
142
  @other_window = @session.window_opened_by do
150
143
  @session.find(:css, '#openWindow').click
151
144
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#windows', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#within_window', requires: [:windows] do
2
3
  before(:each) do
3
4
  @window = @session.current_window
@@ -132,9 +133,7 @@ Capybara::SpecHelper.spec '#within_window', requires: [:windows] do
132
133
 
133
134
  context "with string" do
134
135
  it "should warn" do
135
- expect(@session).to receive(:warn).with("DEPRECATION WARNING: Passing string argument "\
136
- "to #within_window is deprecated. Pass window object or lambda. "\
137
- "(called from #{__FILE__}:138)").and_call_original
136
+ expect(@session).to receive(:warn).with(/DEPRECATION WARNING/).and_call_original
138
137
  @session.within_window('firstPopup') {}
139
138
  end
140
139
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#within_frame', :requires => [:frames] do
2
3
  before(:each) do
3
4
  @session.visit('/within_frames')
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  Capybara::SpecHelper.spec '#within' do
2
3
  before do
3
4
  @session.visit('/with_scope')
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
1
2
  require "rspec"
3
+ require "rspec/expectations"
2
4
  require "capybara"
3
5
  require "capybara/rspec" # Required here instead of in rspec_spec to avoid RSpec deprecation warning
4
6
  require "capybara/spec/test_app"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'sinatra/base'
2
3
  require 'tilt/erb'
3
4
  require 'rack'
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <h1>Buttons</h1>
2
3
  <button>Click me!</button>
3
4
  <button id="click_me_123">Click me by id!</button>
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <form action="/form" method="post">
2
3
  <fieldset id="agent_fieldset">
3
4
  <legend>Agent</legend>
@@ -26,4 +27,4 @@
26
27
  <input type="submit" value="Create"/>
27
28
  </p>
28
29
  </fieldset>
29
- </form>
30
+ </form>
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <h1>Form</h1>
2
3
 
3
4
  <form action="/form" method="post">
@@ -153,6 +154,10 @@ New line after and before textarea tag
153
154
  <label for="gender_both">Both</label>
154
155
  </p>
155
156
 
157
+ <p>
158
+ <input type="checkbox" id="no_attr_value_checked" value="1" checked/>
159
+ </p>
160
+
156
161
  <p>
157
162
  <input type="checkbox" value="dog" name="form[pets][]" id="form_pets_dog" checked="checked"/>
158
163
  <label for="form_pets_dog">Dog</label>
@@ -292,6 +297,16 @@ New line after and before textarea tag
292
297
  </label>
293
298
  </p>
294
299
 
300
+ <p>
301
+ <label for="form_disabled_select2">
302
+ Disabled Select 2
303
+ <select name="form[disabled_select2]" id="form_disabled_select2" disabled>
304
+ <option value="Should not see me" selected="selected">Should not see me</option>
305
+ </select>
306
+ </label>
307
+ </p>
308
+
309
+
295
310
  <p>
296
311
  <label for="form_disabled_file">
297
312
  Disabled File
@@ -318,6 +333,11 @@ New line after and before textarea tag
318
333
 
319
334
  <input type="text" name="form[outside_input]" value="outside_input" form="form1"/>
320
335
 
336
+ <label>
337
+ Nested Label
338
+ <input type="text" name="nested_label" id="nested_label"/>
339
+ </label>
340
+
321
341
  <form id="form1" action="/form" method="post">
322
342
  <input type="text" name="form[which_form]" value="form1" id="form_which_form"/>
323
343
  <input type="text" name="form[for_form2]" value="for_form2" form="form2"/>
@@ -423,6 +443,10 @@ New line after and before textarea tag
423
443
  <label for="html5_email">Html5 Email</label>
424
444
  <input type="email" name="form[html5_email]" value="person@email.com" id="html5_email"/>
425
445
  </p>
446
+ <p>
447
+ <label for="html5_multiple_email">Html5 Multiple Email</label>
448
+ <input type="email" multiple name="form[html5_multiple_email]" value="person@email.com" id="html5_multiple_email"/>
449
+ </p>
426
450
  <p>
427
451
  <label for="html5_url">Html5 Url</label>
428
452
  <input type="url" name="form[html5_url]" value="http://www.example.com" id="html5_url"/>
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <html>
2
3
  <head>
3
4
  <title>This is the child frame title</title>
@@ -6,4 +7,4 @@
6
7
  <iframe src="/frame_one" id="grandchildFrame1"></iframe>
7
8
  <iframe src="/frame_two" id="grandchildFrame2"></iframe>
8
9
  </body>
9
- </html>
10
+ </html>
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <html>
2
3
  <head>
3
4
  <title>This is the title of frame one</title>
@@ -5,4 +6,4 @@
5
6
  <body>
6
7
  <div id="divInFrameOne">This is the text of divInFrameOne</div>
7
8
  </body>
8
- </html>
9
+ </html>
@@ -1,3 +1,4 @@
1
+ <%# frozen_string_literal: true %>
1
2
  <html>
2
3
  <head>
3
4
  <title>This is the parent frame title</title>
@@ -5,4 +6,4 @@
5
6
  <body>
6
7
  <iframe src='/frame_child' id='childFrame'></iframe>
7
8
  </body>
8
- </html>
9
+ </html>