Advanced Web Monetization testing library with powerful declarative API.

Usage no npm install needed!

<script type="module">
  import tessy from 'https://cdn.skypack.dev/tessy';



Advanced Web Monetization testing library with powerful declarative API.

Version Cypress Selenium Pupeteer Open Source Love License: MIT Twitter: VladoDev


Tessy is Web Monetization testing library. This guide assumes that you are familiar with Web Monetization and it's core concepts. Just to be clear, this is a testing library & no real money is ever transmitted. Library emulates "real" Web Monetization API which is currently available only with the Coil extension. I refer it to as "real" because it's not yet implemented by the browsers. It's still under development, so it will take quite some time until it becomes a standard.

The way that the library works is by firing fake Web Monetization events identical to the events from the "real" Web Monetization API. This allows you to test your website/app in Web Monetization enabled environment. It's especially useful if your website/app provides additional features to the users of Web Monetization and you want to make sure that those features are bug-free & working as expected.

:package: Installation

# Installs the plugin and saves it as a development dependency
npm i tessy --save-dev

:cloud: Usage

Currently, Tessy integrates with the 3 most popular e2e (end-to-end) testing frameworks. Don't let this fool you, Tessy is not limited to these frameworks only! The library exposes an API which allows you to use it with/without any framework/library. These integrations just provide "syntatic sugar" so you can focus on your tests rather than setting up the library.


You can wire up Tessy with Cypress by passing the object that Cypress gives us, cy to Tessy. The library will attach an additional method to cy, visitMonetized which allows you to open a web page with Web Monetization enabled (streaming).

  • visitMonetized(url, [visitOptions], [monetizationOptions])

    url - URL to load (String)

    visitOptions - visitMonetized is just a wrapper with some magic around Cypress's visit method. Options that you would normally pass to visit, you pass here. (Object)

    monetizationOptions (Object)

Example usage:

// cypress/integration/your_test.js

describe('My First Test', () => {
  it('Does not do much!', () => {
    cy.visitMonetized('https://testwebmonetization.com').then(window => {
      const monetizationEnabled =
        window.document.monetization.state === 'started';



Passing Selenium's driver object to Tessy, getMonetized method is added to the driver object. getMonetized, opens the page with Web Monetization API enabled and streaming money. If you want to modify Web Monetization behavior, you can do so by passing options object as the second argument.

  • getMonetized(url, [monetizationOptions]) (async function)

    url - URL to load (String)

    monetizationOptions (Object)

Example usage:

// test_file.js
const tessy = require('tessy/api/selenium');
const { Builder } = require('selenium-webdriver');

(async function example() {
  let driver = await new Builder().forBrowser('firefox').build();

  await driver.getMonetized('https://testwebmonetization.com');


Tessy integrates with Puppeteer by extending the browser object with an additional newMonetizedPage method. Just like with the previous two frameworks, Tessy tries to maintain a consistent & declarative API for each framework's ecosystem. Options can be passed as a second argument.

  • newMonetizedPage(url, [monetizationOptions]) (async function)

    url - URL to load (String)

    monetizationOptions (Object)

Example usage:

// test_file.js
const tessy = require('tessy/api/puppeteer');
const puppeteer = require('puppeteer');

const browser = await puppeteer.launch({
  args: ['--no-sandbox'],
  headless: false

const page = await browser.newMonetizedPage();
await page.goto('https://testwebmonetization.com');

Standalone Usage

Apart from the framework integrations above, Tessy can be used standalone. This proves useful with older setups. (eg. fixtures)

Example usage:

// index.js (This needs to be bundled to be used in a browser with a module bundler like Parcel or Webpack)
import {
} from 'tessy';

const {
} = require('../src/index');


document.onreadystatechange = function () {
  if (document.readyState === 'complete') {
    // initPluginOptions(); OPTIONAL
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Tessy Example</title>
    <!-- Make sure to load Tessy in the <head> before your web monetization listeners (example below) -->
    <script src="tessy-bundle.js"></script>


      Lorem ipsum dolor sit amet consectetur, adipisicing elit. Inventore natus
      ut alias fugit, eaque ipsa voluptatem. Soluta inventore, nihil doloribus
      placeat eligendi, illum deserunt facere laudantium aliquam vero veniam

      if (document.monetization) {
        // Monetization Start Event.
        document.monetization.addEventListener('monetizationstart', function (
        ) {
          // e.g "Thank you" modal for supporting web monetization ...
          console.log('monetizationstarted', event);

        // Monetization Progress Event.
          function (event) {
            // e.g. Unlock bonus content ...
            console.log('monetizationprogress', event);

:books: API


  • monetizationOptions

        // Amount of money to stream every second (default: "1000")
        amount: "0.0001",
        // Currency (default: "USD")
        assetCode: "AUD",
        // The scale of the amount (default: 9)
        assetScale: 5,
        // Pointer to the test wallet (default: web monetization meta tag on the page)
        paymentPointer: "$coil.xrptipbot.com/LKAS89_AFOI82"

Web Monetization

Tessy exposes some useful methods on document.monetization API that allow you to completely be in the charge of your Web Monetized environment.

  • pauseMonetization([ms])

    ms - number of milliseconds to pause monetization events (progressevent)

    Pauses monetization for a number of ms. If it's not specified, then monetization is paused until it is explicitly resumed again. (resumeMonetization())

  • resumeMonetization()

    Resumes previously paused monetization.

  • emit(event)

    event - Monetization event to emit. Web Monetization has 4 main events (monetizationstart, monetizationprogress, monetizationpending, monetizationstopped)

    This is a very powerful function and you can test any state of the web monetization in your app to see how it behaves and identify potential bugs.

:sparkles: Run tests

The library uses Jest for running tests.

Jest will execute all .test.js files in the test folder.

npm test

:man: Author

Vladimir Mikulic

:handshake: Contributing

Contributions, issues and feature requests are welcome!

🍻 Credits

Logo design is provided by Freepik. ❤️

:pencil: License

This project is licensed under MIT license.

:man_astronaut: Show your support

Give a ⭐️ if this project helped you!