Issue passing Run Functional Tests using a Headless Browser

Tell us what’s happening:
Describe your issue in detail here.

I’ve been having issues passing this. First I had the correct code which was the same as the solution, however I was getting this console error on Replit - TypeError: browser.fill(…).pressButton is not a function. Searching on the forum, I found a thread about the same issue - Can't pass "Run Functional Tests using a Headless Browser" challenge - #3 by SuperGeniusZeb

Now I’m using their code:

browser.fill('surname', 'Colombo', async () => {
  browser.pressButton('submit', () => {
    browser.assert.success();
    browser.assert.text('span#name', 'Cristoforo');
    browser.assert.text('span#surname', 'Colombo');
    browser.assert.element('span#dates', 1);
    done()
  });
});

Now it passes the test in the Replit console but doesn’t pass on FreeCodeCamp, only the ‘All Tests Should Pass’ is ticked. Please help.

image

For project Run Functional Tests Using a Headless Browser II, the same issue occurs but it actually passes 1 test:

Your project link(s)

solution: https://replit.com/@1nfernox/boilerplate-mochachai#tests/2_functional-tests.js

Your browser information:

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

Challenge: Run Functional Tests using a Headless Browser

Link to the challenge:

Hello there,

In general, it is not the best idea to corner yourself by debugging with threads that old.

Specifically:

Have a look at the example code from the lesson:

test('#test - submit the input "surname" : "Polo"', function (done) {
  browser.fill('surname', 'Polo').pressButton('submit', function () {
    browser.assert.success();
    browser.assert.text('span#name', 'Marco');
    browser.assert.text('span#surname', 'Polo');
    browser.assert.elements('span#dates', 1);
    done();
  });
}

Hope this helps

Thanks for your help. I’ve changed that line to browser.assert.elements now and it passes that test. It’s just the other 2 tests now for Run Functional Tests using a Headless Browser II:

However on the Run Functional Tests using a Headless Browser test it still fails. I don’t understand why the ‘You should assert that the headless browser request succeeded.’ fails on the first one but passes on the second one.

This is likely related to chai functional tests not passing on FCC but passed on Replit · Issue #43228 · freeCodeCamp/freeCodeCamp · GitHub

Yes that does look exactly like the issue I’m having. Any idea if the production code was updated? I did only clone it late last week.

It looks like this is fixed in .dev. So, once what we have in our staging instance is pushed into production, this will be re-fixed.

We do not have a timeline for this, but I would assume it be this week.

Thanks. Once its pushed into production, would I need to clone it again on Replit? Also how would I know when the fix has been applied?

Good questions.

No, this should not be necessary; the production code (tests) was rolled back, but the boilerplate was not.

There are a few ways, but the easiest is usually going to the prod-current branch, and looking at the latest commit date:

So, once this is no longer 16 days, you should be good-to-go.

Hope this helps

Hi, the latest commit date was updated. My tests still pass on Replit but not on FreeCodeCamp, the tests which passed and failed are exactly the same as before.

You are correct. However, the build has not been released yet - we are in the process of QAing it. Basically, one more button still needs to be pushed before it is live :slightly_smiling_face:

I can confirm the tests are now passing. Thanks for your help.

1 Like

Unable to pass the test, in the console.log it says :
AssertionError [ERR_ASSERTION]: No INPUT matching ‘surname’.

Sometimes Repl failed to load, but I can load up a different Repl without issues.

What should I do? Code seems fine to me…

Update 23th Nov: suddenly it work. I have no idea why but oh yea.


https://replit.com/@TheCrow95T/boilerplate-mochachai#tests/2_functional-tests.js

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