Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

TypeError: nemo.accessibility.scan(...).then is not a function #15

Closed
fgeorge opened this issue Jan 16, 2018 · 2 comments
Closed

TypeError: nemo.accessibility.scan(...).then is not a function #15

fgeorge opened this issue Jan 16, 2018 · 2 comments
Assignees

Comments

@fgeorge
Copy link

fgeorge commented Jan 16, 2018

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.

@nikulkarni
Copy link
Collaborator

We are using webdriver promise manager in nemo-accessibility and it is deprecated in selenium 3.x (since you are using nemo 3.x). Will need to fix this and publish nemo-accessibility@3.x, will work on this soon and update it here

@nikulkarni nikulkarni self-assigned this Jan 16, 2018
@mpnkhan
Copy link
Contributor

mpnkhan commented Feb 18, 2019

Upgraded to adapt to Nemo4

@mpnkhan mpnkhan closed this as completed Feb 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants