Unable to pass " Quality Assurance and Testing with Chai - Run Functional Tests using a Headless Browser"

Hello,

I don’t know why I’m unable to pass " Run Functional Tests using a Headless Browser" and, also, " Run Functional Tests Using a Headless Browser II" from " Quality Assurance and Testing with Chai".

I have spent a long time looking for a solution (in this forum and also in internet), but the problem is still there.

There was a bug affecting these two parts which was corrected recently. Maybe this is the key to solve the problem. However, I cloned the code which freeCodeCamp provides to solve the challenges. So, it doesn’t make sense that this base code is wrong.

This is the console’s feedback:

I think I followed all the steps correctly and I have even reviewed them. I would appreciate any help.

Here is my code from repl.it:

https://repl.it/@PedroJavierJav1/boilerplate-mochachai#tests/2_functional-tests.js

1 Like

Hello there,

Sometimes, it helps to increase the timeout here (server.js):

setTimeout(function () {
    try {
      runner.run();
    } catch (e) {
      error = e;
      console.log('Tests are not valid:');
      console.log(error);
    }
  }, 1500);

Side Note: I am struggling to get Repl.it to bring up the project, so it could be on their side.

I increased the timeout to 5000, but the problem is still the same.

Neither test of the two challenges passes:

About the side note, I don’t understand. You can’t open my project?

Thanks for the quick response!

I managed to fork your project, and it passed the tests on my end. Are you still having issues?

Hello @PedroRV I forked your project and ran it without changing anything :

So either you fixed it before I could check it or your browser maybe acting up. I am using POP OS and Mozilla FireFox (hope that helps).

Hello guys,

It was the browser I was using (Chrome). I tried the code in Microsoft Edge and it worked perfectly. I have both challenges passed now!!

If you know why it works by changing the browser, it would be good to know.

Thanks for the help guys!

Would you mind opening up your browser console, and submitting the project again within Chrome? and share any errors which pop-up

I suspect you might have a browser extension which is affecting the tests, but doing the above would help us debug.

1 Like

Well, I have just submitted the project again using Chrome and it’s working in both challenges now. Quite strange to be honest. Maybe I had something opened when I tried this morning which was interceding.

I have submitted it more than once and it worked every time.

Well, next time something like this happens, I will have into consideration that restarting the browser can fix the problem.

Thanks!

1 Like