0.1.8 • Published 7 months ago

@dapplets/dapplet-playwright v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@dapplets/dapplet-playwright Library

The @dapplets/dapplet-playwright library is a collection of fixtures designed for testing dapplets within the Dapplet Extension environment. It automates the process of downloading the specified version of the extension and provides utilities for testing.

Installation

You can install the library using npm:

npm i -D @dapplets/dapplet-playwright

Configuration

To use the @dapplets/dapplet-playwright library, you need to configure the playwright.config.ts file in your project. This file specifies various settings for testing, including browser configuration and extension version. An example configuration for Chromium is as follows:

import { defineConfig } from 'playwright';
import { devices } from 'playwright-chromium';
import { BrowserOptions } from "@dapplets/dapplet-playwright";
  
export default defineConfig<BrowserOptions>({
  projects: [
    {
      name: "chromium",
      use: {
        ...devices["Desktop Chrome"],
        newHeadless: process.env.CI ? true : false,
        extensionVersion: "v0.60.0-alpha.2",
      },
    }
  ],
});

Adjust the configuration according to your requirements, including the browser you want to use and the extension version you want to test with.

Usage

Here's an example of how you can use the @dapplets/dapplet-playwright library to test your dapplet:

import { expect, test } from "@dapplets/dapplet-playwright";

test("should inject widget", async ({
  page,
  enableDevServer,
  activateDapplet,
}) => {
  await page.goto('https://example.com');

  await enableDevServer("http://localhost:3001/dapplet.json");
  await activateDapplet("your-dapplet-id", "http://localhost:3001/dapplet.json");

  await expect(page.locator('.dapplet-widget')).toBeVisible();
});

In this example, the expect, test, enableDevServer, and activateDapplet functions are provided by the library, making it easy to write tests for your dapplets.

Contributing

Contributions to the @dapplets/dapplet-playwright library are welcome! If you find any issues or have improvements to suggest, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.

0.1.8

7 months ago

0.1.7

7 months ago

0.1.6

8 months ago

0.1.5

8 months ago

0.1.4

9 months ago

0.1.3

9 months ago

0.1.2

9 months ago

0.1.1

9 months ago

0.1.0

9 months ago