First of all, yes, a part of my answer definitely is helpful to solve the error that is posted by OP. Secondly, after trying the below step, I faced a couple of other errors, and so, have written the solution of those too.
(Psst! I am not sure if I've successfully helped in solving the above error, or if I've broken some rule or format of answering, but I faced the above error and some others and it took much time for me to find the proper solutions for those errors. I'm writing the complete solution because in case, if someone else also faces these errors, then he'll hopefully get a solution here.)
So adding to, and elaborating the answer provided by PrashanthiDevi, and also adding my personal experience, here it is:
I am new to the whole e2e and unit tests part. I started looking into this part from Protractor. Now I already had the files in which tests were written, but I had to run the tests.
I had already installed all the required softwares and tools, but when I initially ran the code for running the tests, gulp itest
, I got this 'Cannot find module' Error. After going through many different questions on SO, I found one answer that I thought could help getting a solution.
The person had suggested to run the command npm install
in my project folder.
The reason for doing this was to update the node-modules folder, inside our project folder, with all the required and necessary files and dependencies.
(The below part maybe irrelevant with this question, but might be helpful if anyone came across the same situation that I faced.)
The above step surely solved my previous error, but threw a new one! This time the error being Could not find chromedriver at '..\node_modules\protractor\selenium\chromedriver'
.
However, the solution of this error was pretty silly (and funny) to me. I already had the chromedriver file in my selenium folder. But, turns out that the above error was coming because my chromedriver files were inside selenium folder and not inside chromedriver folder. So, creating a chromedriver folder and copying the chromedriver files there solved my problem!
Also, for the error: Timed out waiting for the WebDriver Server, you could add this line of code to conf.js file inside exports.config{}
:
seleniumAddress: 'http://localhost:8080/'
Hope this helps!
node_modules
directory is expected to be in the root of your project, alongisdeapp.js
in your case. Why did you use..
the npm install path? – Inhumanityconst wpt = require("src/wpt");
which should have beenconst wpt = require("./src/wpt");
. Path to the module or main JavaScript file was wrong. HTH someone. – Philina