FCC testing script not working

Tell us what’s happening:
CDN Link to test in any environment no working

I am building my projects on my local machine instead of Codepen, then paste the provided code to run the test. The thing is it doesn’t work. Sometimes the testing button will appear, but only once, then doesn’t reappear. Or it doesn’t appear at all. I have tested this with several browsers, and different platforms, and uploading the project to a testing server. I even saved the javascript as a local file and linked it, and still nothing.

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:85.0) Gecko/20100101 Firefox/85.0.

Challenge: Build a Personal Portfolio Webpage

Link to the challenge:

Will you please post a snippet of your code to show how you’re implementing the test suite.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Thanks for the quick reply.

The code I am referring to is at the bottom of each project as quoted " CDN link to run the tests in any environment you like: https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"

I usually just open the blank Codepen and copy the script at the top of the HTML part of the CP and drop it into my local text editor, the code is:

<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>

Hopefully this helps and I can get this to work.

Okay, that looks correct.
Where are you dropping it?

The script is JS and should therefore be right before the closing body tag. If it’s placed in the head element it will not work correctly.

Ahhhhh ok I have been placing it in my head element. That’s probably the issue. I will try moving it down before the closing body tag. Will test it out tomorrow, had enough coding for today!

Thanks again!

No worries.

I was just about to edit when I saw you responding so I waited.

The test script (as I said, it JavaScript) relies on the HTML code being loaded before it runs. So if it’s in the head element then it doesn’t see the HTML and that’s why it fails.

Come back if you have any other issues.

Happy coding!

Ok, script is working now all good there.

But it seems it failing on my media query. I use and external css file for my media query, is it possible the script doesn’t see this correctly?

Code I use is something like this:

<link href="smaller.css" rel="stylesheet" type="text/css" media="screen and (max-width: 570px)">

I am going to try and put the media query entries within the main CSS file and see if it pass’s the test.

The media query belongs in the external stylesheet, not in the link to the external stylesheet.

I have removed the additional external CSS stylesheet and moved the media query to the single CSS file. But it still does not pass the test.

The code I am use is like this:

nav {
	background-color: rgba(73,73,73,1.00);
	height: 100%;
	width: 30%;
	position: fixed;
	border-right: 3px solid rgba(0,0,0,1.00);
}

@media screen and (max-width: 570px) {

nav {
	height: auto;
	width: 100%;
	position: relative;
	border-right-style: none;
	}
}

Update:

I am getting the impression the testing script might have a error. When I copy all the HTML and CSS and paste it into a Code PEN, it passes all the tests. But locally it will not pass the media query.

I’ve heard of others having this issue. I’m not sure what the issue is.

I was just getting ready to post and ask you to put it to a live site to see if the test passes. You were a step ahead of me.

:smile:

Glad we are on the same page. Curious what I should do moving forward, I don’t mind pasting the code in CodePen for simpler projects. But if this ends up being the only error can I move forward and still submit my link with this one issue?

To submit your project it has to be a live link like codepen so it won’t be an issue.
It will only be an inconvenience when you’re coding locally.

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