-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d5fffc
commit b3946c3
Showing
8 changed files
with
91 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
// eslint-disable-next-line import/no-unresolved | ||
import { source } from 'axe-core'; | ||
|
||
export function runAxeCore() { | ||
// inject the axe-core lib | ||
browser.execute(source); | ||
class AxeCore { | ||
async run() { | ||
await browser.execute(source); | ||
const options = { | ||
runOnly: { | ||
type: 'tag', | ||
values: ['ACT', 'best-practice', 'wcag2a', 'wcag2aa'], | ||
}, | ||
}; | ||
// run inside browser and get results | ||
const results = await browser.executeAsync((opts, done) => { | ||
// eslint-disable-next-line no-undef | ||
axe | ||
.run(opts) | ||
.then((res) => done(res)) | ||
.catch((err) => { | ||
throw err; | ||
}); | ||
}, options); | ||
return this.process(await results); | ||
} | ||
|
||
// https://github.com/dequelabs/axe-core/blob/develop/doc/API.md | ||
const options = { | ||
runOnly: { | ||
type: 'tag', | ||
values: ['ACT', 'best-practice', 'wcag2a', 'wcag2aa'], | ||
}, | ||
}; | ||
// run inside browser and get results | ||
const results = browser.executeAsync((opts, done) => { | ||
// eslint-disable-next-line no-undef | ||
axe | ||
.run(opts) | ||
.then((res) => done(res)) | ||
.catch((err) => { | ||
throw err; | ||
}); | ||
}, options); | ||
|
||
return { | ||
results, | ||
incomplete: results.incomplete.map((a) => { | ||
return { id: a.id, issues: a.nodes.length }; | ||
}), | ||
violations: results.violations.map((a) => { | ||
return { id: a.id, issues: a.nodes.length }; | ||
}), | ||
}; | ||
process(results) { | ||
return { | ||
results, | ||
incomplete: results.incomplete.map((a) => { | ||
return { id: a.id, issues: a.nodes.length }; | ||
}), | ||
violations: results.violations.map((a) => { | ||
return { id: a.id, issues: a.nodes.length }; | ||
}), | ||
}; | ||
} | ||
} | ||
export async function runAxeCore() { | ||
return new AxeCore().run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import Login from '@nuxeo/nuxeo-web-ui-ftest/pages/login'; | ||
import UI from '@nuxeo/nuxeo-web-ui-ftest/pages/ui'; | ||
|
||
const login = (username = 'Administrator', password = 'Administrator') => { | ||
const login = async (username = 'Administrator', password = 'Administrator') => { | ||
const logIn = Login.get(); | ||
logIn.username = username; | ||
logIn.password = password; | ||
logIn.submit(); | ||
const ui = UI.get(); | ||
ui.waitForVisible('nuxeo-page'); | ||
await logIn.setUsername(username); | ||
await logIn.setPassword(password); | ||
await logIn.submit(); | ||
}; | ||
|
||
export const authRedirect = async (browser, path) => { | ||
await login(); | ||
await browser.url(path); | ||
await browser.execute(() => { | ||
document.dispatchEvent(new CustomEvent('automation-ready')); | ||
}); | ||
}; | ||
|
||
export default login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters