npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

plotwright

v0.3.13

Published

A meta-framework for web testing using Mountebank and Playwright

Downloads

128

Readme

Plotwright

Plotwright is a practical testing framework that combines the capabilities of Playwright and Mountebank. It allows you to test not only the client side of the application, but also the interaction with the server, substituting API responses according to the contract we need.

How Plotwright can be useful

  • Simplicity: Plotwright simplifies the testing process by eliminating the need for complex preparatory work such as deploying APIs, Docker, and other infrastructure.
  • Isolation: The framework allows you to isolate tests from each other, making the testing process more stable and predictable.
  • Flexibility: Plotwright allows you to substitute API responses with those you need in your tests. You can easily simulate errors, broken data, empty data, and anything else to test how the UI behaves in such cases.

Differences from other products

  • Isolation: Plotwright allows you to fully isolate tests from each other, providing more stable and reliable results.
  • Testing not only the client side: Unlike Playwright, Plotwright allows you to test not only the client side, but also the BFF (Back-end for Front-end) of your application.
  • Language independence: Plotwright allows you to test your application regardless of the language used on the client side or on the BFF.
  • Simplification of the testing process: Unlike regular Playwright and headless Chrome tools, Plotwright simplifies the testing process by providing a convenient API and automating many routine tasks.
  • API response substitution: Plotwright allows you to substitute API responses with those you need in specific tests, allowing you to simulate various scenarios and conditions.

Get started

  1. Install Plotwright using npm: npm install plotwright
  2. Create a minimal configuration file: npx plotwright init
  3. Specify in the file the path to your e2e tests and to the substituted APIs:
/**
 * plotwright.config.js
 * @type {import('plotwright').Configuration}
 */
module.exports = {
  playwright: {
    testDir: "./e2e/specs",
  },
  mountebank: {
    imposters: ["./e2e/imposters/stub-api."],
  },
};
  1. Create a test scenario file:
// ./e2e/specs/example.spec.js
import { test, describe, expect, step } from "plotwright";

describe("Test suite", () => {
  test("Test example page", async ({ page, useStubs }) => {
    await useStubs([import("./_stubs_/success-response-api.json")]);

    await page.goto("https://example.com");

    await step("Check page title", async () => {
      const title = await page.title();
      expect(title).toBe("Example Domain");
    });

    await step("Check page has button 'Submit'", async () => {
      await expect(page.getByRole("button", { name: "Submit" })).toBeVisible();
    });
  });
});
  1. Run the test using the command npx plotwright test.