Skip to content

Commit

Permalink
test(axe-core-rspec): add e2e tests and set up rake tasks (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeyyy committed Jul 14, 2020
1 parent 246c3d6 commit a8ac475
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/axe-core-rspec/Rakefile
Expand Up @@ -2,4 +2,30 @@ require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)

# default task
task :default => :spec

# unit tests
desc "Tests Unit"
task :test_unit do
sh "bundle install && bundle exec rake"
end

# e2e tests
desc "Tests e2e"
task :test_e2e_capybara do
sh "cd e2e/capybara && bundle install && bundle exec rspec"
end

task :test_e2e => [
"test_e2e_capybara",
] do
end

# all tests
desc "Tests all"
task :test_all => [
"test_unit",
"test_e2e",
] do
end
7 changes: 7 additions & 0 deletions packages/axe-core-rspec/e2e/capybara/Gemfile
@@ -0,0 +1,7 @@
source "https://rubygems.org"

gem "rspec"
gem "capybara"
gem "selenium-webdriver"
gem "axe-core-capybara", :path => "../../../axe-core-capybara"
gem "axe-core-rspec", :path => "../../"
21 changes: 21 additions & 0 deletions packages/axe-core-rspec/e2e/capybara/spec/a11y_spec.rb
@@ -0,0 +1,21 @@
require "spec_helper"

# Typical example using standard RSpec dsl
describe "ABCD CompuTech (RSpec DSL)",
:type => :feature, :driver => :selenium do
before :each do
visit "http://abcdcomputech.dequecloud.com/"
end

it "is known to be inaccessible, should fail" do
expect(page).not_to be_accessible
end

it "is known to have an accessible sub-tree (should pass)" do
expect(page).to be_accessible.within "#intro"
end

it "is known to have an inaccessible sub-tree (should fail)" do
expect(page).not_to be_accessible.within "#topbar"
end
end
11 changes: 11 additions & 0 deletions packages/axe-core-rspec/e2e/capybara/spec/spec_helper.rb
@@ -0,0 +1,11 @@
require "rspec"
require "capybara/rspec"
require "axe-rspec"
require "axe-capybara"

@page = AxeCapybara.configure("firefox") do |c|
end

RSpec.configure do |config|
config.color = true
end

0 comments on commit a8ac475

Please sign in to comment.