Unit test a Frontend Page Reload

I have a Web Frontend that stores its state using localStorage.

those. the same page is displayed to the user on page reload.

Now, I would like to unit test so that the page shown after reload is the same as the page shown before reload.

Running window.location.reload()

with jasmine test in your pocket with PhantomJS throws the error "Some of your tests did a full page reload!"

Is there a way to automatically test page reloads? I am open to switching test environment, test run and test browser.

Thank!

+3


source to share


1 answer


The tests you describe are functional tests , not unit tests.

You need a test runner that supports functional tests.



Karma doesn't support functional tests, but for example CasperJS does.

-1


source







All Articles