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 🙏

© 2025 – Pkg Stats / Ryan Hefner

cy2pwconvert

v1.0.15

Published

CLI tool to convert Cypress tests to Playwright

Readme

cy2pwconvert

A command-line tool to migrate Cypress tests to Playwright, preserving directory structure and converting .js & .ts test files automatically.

🚀 Features

✅ Converts Cypress .js and .ts test files to Playwright
✅ Preserves the original folder structure
✅ Supports custom source and target directories
✅ CLI-based, install once and use anywhere
✅ Error handling for missing directories


📥 Installation

1️⃣ Global Installation (Recommended)

npm install -g cy2pwconvert

2️⃣ Local Installation (Project-based)

npm install --save-dev cy2pwconvert

📌 Usage

🔄 Convert Cypress Tests (Default Paths)

cy2pwconvert

(Default: ./cypress/integration./playwright/tests)

📂 Convert with Custom Source & Target Directories

cy2pwconvert ./my-cypress-tests ./my-playwright-tests

🆘 Help

cy2pwconvert --help

Options

Usage: npx cy2pwconvert .cypress/ tests/

Arguments:
  src                                            Source file or folder
  dst                                            Target file or folder

Options:
  -V, --version                                  output the version number
  -ft, --filetype <filetype>                     File types to convert default: .js, example: .js,.ts, current support: .js,.ts,.jsx (default: ".js,.ts")
  -idp, --installDependency <installDependency>  Installs Dependency after project clone (default: false)
  -sC, --skipConfig <skipConfig>                 Skips the config conversion from cypress to playwright (default: true)
  -ep, --enablePlugins <enablePlugins>           If enabled, this packages takes plugins from babel config file or package file, which comes under plugins key. (default:
                                                 false)
  -ep, --preserveBDD <preserveBDD>               This option will help you to preserve bdd being converted to tdd (default: true)
  -h, --help                                     display help for command

🔧 How It Works

  • Replaces Cypress commands (cy.visit(), cy.get(), etc.) with Playwright equivalents.
  • Ensures async/await syntax for Playwright compatibility.
  • Converts all .js and .ts test files while maintaining directory structure.
  • Converts you Cypress config to Playwright config

📖 Example

Before (Cypress Test)

describe('Login', () => {
  it('should log in successfully', () => {
    cy.visit('/login');
    cy.get('#username').type('admin');
    cy.get('#password').type('password');
    cy.contains('Submit').click();
    cy.get('.dashboard').should('be.visible');
  });
});

After (Playwright Test)

test.describe('Login', async ({ page }) => {
  test('should log in successfully', async ({ page }) => {
    await page.goto('/login');
    await page.locator('#username').fill('admin');
    await page.locator('#password').fill('password');
    await page.getByText('Submit').click();
    await expect(page.locator('.dashboard')).toBeVisible();
  });
});

🛠 Supported Cypress → Playwright Config Mappings

✅ Supports all Cypress config formats:

  • cypress.config.js
  • cypress.config.json
  • cypress.config.ts (via ts-node)

✅ Merges into existing playwright.config.ts

  • If the Playwright config already has settings, it preserves them while adding the new ones.

✅ Creates a new Playwright config if missing

✅ Supports both Playwright JS & TS configs:

  • Detects if playwright.config.ts or playwright.config.js exists.
  • Merges Cypress settings into the correct file.

✅ Handles missing Playwright config:

  • If no playwright.config.ts/js exists, it creates a new one based on the detected Cypress format.

✅ Automatically formats with Prettier


🛠 Development & Contributions

🔧 Local Development

Clone the repo:

git clone [email protected]:arunchaitanyajami/cy2pwconvert.git
cd cy2pwconvert
npm install

🔗 Link for Local Testing

npm link
cy2pwconvert ./cypress/integration ./playwright/tests

Foundation

I took the inspiration from cy2pw package. Copied the code and added additional features on top of this code.

Open Source Packages : https://www.npmjs.com/package/cy2pw

📝 License

MIT License. Feel free to contribute! 🚀

Version Update

v1.0.13

  • Support Cypress custom commands.
  • Cucumber: Move away from Regx to Babel plugin.