sauce_bindings 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sauce_bindings/session.rb +6 -0
- data/lib/sauce_bindings/version.rb +1 -1
- data/sauce_bindings.gemspec +1 -0
- data/spec/examples/accessibility_spec.rb +32 -0
- data/spec/examples/axe.min.js +1 -0
- data/spec/integration/accessibility_spec.rb +59 -0
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 548124ac8f2aff4804f2c60c0176a409a1426b460e119d7fab72324c90c6332f
|
4
|
+
data.tar.gz: b7c9612c34280b5b01118905133b485321f5f6ede306ae66368dbcd8df55192a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee0ddbee4427ad06c072510328406b8df7322ea218750e339b4dac5a3810bded7fa0ad394d81c8c2b2cfee593791368a164f529e0d0819b1dfd46fbc16955a61
|
7
|
+
data.tar.gz: 330979521166f468908cfd7d6ff61b266a448e11c9a5c3e49d5dc063fec7087e63b1df83d97e82dc6a03afcf68bfe888184d427e81da9ca9a2c23c95ab2aab5a
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'sauce_whisk'
|
4
|
+
require 'sa11y/analyze'
|
4
5
|
require 'selenium-webdriver'
|
5
6
|
|
6
7
|
module SauceBindings
|
@@ -53,6 +54,11 @@ module SauceBindings
|
|
53
54
|
@data_center = data_center
|
54
55
|
end
|
55
56
|
|
57
|
+
def accessibility_results(js_lib: nil, frames: true, cross_origin: false)
|
58
|
+
sa11y = Sa11y::Analyze.new(driver, js_lib: js_lib, frames: frames, cross_origin: cross_origin)
|
59
|
+
sa11y.results
|
60
|
+
end
|
61
|
+
|
56
62
|
def url
|
57
63
|
@url ||= "https://#{@username}:#{@access_key}@#{DATA_CENTERS[data_center]}:443/wd/hub"
|
58
64
|
end
|
data/sauce_bindings.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
30
30
|
spec.add_development_dependency 'webmock', '~> 3.5'
|
31
31
|
|
32
|
+
spec.add_runtime_dependency 'sa11y', '~> 0.2.0'
|
32
33
|
spec.add_runtime_dependency 'sauce_whisk'
|
33
34
|
spec.add_runtime_dependency 'selenium-webdriver', '>= 3.142.7'
|
34
35
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'sauce_bindings'
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
describe 'Create Session' do
|
7
|
+
it 'starts session' do
|
8
|
+
# 1. Create Session object with the desired Data Center
|
9
|
+
session = SauceBindings::Session.new
|
10
|
+
|
11
|
+
# 2. Start Session to get the Driver
|
12
|
+
driver = session.start
|
13
|
+
|
14
|
+
# 3. Use the driver in your tests just like normal
|
15
|
+
driver.get('https://www.saucedemo.com/')
|
16
|
+
|
17
|
+
# 4a. Get accessibility default results with frame support
|
18
|
+
session.accessibility_results
|
19
|
+
|
20
|
+
# 4b. Get accessibility default results without frame support
|
21
|
+
session.accessibility_results(frames: false)
|
22
|
+
|
23
|
+
# 4c. Get accessibility results with cross origin frame support
|
24
|
+
session.accessibility_results(cross_origin: true)
|
25
|
+
|
26
|
+
# 4d. Get accessibility results with a different version of Axe Core JS Library
|
27
|
+
session.accessibility_results(js_lib: File.read(File.expand_path('axe.min.js', __dir__)))
|
28
|
+
|
29
|
+
# 5. Stop the Session with whether the test passed or failed
|
30
|
+
session.stop(true)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
// Blank file
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
module SauceBindings
|
6
|
+
describe Session do
|
7
|
+
describe 'gets accessibility results' do
|
8
|
+
before { WebMock.allow_net_connect! }
|
9
|
+
|
10
|
+
it 'with nested iframes' do
|
11
|
+
@session = Session.new
|
12
|
+
driver = @session.start
|
13
|
+
|
14
|
+
driver.get('http://watir.com/examples/nested_iframes.html')
|
15
|
+
|
16
|
+
results = @session.accessibility_results
|
17
|
+
|
18
|
+
problems = results['violations'].map { |v| v['nodes'].size }.inject(0, :+)
|
19
|
+
expect(problems).to eq 16
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'with nested frames' do
|
23
|
+
@session = Session.new
|
24
|
+
driver = @session.start
|
25
|
+
|
26
|
+
driver.get('http://watir.com/examples/nested_frames.html')
|
27
|
+
|
28
|
+
results = @session.accessibility_results
|
29
|
+
|
30
|
+
problems = results['violations'].map { |v| v['nodes'].size }.inject(0, :+)
|
31
|
+
expect(problems).to eq 14
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'with nested iframes and frames turned off' do
|
35
|
+
@session = Session.new
|
36
|
+
driver = @session.start
|
37
|
+
|
38
|
+
driver.get('http://watir.com/examples/nested_iframes.html')
|
39
|
+
|
40
|
+
results = @session.accessibility_results(frames: false)
|
41
|
+
|
42
|
+
problems = results['violations'].map { |v| v['nodes'].size }.inject(0, :+)
|
43
|
+
expect(problems).to eq 7
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'with nested frames and frames turned off' do
|
47
|
+
@session = Session.new
|
48
|
+
driver = @session.start
|
49
|
+
|
50
|
+
driver.get('http://watir.com/examples/nested_frames.html')
|
51
|
+
|
52
|
+
results = @session.accessibility_results(frames: false)
|
53
|
+
|
54
|
+
problems = results['violations'].map { |v| v['nodes'].size }.inject(0, :+)
|
55
|
+
expect(problems).to eq 6
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sauce_bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Titus Fortner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.5'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: sa11y
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.2.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.2.0
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: sauce_whisk
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,11 +193,14 @@ files:
|
|
179
193
|
- lib/sauce_bindings/version.rb
|
180
194
|
- sauce_bindings.gemspec
|
181
195
|
- spec/deprecated_options.yml
|
196
|
+
- spec/examples/accessibility_spec.rb
|
197
|
+
- spec/examples/axe.min.js
|
182
198
|
- spec/examples/basic_options_spec.rb
|
183
199
|
- spec/examples/browser_options_spec.rb
|
184
200
|
- spec/examples/create_session_spec.rb
|
185
201
|
- spec/examples/data_center_spec.rb
|
186
202
|
- spec/examples/sauce_options_spec.rb
|
203
|
+
- spec/integration/accessibility_spec.rb
|
187
204
|
- spec/integration/desktop_spec.rb
|
188
205
|
- spec/options.yml
|
189
206
|
- spec/spec_helper.rb
|
@@ -216,11 +233,14 @@ specification_version: 4
|
|
216
233
|
summary: Simple interface for interacting with Sauce Labs.
|
217
234
|
test_files:
|
218
235
|
- spec/deprecated_options.yml
|
236
|
+
- spec/examples/accessibility_spec.rb
|
237
|
+
- spec/examples/axe.min.js
|
219
238
|
- spec/examples/basic_options_spec.rb
|
220
239
|
- spec/examples/browser_options_spec.rb
|
221
240
|
- spec/examples/create_session_spec.rb
|
222
241
|
- spec/examples/data_center_spec.rb
|
223
242
|
- spec/examples/sauce_options_spec.rb
|
243
|
+
- spec/integration/accessibility_spec.rb
|
224
244
|
- spec/integration/desktop_spec.rb
|
225
245
|
- spec/options.yml
|
226
246
|
- spec/spec_helper.rb
|