axe-core-api 4.9.0.pre.849d39a → 4.9.1.pre.1a5838a

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ea179a516f33e0d5e64fb563c16a4fb4b267fae8e7f23bffbd227404e68bff8
4
- data.tar.gz: 46941651ccb03f0c77f28430544fe9e94f4147df21eb3b633ffbed29a8a4e1dd
3
+ metadata.gz: 12c93c9466138b2f7e70781d37dc404da0cc7d1aac8e2ad907e730491ec6b0bc
4
+ data.tar.gz: fc35cf2bfdb8fad39f07c52a3708e4f6c31394322882cce528bc5f06a655bd73
5
5
  SHA512:
6
- metadata.gz: 72f76da27e87b79c6db29ca096239f0377925d3aa285b33f30b8daa65d677623503044d48c5f3b77e06e8f937bcd225f89741df92290eed81660fe88eec1f618
7
- data.tar.gz: 5ed059168a23382bda115c0564498c747f0256f1b1fd839b383003a25d69d6584cf2cf82f21b734f2e466f1ee6aca581b122ef160bcb95d0045814e4d8f2c2fb
6
+ metadata.gz: b08b4d39d1346d1292e7dfb151267745b21ba62752a89293c5f0ccfa69c62bece7eaad8e81bf4edb4cd5dbf2025776533ebc0cc303ba9a4a683885a2701d3546
7
+ data.tar.gz: aa900c93bcbd4f4100cfcbd8f7616df6bad1bab07ae46f1048870b27e2a44ac86624e3c7defd1929586b9898b91380d9982f39fbc5190ad851b18d0522f4ee84
data/lib/axe/api/run.rb CHANGED
@@ -87,22 +87,28 @@ module Axe
87
87
 
88
88
  def within_about_blank_context(page)
89
89
  driver = get_selenium page
90
+ # This is a workaround to maintain Selenium 3 support
91
+ # Likely driver.switch_to.new_window(:tab) should be used instead, should we drop support, as per
92
+ # https://github.com/dequelabs/axe-core-gems/issues/352
90
93
 
91
- num_handles = page.window_handles.length
94
+ before_handles = page.window_handles
92
95
  begin
93
96
  driver.execute_script("window.open('about:blank'), '_blank'")
94
- if num_handles == page.window_handles.length
95
- raise StandardError.new "Could not open new window. Please make sure that you have popup blockers disabled."
96
- end
97
- driver.switch_to.window page.window_handles[-1]
98
97
  rescue
99
- raise StandardError.new "switchToWindow failed. Are you using updated browser drivers? Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
98
+ raise StandardError.new "switchToWindow failed. Are you using updated browser drivers? Please check out https://github.com/dequelabs/axe-core-gems/blob/develop/error-handling.md"
99
+ end
100
+ after_handles = page.window_handles
101
+ new_handles = after_handles.difference(before_handles)
102
+ if new_handles.length != 1
103
+ raise StandardError.new "Unable to determine window handle"
100
104
  end
105
+ new_handle = new_handles[0]
106
+ driver.switch_to.window new_handle
101
107
  driver.get "about:blank"
102
108
 
103
109
  ret = yield page
104
110
 
105
- driver.switch_to.window page.window_handles[-1]
111
+ driver.switch_to.window new_handle
106
112
  driver.close
107
113
  driver.switch_to.window @original_window
108
114
 
data/lib/axe/api.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Axe
2
+ module API
3
+ autoload :Run, "axe/api/run"
4
+ end
5
+ end
data/lib/axe/core.rb CHANGED
@@ -38,22 +38,8 @@ module Axe
38
38
  Core.has_run_partial?(@page) and not Axe::Configuration.instance.legacy_mode
39
39
  end
40
40
 
41
- def assert_frame_ready
42
- begin
43
- ready = Timeout.timeout(10) {
44
- @page.evaluate_script <<-JS
45
- document.readyState === 'complete'
46
- JS
47
- }
48
- rescue Timeout::Error
49
- ready = false
50
- end
51
- raise Exception.new "Page/frame not ready" if not ready
52
- end
53
-
54
41
  def load_axe_core(source)
55
42
  return if already_loaded?
56
- assert_frame_ready
57
43
  loader = Common::Loader.new(@page, self)
58
44
  loader.load_top_level source
59
45
  return if use_run_partial
@@ -2,7 +2,7 @@ require "forwardable"
2
2
 
3
3
  require_relative "../../chain_mail/chainable"
4
4
  require_relative "../core"
5
- require_relative "../api/run"
5
+ require_relative "../api"
6
6
 
7
7
  module Axe
8
8
  module Matchers