I’m trying to test whether a link opens a pdf document in a new page in Playwright. Now, when i do it the normal way through testing a popup i.e.

page.on('popup', async popup => {
  await popup.waitForLoadState();
  console.log(await popup.title());
});

it returns

Error: page.waitForLoadState: Test ended.
=========================== logs ===========================
  "networkidle" event fired
============================================================

I am not too sure what networkidle entails but it sounds like its not making network requests which I guess makes sense since pdf documents aren’t exactly websites that can be tested. Originially I was planning to check that the url of the new page that is opened ends with '.pdf' but now I’m not sure how to do this?

1