capybara 3.16.1 → 3.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/History.md +321 -0
  4. data/README.md +51 -60
  5. data/lib/capybara.rb +71 -114
  6. data/lib/capybara/config.rb +8 -5
  7. data/lib/capybara/cucumber.rb +1 -1
  8. data/lib/capybara/driver/node.rb +15 -3
  9. data/lib/capybara/dsl.rb +10 -2
  10. data/lib/capybara/helpers.rb +5 -3
  11. data/lib/capybara/minitest.rb +242 -141
  12. data/lib/capybara/minitest/spec.rb +159 -90
  13. data/lib/capybara/node/actions.rb +85 -74
  14. data/lib/capybara/node/base.rb +4 -4
  15. data/lib/capybara/node/document.rb +2 -2
  16. data/lib/capybara/node/document_matchers.rb +3 -3
  17. data/lib/capybara/node/element.rb +216 -117
  18. data/lib/capybara/node/finders.rb +65 -65
  19. data/lib/capybara/node/matchers.rb +228 -126
  20. data/lib/capybara/node/simple.rb +9 -4
  21. data/lib/capybara/queries/ancestor_query.rb +5 -7
  22. data/lib/capybara/queries/base_query.rb +2 -1
  23. data/lib/capybara/queries/current_path_query.rb +1 -1
  24. data/lib/capybara/queries/selector_query.rb +296 -30
  25. data/lib/capybara/queries/sibling_query.rb +5 -4
  26. data/lib/capybara/queries/style_query.rb +2 -2
  27. data/lib/capybara/queries/text_query.rb +13 -1
  28. data/lib/capybara/queries/title_query.rb +1 -1
  29. data/lib/capybara/rack_test/browser.rb +7 -2
  30. data/lib/capybara/rack_test/driver.rb +1 -1
  31. data/lib/capybara/rack_test/form.rb +1 -1
  32. data/lib/capybara/rack_test/node.rb +43 -7
  33. data/lib/capybara/registration_container.rb +44 -0
  34. data/lib/capybara/registrations/drivers.rb +36 -0
  35. data/lib/capybara/registrations/patches/puma_ssl.rb +27 -0
  36. data/lib/capybara/registrations/servers.rb +44 -0
  37. data/lib/capybara/result.rb +36 -8
  38. data/lib/capybara/rspec/matcher_proxies.rb +6 -4
  39. data/lib/capybara/rspec/matchers.rb +100 -63
  40. data/lib/capybara/rspec/matchers/base.rb +23 -10
  41. data/lib/capybara/rspec/matchers/count_sugar.rb +37 -0
  42. data/lib/capybara/rspec/matchers/have_ancestor.rb +28 -0
  43. data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
  44. data/lib/capybara/rspec/matchers/have_selector.rb +16 -8
  45. data/lib/capybara/rspec/matchers/have_sibling.rb +27 -0
  46. data/lib/capybara/rspec/matchers/have_text.rb +4 -4
  47. data/lib/capybara/rspec/matchers/have_title.rb +2 -2
  48. data/lib/capybara/rspec/matchers/match_selector.rb +3 -3
  49. data/lib/capybara/rspec/matchers/match_style.rb +2 -2
  50. data/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
  51. data/lib/capybara/selector.rb +219 -588
  52. data/lib/capybara/selector/builders/css_builder.rb +10 -6
  53. data/lib/capybara/selector/builders/xpath_builder.rb +1 -1
  54. data/lib/capybara/selector/css.rb +4 -2
  55. data/lib/capybara/selector/definition.rb +277 -0
  56. data/lib/capybara/selector/definition/button.rb +52 -0
  57. data/lib/capybara/selector/definition/checkbox.rb +26 -0
  58. data/lib/capybara/selector/definition/css.rb +10 -0
  59. data/lib/capybara/selector/definition/datalist_input.rb +35 -0
  60. data/lib/capybara/selector/definition/datalist_option.rb +25 -0
  61. data/lib/capybara/selector/definition/element.rb +27 -0
  62. data/lib/capybara/selector/definition/field.rb +40 -0
  63. data/lib/capybara/selector/definition/fieldset.rb +14 -0
  64. data/lib/capybara/selector/definition/file_field.rb +13 -0
  65. data/lib/capybara/selector/definition/fillable_field.rb +33 -0
  66. data/lib/capybara/selector/definition/frame.rb +17 -0
  67. data/lib/capybara/selector/definition/id.rb +6 -0
  68. data/lib/capybara/selector/definition/label.rb +62 -0
  69. data/lib/capybara/selector/definition/link.rb +54 -0
  70. data/lib/capybara/selector/definition/link_or_button.rb +16 -0
  71. data/lib/capybara/selector/definition/option.rb +27 -0
  72. data/lib/capybara/selector/definition/radio_button.rb +27 -0
  73. data/lib/capybara/selector/definition/select.rb +81 -0
  74. data/lib/capybara/selector/definition/table.rb +109 -0
  75. data/lib/capybara/selector/definition/table_row.rb +21 -0
  76. data/lib/capybara/selector/definition/xpath.rb +5 -0
  77. data/lib/capybara/selector/filter_set.rb +13 -9
  78. data/lib/capybara/selector/filters/base.rb +11 -2
  79. data/lib/capybara/selector/filters/locator_filter.rb +13 -3
  80. data/lib/capybara/selector/regexp_disassembler.rb +9 -2
  81. data/lib/capybara/selector/selector.rb +43 -448
  82. data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -0
  83. data/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -0
  84. data/lib/capybara/selenium/atoms/src/getAttribute.js +161 -0
  85. data/lib/capybara/selenium/atoms/src/isDisplayed.js +454 -0
  86. data/lib/capybara/selenium/driver.rb +125 -56
  87. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +73 -17
  88. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +124 -0
  89. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +41 -2
  90. data/lib/capybara/selenium/driver_specializations/internet_explorer_driver.rb +14 -1
  91. data/lib/capybara/selenium/driver_specializations/safari_driver.rb +14 -5
  92. data/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
  93. data/lib/capybara/selenium/extensions/find.rb +67 -45
  94. data/lib/capybara/selenium/extensions/html5_drag.rb +152 -36
  95. data/lib/capybara/selenium/extensions/modifier_keys_stack.rb +28 -0
  96. data/lib/capybara/selenium/logger_suppressor.rb +34 -0
  97. data/lib/capybara/selenium/node.rb +227 -56
  98. data/lib/capybara/selenium/nodes/chrome_node.rb +93 -8
  99. data/lib/capybara/selenium/nodes/edge_node.rb +104 -0
  100. data/lib/capybara/selenium/nodes/firefox_node.rb +37 -59
  101. data/lib/capybara/selenium/nodes/ie_node.rb +22 -0
  102. data/lib/capybara/selenium/nodes/safari_node.rb +27 -54
  103. data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
  104. data/lib/capybara/selenium/patches/atoms.rb +18 -0
  105. data/lib/capybara/selenium/patches/is_displayed.rb +16 -0
  106. data/lib/capybara/selenium/patches/logs.rb +45 -0
  107. data/lib/capybara/server.rb +19 -3
  108. data/lib/capybara/server/animation_disabler.rb +2 -2
  109. data/lib/capybara/server/checker.rb +6 -2
  110. data/lib/capybara/server/middleware.rb +23 -13
  111. data/lib/capybara/session.rb +124 -106
  112. data/lib/capybara/session/config.rb +12 -10
  113. data/lib/capybara/session/matchers.rb +6 -6
  114. data/lib/capybara/spec/public/offset.js +6 -0
  115. data/lib/capybara/spec/public/test.js +94 -5
  116. data/lib/capybara/spec/session/all_spec.rb +84 -6
  117. data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
  118. data/lib/capybara/spec/session/assert_current_path_spec.rb +5 -2
  119. data/lib/capybara/spec/session/assert_text_spec.rb +9 -5
  120. data/lib/capybara/spec/session/attach_file_spec.rb +14 -6
  121. data/lib/capybara/spec/session/check_spec.rb +10 -4
  122. data/lib/capybara/spec/session/choose_spec.rb +8 -2
  123. data/lib/capybara/spec/session/click_button_spec.rb +44 -1
  124. data/lib/capybara/spec/session/click_link_spec.rb +11 -0
  125. data/lib/capybara/spec/session/evaluate_script_spec.rb +12 -0
  126. data/lib/capybara/spec/session/fill_in_spec.rb +37 -2
  127. data/lib/capybara/spec/session/find_spec.rb +60 -6
  128. data/lib/capybara/spec/session/first_spec.rb +1 -1
  129. data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +14 -1
  130. data/lib/capybara/spec/session/frame/within_frame_spec.rb +12 -1
  131. data/lib/capybara/spec/session/has_ancestor_spec.rb +46 -0
  132. data/lib/capybara/spec/session/has_button_spec.rb +16 -0
  133. data/lib/capybara/spec/session/has_css_spec.rb +35 -6
  134. data/lib/capybara/spec/session/has_current_path_spec.rb +6 -4
  135. data/lib/capybara/spec/session/has_field_spec.rb +34 -0
  136. data/lib/capybara/spec/session/has_select_spec.rb +32 -4
  137. data/lib/capybara/spec/session/has_selector_spec.rb +4 -4
  138. data/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
  139. data/lib/capybara/spec/session/has_table_spec.rb +51 -5
  140. data/lib/capybara/spec/session/has_text_spec.rb +47 -0
  141. data/lib/capybara/spec/session/matches_style_spec.rb +2 -2
  142. data/lib/capybara/spec/session/node_spec.rb +574 -16
  143. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +2 -2
  144. data/lib/capybara/spec/session/save_screenshot_spec.rb +4 -4
  145. data/lib/capybara/spec/session/scroll_spec.rb +1 -1
  146. data/lib/capybara/spec/session/select_spec.rb +5 -10
  147. data/lib/capybara/spec/session/selectors_spec.rb +24 -3
  148. data/lib/capybara/spec/session/uncheck_spec.rb +2 -2
  149. data/lib/capybara/spec/session/unselect_spec.rb +1 -1
  150. data/lib/capybara/spec/session/window/window_spec.rb +10 -9
  151. data/lib/capybara/spec/spec_helper.rb +7 -2
  152. data/lib/capybara/spec/test_app.rb +26 -21
  153. data/lib/capybara/spec/views/animated.erb +49 -0
  154. data/lib/capybara/spec/views/form.erb +25 -4
  155. data/lib/capybara/spec/views/frame_child.erb +2 -1
  156. data/lib/capybara/spec/views/frame_one.erb +1 -0
  157. data/lib/capybara/spec/views/obscured.erb +9 -9
  158. data/lib/capybara/spec/views/offset.erb +32 -0
  159. data/lib/capybara/spec/views/react.erb +45 -0
  160. data/lib/capybara/spec/views/spatial.erb +31 -0
  161. data/lib/capybara/spec/views/with_animation.erb +29 -1
  162. data/lib/capybara/spec/views/with_dragula.erb +24 -0
  163. data/lib/capybara/spec/views/with_html.erb +28 -2
  164. data/lib/capybara/spec/views/with_js.erb +2 -1
  165. data/lib/capybara/spec/views/with_jstree.erb +26 -0
  166. data/lib/capybara/spec/views/with_sortable_js.erb +21 -0
  167. data/lib/capybara/version.rb +1 -1
  168. data/lib/capybara/window.rb +10 -10
  169. data/spec/basic_node_spec.rb +6 -6
  170. data/spec/capybara_spec.rb +28 -28
  171. data/spec/dsl_spec.rb +16 -3
  172. data/spec/filter_set_spec.rb +5 -5
  173. data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
  174. data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
  175. data/spec/minitest_spec.rb +12 -2
  176. data/spec/minitest_spec_spec.rb +56 -45
  177. data/spec/rack_test_spec.rb +25 -12
  178. data/spec/regexp_dissassembler_spec.rb +53 -39
  179. data/spec/result_spec.rb +50 -54
  180. data/spec/rspec/features_spec.rb +1 -0
  181. data/spec/rspec/shared_spec_matchers.rb +78 -62
  182. data/spec/rspec_spec.rb +5 -5
  183. data/spec/sauce_spec_chrome.rb +1 -0
  184. data/spec/selector_spec.rb +26 -16
  185. data/spec/selenium_spec_chrome.rb +84 -5
  186. data/spec/selenium_spec_chrome_remote.rb +23 -8
  187. data/spec/selenium_spec_edge.rb +23 -8
  188. data/spec/selenium_spec_firefox.rb +16 -21
  189. data/spec/selenium_spec_firefox_remote.rb +4 -13
  190. data/spec/selenium_spec_ie.rb +23 -15
  191. data/spec/selenium_spec_safari.rb +17 -17
  192. data/spec/server_spec.rb +87 -42
  193. data/spec/session_spec.rb +11 -4
  194. data/spec/shared_selenium_node.rb +83 -0
  195. data/spec/shared_selenium_session.rb +62 -72
  196. data/spec/spec_helper.rb +43 -5
  197. metadata +114 -16
@@ -10,7 +10,8 @@
10
10
  </script>
11
11
  </head>
12
12
  <body id="childBody">
13
- <a href="javascript:void(0)" onClick="closeWin()">Close Window</a>
13
+ <a href="javascript:void(0)" onClick="closeWin()">Close Window Now</a>
14
+ <a href="javascript:void(0)" onClick="setTimeout(function(){closeWin()}, 10)">Close Window Soon</a>
14
15
  <iframe src="/frame_one" id="grandchildFrame1"></iframe>
15
16
  <iframe src="/frame_two" id="grandchildFrame2"></iframe>
16
17
  </body>
@@ -5,5 +5,6 @@
5
5
  </head>
6
6
  <body>
7
7
  <div id="divInFrameOne">This is the text of divInFrameOne</div>
8
+ <div id="otherDivInFrameOne">Some other text</div>
8
9
  </body>
9
10
  </html>
@@ -1,15 +1,13 @@
1
1
  <html>
2
2
  <head>
3
3
  <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
- <title>with_animation</title>
5
- <script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
6
- <script>
7
- $(document).on('contextmenu', function(e){ e.preventDefault(); });
8
- </script>
4
+ <title>Obscured</title>
9
5
  <style>
10
6
  div {
11
- width: 400px;
12
- height: 400px;
7
+ width: 200px;
8
+ height: 200px;
9
+ }
10
+ #cover, #offscreen, #offscreen_wrapper {
13
11
  position: absolute;
14
12
  }
15
13
  #obscured {
@@ -17,6 +15,7 @@
17
15
  background-color: red;
18
16
  }
19
17
  #cover {
18
+ top: 0px;
20
19
  z-index: 2;
21
20
  background-color: blue;
22
21
  }
@@ -33,12 +32,13 @@
33
32
  }
34
33
  </style>
35
34
  </head>
36
-
37
- <body id="with_animation">
35
+ <body>
38
36
  <div id="obscured">
39
37
  <input id="obscured_input"/>
40
38
  </div>
41
39
  <div id="cover"></div>
40
+ <iframe id="frameOne" height="10px" src="/frame_one"></iframe>
41
+ <iframe id="nestedFrames" src="/frame_parent"></iframe>
42
42
  <div id="offscreen_wrapper">
43
43
  <div id="offscreen"></div>
44
44
  </div>
@@ -0,0 +1,32 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
+ <title>Offset</title>
5
+ <style>
6
+ body {
7
+ margin: 0px;
8
+ }
9
+ #wrapper {
10
+ width: 300px;
11
+ height: 300px;
12
+ margin: 0px;
13
+ }
14
+ #clicker {
15
+ position: relative;
16
+ width: 100px;
17
+ height: 100px;
18
+ top: 100px;
19
+ left: 100px;
20
+ background-color: red;
21
+ margin: 0px;
22
+ }
23
+ </style>
24
+ <script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
25
+ <script src="/offset.js" type="text/javascript" charset="utf-8"></script>
26
+ </head>
27
+ <body>
28
+ <div id="wrapper">
29
+ <div id="clicker"></div>
30
+ </div>
31
+ </body>
32
+ </html>
@@ -0,0 +1,45 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <script src="https://unpkg.com/react/umd/react.development.js"></script>
5
+ <script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script>
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ <script>
10
+ // https://codepen.io/gaearon/pen/VmmPgp?editors=0010
11
+ class NameForm extends React.Component {
12
+ constructor(props) {
13
+ super(props);
14
+ this.state = { value: '' };
15
+
16
+ this.handleChange = this.handleChange.bind(this);
17
+ this.handleSubmit = this.handleSubmit.bind(this);
18
+ }
19
+
20
+ handleChange(event) {
21
+ this.setState({ value: event.target.value });
22
+ }
23
+
24
+ handleSubmit(event) {
25
+ alert('A name was submitted: ' + this.state.value);
26
+ event.preventDefault();
27
+ }
28
+
29
+ render() {
30
+ return (
31
+ React.createElement("form", { onSubmit: this.handleSubmit },
32
+ React.createElement("label", null, "Name:",
33
+
34
+ React.createElement("input", { type: "text", value: this.state.value, onChange: this.handleChange })),
35
+
36
+ React.createElement("input", { type: "submit", value: "Submit" })));
37
+ }}
38
+
39
+
40
+ ReactDOM.render(
41
+ React.createElement(NameForm, null),
42
+ document.getElementById('root'));
43
+ </script>
44
+ </body>
45
+ </html>
@@ -0,0 +1,31 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
+ <title>spatial</title>
5
+ <style>
6
+ #spatial {
7
+ display: grid;
8
+ grid-template-columns: repeat(3, 1fr);
9
+ grid-gap: 10px;
10
+ grid-auto-rows: minmax(100px, auto);
11
+ }
12
+ .footer {
13
+ grid-column: 1 / 4;
14
+ }
15
+ </style>
16
+ </head>
17
+
18
+ <body id="spatial">
19
+ <div class="corner">1</div>
20
+ <div class="distance">2</div>
21
+ <div class="corner">3</div>
22
+ <div>4</div>
23
+ <div class="center">5</div>
24
+ <div>6</div>
25
+ <div class="corner">7</div>
26
+ <div>8</div>
27
+ <div class="corner">9</div>
28
+ <div class="footer distance">10</div>
29
+ </body>
30
+ </html>
31
+
@@ -6,6 +6,17 @@
6
6
  <script src="/jquery.js" type="text/javascript" charset="utf-8"></script>
7
7
  <script src="/jquery-ui.js" type="text/javascript" charset="utf-8"></script>
8
8
  <script src="/test.js" type="text/javascript" charset="utf-8"></script>
9
+ <script type="text/javascript">
10
+ $(document).on('transitionend', function(){
11
+ $(document.body).append('<div>Transition Ended</div>')
12
+ });
13
+ $(document).on('animationend', function(){
14
+ $(document.body).append('<div>Animation Ended</div>')
15
+ });
16
+ $(document).on('contextmenu', function(e){
17
+ e.preventDefault();
18
+ });
19
+ </script>
9
20
  <style>
10
21
  .transition.away {
11
22
  width: 0%;
@@ -17,6 +28,13 @@
17
28
  overflow: hidden;
18
29
  }
19
30
 
31
+ a::after {
32
+ content: "";
33
+ width: 0px;
34
+ height: 0px;
35
+ background-color: blue;
36
+ }
37
+
20
38
  a:not(.away) {
21
39
  height: 20px;
22
40
  }
@@ -35,12 +53,22 @@
35
53
  animation-duration: 3s;
36
54
  animation-fill-mode: forwards;
37
55
  }
56
+
57
+ @keyframes pseudo_grow {
58
+ 100% { height: 100px, width: 100px };
59
+ }
60
+
61
+ a.animation.pseudo::after {
62
+ animation: pseudo_grow 3s forwards;
63
+ }
38
64
  </style>
39
65
  </head>
40
66
 
41
67
  <body id="with_animation">
42
68
  <a href='#' class='transition' onclick='this.classList.add("away")'>transition me away</a>
43
- <a href='#' class='animation' onclick='this.classList.add("away")'>animate me away</a>
69
+ <a href='#' class='animation' onclick='this.classList.add("away")' oncontextmenu='this.classList.add("pseudo")'>
70
+ animate me away
71
+ </a>
44
72
  </body>
45
73
  </html>
46
74
 
@@ -0,0 +1,24 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
+ <title>with_dragula</title>
5
+
6
+ </head>
7
+
8
+ <body id="with_dragula">
9
+ <div id="sortable">
10
+ <div class="item1">Item 1</div>
11
+ <div class="item2">Item 2</div>
12
+ <div class="item3">Item 3</div>
13
+ <div class="item4">Item 4</div>
14
+ <div class="item5">Item 5</div>
15
+ </div>
16
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/dragula/3.7.2/dragula.js" type="text/javascript"></script>
17
+ <script>
18
+ let container = document.getElementById("sortable");
19
+ dragula([container]);
20
+ container.className = "ready"
21
+ </script>
22
+ </body>
23
+ </html>
24
+
@@ -36,8 +36,8 @@
36
36
  </p>
37
37
 
38
38
  <p>
39
- <input type="text" id="test_field" data-test-id="test_id" value="monkey"/>
40
- <input type="text" readonly="readonly" value="should not change" />
39
+ <input type="text" id="test_field" spellcheck="TRUE" data-test-id="test_id" value="monkey"/>
40
+ <input type="text" readonly="readonly" spellcheck="FALSE" value="should not change" />
41
41
  <textarea id="normal" data-other-test-id="test_id">
42
42
  banana</textarea>
43
43
  <textarea id="additional_newline">
@@ -138,6 +138,9 @@ banana</textarea>
138
138
  Ancestor
139
139
  <div id="child">Child</div>
140
140
  </div>
141
+ <div id="ancestor1_sibiling">
142
+ ASibling
143
+ </div>
141
144
  </div>
142
145
  <button id="ancestor_button" type="submit" disabled>
143
146
  <img id="button_img" width="20" height="20" alt="button img"/>
@@ -178,5 +181,28 @@ banana</textarea>
178
181
  &#x20;&#x1680;&#x2000;&#x2001;&#x2002; &#x2003;&#x2004;&nbsp;&#x2005; &#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x202F;&#x205F;&#x3000;
179
182
  </div>
180
183
 
184
+ <details id="closed_details">
185
+ <summary>
186
+ <h6>Something</h6>
187
+ </summary>
188
+ <ul>
189
+ <li>Random</li>
190
+ <li>Things</li>
191
+ </ul>
192
+ </details>
193
+
194
+ <details id="open_details" open>
195
+ <summary>
196
+ <h6>Summary</h6>
197
+ </summary>
198
+ <div>
199
+ Contents
200
+ </div>
201
+ </details>
202
+
203
+ <template id="template">
204
+ <input />
205
+ </template>
206
+
181
207
  <a href="/download.csv" download>Download Me</a>
182
208
  <a href="/download.csv" download="other.csv">Download Other</a>
@@ -28,13 +28,14 @@
28
28
  <div id="drag_html5" draggable="true">
29
29
  <p>This is an HTML5 draggable element.</p>
30
30
  </div>
31
- <a id="drag_link_html5" href="#">This is an HTML5 draggable link</a>
31
+ <a id="drag_link_html5" href="#"><p>This is an HTML5 draggable link</p></a>
32
32
  <div id="drop_html5" class="drop">
33
33
  <p>It should be dropped here.</p>
34
34
  </div>
35
35
 
36
36
  <p><a href="#" id="clickable">Click me</a></p>
37
37
  <p><a href="#" id="slow-click">Slowly</a></p>
38
+ <p><span id="aria-button" role="button">ARIA button</span></p>
38
39
 
39
40
  <p>
40
41
  <select id="waiter">
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
5
+ <title>with_jstree</title>
6
+ </head>
7
+ <body id="with_jstree">
8
+ <div id="container">
9
+ <ul>
10
+ <li>Child node A</li>
11
+ <li>Child node B</li>
12
+ <li>Child node C</li>
13
+ </ul>
14
+ </div>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
16
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.3.8/jstree.min.js"></script>
17
+ <script>
18
+ $(function () {
19
+ $('#container').jstree({
20
+ "core" : { "check_callback" : true }, // so that operations work
21
+ "plugins" : ["dnd"]
22
+ });
23
+ });
24
+ </script>
25
+ </body>
26
+ </html>
@@ -0,0 +1,21 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
4
+ <title>with_sortable_js</title>
5
+ <script src="https://sortablejs.github.io/Sortable/Sortable.js" type="text/javascript"></script>
6
+ </head>
7
+
8
+ <body id="with_sortable_js">
9
+ <div id="sortable">
10
+ <div class="item1">Item 1</div>
11
+ <div class="item2">Item 2</div>
12
+ <div class="item3">Item 3</div>
13
+ <div class="item4">Item 4</div>
14
+ <div class="item5">Item 5</div>
15
+ </div>
16
+ <script>
17
+ new Sortable(document.getElementById("sortable"));
18
+ </script>
19
+ </body>
20
+ </html>
21
+
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Capybara
4
- VERSION = '3.16.1'
4
+ VERSION = '3.33.0'
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Capybara
4
4
  ##
5
- # The Window class represents a browser window.
5
+ # The {Window} class represents a browser window.
6
6
  #
7
7
  # You can get an instance of the class by calling either of:
8
8
  #
@@ -12,12 +12,12 @@ module Capybara
12
12
  # * {Capybara::Session#switch_to_window}
13
13
  #
14
14
  # Note that some drivers (e.g. Selenium) support getting size of/resizing/closing only
15
- # current window. So if you invoke such method for:
15
+ # current window. So if you invoke such method for:
16
16
  #
17
- # * window that is current, Capybara will make 2 Selenium method invocations
18
- # (get handle of current window + get size/resize/close).
19
- # * window that is not current, Capybara will make 4 Selenium method invocations
20
- # (get handle of current window + switch to given handle + get size/resize/close + switch to original handle)
17
+ # * window that is current, Capybara will make 2 Selenium method invocations
18
+ # (get handle of current window + get size/resize/close).
19
+ # * window that is not current, Capybara will make 4 Selenium method invocations
20
+ # (get handle of current window + switch to given handle + get size/resize/close + switch to original handle)
21
21
  #
22
22
  class Window
23
23
  # @return [String] a string that uniquely identifies window within session
@@ -57,12 +57,12 @@ module Capybara
57
57
  # Close window.
58
58
  #
59
59
  # If this method was called for window that is current, then after calling this method
60
- # future invocations of other Capybara methods should raise
61
- # `session.driver.no_such_window_error` until another window will be switched to.
60
+ # future invocations of other Capybara methods should raise
61
+ # {Capybara::Driver::Base#no_such_window_error session.driver.no_such_window_error} until another window will be switched to.
62
62
  #
63
63
  # @!macro about_current
64
64
  # If this method was called for window that is not current, then after calling this method
65
- # current window shouldn remain the same as it was before calling this method.
65
+ # current window should remain the same as it was before calling this method.
66
66
  #
67
67
  def close
68
68
  @driver.close_window(handle)
@@ -93,7 +93,7 @@ module Capybara
93
93
  # Maximize window.
94
94
  #
95
95
  # If a particular driver (e.g. headless driver) doesn't have concept of maximizing it
96
- # may not support this method.
96
+ # may not support this method.
97
97
  #
98
98
  # @macro about_current
99
99
  #
@@ -5,7 +5,7 @@ require 'spec_helper'
5
5
  RSpec.describe Capybara do
6
6
  describe '.string' do
7
7
  let :string do
8
- Capybara.string <<-STRING
8
+ described_class.string <<-STRING
9
9
  <html>
10
10
  <head>
11
11
  <title>simple_node</title>
@@ -52,7 +52,7 @@ RSpec.describe Capybara do
52
52
  end
53
53
 
54
54
  it 'allows using custom matchers' do
55
- Capybara.add_selector :lifeform do
55
+ described_class.add_selector :lifeform do
56
56
  xpath { |name| ".//option[contains(.,'#{name}')]" }
57
57
  end
58
58
  expect(string).to have_selector(:id, 'page')
@@ -62,7 +62,7 @@ RSpec.describe Capybara do
62
62
  end
63
63
 
64
64
  it 'allows custom matcher using css' do
65
- Capybara.add_selector :section do
65
+ described_class.add_selector :section do
66
66
  css { |css_class| "section .#{css_class}" }
67
67
  end
68
68
  expect(string).to have_selector(:section, 'subsection')
@@ -112,13 +112,13 @@ RSpec.describe Capybara do
112
112
 
113
113
  it 'drops illegal fragments when using gumbo' do
114
114
  skip 'libxml is less strict than Gumbo' unless Nokogiri.respond_to?(:HTML5)
115
- expect(Capybara.string('<td>1</td>')).not_to have_css('td')
115
+ expect(described_class.string('<td>1</td>')).not_to have_css('td')
116
116
  end
117
117
 
118
118
  it 'can disable use of gumbo' do
119
119
  skip "Test doesn't make sense unlesss nokogumbo is loaded" unless Nokogiri.respond_to?(:HTML5)
120
- Capybara.allow_gumbo = false
121
- expect(Capybara.string('<td>1</td>')).to have_css('td')
120
+ described_class.allow_gumbo = false
121
+ expect(described_class.string('<td>1</td>')).to have_css('td')
122
122
  end
123
123
 
124
124
  describe '#title' do