If you want to test the whole page, you’ll want to use an End to End testing tool like Chimp, Cypress, Puppeteer, SlimerJS, etc.
What they do is run a full browser instance and then execute the tests you have specified.
I recommend you check out some of the tools or search for End to End testing guides