Skip to content

Commit

Permalink
Merge pull request #288 from dequelabs/release-4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-siek authored Jan 26, 2023
2 parents e64db2f + 50e5a06 commit f321596
Show file tree
Hide file tree
Showing 13 changed files with 258 additions and 35 deletions.
14 changes: 12 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ orbs:
browser-tools: circleci/[email protected]
node: circleci/[email protected]


commands:
bootstrap:
description: Install dependencies and bootstrap packages
Expand All @@ -22,7 +21,7 @@ commands:
- run: rake bootstrap # bootstrap packages

jobs:
test:
test:
<<: *defaults
steps:
- bootstrap
Expand Down Expand Up @@ -80,11 +79,22 @@ jobs:
chmod +x ./ruby-github-release.sh
./ruby-github-release.sh
check_license:
<<: *defaults
steps:
- checkout
- node/install:
node-version: '16.13'
- bootstrap
- run: bash .circleci/print_license.sh

workflows:
version: 2
build:
jobs:
- test
- check_license:
context: html-tools
- canary_release:
requires:
- test
Expand Down
40 changes: 40 additions & 0 deletions .circleci/print_license.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

for dir in packages/*; do
cd "$dir"

echo ""
echo ""
echo ""
echo ""
echo "Printing dependencies for $dir"

bundle exec ruby > licenses <<RUBY
licenses = {}
Gem.loaded_specs.each do |name, spec|
license = spec.license
if not licenses.key?(license)
licenses[license] = []
end
licenses[license].push(name)
end
licenses.each do |license, names|
puts license
names.each do |name|
puts "\t#{name}"
end
puts ""
end
RUBY
cat licenses
# Matches words at the beginning of the line that contain "gpl".
# We add a tab to package names so this prevents false-positives.
cat licenses | grep -i -P '^[^\s]*gpl'
result=$?
if [ $result -eq 0 ]; then
echo "Discovered a dependency using the GPL license"
exit 1
fi

cd -
done
3 changes: 0 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/semantic-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Semantic PR title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

jobs:
semantic-pr-title:
runs-on: ubuntu-latest
steps:
- uses: dequelabs/semantic-pr-title@v1
38 changes: 38 additions & 0 deletions .github/workflows/update-axe-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update axe-core

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- id: update
uses: dequelabs/update-axe-core@v1
- id: type
run: |
CommitType=""
if [ "${{ steps.update.outputs.patch_version_updated }}" == "true" ]; then
CommitType="fix"
elif [ "${{ steps.update.outputs.minor_version_updated }}" == "true" ]; then
CommitType="feat"
elif [ "${{ steps.update.outputs.major_version_updated }}" == "true" ]; then
CommitType="feat"
fi
echo "type=$CommitType" >>"$GITHUB_OUTPUT"
- name: Open PR
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT }}
commit-message: '${{ steps.type.outputs.type }}: Update axe-core to v${{ steps.update.outputs.version }}'
branch: auto-update-axe-core
base: develop
title: '${{ steps.type.outputs.type }}: Update axe-core to v${{ steps.update.outputs.version }}'
body: |
This patch updates version of [`axe-core`](https://npmjs.org/axe-core) to v${{ steps.update.outputs.version }}.
This PR was opened by a robot :robot: :tada:.
37 changes: 23 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.


## [4.6.0](https://github.com/dequelabs/axe-core-gems/compare/v4.5.1...v4.6.0) (2023-01-19)


### Features

* Update axe-core to v4.6.0 ([#283](https://github.com/dequelabs/axe-core-gems/issues/283))
([e6f7e3f](https://github.com/dequelabs/axe-core-gems/commit/e6f7e3fb0eaa0bc35b5c6d27b05f71705252ecee))

### [4.5.1](https://github.com/dequelabs/axe-core-gems/compare/v4.4.1...v4.5.1) (2022-11-21)


Expand Down Expand Up @@ -128,24 +137,24 @@ All notable changes to this project will be documented in this file. See [standa

### Features

- feat: rename `BeAccessible` to `BeAxeClean` (#138) [b702a53](https://github.com/dequelabs/axe-core-gems/commit/b702a53ba770c73f8a3e35cf2633697e46f0e4be)
- feat: `axe-core-api` gem (#113) [d8acb9d](https://github.com/dequelabs/axe-core-gems/commit/d8acb9d662e6a6748c67019cb0b5708543eff34c)
- feat: `axe-core-cucumber` gem (#105) [a0f5d77](https://github.com/dequelabs/axe-core-gems/commit/a0f5d7794c990af13e96e882b1cd5ea593e2a002)
- feat: `axe-core-rspec` gem (#104) [6acf37c](https://github.com/dequelabs/axe-core-gems/commit/6acf37c185fb739c03a407b737dd6fc8a2fc4b69)
- feat: `axe-core-capybara` gem (#103) [aad434d](https://github.com/dequelabs/axe-core-gems/commit/aad434d691878c6a5696fb02606ffbb98b51ea26)
- feat: `axe-core-watir` gem (#102) [4831ab1](https://github.com/dequelabs/axe-core-gems/commit/4831ab1ff773938e8433c5aecd0842c710a515be)
- feat: `axe-core-selenium` gem (#101) [f1f203c](https://github.com/dequelabs/axe-core-gems/commit/f1f203cde4790f6290d71f1309c247139f954f73)
- feat: rename `BeAccessible` to `BeAxeClean` (#138) [b702a53](https://github.com/dequelabs/axe-core-gems/commit/b702a53ba770c73f8a3e35cf2633697e46f0e4be)
- feat: `axe-core-api` gem (#113) [d8acb9d](https://github.com/dequelabs/axe-core-gems/commit/d8acb9d662e6a6748c67019cb0b5708543eff34c)
- feat: `axe-core-cucumber` gem (#105) [a0f5d77](https://github.com/dequelabs/axe-core-gems/commit/a0f5d7794c990af13e96e882b1cd5ea593e2a002)
- feat: `axe-core-rspec` gem (#104) [6acf37c](https://github.com/dequelabs/axe-core-gems/commit/6acf37c185fb739c03a407b737dd6fc8a2fc4b69)
- feat: `axe-core-capybara` gem (#103) [aad434d](https://github.com/dequelabs/axe-core-gems/commit/aad434d691878c6a5696fb02606ffbb98b51ea26)
- feat: `axe-core-watir` gem (#102) [4831ab1](https://github.com/dequelabs/axe-core-gems/commit/4831ab1ff773938e8433c5aecd0842c710a515be)
- feat: `axe-core-selenium` gem (#101) [f1f203c](https://github.com/dequelabs/axe-core-gems/commit/f1f203cde4790f6290d71f1309c247139f954f73)


### Bug Fixes

- fix: use `axe-core-api` gem in `axe-core-watir` gem (#118) [16ab9cd](https://github.com/dequelabs/axe-core-gems/commit/16ab9cdc1b28db226f441c8b609523f68ad0bc37)
- fix: use `axe-core-api` gem in `axe-core-selenium` gem (#117) [9c1c93c](https://github.com/dequelabs/axe-core-gems/commit/9c1c93cbf31b984b976da5219b66019018e3f62c)
- fix: use `axe-core-api` gem in `axe-core-rspec` gem (#116) [6144aa9](https://github.com/dequelabs/axe-core-gems/commit/6144aa963a4808165f4606a95d6b60c4f9068456)
- fix: use `axe-core-api` gem in `axe-core-cucumber` gem (#115) [39fd531](https://github.com/dequelabs/axe-core-gems/commit/39fd5319f914cc01b2924bd38ceca886411b5366)
- fix: use `axe-core-api` gem in `axe-core-capybara` gem (#114) [c5f466a](https://github.com/dequelabs/axe-core-gems/commit/c5f466a5ce700303ff8f21043195fa833d20e853)
- fix(axe-core-gems): add e2e tests and set up rake tasks (#110) [a8ac475](https://github.com/dequelabs/axe-core-gems/commit/a8ac475959a87b91f49de6e916834dcd456c84ee)
- fix: allow to configure browser as a Symbol argument for webdrivers (#109) [9e116d7](https://github.com/dequelabs/axe-core-gems/commit/9e116d7b38fef5a77efbc503be8bc69c8ac0d9ff)
- fix: use `axe-core-api` gem in `axe-core-watir` gem (#118) [16ab9cd](https://github.com/dequelabs/axe-core-gems/commit/16ab9cdc1b28db226f441c8b609523f68ad0bc37)
- fix: use `axe-core-api` gem in `axe-core-selenium` gem (#117) [9c1c93c](https://github.com/dequelabs/axe-core-gems/commit/9c1c93cbf31b984b976da5219b66019018e3f62c)
- fix: use `axe-core-api` gem in `axe-core-rspec` gem (#116) [6144aa9](https://github.com/dequelabs/axe-core-gems/commit/6144aa963a4808165f4606a95d6b60c4f9068456)
- fix: use `axe-core-api` gem in `axe-core-cucumber` gem (#115) [39fd531](https://github.com/dequelabs/axe-core-gems/commit/39fd5319f914cc01b2924bd38ceca886411b5366)
- fix: use `axe-core-api` gem in `axe-core-capybara` gem (#114) [c5f466a](https://github.com/dequelabs/axe-core-gems/commit/c5f466a5ce700303ff8f21043195fa833d20e853)
- fix(axe-core-gems): add e2e tests and set up rake tasks (#110) [a8ac475](https://github.com/dequelabs/axe-core-gems/commit/a8ac475959a87b91f49de6e916834dcd456c84ee)
- fix: allow to configure browser as a Symbol argument for webdrivers (#109) [9e116d7](https://github.com/dequelabs/axe-core-gems/commit/9e116d7b38fef5a77efbc503be8bc69c8ac0d9ff)


### BREAKING CHANGES
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axe-core-gems",
"version": "4.5.1",
"version": "4.6.0",
"license": "MPL-2.0",
"private": true,
"repository": {
Expand Down
110 changes: 106 additions & 4 deletions packages/axe-core-api/e2e/selenium/spec/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
options.add_argument('--headless')
$driver = Selenium::WebDriver.for :firefox, options: options

def run_axe
Axe::Core.new($driver).call Axe::API::Run.new
Run = Axe::API::Run

def run_axe(run = Run.new)
Axe::Core.new($driver).call run
end

$fixture_root = File.join __dir__, "..", "..", "..", "..", "..", "node_modules", "axe-test-fixtures", "fixtures"
Expand Down Expand Up @@ -270,7 +272,7 @@ def recursive_compact(thing)


describe "run vs runPartial" do
it "should return the same results", :oldaxe => true do
it "should return the same results" do
$driver.get fixture "/nested-iframes.html"
legacy_res = with_js($axe_post_43x + $force_legacy_js) { run_axe }
expect(legacy_res.results.testEngine["name"]).to eq "axe-legacy"
Expand All @@ -285,7 +287,107 @@ def recursive_compact(thing)
end
end

describe "legacy_mode", :newt => true do
describe "4.6 selectors" do
def flat_targets(rules)
targets = []
rules.each do |rule|
rule.nodes.each do |node|
node["target"].each do |target|
if target.is_a? Array
targets.concat target
else
targets.append target
end
end
end
end

targets
end

it "with labelled frame", :newt => true do
$driver.get fixture "/context-include-exclude.html"

run = Run.new
.within({ "fromFrames" => ["#ifr-inc-excl", "html"] })
.excluding({ "fromFrames" => ["#ifr-inc-excl", "#foo-bar"] })
.within({ "fromFrames" => ["#ifr-inc-excl", "#foo-baz", "html"] })
.excluding({ "fromFrames" => ["#ifr-inc-excl", "#foo-baz", "input"] })
res = run_axe run

label_result = res.results.violations.find {|rule| rule.id == :label}

targets = flat_targets res.results.passes
expect(targets).not_to include "#foo-bar"
expect(targets).not_to include "input"
expect(label_result).to be_nil
end

it "with include shadow DOM" do
$driver.get fixture "/shadow-dom.html"

run = Run.new
.within([["#shadow-root-1", "#shadow-button-1"]])
.within([["#shadow-root-2", "#shadow-button-2"]])
res = run_axe run

targets = flat_targets res.results.passes
expect(targets).to include "#shadow-button-1"
expect(targets).to include "#shadow-button-2"
expect(targets).not_to include "#button"
end

it "with exclude shadow DOM" do
$driver.get fixture "/shadow-dom.html"

run = Run.new
.excluding([["#shadow-root-1", "#shadow-button-1"]])
.excluding([["#shadow-root-2", "#shadow-button-2"]])
res = run_axe run

targets = flat_targets res.results.passes
expect(targets).not_to include "#shadow-button-1"
expect(targets).not_to include "#shadow-button-2"
expect(targets).to include "#button"
end

it "with labelled shadow DOM" do
$driver.get fixture "/shadow-dom.html"

run = Run.new
.within({ "fromShadowDom" => ["#shadow-root-1", "#shadow-button-1"] })
.excluding({ "fromShadowDom" => ["#shadow-root-2", "#shadow-button-2"] })
res = run_axe run

targets = flat_targets res.results.passes
expect(targets).to include "#shadow-button-1"
expect(targets).not_to include "#shadow-button-2"
end

it "with labelled iframe and shadow DOM" do
$driver.get fixture "/shadow-frames.html"

run = Run.new
.with_options({ "runOnly" => "label"})
.excluding({
"fromFrames" => [{
"fromShadowDom" => ["#shadow-root", "#shadow-frame"]
},
"input"
]
})
res = run_axe run

expect(res.results.violations[0].id).to eq :label
expect(res.results.violations[0].nodes.length).to eq 2

nodes = res.results.violations[0].nodes
expect(nodes[0].target).to eq ["#light-frame", "input"]
expect(nodes[1].target).to eq ["#slotted-frame", "input"]
end
end

describe "legacy_mode" do
run_partial_throws = ";axe.runPartial = () => { throw new Error('No runPartial')}"

it "runs legacy mode when used" do
Expand Down
4 changes: 2 additions & 2 deletions packages/axe-core-api/lib/axe/api/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def initialize
end

def within(*selectors)
@inclusion.concat selectors.map { |s| Array(Selector.new s) }
@inclusion.concat selectors.map { |s| Selector::normalize s }
end

def excluding(*selectors)
@exclusion.concat selectors.map { |s| Array(Selector.new s) }
@exclusion.concat selectors.map { |s| Selector::normalize s }
end

def to_h
Expand Down
12 changes: 12 additions & 0 deletions packages/axe-core-api/lib/axe/api/selector.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
module Axe
module API
class Selector
def self.normalize(s)
if s.is_a? Hash
if s.key? :iframe and s.key? :selector
Array(Selector.new s)
else
s
end
else
Array(Selector.new s)
end
end

def initialize(s)
@selector = case s
when Array then s
Expand Down
14 changes: 7 additions & 7 deletions packages/axe-core-api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f321596

Please sign in to comment.