Skip to content

Commit

Permalink
feat(cli): add configuration re-use
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Feb 19, 2024
1 parent f887c26 commit 3c6db18
Show file tree
Hide file tree
Showing 6 changed files with 437 additions and 43 deletions.
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ const results = await autoKayle({
# FAST_AXE TIME 203.2565419971943
```

## CLI

If you need to use kayle in the CI or shell [kayle CLI](./kayle_cli/).

```sh
npm install kayle_cli
# configure the engine defaults.
kayle_cli --automation-lib puppeteer --standard wcag2aa configure
# install the deps for the runner.
kayle_cli install
# audit a website url.
kayle_cli https://www.somewebsite.com
```

## Clips

You can include base64 images with the audits to get a visual of the exact location of the issue.
Expand Down Expand Up @@ -290,22 +304,6 @@ const results = await kayle({
});
```

## CLI

The [kayle CLI](./kayle_cli/) is a work in progress.

```sh
npm install kayle_cli
# install the deps - you can swap puppeteer with playwright
kayle_cli --automation-lib puppeteer install
```

Audit a website url.

```sh
kayle_cli --automation-lib puppeteer https://www.somewebsite.com
```

## Testing

For the comparison between using `fast_htmlcs`, `fast_axecore`, and the metrics for the 3rd party `@axe-core/playwright`.
Expand Down
3 changes: 2 additions & 1 deletion kayle_cli/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package.json
start.js
uninstall.js
pre-install.js
pre-install.js
kayle_config.json
268 changes: 268 additions & 0 deletions kayle_cli/Cargo.lock

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

6 changes: 4 additions & 2 deletions kayle_cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kayle_cli"
version = "0.0.2"
version = "0.0.3"
edition = "2021"
description = "The kayle CLI for web accessibility auditing"
repository = "https://github.com/a11ywatch/kayle"
Expand All @@ -9,4 +9,6 @@ authors = ["j-mendez"]
license = "MIT"

[dependencies]
clap = { version = "4.5.1", features = ["derive"]}
clap = { version = "4.5.1", features = ["derive"]}
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
23 changes: 16 additions & 7 deletions kayle_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Make sure you have an automation lib installed. Use the arg `--automation-lib`

```sh
kayle_cli --automation-lib puppeteer install
# configure the audits
kayle_cli --automation-lib puppeteer --standard wcag2aa configure
```

Pass in a list of urls to get the results.
Expand All @@ -34,12 +36,18 @@ Usage: kayle_cli [OPTIONS] <COMMAND>
Commands:
upgrade Upgrade kayle and the dependencies required
install Install kayle and the dependencies required
configure Configure the audits
configure Configure the audit to disk to re-use across runs
help Print this message or the help of the given subcommand(s)

Options:
-s, --standard <STANDARD>
The accessibility standard to run, WCAG2A, WCAG2AA, WCAG2AAA, and Section508
The accessibility standard to run

Possible values:
- wcag2a: WCAG2A
- wcag2aa: WCAG2AA
- wcag2aaa: WCAG2AAA
- section508: Section508

--include-warnings <INCLUDE_WARNINGS>
Include warnings in the audit
Expand All @@ -54,6 +62,11 @@ Options:
-r, --runners <RUNNERS>
The accessibility runner to use htmlcs, axecore, or kayle

Possible values:
- kayle: Kayle
- htmlcs: htmlcs
- axe: axe

--automation-lib <AUTOMATION_LIB>
The automation lib to use either puppeteer or playwright

Expand All @@ -71,8 +84,4 @@ Options:
```sh
kayle_cli https://www.drake.com
{"documentTitle":"Drake Industries | Custom, Durable, High-Quality Labels, Asset Tags and Custom Server Bezels","pageUrl":"https://www.drake.com/","issues":[{"context":"<h5 class=\"normal\">\n<div class=\"span12 widget-span ...</h5>","selector":"body>:nth-child(2)>:nth-child(1)>:nth-child(2)>:nth-child(1)>:nth-child(1)>:nth-child(2)>:nth-child(1)>:nth-child(1)>:nth-child(2)>:nth-child(1)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_3.1_3_1_A.G141","type":"error","typeCode":1,"message":"The heading structure is not logically nested. This h5 element should be an h2 to be properly nested.","runner":"htmlcs","recurrence":0},{"context":"<h5>Labels</h5>","selector":"#hs_cos_wrapper_module_1569856007055222>:nth-child(1)>:nth-child(2)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_3.1_3_1_A.G141","type":"error","typeCode":1,"message":"The heading structure is not logically nested. This h5 element should be an h3 to be properly nested.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/labels?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856007055222>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/name-plates?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856034269224>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/equipment-panel-overlays?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856037305225>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/membrane-switches?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856084644237>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/oem-bezel-re-branding?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856082608235>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a href=\"https://www.drake.com/safety?hsLang=en\">Learn more</a>","selector":"#hs_cos_wrapper_module_1569856080132233>:nth-child(1)>:nth-child(3)>:nth-child(1)","code":"WCAG2AA.Principle1.Guideline1_4.1_4_3.G18.Fail","type":"error","typeCode":1,"message":"This element has insufficient contrast at this conformance level. Expected a contrast ratio of at least 4.5:1, but text in this element has a contrast ratio of 3.44:1. Recommendation: change text colour to #00171d.","runner":"htmlcs","recurrence":0},{"context":"<a class=\"expandMenu\"><i></i><i></i><i></i></a>","selector":"#hs_cos_wrapper_module_14725592865174>:nth-child(1)","code":"WCAG2AA.Principle4.Guideline4_1.4_1_2.H91.A.EmptyNoId","type":"error","typeCode":1,"message":"Anchor element found with no link content and no name and/or ID attribute.","runner":"htmlcs","recurrence":0}],"meta":{"errorCount":9,"warningCount":0,"noticeCount":0,"accessScore":100},"automateable":{"missingAltIndexs":[]}}%
```

## Todo

1. Configuration.
```
Loading

0 comments on commit 3c6db18

Please sign in to comment.