Hi Ben,
Sorry for the delayed response, it looks like the issue is a bit more complex than I first thought. What does your testing framework look like? Are you using something like Puppeteer or Selenium? How are you handling the “window” object, are you mocking it? Also what are you planning to test, is it mostly APIs for processing the documents or is it more like integration testing to make sure everything works?
One issue with testing WebViewer is that it dynamically fetch resources (it does it from the “path” you pass in, so that path need to be publicly accessible). I think the current issue could be WebViewer is unable to fetch those resources. If you are using a testing framework that has a “non headless” mode (so you can see what is happening), you can check the network tab to see if WebViewer is able to fetch resources.
One approach would be to host WebViewer somewhere, (so running something like "npm run start"
before running your test or use a test suit that can do that for you). Also if your test suit is able to, you can navigate to a page with WebViewer, but this start feeling like integration testing instead of unit testing
Let me know if the above help and more information about your test suite. Thank you
Best Regards,
Andrew Yip
Software Developer
PDFTron Systems, Inc.