1
votes

I am trying to integrate Selenium IDE with Azure devops test plan

I have an "NPM install" task in my release pipeline and received an error of Error: Npm failed with return code: 1

This is the error from the log:

    2020-10-12T22:37:37.9680875Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" test"
    2020-10-12T22:38:16.6366869Z 
    2020-10-12T22:38:16.6367643Z > [email protected] test D:\a\r1\a\Test_IND-CI \drop\Selenium IDE
    2020-10-12T22:38:16.6368107Z > npx mocha --reporter xunit > result.xml
    2020-10-12T22:38:16.6368363Z 
    2020-10-12T22:38:16.6368738Z npx: installed 136 in 32.857s
    2020-10-12T22:38:16.6368973Z 
    2020-10-12T22:38:16.6369245Z Error: Cannot find module 'selenium-webdriver'
    2020-10-12T22:38:16.6369465Z Require stack:
    2020-10-12T22:38:16.6369714Z - D:\a\r1\a\Test_IND-CI \drop\Selenium IDE\test.js
    2020-10-12T22:38:16.6370004Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js
    2020-10-12T22:38:16.6370300Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\mocha.js
    2020-10-12T22:38:16.6370850Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\one-and-dones.js
    2020-10-12T22:38:16.6371232Z - C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\options.js
    2020-10-12T22:38:16.6371553Z - C:\npm\cache\_npx\5920\node_modules\mocha\bin\mocha
    2020-10-12T22:38:16.6371883Z     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    2020-10-12T22:38:16.6372236Z     at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    2020-10-12T22:38:16.6372757Z     at Module.require (internal/modules/cjs/loader.js:1025:19)
    2020-10-12T22:38:16.6373259Z     at require (internal/modules/cjs/helpers.js:72:18)
    2020-10-12T22:38:16.6373925Z     at Object.<anonymous> (D:\a\r1\a\Test_IND-CI \drop\Selenium IDE\test.js:2:37)
    2020-10-12T22:38:16.6374606Z     at Module._compile (internal/modules/cjs/loader.js:1137:30)
    2020-10-12T22:38:16.6374983Z     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    2020-10-12T22:38:16.6375320Z     at Module.load (internal/modules/cjs/loader.js:985:32)
    2020-10-12T22:38:16.6375644Z     at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    2020-10-12T22:38:16.6375999Z     at Module.require (internal/modules/cjs/loader.js:1025:19)
    2020-10-12T22:38:16.6382142Z     at require (internal/modules/cjs/helpers.js:72:18)
    2020-10-12T22:38:16.6382865Z     at Object.exports.requireOrImport (C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js:20:12)
    2020-10-12T22:38:16.6385244Z     at Object.exports.loadFilesAsync (C:\npm\cache\_npx\5920\node_modules\mocha\lib\esm-utils.js:33:34)
    2020-10-12T22:38:16.6385856Z     at Mocha.loadFilesAsync (C:\npm\cache\_npx\5920\node_modules\mocha\lib\mocha.js:427:19)
    2020-10-12T22:38:16.6387258Z     at singleRun (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run-helpers.js:156:15)
    2020-10-12T22:38:16.6388582Z     at exports.runMocha (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run-helpers.js:225:10)
    2020-10-12T22:38:16.6389265Z     at Object.exports.handler (C:\npm\cache\_npx\5920\node_modules\mocha\lib\cli\run.js:366:11)
    2020-10-12T22:38:16.6390655Z     at C:\npm\cache\_npx\5920\node_modules\mocha\node_modules\yargs\lib\command.js:241:49
    2020-10-12T22:38:16.6391922Z npm ERR! Test failed.  See above for more details.
    2020-10-12T22:38:16.6590665Z ##[warning]Couldn't find a debug log in the cache or working directory
    2020-10-12T22:38:16.6612445Z ##[error]Error: Npm failed with return code: 1

This is the settings of my npm install task:

enter image description here

1
How about the issue? Does the answer below resolved your question, If not, would you please let me know the latest information about this issue?Leo Liu-MSFT

1 Answers

-1
votes

Azure Devops Failing on npm install (Cannot find module 'Selenium-Webdriver'

According to the error message:

Error: Cannot find module 'selenium-webdriver'

And the configuration screenshot of the build definition, we could to know that you execute the npm test directly without the packages. we need to use npm install command line to ensure that all the packages are installed:

npm install selenium-webdriver --save or npm install

You could check this thread for some more details.