File tree 2 files changed +18
-6
lines changed
2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ var q = require('q'),
13
13
* exports.config = {
14
14
* ...
15
15
* plugins: [{
16
- * chromeA11YDevTools: true,
16
+ * chromeA11YDevTools: {
17
+ * treatWarningsAsFailures: true
18
+ * },
17
19
* path: 'node_modules/protractor.plugins/accessiblity'
18
20
* }]
19
21
* }
@@ -152,7 +154,7 @@ function runTenonIO(config) {
152
154
* failed tests
153
155
* @private
154
156
*/
155
- function runChromeDevTools ( ) {
157
+ function runChromeDevTools ( config ) {
156
158
157
159
var data = fs . readFileSync ( AUDIT_FILE , 'utf-8' ) ;
158
160
data = data + ' return axs.Audit.run();' ;
@@ -189,10 +191,18 @@ function runChromeDevTools() {
189
191
190
192
return audit . forEach ( function ( result , index ) {
191
193
if ( result . result === 'FAIL' ) {
192
- result . passed = false ;
193
- testOut . failedCount ++ ;
194
-
195
194
var label = result . elementCount === 1 ? ' element ' : ' elements ' ;
195
+ if ( result . rule . severity !== 'Warning'
196
+ || config . chromeA11YDevTools . treatWarningsAsFailures ) {
197
+ result . passed = false ;
198
+ testOut . failedCount ++ ;
199
+ } else {
200
+ result . passed = true ;
201
+ result . rule . heading = '\x1b[33m(WARNING) '
202
+ + result . rule . heading + ' (' + result . elementCount
203
+ + label + 'failed)' ;
204
+ // TODO - continue to output the element failures.
205
+ }
196
206
result . output = '\n\t\t' + result . elementCount + label + 'failed:' ;
197
207
198
208
// match elements returned via promises
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ exports.config = {
13
13
} ,
14
14
printAll : false
15
15
} ,
16
- chromeA11YDevTools : true ,
16
+ chromeA11YDevTools : {
17
+ treatWarningsAsFailures : true
18
+ } ,
17
19
path : '../index.js'
18
20
} ]
19
21
} ;
You can’t perform that action at this time.
0 commit comments