axe-core-api 4.0.0.pre.c36a2a1 → 4.0.0.pre.c46720b

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: bf8c79fe1a2b023b71dc36f78bb5976ca136c24b812940f01292cf7a9fc5a214
4
- data.tar.gz: 663ad66db0aff909ab65c3a778a2ecd5c582cb0ed8ed53283d926213d61326ce
3
+ metadata.gz: a14358b906d30e6bc99898292675d0b4ac96f8c0807b1ea15da2264009574cc3
4
+ data.tar.gz: dfd62ab52270b6ae9c0999ab3b759d2b8441017d87c673cf24ac746e69fa1d13
5
5
  SHA512:
6
- metadata.gz: 4fc0ccd93a647561af297b8921f3e50074be8d5cfb263df70f542777d99ab8528b1242374d893f742bb4abd83a9fd2a40f2c1204f6ea23a242b598ad5e8e79fc
7
- data.tar.gz: 29dba80aaa337a780ec17e678ac299fb890089a8ae0079baed93e0e77240af2deadf9c55e2686a8b3e18525541b25a08a88f007116e31b5fb6846bcb2138f0c3
6
+ metadata.gz: 13889c574ae182f933beeb9749ba50c2b0b5a5bb855d73f5dcf9fa09e2407572bfdf34f1067a84e0dc123d6caa7969bab832ab2944dc084e4b68fc6161871217
7
+ data.tar.gz: af4b61ef6a4466b7f2cf5745260994f22655ad17592bafb896042a6383af6d19c8cd7d36260848ae6940ec7b5d46e9bc7a875fa34d8bd4f885ce181392710b32
@@ -26,7 +26,7 @@ module Axe
26
26
  # init
27
27
  def initialize
28
28
  @page = :page
29
- @skip_iframes = :skip_iframes
29
+ @skip_iframes = nil
30
30
  @jslib_path = get_root + "/node_modules/axe-core/axe.min.js"
31
31
  end
32
32
 
data/lib/axe/core.rb CHANGED
@@ -31,6 +31,7 @@ module Axe
31
31
  end
32
32
 
33
33
  def wrap_driver(driver)
34
+ driver = driver.driver if driver.respond_to? :driver
34
35
  ::WebDriverScriptAdapter::QuerySelectorAdapter.wrap(
35
36
  ::WebDriverScriptAdapter::FrameAdapter.wrap(
36
37
  ::WebDriverScriptAdapter::ExecuteAsyncScriptAdapter.wrap(
data/lib/loader.rb CHANGED
@@ -10,6 +10,7 @@ module Common
10
10
 
11
11
  def call(source)
12
12
  @page.execute_script source
13
+ @page.execute_script "axe.configure({ allowedOrigins: ['<unsafe_all_origins>'] });"
13
14
  Common::Hooks.run_after_load @lib
14
15
  load_into_iframes(source) unless Axe::Configuration.instance.skip_iframes
15
16
  end
@@ -3,7 +3,7 @@ require "dumb_delegator"
3
3
  module WebDriverScriptAdapter
4
4
  class FrameAdapter < ::DumbDelegator
5
5
  def self.wrap(driver)
6
- if driver.respond_to?(:within_frame)
6
+ if driver.respond_to?(:find_css)
7
7
  CapybaraAdapter.new driver
8
8
  elsif !driver.respond_to?(:switch_to)
9
9
  WatirAdapter.new driver
@@ -16,20 +16,19 @@ module WebDriverScriptAdapter
16
16
 
17
17
  private
18
18
 
19
- class CapybaraAdapter < ::DumbDelegator
20
- def find_frames
21
- all(:css, "iframe")
19
+ class WatirAdapter < ::DumbDelegator
20
+ def initialize(driver)
21
+ super(driver)
22
+ @driver = driver
22
23
  end
23
- end
24
24
 
25
- class WatirAdapter < ::DumbDelegator
26
25
  # delegate to Watir's Selenium #driver
27
26
  def within_frame(frame, &block)
28
- SeleniumAdapter.instance_method(:within_frame).bind(FrameAdapter.wrap driver).call(frame, &block)
27
+ SeleniumAdapter.instance_method(:within_frame).bind(FrameAdapter.wrap @driver).call(frame, &block)
29
28
  end
30
29
 
31
30
  def find_frames
32
- driver.find_elements(:css, "iframe")
31
+ find_elements(:css, "iframe")
33
32
  end
34
33
  end
35
34
 
@@ -57,6 +56,41 @@ module WebDriverScriptAdapter
57
56
  end
58
57
  end
59
58
 
59
+ class CapybaraAdapter < ::DumbDelegator
60
+ def initialize(driver)
61
+ super(driver)
62
+ @driver = driver
63
+ end
64
+
65
+ def within_frame(frame)
66
+ # Patch the `Symbol` class to respond to the :native method.
67
+ # Will be fixed in https://github.com/teamcapybara/capybara/pull/2462
68
+ (:parent).class.define_method(:native) do
69
+ nil
70
+ end
71
+ switch_to_frame frame
72
+ yield
73
+ ensure
74
+ begin
75
+ switch_to_frame :parent
76
+ rescue => e
77
+ if /switchToParentFrame|frame\/parent/.match(e.message)
78
+ ::Kernel.warn "WARNING:
79
+ This browser only supports first-level iframes.
80
+ Second-level iframes and beyond will not be audited.
81
+ To skip auditing all iframes,
82
+ set Axe::Configuration#skip_iframes=true"
83
+ end
84
+ switch_to_frame :top
85
+ end
86
+ end
87
+
88
+ def find_frames
89
+ find_css("iframe")
90
+ end
91
+ end
92
+
93
+
60
94
  # Selenium Webdriver < 2.43 doesnt support moving back to the parent
61
95
  class ParentlessFrameAdapter < ::DumbDelegator
62
96
  # storage of frame stack (for reverting to parent) taken from Capybara
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axe-core-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.pre.c36a2a1
4
+ version: 4.0.0.pre.c46720b
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deque Systems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-29 00:00:00.000000000 Z
11
+ date: 2021-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dumb_delegator