-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
axe accessibility testing demo #1400
Conversation
* configure driver = { type: 'chrome', showDriverLog: true } | ||
|
||
Scenario: | ||
* def axeJs = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah. you're gonna love this:
* def axeJs = karate.http('https://cdnjs.cloudflare.com/ajax/libs/axe-core/4.0.2/axe.min.js').get().body
try it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW even a GET via karate should have worked, but there is this new JS API which is interesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above was really cool - karate keeps getting sleek!
# inject axe script | ||
* driver.script(axeJs()); | ||
# execute axe | ||
* def axeResponse = driver.scriptAwaitPromise('axe.run().then(results => JSON.stringify(results))'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you saying the result of stringify will come back to karate as the axeResponse
variable ? that's cool !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
@@ -964,5 +967,11 @@ public void inputFile(String locator, String... relativePaths) { | |||
Integer nodeId = elementId(locator); | |||
method("DOM.setFileInputFiles").param("files", files).param("nodeId", nodeId).send(); | |||
} | |||
|
|||
|
|||
public Object scriptAwaitPromise(String expression) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to add this method to karate now, apologies for stealing your code, but just want to make a release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made changes with new commit. Thank you.
@chaudharydeepak here's the commit on top of yours where I added the HTML report: ff62548 |
this looks really cool! Thank you @ptrthomas ! |
axe accessibility testing demo