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

universal-cypress-framework

v0.0.9

Published

Enterprise-grade reusable Cypress framework structures and utilities

Downloads

796

Readme

🌲 Universal Cypress Framework

The robust, enterprise-grade generic Cypress framework for modern web and Electron applications.

This package automatically scaffolds a production-ready testing environment so you can start writing tests in seconds, not hours.


� Quick Start

1. Create a New Project Folder

Create a directory for your automation project.

mkdir my-test-project
cd my-test-project

2. Install

Run the standard NPM install command.

npm install universal-cypress-framework

✨ Magic Happens Here: The installation automatically:

  • 📄 Generates a package.json (if you don't have one).
  • 📂 Scaffolds the entire cypress/ folder structure.
  • ⚙️ Creates cypress.config.js and .env files.
  • 📦 Installs cypress and dotenv.
  • ⚡ Adds helpful scripts like npm run cy:open.

3. Start Testing

npm run cy:open

� Project Structure

After installation, your project will look like this:

my-test-project/
├── cypress/
│   ├── e2e/              <-- Your generic tests go here
│   ├── fixtures/         <-- Test data files
│   └── support/
│       ├── framework/    <-- 🛡️ THE CORE FRAMEWORK (Ejected)
│       │   ├── actions/  <-- Reusable UI actions
│       │   ├── api/      <-- API wrappers
│       │   ├── pages/    <-- Base Page Objects
│       │   └── utils/    <-- Data generators & Helpers
│       └── e2e.js        <-- Auto-configured support file
├── .env                  <-- Environment variables (URLs, Creds)
├── cypress.config.js     <-- Cypress configuration
└── package.json

🛠 Usage Guide

1. Creating Page Objects

Extend the BasePage to inherit stability checks automatically.

// cypress/pages/LoginPage.js
import { BasePage } from '../support/framework';

export class LoginPage extends BasePage {
  constructor() {
    super('/login'); // URL path
  }

  login(username, password) {
    // BasePage ensures element stability before interaction
    cy.get('#username').type(username);
    cy.get('#password').type(password);
    cy.get('button[type="submit"]').click();
  }
}

2. Generating Test Data

Use the built-in DataFactory for consistent fake data.

import { DataFactory, fakerNepali } from '../support/framework';

// Generate a random user
const user = DataFactory.generateUser(); 
// { username: '...', email: '...', password: '...' }

// Generate Nepali-specific data
const citizenId = fakerNepali.contact.citizenshipNo(); 
// "27-01-75-12345"

3. Writing a Test Spec

// cypress/e2e/login_test.cy.js
import { LoginPage } from '../pages/LoginPage';

describe('Login Flow', () => {
    const loginPage = new LoginPage();

    it('should login successfully', () => {
        loginPage.visit();
        loginPage.login(process.env.TEST_USER, process.env.TEST_PASS);
        
        cy.url().should('include', '/dashboard');
    });
});

⚙️ Configuration

Environment Variables

Edit the .env file to manage your configuration.

BASE_URL=https://example.com
API_URL=https://api.example.com
TEST_ENV=staging

The framework automatically loads these into Cypress. You can access them via Cypress.env('BASE_URL') or process.env in certain contexts.


❓ FAQ

Q: Can I modify the framework files in cypress/support/framework?
A: Yes! The framework is "ejected" into your project. You own the code. Feel free to customize the local files to fit your specific needs.

Q: How do I update to a newer version?
A: Since the code is ejected, updating requires reinstalling the package or manually copying new files. We recommend treating your cypress/support/framework as your own codebase.


Made with ❤️ by KritanStha