Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@woocommerce/e2e-utils-playwright

Package Overview
Dependencies
Maintainers
10
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@woocommerce/e2e-utils-playwright

End-To-End (E2E) test Playwright utils for WooCommerce

latest
Source
npmnpm
Version
0.4.0
Version published
Weekly downloads
46
-45.88%
Maintainers
10
Weekly downloads
 
Created
Source

End-to-End Test Utilities For WooCommerce

This package contains utilities to help writing e2e tests specific to WooCommerce using Playwright.

[!WARNING]

This package is still under active development. Documentation might not be up-to-date, and the 0.x version can introduce breaking changes.

Installation

npm install @woocommerce/e2e-utils-playwright --save-dev

Usage

Example:

import { addAProductToCart } from '@woocommerce/e2e-utils-playwright';

test('can add products to cart', async ({ page }) => {
  const product = {
    id: 1,
    name: 'Test Product',
  };

  await addAProductToCart(page, product.id);
  await page.goto('/cart/');

  await expect(page.locator('td.product-name')).toContainText(product.name);
});

API Client

The package provides an API client utility for making authenticated requests to the WooCommerce REST API.

Basic Auth Example

import { createClient } from '@woocommerce/e2e-utils-playwright';

const client = createClient('http://localhost:8889/', {
  type: 'basic',
  username: 'admin',
  password: 'password',
});

const response = await client.get('wc/v3/products');
console.log(response.data);

OAuth1 Example

import { createClient } from '@woocommerce/e2e-utils-playwright';

const client = createClient('http://localhost:8889/', {
  type: 'oauth1',
  consumerKey: 'ck_xxx',
  consumerSecret: 'cs_xxx',
});

const response = await client.get('wc/v3/products');
console.log(response.data);

Supported methods: get(path, params, debug), post(path, data, debug), put(path, data, debug), delete(path, params, debug)

Contributing to this package

This is an individual package that's part of the WooCommerce project, which is organized as a monorepo.

To find out more about contributing to this package or WooCommerce as a whole, please read the project's main contributor guide.

FAQs

Package last updated on 08 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts