0.0.27 • Published 4 years ago

swae v0.0.27

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

swae Build Status npm version

ServiceWorkerAssessmentEngine

A service worker testing framework in the early stages of development. There are lots of bugs, and every release is potentially a breaking change. Effectively a big wrapper around chrome-debugging-client, which is node client for interacting with Headless Chrome via the Chrome DevTools Protocol. Built with TypeScript.

Example

import { expect } from 'chai';
import { TestSession } from 'swae';
import { createServer } from './my-test-server';

const session = new TestSession(createServer());
before(session.ready.bind(session));
after(session.close.bind(session));

describe('Service Worker', () => {
  it('should respond to requests', async () => {
    await session.run(async (testEnv) => {
      const client = await testEnv.createTab();

      await client.navigate();

      await client.evaluate(function() {
        return navigator.serviceWorker.register('/sw.js');
      });

      await client.swState.waitForActivated();

      const { body, networkResult } = await client.navigate();

      expect(networkResult.response.fromServiceWorker).to.be.true;
    });
  });
});
0.0.27

4 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago