Functional testing with Mocha

Could someone help me with functional test case #5. I think I wrote the code correctly but then it doesn’t pass.

test('Submit the surname "Colombo" in the HTML form', function (done) {
        browser.fill('surname', 'Colombo').then(function() {
          browser.pressButton('submit', function() {
              browser.assert.text('span#name', 'Cristoforo');
              browser.assert.text('span#surname', 'Colombo');
              browser.assert.elements('span#dates', 1);

Your project link(s)


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36

Challenge: Run Functional Tests Using a Headless Browser

Link to the challenge:

It is just Replit being weird.

Keep running (start and stop) it until you see all tests pass and the page with the form stays up. Once you get it to pass and have the page still accessible then submit the project.

I did that actually. All the test passes and when I try to submit my solution it says time out or something other failure maessage.

Are you sure the paged stayed up? It is not enough that you pass the tests the page needs to stay up so you can still see it.

Here is a fork of your code passing.

This is what I get. And the server is up and running

This is so weird. Now I am getting this one.

I don’t know what to tell you, I just forked your project again and it is still passing for me. I also commented back in the other tests first.

When I say the page needs to stay up when you submit, I mean this page:

It can not look like this when you submit:

If that still doesn’t work try forking your own project and use the fork (sometimes forking the project changes something, don’t ask me why).

Edit: Just to be clear, the issue is with Replit and not the tests. If you can not get it to work using Replit another option is to try using Glitch. You can import the GitHub starter repo when creating a new project on Glitch. Then copy over the code and try submitting again.

Here I am using glitch but still doesn’t work.

When I try other tests they all work except the browserless tests.

Post the link to your Glitch.

Edit: Also, can you please look in the network tab when submitting, see if there is anything in red. Post a screenshot as well if you see anything in red.

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