25 + 5 passes the tests but doesn't pass the tests

Hi there, I made the 25 + 5 Clock

It functions exactly according to the user stories but won’t pass the tests. I made sure all the required id’s were correct and on the right elements.

Part of the problem might be that there are setTimeout’s on all the increment/decrement handlers that allow an animation to run (It also makes the tests take a long time because they get caught trying to decrease the session lengths and only decrease them 1 before giving up and starting the timer). I tried taking these off but still didn’t pass those tests.

Also no clue why it thinks my time format (mm:ss) is wrong on the id=“time-left” element…

And ya, the layout is whack and the sounds are slow, this is just a quick codepen version to get the test suite to work

Get rid of all the animations :sneezing_face:The tests are running by a machine not someone is manually clicking and testing , meaning the test may click a button 1000 times in a ms to check whether its working.

 function incrementStudy() {
    if (disableButtons || timerActive) return
    if (studyLength < 60) {
      setDisableButtons(true)
      incrementSound.play()
      setAnimateStudy((prev) => ({
        ...prev,
        up: true
      }))
      setTimeout(() => {
        setStudyLength((prev) => prev + 1)
      }, 200)
      setTimeout(() => {
        setAnimateStudy((prev) => ({
          ...prev,
          up: false
        }))
        setDisableButtons(false)
      }, 350)
    }
    return
  }

And you are disabling a button for 500ms. Then how could it complete the test successfully :slightly_frowning_face:

I just finished this one. Not sure if this is the case here, but I used span id=“time-left” for my time display, and I was failing tests regarding clock not reaching 00:00 even though it was perfectly functional. I changed my time display to a div, and that fixed it… in your code you’re using h2 for your clock. Might want to see if that’s causing any issues (not sure what the test is checking for).

1 Like

But… I love my animations… haha. I figured those were part of the problem. Took them off and adjusted a lot of stuff, got it to pass.

2 Likes

Thank you! This was exactly the problem for those tests, so weird. I moved the id onto the div containing the h2 and it worked, albeit very slowly.

No clue how the tests work, my noob guess would be some kind of difference depending if its testing for innerText vs. textContent (and probably not but vs. innerHTML?).

There’s so many different properties for each HTML element it’s kinda nuts. I’d actually be interested to know how it’s testing that!

Sheeesh, your project looks great, I liked it A LOT. Using the range inputs its pretty clever.

Thank you! It kicked my ass for sure. This is actually just a version to pass the FCC tests, the full version is here

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