0.0.27 • Published 5 years ago

swae v0.0.27

Weekly downloads
2
License
MIT
Repository
github
Last release
5 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

5 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago