1

I have an SPA that I want to test using Google Lighthouse. However, I am not sure if there is even a way to do it. It's a React Native app. The only reason I am running it on web is for development purposes. There are no URL links to it; it's a single page app that uses react-native-router. Does anyone know how I can use Lighthouse to test the accessibility for each screen/page? Right now, Lighthouse only tests the base/home screen. Even when I navigate to the other screens and try to use Lighthouse, it refreshes the entire app, and generates a report for the home/base screen.

Super Jade
  • 5,609
  • 7
  • 39
  • 61
george
  • 41
  • 5
  • 1
    Two things to check: 1. Is the site updating the URL correctly (i.e. if you navigate to a page directly via URL does it show the correct page), check your router is set up correctly. 2. The other thing to check / a question is is the page behind any kind of authentication as Lighthouse does each run without any cookies etc. by default. – GrahamTheDev Nov 25 '20 at 07:37
  • 1. the site does not update the url. I am using react-native-router, so basically, it goes to the correct page, but removes the URL. 2. I have no Auth so that is not an issue – george Nov 25 '20 at 09:41
  • Then you need to fix the router really, I am sure there are plenty of router extensions that use the history API to update the URL. With regards to how to test you might find [this answer](https://stackoverflow.com/questions/64647628/how-to-use-googles-page-speed-insight-tool-on-localhost/64648659#64648659) useful as it details the Lighthouse CLI and puppeteer which would allow you to do what you want with some effort. – GrahamTheDev Nov 25 '20 at 10:57

0 Answers0