3.0.0 • Published 6 years ago

wapiti v3.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Wapiti

Build Status Documentation

npm.io

Integration testing based on Puppeteer.

Wapiti is aimed at single page apps that rely on APIs. The goal is to be able to use the VCR pattern in order to first mock the API on your local tests and then be able to commit the results and test it on your continuous integration. VCR is optional and can be setup for each tests.

You can also read more on why this project exists

Installation

npm install --save-dev wapiti

Documentation

You can read all documentation on the website.

You can also check the tests folder for more examples.

Example

In theory, you could use Wapiti with any test framework, here is an example with Jest

const path = require("path");
const Wapiti = require("wapiti");

test("it should get the content of elements of the page", async () => {
  const result = await Wapiti().goto("file://" + path.join(__dirname, "getH1.html"))
    .capture(() => document.querySelector("h1").textContent)
    .capture(() => document.querySelector("h2").textContent)
    .run();
  expect(result).toEqual(["content of h1", "content of h2"]);
});

// And with VCR
test("it should use the Wapiti fetch", async () => {
  const result = await Wapiti().setupVCR()
    .goto("file://" + path.join(__dirname, "fetch.html")) // will try to fetch "https://api.github.com/users/github"
    .capture(() => document.querySelector("#result").textContent)
    .run();

  expect(result).toEqual("9919"); // ID of github user on github
});

Thanks

This project could not have seen the light of day without the work of the talented people at Google on Puppeteer.

3.0.0

6 years ago

2.0.0

6 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago