Quality Assurance and Testing with Chai - Run Functional Tests Using a Headless Browser

Tell us what’s happening:
Getting error on the last 3 challenges:

  1. “before all” hook in “Functional Tests with Zombie.js”
  2. Functional Tests with Zombie.js
    “before all” hook in “Functional Tests with Zombie.js”:
    Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves. (/home/runner/boilerplate-mochachai/tests/2_functional-tests.js)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)

Your project link(s)

solution: boilerplate-mochachai - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Quality Assurance and Testing with Chai - Run Functional Tests Using a Headless Browser

Link to the challenge:

What’s the purpose of the after function at the end of your file?

//you are calling

It’s been a while since I played with this module, but that does look like an area where an async call is being made with no done function being called.

Without the after() i get: “Hmm… We couldn’t reach this Repl”.
i tried to add done() after the get() but didn’t work.

Ok, so my other thought would be is that for some reason the requests are taking longer to complete than the actual timeout is set for… try increasing the time of the timeout and see what happens? Maybe go to 10000 instead of 5000.

I vaguely remember having this issue once too, but i cannot remember what it was that fixed it.

Your repl should pass all tests and pass on FCC too if you simply change the Browser.site url to ‘http://localhost:3000/’ to run the tests locally (without changing anything else in your code).
It’s a thorny issue with Replit and Zombie not working together very well.

I just forked your repl and it passed immediately for me when I ran the tests locally.

But ffc won’t accept local code, it has to be live site. So do i need to try on repl until it works ?

No, it will definitely pass on FCC with the Browser.site url set to localhost. That’s how I completed these final Zombie challenges.

EDIT: To clarify, you still submit the live repl link to FCC, it’s just the Browser.site url within your code which is set locally.

I have already tried that on the part that didn’t work. I’ll try on every timeout but i don’t think it will make a difference, the code works fine locally so it must be a repl-zombie problem.

That worked, so it was repl-zombie problem, thank you

You’ll find that QA tests crash repls all the time so, when you’re working on QA projects, it’s worth adding the ‘after’ code to your functional-tests file to reboot the repl, which will allow the projects to pass on FCC.
You can also turn the tests off whilst you’re building your app code, to save time and hassle.

I’ll keep that in mind, thank you. About turning off the tests, will it work commenting the file or is there another trick?

Usefully, you’re given an ENV variable to turn the tests on and off. If the value is set to ‘test’, the tests run. If you change the value to something else (e.g. testicle), they won’t.

So it’s obvious that QA is unique and needs special treatment. Anyway thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.