TypeError: nemo.accessibility.scan(...).then is not a function #15
Description
I am trying to do some accessibility testing for a web app and am currently stuck with the following issue.
TypeError: nemo.accessibility.scan(...).then is not a function
The versions of node and node modules used are as below.
node 8.9.4
"mocha": "4.1.0",
"nemo": "3.0.1",
"nemo-accessibility": "2.0.1",
"nemo-view": "2.2.3"
I have confirmed AATT server is up and running on localhost:3000.
below is the example code that will reproduce the error.
spec.js
var basedir = require('path').resolve(__dirname, '..');
var Nemo = require('nemo');
var nemo;
describe('accessibility test suite', function () {
before(function (done) {
nemo = Nemo(basedir, function (err) {
if (err) {
return done(err);
}
done();
});
});
after(function (done) {
nemo.driver.quit().then(done);
});
it('should automate the browser', function (done) {
nemo.driver.get(nemo.data.baseUrl);
nemo.driver.sleep(3000);
nemo.accessibility.scan().then(function (result) {
var file = process.cwd() + '/example/report/entirePage.html';
fs.writeFile(file, result, function (err) {
console.log('Successfully wrote the file ' + file);
});
});
nemo.driver.sleep(3000).then(function () {
done();
}, function (err) {
done(err);
})
});
});
config.json
{
"plugins": {
"view": {
"module": "nemo-view",
"arguments": ["path:locator"]
},
"nemo-accessibility": {
"module": "nemo-accessibility",
"arguments": ["http://localhost:3000/evaluate"]
}
},
"driver": {
"browser": "chrome"
},
"data": {
"baseUrl": "https://www.paypal.com/"
}
}
run the test
node_modules/.bin/mocha test/functional/spec/*.js --timeout 30000 --reporter spec
error
TypeError: nemo.accessibility.scan(...).then is not a function
Looks like for some reason, scanElement in nemo-accessibility module is not returning a promise. I have tried specifying a particular element using the 'element' option but that also did not help.