capybara-accessible 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -2
- data/.travis.yml +26 -0
- data/Gemfile +0 -1
- data/LICENSE +19 -0
- data/README.md +33 -40
- data/Rakefile +3 -8
- data/capybara-accessible.gemspec +16 -22
- data/lib/capybara/accessible.rb +34 -85
- data/lib/capybara/accessible/adapters/poltergeist.rb +18 -0
- data/lib/capybara/accessible/adapters/selenium.rb +20 -0
- data/lib/capybara/accessible/auditor.rb +27 -54
- data/lib/capybara/accessible/driver.rb +16 -0
- data/lib/capybara/accessible/extensions/driver.rb +28 -0
- data/lib/capybara/accessible/extensions/element.rb +19 -0
- data/lib/capybara/accessible/tasks.rb +0 -1
- data/lib/capybara/accessible/version.rb +1 -1
- data/lib/vendor/google/accessibility-developer-tools/axs_testing.js +2548 -1555
- data/spec/accessible_app.rb +2 -0
- data/spec/capybara_accessible_spec.rb +81 -0
- data/spec/spec_helper.rb +5 -10
- metadata +21 -66
- data/LICENSE.txt +0 -22
- data/lib/capybara/accessible/driver_extensions.rb +0 -6
- data/lib/capybara/accessible/element.rb +0 -10
- data/spec/poltergeist_driver_spec.rb +0 -56
- data/spec/selenium_driver_spec.rb +0 -70
- data/spec/webkit_driver_spec.rb +0 -71
- data/tddium.yml +0 -7
- data/travis.yml +0 -7
data/spec/accessible_app.rb
CHANGED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'capybara-accessible', type: 'feature' do
|
4
|
+
shared_examples 'a capybara accessible driver' do
|
5
|
+
context 'a page without accessibility errors' do
|
6
|
+
it 'does not raise an exception on audit failures' do
|
7
|
+
expect { visit('/accessible') }.to_not raise_error
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
context 'a page with inaccessible elements' do
|
12
|
+
it 'raises an exception on visiting the page' do
|
13
|
+
expect { visit('/inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'raises an exception when visiting the page via a link' do
|
17
|
+
visit('/accessible')
|
18
|
+
expect { click_link('inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'with configuration that excludes rules' do
|
22
|
+
before do
|
23
|
+
Capybara::Accessible::Auditor.exclusions = ['AX_TEXT_01']
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'does not raise an error on an excluded rule' do
|
27
|
+
expect { visit('/excluded') }.to_not raise_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'with log level set to warn' do
|
32
|
+
before do
|
33
|
+
Capybara::Accessible::Auditor.log_level = :warn
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
Capybara::Accessible::Auditor.log_level = :error
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'puts to stdout and does not raise an error' do
|
41
|
+
expect($stdout).to receive(:puts)
|
42
|
+
expect { visit('/inaccessible') }.to_not raise_error
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'a page with a javascript popup' do
|
47
|
+
it 'does not raise an exception' do
|
48
|
+
visit('/alert')
|
49
|
+
expect { click_link('Alert!') }.to_not raise_error
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with severity set to severe' do
|
54
|
+
before do
|
55
|
+
Capybara::Accessible::Auditor.severe_rules = ['AX_TEXT_02']
|
56
|
+
end
|
57
|
+
|
58
|
+
after do
|
59
|
+
Capybara::Accessible::Auditor.severe_rules = []
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'raises an exception on the image without alt text' do
|
63
|
+
expect { visit('/severe') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe 'poltergeist driver', driver: :accessible_poltergeist do
|
70
|
+
it_behaves_like 'a capybara accessible driver'
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'selenium firefox driver', driver: :accessible_selenium do
|
74
|
+
it_behaves_like 'a capybara accessible driver'
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'selenium chrome driver', driver: :accessible_selenium_chrome do
|
78
|
+
it_behaves_like 'a capybara accessible driver'
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,15 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'rspec/autorun'
|
3
|
-
require 'rbconfig'
|
4
1
|
require 'capybara'
|
5
|
-
require 'capybara/spec/spec_helper'
|
6
2
|
require 'capybara/accessible'
|
7
|
-
require '
|
8
|
-
require '
|
3
|
+
require 'capybara/poltergeist'
|
4
|
+
require 'capybara/rspec'
|
9
5
|
|
10
|
-
|
11
|
-
$LOAD_PATH << File.join(PROJECT_ROOT, 'lib')
|
6
|
+
require 'accessible_app'
|
12
7
|
|
13
8
|
RSpec.configure do |c|
|
14
|
-
Capybara::SpecHelper.configure(c)
|
15
9
|
c.around(:each, :inaccessible => true) do |example|
|
16
10
|
Capybara::Accessible.skip_audit { example.run }
|
17
11
|
end
|
18
12
|
end
|
19
13
|
|
20
|
-
Capybara.
|
14
|
+
Capybara.app = AccessibleApp
|
15
|
+
Capybara.server = :webrick
|
metadata
CHANGED
@@ -1,57 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-accessible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Case Commons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: selenium-webdriver
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: capybara-webkit
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - ">="
|
46
18
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
type: :
|
19
|
+
version: 3.12.0
|
20
|
+
type: :runtime
|
49
21
|
prerelease: false
|
50
22
|
version_requirements: !ruby/object:Gem::Requirement
|
51
23
|
requirements:
|
52
24
|
- - ">="
|
53
25
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
26
|
+
version: 3.12.0
|
55
27
|
- !ruby/object:Gem::Dependency
|
56
28
|
name: poltergeist
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,33 +67,19 @@ dependencies:
|
|
95
67
|
- !ruby/object:Gem::Version
|
96
68
|
version: '0'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: tddium
|
70
|
+
name: selenium-webdriver
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
73
|
- - ">="
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
75
|
+
version: 3.14.0
|
118
76
|
type: :development
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
80
|
- - ">="
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
82
|
+
version: 3.14.0
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
84
|
name: sinatra
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +94,8 @@ dependencies:
|
|
136
94
|
- - ">="
|
137
95
|
- !ruby/object:Gem::Version
|
138
96
|
version: '0'
|
139
|
-
description:
|
97
|
+
description: A Selenium based webdriver and Capybara extension that runs Google Accessibility
|
98
|
+
Developer Tools auditing assertions on page visits.
|
140
99
|
email:
|
141
100
|
- accessibility@casecommons.org
|
142
101
|
executables: []
|
@@ -144,26 +103,26 @@ extensions: []
|
|
144
103
|
extra_rdoc_files: []
|
145
104
|
files:
|
146
105
|
- ".gitignore"
|
106
|
+
- ".travis.yml"
|
147
107
|
- Gemfile
|
148
|
-
- LICENSE
|
108
|
+
- LICENSE
|
149
109
|
- README.md
|
150
110
|
- Rakefile
|
151
111
|
- capybara-accessible.gemspec
|
152
112
|
- lib/capybara/accessible.rb
|
113
|
+
- lib/capybara/accessible/adapters/poltergeist.rb
|
114
|
+
- lib/capybara/accessible/adapters/selenium.rb
|
153
115
|
- lib/capybara/accessible/auditor.rb
|
154
|
-
- lib/capybara/accessible/
|
155
|
-
- lib/capybara/accessible/
|
116
|
+
- lib/capybara/accessible/driver.rb
|
117
|
+
- lib/capybara/accessible/extensions/driver.rb
|
118
|
+
- lib/capybara/accessible/extensions/element.rb
|
156
119
|
- lib/capybara/accessible/railtie.rb
|
157
120
|
- lib/capybara/accessible/tasks.rb
|
158
121
|
- lib/capybara/accessible/version.rb
|
159
122
|
- lib/vendor/google/accessibility-developer-tools/axs_testing.js
|
160
123
|
- spec/accessible_app.rb
|
161
|
-
- spec/
|
162
|
-
- spec/selenium_driver_spec.rb
|
124
|
+
- spec/capybara_accessible_spec.rb
|
163
125
|
- spec/spec_helper.rb
|
164
|
-
- spec/webkit_driver_spec.rb
|
165
|
-
- tddium.yml
|
166
|
-
- travis.yml
|
167
126
|
homepage: https://github.com/Casecommons/capybara-accessible
|
168
127
|
licenses:
|
169
128
|
- MIT
|
@@ -184,15 +143,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
143
|
version: '0'
|
185
144
|
requirements: []
|
186
145
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.7.6
|
188
147
|
signing_key:
|
189
148
|
specification_version: 4
|
190
|
-
summary:
|
191
|
-
Developer Tools auditing assertions on page visits.
|
149
|
+
summary: Capybara extension and webdriver for automated accessibility testing
|
192
150
|
test_files:
|
193
151
|
- spec/accessible_app.rb
|
194
|
-
- spec/
|
195
|
-
- spec/selenium_driver_spec.rb
|
152
|
+
- spec/capybara_accessible_spec.rb
|
196
153
|
- spec/spec_helper.rb
|
197
|
-
- spec/webkit_driver_spec.rb
|
198
|
-
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2010-13 Case Commons, Inc.
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Using poltergeist driver" do
|
4
|
-
require "capybara/poltergeist"
|
5
|
-
before do
|
6
|
-
@session = Capybara::Session.new(:accessible_poltergeist, AccessibleApp)
|
7
|
-
end
|
8
|
-
|
9
|
-
context 'a page without accessibility errors' do
|
10
|
-
it 'does not raise an exception on audit failures' do
|
11
|
-
expect { @session.visit('/accessible') }.to_not raise_error
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'a page with inaccessible elements' do
|
16
|
-
it 'raises an exception on visiting the page' do
|
17
|
-
expect { @session.visit('/inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'raises an exception when visiting the page via a link' do
|
21
|
-
@session.visit('/accessible')
|
22
|
-
expect { @session.click_link('inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
23
|
-
end
|
24
|
-
|
25
|
-
context 'with configuration that excludes rules' do
|
26
|
-
before do
|
27
|
-
Capybara::Accessible::Auditor.exclusions = ['AX_TEXT_01']
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'does not raise an error on an excluded rule' do
|
31
|
-
expect { @session.visit('/excluded') }.to_not raise_error
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
context 'a page with a javascript popup' do
|
36
|
-
it 'does not raise an exception' do
|
37
|
-
@session.visit('/alert')
|
38
|
-
expect { @session.click_link('Alert!') }.to_not raise_error
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'with severity set to severe' do
|
43
|
-
before do
|
44
|
-
Capybara::Accessible::Auditor.severe_rules = ['AX_TEXT_02']
|
45
|
-
end
|
46
|
-
|
47
|
-
after do
|
48
|
-
Capybara::Accessible::Auditor.severe_rules = []
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'raises an exception on the image without alt text' do
|
52
|
-
expect { @session.visit('/severe') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Using selenium driver" do
|
4
|
-
before do
|
5
|
-
@session = Capybara::Session.new(:accessible_selenium, AccessibleApp)
|
6
|
-
end
|
7
|
-
|
8
|
-
context 'a page without accessibility errors' do
|
9
|
-
it 'does not raise an exception on audit failures' do
|
10
|
-
expect { @session.visit('/accessible') }.to_not raise_error
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'a page with inaccessible elements' do
|
15
|
-
it 'raises an exception on visiting the page' do
|
16
|
-
expect { @session.visit('/inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'raises an exception when visiting the page via a link' do
|
20
|
-
@session.visit('/accessible')
|
21
|
-
expect { @session.click_link('inaccessible') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
22
|
-
end
|
23
|
-
|
24
|
-
context 'with configuration that excludes rules' do
|
25
|
-
before do
|
26
|
-
Capybara::Accessible::Auditor.exclusions = ['AX_TEXT_01']
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'does not raise an error on an excluded rule' do
|
30
|
-
expect { @session.visit('/excluded') }.to_not raise_error
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context 'with log level set to warn' do
|
35
|
-
before do
|
36
|
-
Capybara::Accessible::Auditor.log_level = :warn
|
37
|
-
end
|
38
|
-
|
39
|
-
after do
|
40
|
-
Capybara::Accessible::Auditor.log_level = :error
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'puts to stdout and does not raise an error' do
|
44
|
-
$stdout.should_receive(:puts)
|
45
|
-
expect { @session.visit('/inaccessible') }.to_not raise_error
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context 'a page with a javascript popup' do
|
50
|
-
it 'does not raise an exception' do
|
51
|
-
@session.visit('/alert')
|
52
|
-
expect { @session.click_link('Alert!') }.to_not raise_error
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with severity set to severe' do
|
57
|
-
before do
|
58
|
-
Capybara::Accessible::Auditor.severe_rules = ['AX_TEXT_02']
|
59
|
-
end
|
60
|
-
|
61
|
-
after do
|
62
|
-
Capybara::Accessible::Auditor.severe_rules = []
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'raises an exception on the image without alt text' do
|
66
|
-
expect { @session.visit('/severe') }.to raise_error(Capybara::Accessible::InaccessibleError)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|