Skip to content
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

Merged
merged 5 commits into from
Dec 15, 2020
Merged

axe accessibility testing demo #1400

merged 5 commits into from
Dec 15, 2020

Conversation

chaudharydeepak
Copy link
Contributor

axe accessibility testing demo

  • Relevant Issues : (compulsory)
  • Relevant PRs : (optional)
  • Type of change :
    • New feature

* configure driver = { type: 'chrome', showDriverLog: true }

Scenario:
* def axeJs =
Copy link
Member

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 :)

Copy link
Member

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

Copy link
Contributor Author

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))');
Copy link
Member

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 !

Copy link
Contributor Author

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) {
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

Copy link
Contributor Author

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.

@ptrthomas ptrthomas merged commit 8bbb00a into karatelabs:develop Dec 15, 2020
@ptrthomas
Copy link
Member

@chaudharydeepak here's the commit on top of yours where I added the HTML report: ff62548

@chaudharydeepak
Copy link
Contributor Author

@chaudharydeepak here's the commit on top of yours where I added the HTML report: ff62548

this looks really cool! Thank you @ptrthomas !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants