felixzapata / gulp-axe-webdriver

Gulp plugin for aXe utilizing WebDriverJS
MIT License
24 stars 7 forks source link

Cannot read property 'run' of undefined #18

Closed okeul closed 6 years ago

okeul commented 6 years ago

Hi !

I have an error every time I try to run the Axe task on multiple files. It work with one, two or three files but not more. I tried with glob patterns and it's the same results.

For the test i'm using your test.html file and I just duplicated and renamed it.

Do you have an idea ?

Error:

capture d ecran 2018-08-01 a 17 34 07

gulpfile.js

var gulp = require('gulp');
var axe = require('gulp-axe-webdriver');

gulp.task('axe', function() {
  var options = {
    headless: true,
    tags: ['wcag2aaa', 'wcag2aa', 'wcag2a', 'best-practice'],
    urls: ['src/test1.html', 'src/test2.html', 'src/test3.html', 'src/test4.html', 'src/test5.html']
    // urls: ['src/**/*.html'] // same results with glob patterns
  };
  return axe(options);  
});

package.json

{
  "dependencies": {
    "gulp": "^3.9.1",
    "gulp-axe-webdriver": "^3.0.0"
  }
}
felixzapata commented 6 years ago

hi, i will take a look ASAP.

felixzapata commented 6 years ago

mm it's weird... it looks only works with two files.

felixzapata commented 6 years ago

With these packages:

    "axe-core": "^3.0.3",
    "axe-webdriverjs": "^2.0.1",
    "chromedriver": "^2.41.0",
    "selenium-webdriver": "^4.0.0-alpha.1",

there is no error related with selenium, but the plugin does not work well. It looks like it copy the same results for all the filres.

felixzapata commented 6 years ago

Nevermind, the error is still happen with more than one files. And it is not related with the version 3 because I have the same error with the previous version.

At the moment, I have no idea what is happening.

okeul commented 6 years ago

Yes it's weird... I try a different way, like grunt-axe-webdriver. Same bug with Chrome, but it's work with Firefox... for a moment then there is a new bug...

My fork with the firefox engine : https://github.com/okeul/gulp-axe-webdriver/tree/browsers Bug with firefox engine : https://github.com/dequelabs/axe-core/issues/1044

felixzapata commented 6 years ago

@okeul can you try this?

"dependencies": {
    "axe-core": "^3.0.1",
    "axe-webdriverjs": "^2.0.0",
    "chalk": "^1.1.3",
    "chromedriver": "2.41.0",
    "file-url": "^1.1.0",
    "fs-extra": "^0.30.0",
    "fs-path": "0.0.22",
    "glob": "^7.0.6",
    "plugin-error": "^1.0.1",
    "promise": "^7.1.1",
    "request": "^2.76.0",
    "selenium-webdriver": "^3.6.0",
    "then-request": "^2.2.0"
  },

index.js

return axeBuilder.analyze(function (results) {
  results.url = url;
  results.timestamp = new Date().getTime();
  results.time = results.timestamp - startTimestamp;
  if (results.violations.length > 0) {
    ++violationsCount;
  }
  if (options.verbose) {
    console.log(chalk.cyan('Analyisis finished for: ') + url);
  }
  resolve(results);
});
okeul commented 6 years ago

It works like a charm ! Well done 👍👍👍

okeul commented 6 years ago

@felixzapata can't wait the next release :-)

okeul commented 6 years ago

@felixzapata My fork is updated with your changes and it works. See the PR : https://github.com/felixzapata/gulp-axe-webdriver/pull/19

felixzapata commented 6 years ago

I've released version 3.0.1