title: Test service worker in Test Cafe
body: <p>I would like to use TestCafe to check if my service worker is registered successfully. I can check that from browser console using the following code</p>
  <p><code>(await window.navigator.serviceWorker.getRegistration()).active.scriptURL === 'PATH TO SERVICE WORK JS FILE'</code></p>
  <p>When trying to run this code from Test Cafe <code>ClientFunction</code>, the navigator object is empty.</p>
  <p>How can I check if the service worker is loaded?</p>
  <pre><code>import { ClientFunction } from 'testcafe';
  
  const getServiceWorker= ClientFunction(() =&gt; window.navigator.serviceWorker.getRegistration());
  
  fixture `My fixture`
      .page `http://www.example.com/`;
  
  test('My Test', async t =&gt; {
      const serviceWorker = await getServiceWorker();
  await t
        .expect(serviceWorker  &amp;&amp; serviceWorker  !== null &amp;&amp; serviceWorker.active).ok();
  
  });
  </code></pre>
  <p><strong>Edit:</strong>
  I have created an issue on TestCafe Github here <a href="https://github.com/DevExpress/testcafe/issues/7239" rel="nofollow noreferrer">https://github.com/DevExpress/testcafe/issues/7239</a></p>