How to run the Random Quote Generator Tests in React

Hi Everyone,

I’m trying to run the tests for Random Quote Generator in Visual Studio code, I’m wondering how I go about this? I have Paste the link in the scripts but nothing really happens what else do I need to do? I have also everything pushed to GitHub as I also hear you can test there too?

Kind Regards,

Yes Sure here is the repository I have posted it to:-

I have the test script pasted into the index.html file, I used components and rendered one main component in the App.js file.

Thank you for taking a look at this.

Move the script down to just before the closing body tag.

Thank you that has done the trick for me really appreciate your help.


But I have another question sorry as I have rendered one component in App.js and the tests are failing is I assume that the tests can not see the corresponding div and id? Is there any way around this I will show a pic of how I am rendering. Thanks again

React renders HTML elements, that is what the test is looking at, the actual elements on the page.

Without having tested it I would suggest you put the ids on the elements with the actual required content, not on outer wrapping containers. E.g. if a button is required to have an id, put it on the button, not the div container it is inside.

Thank you so much I just have the layout test failing but ill work that out, thanks again @lasjorg I owe you a beer.

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